diff --git a/csharp/.gitignore b/csharp/.gitignore new file mode 100644 index 00000000..19af6f85 --- /dev/null +++ b/csharp/.gitignore @@ -0,0 +1,43 @@ +# +# Untracked directories +# +src/AddressBook/bin +src/AddressBook/obj +src/ProtocolBuffers/bin/ +src/ProtocolBuffers/obj/ +src/ProtocolBuffers/objCF +src/ProtocolBuffers.Test/bin/ +src/ProtocolBuffers.Test/obj/ +src/ProtocolBuffersLite.Test/bin/ +src/ProtocolBuffersLite.Test/obj/ +src/ProtoBench/bin/ +src/ProtoBench/obj/ +src/ProtoDump/bin/ +src/ProtoDump/obj/ +src/ProtoGen/bin/ +src/ProtoGen/obj/ +src/ProtoGen.Test/bin/ +src/ProtoGen.Test/obj/ +src/ProtoMunge/bin/ +src/ProtoMunge/obj/ +mono/bin +mono/tmp +mono/protoc +build_output +build_temp +build/msbuild*.log +lib/Microsoft.Silverlight.Testing +lib/NUnit + +# +# Untracked files +# +*.user +*.suo +_ReSharper.* +*.sln.cache +mono/TestResult.xml +mono/.libs +mono/*.exe +mono/*.dll +lib/protoc.exe diff --git a/csharp/CHANGES.txt b/csharp/CHANGES.txt new file mode 100644 index 00000000..b29debb8 --- /dev/null +++ b/csharp/CHANGES.txt @@ -0,0 +1,148 @@ +=============================================================================== +Welcome to the C# port of Google Protocol Buffers, written by Jon Skeet +(skeet@pobox.com) based on the work of many talented people. + +=============================================================================== +RELEASE NOTES - Code imported into Google's main protobuf repository +=============================================================================== + +Everything below note this represents history of protobuf-csharp-port project +before the code was merged into csharp/ subtree of GitHub google/protobuf +repository. +Frozen legacy version of the original project is available in +https://github.com/jskeet/protobuf-csharp-port. + +=============================================================================== +RELEASE NOTES - Version 2.4.1.555 +=============================================================================== + +Changes: +- Upgrade solution format to Visual Studio 2012. +- Add the ability to print a builder (not just a message) +- TextGenerator introduces a new overload of PrintTo +- Munge protoc's error format into a VS-C#-compatible output format. +- Work to make ProtoGen clone that acts as a protoc.exe plugin. +- Added the AllowPartiallyTrustedCallers attribute +- Optimized enum parsing. + +Fixes: +- Fix for bug in limited input stream's Position, Introduced Position on + output stream +- Fix for writing a character to a JSON output overflows allocated buffer +- Optimize FromBase64String to return Empty when presented with empty string. +- Use string.Concat instead of operator to avoid potential import problems +- Issue 81: quoting for NUnit parameters. +- Issue 56: NuGet package is noisy +- Issue 70: Portable library project has some invalid Nunit-based code. +- Issue 71: CodedInputStream.ReadBytes go to slow path unnecessarily +- Issue 84: warning CS0219: The variable `size' is assigned but never used + +=============================================================================== +RELEASE NOTES - Version 2.4.1.521 +=============================================================================== + +Changes: +- Add generated_code_attributes option, defaulted to false +- Added support for Portable library +- Added 'Unsafe' static type in ByteString to allow direct buffer access + +Fixes: +- Issue 50: The XML serializer will fail to deserialize a message with empty + child message +- Issue 45: Use of 'item' as a field name causes AmbiguousMatchException +- Issue 49: Generated nested static Types class should be partial +- Issue 38: Disable CLSCompliant warnings (3021) +- Issue 40: proto_path does not work for command-line file names +- Issue 54: should retire all bytes in buffer (bufferSize) +- Issue 43: Fix to correct identical 'umbrella_classname' options from trying + to write to the same filename. + +=============================================================================== +RELEASE NOTES - Version 2.4.1.473 +=============================================================================== + +Features: +- Added option service_generator_type to control service generation with + NONE, GENERIC, INTERFACE, or IRPCDISPATCH +- Added interfaces IRpcDispatch and IRpcServerStub to provide for blocking + services and implementations. +- Added ProtoGen.exe command-line argument "--protoc_dir=" to specify the + location of protoc.exe. +- Extracted interfaces for ICodedInputStream and ICodedOutputStream to allow + custom implementation of writers with both speed and size optimizations. +- Addition of the "Google.ProtoBuffers.Serialization" assembly to support + reading and writing messages to/from XML, JSON, IDictionary<,> and others. +- Several performance related fixes and tweeks +- Issue 3: Add option to mark generated code with attribute +- Issue 20: Support for decorating classes [Serializable] +- Issue 21: Decorate fields with [deprecated=true] as [System.Obsolete] +- Issue 22: Reusable Builder classes +- Issue 24: Support for using Json/Xml formats with ICodedInputStream +- Issue 25: Added support for NuGet packages +- Issue 31: Upgraded protoc.exe and descriptor to 2.4.1 + +Fixes: +- Issue 13: Message with Field same name as message causes uncompilable .cs +- Issue 16: Does not integrate well with other tooling +- Issue 19: Support for negative enum values +- Issue 26: AddRange in GeneratedBuilder iterates twice. +- Issue 27: Remove XML documentation output from test projects to clear + warnings/errors. +- Issue 28: Circular message dependencies result in null default values for + Message fields. +- Issue 29: Message classes generated have a public default constructor. You + can disable private ctor generation with the option generate_private_ctor. +- Issue 35: Fixed a bug in ProtoGen handling of arguments with trailing \ +- Big-endian support for float, and double on Silverlight +- Packed and Unpacked parsing allow for all repeated, as per version 2.3 +- Fix for leaving Builder a public ctor on internal classes for use with + generic "where T: new()" constraints. + +Other: +- Changed the code signing key to a privately held key +- Reformatted all code and line-endings to C# defaults +- Reworking of performance benchmarks to produce reliable results, option /v2 +- Issue 34: Silverlight assemblies are now unit tested + +=============================================================================== +RELEASE NOTES - Version 2.3.0.277 +=============================================================================== + +Features: +- Added cls_compliance option to generate attributes indicating + non-CLS-compliance. +- Added file_extension option to control the generated output file's extension. +- Added umbrella_namespace option to place the umbrella class into a nested + namespace to address issues with proto files having the same name as a + message it contains. +- Added output_directory option to set the output path for the source file(s). +- Added ignore_google_protobuf option to avoid generating code for includes + from the google.protobuf package. +- Added the LITE framework (Google.ProtoBuffersLite.dll) and the ability to + generate code with "option optimize_for = LITE_RUNTIME;". +- Added ability to invoke protoc.exe from within ProtoGen.exe. +- Upgraded to protoc.exe (2.3) compiler. + +Fixes: +- Issue 9: Class cannot be static and sealed error +- Issue 12: default value for enumerate fields must be filled out + +Other: +- Rewrite of build using MSBbuild instead of NAnt +- Moved to NUnit Version 2.2.8.0 +- Changed to using secure .snk for releases + +=============================================================================== +RELEASE NOTES - Version 0.9.1 +=============================================================================== + +Fixes: +- issue 10: Incorrect encoding of packed fields when serialized + +=============================================================================== +RELEASE NOTES - Version 0.9.0 +=============================================================================== + +- Initial release + +=============================================================================== \ No newline at end of file diff --git a/csharp/README.md b/csharp/README.md new file mode 100644 index 00000000..62c76384 --- /dev/null +++ b/csharp/README.md @@ -0,0 +1,17 @@ +This directory contains a library that implements Protocol Buffers +functionality in C#. + +Experimental only +----------------- + +C# protobufs are currently under development and are not officially supported yet. +Also, as of now, only proto2 is supported. Proto3 support for C# is currently in progress +(both design & implementation). + +History of C# protobufs +----------------------- + +This subtree was originally imported from https://github.com/jskeet/protobuf-csharp-port +and represents the latest development version of C# protobufs, that will now be developed +and maintained by Google. All the development will be done in open, under this repository +(https://github.com/google/protobuf). \ No newline at end of file diff --git a/csharp/build/BuildAll.bat b/csharp/build/BuildAll.bat new file mode 100644 index 00000000..9bee73c7 --- /dev/null +++ b/csharp/build/BuildAll.bat @@ -0,0 +1,8 @@ +@echo off +SET BUILD_TARGET=%~1 +SET BUILD_CONFIG=%~2 + +IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild +IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug + +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /nologo build.csproj /t:%BUILD_TARGET% /toolsversion:4.0 "/p:Configuration=%BUILD_CONFIG%" %3 %4 %5 %6 diff --git a/csharp/build/Common.targets b/csharp/build/Common.targets new file mode 100644 index 00000000..2aa74dfe --- /dev/null +++ b/csharp/build/Common.targets @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/build/Google.ProtocolBuffers.nuspec b/csharp/build/Google.ProtocolBuffers.nuspec new file mode 100644 index 00000000..c355cd4a --- /dev/null +++ b/csharp/build/Google.ProtocolBuffers.nuspec @@ -0,0 +1,59 @@ + + + + Google.ProtocolBuffers + $version$ + Jon Skeet + Jon Skeet + http://code.google.com/p/protobuf-csharp-port/source/browse/license.txt + http://code.google.com/p/protobuf-csharp-port/ + false + Copyright 2008 Google Inc. All rights reserved. + Protocol Buffers Binary Serialization Format Google + + Google.ProtocolBuffers + A managed code generator and library for Google's data interchange format. + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/csharp/build/Google.ProtocolBuffersLite.nuspec b/csharp/build/Google.ProtocolBuffersLite.nuspec new file mode 100644 index 00000000..8b9107f5 --- /dev/null +++ b/csharp/build/Google.ProtocolBuffersLite.nuspec @@ -0,0 +1,60 @@ + + + + Google.ProtocolBuffersLite + $version$ + Jon Skeet + Jon Skeet + http://code.google.com/p/protobuf-csharp-port/source/browse/license.txt + http://code.google.com/p/protobuf-csharp-port/ + false + Copyright 2008 Google Inc. All rights reserved. + Protocol Buffers Binary Serialization Format Google + + Google.ProtocolBuffersLite + A managed code generator and library for Google's data interchange format. + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/csharp/build/RunBenchmarks.bat b/csharp/build/RunBenchmarks.bat new file mode 100644 index 00000000..d0e65010 --- /dev/null +++ b/csharp/build/RunBenchmarks.bat @@ -0,0 +1,2 @@ +@echo off +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /nologo build.csproj /toolsversion:4.0 /t:RunBenchmarks %1 %2 %3 %4 diff --git a/csharp/build/build.bat b/csharp/build/build.bat new file mode 100644 index 00000000..bd7bd2a0 --- /dev/null +++ b/csharp/build/build.bat @@ -0,0 +1,20 @@ +@echo off +SET BUILD_VERSION=%~1 +SET BUILD_TARGET=%~2 +SET BUILD_CONFIG=%~3 + +IF NOT "%BUILD_VERSION%"=="" GOTO RUN +ECHO. +ECHO Usage: build.bat platform [target] [config] [msbuild arguments] +ECHO. +ECHO - platform: CF20, CF35, NET20, NET35, NET40, PL40, SL20, SL30, or SL40 +ECHO - [target]: Rebuild, Clean, Build, Test, or Publish +ECHO - [config]: Debug or Release +ECHO. +EXIT /B 1 + +:RUN +IF "%BUILD_TARGET%"=="" SET BUILD_TARGET=Rebuild +IF "%BUILD_CONFIG%"=="" SET BUILD_CONFIG=Debug + +CMD.exe /Q /C "CD %~dp0 && %WINDIR%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /nologo target.csproj /toolsversion:4.0 %4 %5 %6 "/t:%BUILD_TARGET%" "/p:Configuration=%BUILD_CONFIG%;TargetVersion=%BUILD_VERSION%" diff --git a/csharp/build/build.csproj b/csharp/build/build.csproj new file mode 100644 index 00000000..e78b2efb --- /dev/null +++ b/csharp/build/build.csproj @@ -0,0 +1,241 @@ + + + + + + + + + + + + + + + + + + Protocol Buffers + Release + Any CPU + + + $(MSBuildProjectDirectory)\.. + $(ProjectDirectory)\src + $(ProjectDirectory)\lib + $(ProjectDirectory)\protos + + $(ProjectDirectory)\build_temp\GeneratedSource + $(ProjectDirectory)\build_temp + $(ProjectDirectory)\build_output + $(BuildOutputDirectory) + + /v2 /fast /formats + $(BuildTempDirectory)\..\BenchmarkResults.txt + $(ProjectDirectory)\benchmarks + + $(Configuration) + + + $(BuildOutputDirectory)\tools\protoc.exe + $(BuildOutputDirectory)\tools\protogen.exe + $(LibDirectory)\NUnit\tools\nunit-console.exe + $(LibDirectory)\CsProjectProjector\CsProjectProjector.exe + $(LibDirectory)\7-Zip 9.20\7za.exe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(SourceDirectory)\ProtocolBuffers\DescriptorProtos + + + $(SourceDirectory)\ProtocolBuffers\DescriptorProtos + + + + + $(SourceDirectory)\AddressBook + + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffersLite.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtocolBuffers.Test\TestProtos + + + $(SourceDirectory)\ProtoBench\TestProtos + + + $(SourceDirectory)\ProtoBench\TestProtos + + + $(SourceDirectory)\ProtoBench\TestProtos + + + $(SourceDirectory)\ProtoBench\TestProtos + + + + + + + + \protos\google\protobuf + + + \protos\google\protobuf\compiler + + + \protos\google\protobuf + + + \protos\tutorial + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/csharp/build/googlecode_upload.py b/csharp/build/googlecode_upload.py new file mode 100644 index 00000000..d2d5f974 --- /dev/null +++ b/csharp/build/googlecode_upload.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python +# +# Copyright 2006, 2007 Google Inc. All Rights Reserved. +# Author: danderson@google.com (David Anderson) +# +# Script for uploading files to a Google Code project. +# +# This is intended to be both a useful script for people who want to +# streamline project uploads and a reference implementation for +# uploading files to Google Code projects. +# +# To upload a file to Google Code, you need to provide a path to the +# file on your local machine, a small summary of what the file is, a +# project name, and a valid account that is a member or owner of that +# project. You can optionally provide a list of labels that apply to +# the file. The file will be uploaded under the same name that it has +# in your local filesystem (that is, the "basename" or last path +# component). Run the script with '--help' to get the exact syntax +# and available options. +# +# Note that the upload script requests that you enter your +# googlecode.com password. This is NOT your Gmail account password! +# This is the password you use on googlecode.com for committing to +# Subversion and uploading files. You can find your password by going +# to http://code.google.com/hosting/settings when logged in with your +# Gmail account. If you have already committed to your project's +# Subversion repository, the script will automatically retrieve your +# credentials from there (unless disabled, see the output of '--help' +# for details). +# +# If you are looking at this script as a reference for implementing +# your own Google Code file uploader, then you should take a look at +# the upload() function, which is the meat of the uploader. You +# basically need to build a multipart/form-data POST request with the +# right fields and send it to https://PROJECT.googlecode.com/files . +# Authenticate the request using HTTP Basic authentication, as is +# shown below. +# +# Licensed under the terms of the Apache Software License 2.0: +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Questions, comments, feature requests and patches are most welcome. +# Please direct all of these to the Google Code users group: +# http://groups.google.com/group/google-code-hosting + +"""Google Code file uploader script. +""" + +__author__ = 'danderson@google.com (David Anderson)' + +import httplib +import os.path +import optparse +import getpass +import base64 +import sys + + +def upload(file, project_name, user_name, password, summary, labels=None): + """Upload a file to a Google Code project's file server. + + Args: + file: The local path to the file. + project_name: The name of your project on Google Code. + user_name: Your Google account name. + password: The googlecode.com password for your account. + Note that this is NOT your global Google Account password! + summary: A small description for the file. + labels: an optional list of label strings with which to tag the file. + + Returns: a tuple: + http_status: 201 if the upload succeeded, something else if an + error occured. + http_reason: The human-readable string associated with http_status + file_url: If the upload succeeded, the URL of the file on Google + Code, None otherwise. + """ + # The login is the user part of user@gmail.com. If the login provided + # is in the full user@domain form, strip it down. + if user_name.endswith('@gmail.com'): + user_name = user_name[:user_name.index('@gmail.com')] + + form_fields = [('summary', summary)] + if labels is not None: + form_fields.extend([('label', l.strip()) for l in labels]) + + content_type, body = encode_upload_request(form_fields, file) + + upload_host = '%s.googlecode.com' % project_name + upload_uri = '/files' + auth_token = base64.b64encode('%s:%s'% (user_name, password)) + headers = { + 'Authorization': 'Basic %s' % auth_token, + 'User-Agent': 'Googlecode.com uploader v0.9.4', + 'Content-Type': content_type, + } + + server = httplib.HTTPSConnection(upload_host) + server.request('POST', upload_uri, body, headers) + resp = server.getresponse() + server.close() + + if resp.status == 201: + location = resp.getheader('Location', None) + else: + location = None + return resp.status, resp.reason, location + + +def encode_upload_request(fields, file_path): + """Encode the given fields and file into a multipart form body. + + fields is a sequence of (name, value) pairs. file is the path of + the file to upload. The file will be uploaded to Google Code with + the same file name. + + Returns: (content_type, body) ready for httplib.HTTP instance + """ + BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla' + CRLF = '\r\n' + + body = [] + + # Add the metadata about the upload first + for key, value in fields: + body.extend( + ['--' + BOUNDARY, + 'Content-Disposition: form-data; name="%s"' % key, + '', + value, + ]) + + # Now add the file itself + file_name = os.path.basename(file_path) + f = open(file_path, 'rb') + file_content = f.read() + f.close() + + body.extend( + ['--' + BOUNDARY, + 'Content-Disposition: form-data; name="filename"; filename="%s"' + % file_name, + # The upload server determines the mime-type, no need to set it. + 'Content-Type: application/octet-stream', + '', + file_content, + ]) + + # Finalize the form body + body.extend(['--' + BOUNDARY + '--', '']) + + return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body) + + +def upload_find_auth(file_path, project_name, summary, labels=None, + user_name=None, password=None, tries=3): + """Find credentials and upload a file to a Google Code project's file server. + + file_path, project_name, summary, and labels are passed as-is to upload. + + Args: + file_path: The local path to the file. + project_name: The name of your project on Google Code. + summary: A small description for the file. + labels: an optional list of label strings with which to tag the file. + config_dir: Path to Subversion configuration directory, 'none', or None. + user_name: Your Google account name. + tries: How many attempts to make. + """ + + while tries > 0: + if user_name is None: + # Read username if not specified or loaded from svn config, or on + # subsequent tries. + sys.stdout.write('Please enter your googlecode.com username: ') + sys.stdout.flush() + user_name = sys.stdin.readline().rstrip() + if password is None: + # Read password if not loaded from svn config, or on subsequent tries. + print 'Please enter your googlecode.com password.' + print '** Note that this is NOT your Gmail account password! **' + print 'It is the password you use to access Subversion repositories,' + print 'and can be found here: http://code.google.com/hosting/settings' + password = getpass.getpass() + + status, reason, url = upload(file_path, project_name, user_name, password, + summary, labels) + # Returns 403 Forbidden instead of 401 Unauthorized for bad + # credentials as of 2007-07-17. + if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]: + # Rest for another try. + user_name = password = None + tries = tries - 1 + else: + # We're done. + break + + return status, reason, url + + +def main(): + parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY ' + '-p PROJECT [options] FILE') + parser.add_option('-s', '--summary', dest='summary', + help='Short description of the file') + parser.add_option('-p', '--project', dest='project', + help='Google Code project name') + parser.add_option('-u', '--user', dest='user', + help='Your Google Code username') + parser.add_option('-w', '--password', dest='password', + help='Your Google Code password') + parser.add_option('-l', '--labels', dest='labels', + help='An optional list of comma-separated labels to attach ' + 'to the file') + + options, args = parser.parse_args() + + if not options.summary: + parser.error('File summary is missing.') + elif not options.project: + parser.error('Project name is missing.') + elif len(args) < 1: + parser.error('File to upload not provided.') + elif len(args) > 1: + parser.error('Only one file may be specified.') + + file_path = args[0] + + if options.labels: + labels = options.labels.split(',') + else: + labels = None + + status, reason, url = upload_find_auth(file_path, options.project, + options.summary, labels, + options.user, options.password) + if url: + print 'The file was uploaded successfully.' + print 'URL: %s' % url + return 0 + else: + print 'An error occurred. Your file was not uploaded.' + print 'Google Code upload server said: %s (%s)' % (reason, status) + return 1 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/csharp/build/nuspec.xsd b/csharp/build/nuspec.xsd new file mode 100644 index 00000000..db744d1a --- /dev/null +++ b/csharp/build/nuspec.xsd @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/csharp/build/publish.csproj b/csharp/build/publish.csproj new file mode 100644 index 00000000..bbe71df5 --- /dev/null +++ b/csharp/build/publish.csproj @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + Protocol Buffers + 2 + 4 + 1 + + + + protobuf-csharp-port- + false + + + + + + $(MSBuildProjectDirectory)\.. + $(ProjectDirectory)\build_temp + $(ProjectDirectory)\build_output + $(ProjectDirectory)\src + $(ProjectDirectory)\lib + + + $(ProjectDirectory)\release-key\Google.ProtocolBuffers.snk + + + hg.exe + C:\Python25\python.exe + $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder)Bin\sn.exe + $(LibDirectory)\StampVersion.exe + $(LibDirectory)\7-Zip 9.20\7za.exe + $(LibDirectory)\NuGet.exe + $(BuildOutputDirectory)\tools\protogen.exe + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(VersionMajor).$(VersionMinor).$(VersionBuild).$(VersionRevision) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(Python) "$(MSBuildProjectDirectory)\googlecode_upload.py" --project protobuf-csharp-port --user "$(GoogleUsername)" --password "$(GooglePassword)" + + $(BuildTempDirectory)\$(PackagePrefix)$(VersionLabel)-source.zip + $(BuildTempDirectory)\$(PackagePrefix)$(VersionLabel)-release-binaries.zip + $(BuildTempDirectory)\$(PackagePrefix)$(VersionLabel)-release-symbols.zip + $(BuildTempDirectory)\$(PackagePrefix)$(VersionLabel)-full-binaries.zip + $(BuildTempDirectory)\$(PackagePrefix)$(VersionLabel)-full-symbols.zip + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/csharp/build/target.csproj b/csharp/build/target.csproj new file mode 100644 index 00000000..09a9d50b --- /dev/null +++ b/csharp/build/target.csproj @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + Debug + Any CPU + NET20 + + + + $(MSBuildProjectDirectory)\.. + $(ProjectDirectory)\src + $(ProjectDirectory)\lib + + + $(ProjectDirectory)\build_temp\$(Configuration)\$(TargetVersion) + $(ProjectDirectory)\build_output\$(Configuration)\$(TargetVersion) + $(SourceDirectory)\ProtocolBuffersLibrary.$(TargetVersion).sln + + + $(LibDirectory)\NUnit\tools\nunit-console.exe + $(LibDirectory)\StatLight\tools\StatLight.exe + + + + + + 3.5 + NUNIT + v2.0 + + + 3.5 + NUNIT + v3.5 + + + 4.0 + NUNIT + v4.0 + + + 3.5 + NONE + v2.0 + + + 3.5 + NONE + v3.5 + + + 3.5 + SILVERLIGHT + v2.0 + + + 3.5 + SILVERLIGHT + v3.5 + + + 4.0 + SILVERLIGHT + v4.0 + + + 4.0 + SILVERLIGHT + v4.0 + $(ProjectDirectory)\build_output\$(Configuration)\portable-net40+sl4+sl5+wp7+wp8+win8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/csharp/csproj_templates/CF20.csproj b/csharp/csproj_templates/CF20.csproj new file mode 100644 index 00000000..29684126 --- /dev/null +++ b/csharp/csproj_templates/CF20.csproj @@ -0,0 +1,41 @@ + + + COMPACT_FRAMEWORK + CF20 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + v2.0 + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + + + + + bin\CF20\Debug + obj\CF20\Debug\ + $(DefineConstants);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + true + + + bin\CF20\Release + obj\CF20\Release\ + $(DefineConstants);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + true + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/csproj_templates/CF35.csproj b/csharp/csproj_templates/CF35.csproj new file mode 100644 index 00000000..eae866f0 --- /dev/null +++ b/csharp/csproj_templates/CF35.csproj @@ -0,0 +1,44 @@ + + + COMPACT_FRAMEWORK + CF35 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + v3.5 + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + + + + + bin\CF35\Debug + obj\CF35\Debug\ + $(DefineConstants);NOSERIALIZABLE;NOFILEVERSION + true + + + bin\CF35\Release + obj\CF35\Release\ + $(DefineConstants);NOSERIALIZABLE;NOFILEVERSION + true + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/csproj_templates/NET20.csproj b/csharp/csproj_templates/NET20.csproj new file mode 100644 index 00000000..f9e93920 --- /dev/null +++ b/csharp/csproj_templates/NET20.csproj @@ -0,0 +1,17 @@ + + + CLIENTPROFILE + NET20 + v2.0 + + + bin\NET20\Debug + obj\NET20\Debug\ + $(DefineConstants);NOEXTENSIONS + + + bin\NET20\Release + obj\NET20\Release\ + $(DefineConstants);NOEXTENSIONS + + \ No newline at end of file diff --git a/csharp/csproj_templates/NET35.csproj b/csharp/csproj_templates/NET35.csproj new file mode 100644 index 00000000..80ef69aa --- /dev/null +++ b/csharp/csproj_templates/NET35.csproj @@ -0,0 +1,20 @@ + + + CLIENTPROFILE + NET35 + v3.5 + + + bin\NET35\Debug + obj\NET35\Debug\ + $(DefineConstants) + + + bin\NET35\Release + obj\NET35\Release\ + $(DefineConstants) + + + + + \ No newline at end of file diff --git a/csharp/csproj_templates/NET40.csproj b/csharp/csproj_templates/NET40.csproj new file mode 100644 index 00000000..691845a6 --- /dev/null +++ b/csharp/csproj_templates/NET40.csproj @@ -0,0 +1,20 @@ + + + CLIENTPROFILE + NET40 + v4.0 + + + bin\NET40\Debug + obj\NET40\Debug\ + $(DefineConstants) + + + bin\NET40\Release + obj\NET40\Release\ + $(DefineConstants) + + + + + \ No newline at end of file diff --git a/csharp/csproj_templates/PL40.csproj b/csharp/csproj_templates/PL40.csproj new file mode 100644 index 00000000..2618a79f --- /dev/null +++ b/csharp/csproj_templates/PL40.csproj @@ -0,0 +1,51 @@ + + + 10.0 + PORTABLE_LIBRARY + PL40 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + v4.0 + Profile1 + + + bin\PL40\Debug + obj\PL40\Debug\ + $(DefineConstants);NOSERIALIZABLE;NOSORTEDLIST + + + bin\PL40\Release + obj\PL40\Release\ + $(DefineConstants);NOSERIALIZABLE;NOSORTEDLIST + + + + + + + + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/csproj_templates/SL20.csproj b/csharp/csproj_templates/SL20.csproj new file mode 100644 index 00000000..0abb104b --- /dev/null +++ b/csharp/csproj_templates/SL20.csproj @@ -0,0 +1,44 @@ + + + SILVERLIGHT + SL20 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + v2.0 + false + false + false + + + bin\SL20\Debug + obj\SL20\Debug\ + $(DefineConstants);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + true + + + bin\SL20\Release + obj\SL20\Release\ + $(DefineConstants);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + true + + + + + + + + + + OfflineApplication + + + + + \ No newline at end of file diff --git a/csharp/csproj_templates/SL30.csproj b/csharp/csproj_templates/SL30.csproj new file mode 100644 index 00000000..82ea9a8e --- /dev/null +++ b/csharp/csproj_templates/SL30.csproj @@ -0,0 +1,47 @@ + + + SILVERLIGHT + SL30 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + v3.5 + false + false + false + + + bin\SL30\Debug + obj\SL30\Debug\ + $(DefineConstants);NOSERIALIZABLE;NOSORTEDLIST + true + + + bin\SL30\Release + obj\SL30\Release\ + $(DefineConstants);NOSERIALIZABLE;NOSORTEDLIST + true + + + + + + + + + + + + + OfflineApplication + + + + + \ No newline at end of file diff --git a/csharp/csproj_templates/SL40.csproj b/csharp/csproj_templates/SL40.csproj new file mode 100644 index 00000000..8a38e3d2 --- /dev/null +++ b/csharp/csproj_templates/SL40.csproj @@ -0,0 +1,48 @@ + + + SILVERLIGHT + SL40 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + v4.0 + false + false + false + $(TargetFrameworkVersion) + + + bin\SL40\Debug + obj\SL40\Debug\ + $(DefineConstants);NOSERIALIZABLE;NOSORTEDLIST + true + + + bin\SL40\Release + obj\SL40\Release\ + $(DefineConstants);NOSERIALIZABLE;NOSORTEDLIST + true + + + + + + + + + + + + + OfflineApplication + + + + + \ No newline at end of file diff --git a/csharp/csproj_templates/SLTest.targets b/csharp/csproj_templates/SLTest.targets new file mode 100644 index 00000000..29da2399 --- /dev/null +++ b/csharp/csproj_templates/SLTest.targets @@ -0,0 +1,34 @@ + + + + true + true + true + $(AssemblyName).xap + Properties\AppManifest.xml + $(RootNamespace).App + TestPage.html + true + $(TargetFrameworkVersion) + Properties\OutOfBrowserSettings.xml + true + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + \ No newline at end of file diff --git a/csharp/keys/Google.ProtocolBuffers.snk b/csharp/keys/Google.ProtocolBuffers.snk new file mode 100644 index 00000000..6bbfc90f Binary files /dev/null and b/csharp/keys/Google.ProtocolBuffers.snk differ diff --git a/csharp/keys/generate_new_key.bat b/csharp/keys/generate_new_key.bat new file mode 100644 index 00000000..9f99c077 --- /dev/null +++ b/csharp/keys/generate_new_key.bat @@ -0,0 +1,13 @@ +@ECHO OFF +IF EXIST "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\sn.exe" GOTO FOUND +goto USEPATH + +:FOUND +"C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\sn.exe" -k %~dp0\Google.ProtocolBuffers.snk +GOTO EXIT + +:USEPATH +sn.exe -k %~dp0\Google.ProtocolBuffers.snk +GOTO EXIT + +:EXIT \ No newline at end of file diff --git a/csharp/lib/NUnit-config/Microsoft.VisualStudio.TestTools.cs b/csharp/lib/NUnit-config/Microsoft.VisualStudio.TestTools.cs new file mode 100644 index 00000000..fd151dae --- /dev/null +++ b/csharp/lib/NUnit-config/Microsoft.VisualStudio.TestTools.cs @@ -0,0 +1,54 @@ + +using System; +#if CLIENTPROFILE +namespace Microsoft.VisualStudio.TestTools.UnitTesting +{ + [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = false)] + public sealed class TestClassAttribute : NUnit.Framework.TestFixtureAttribute + { + } + + [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)] + public sealed class TestMethodAttribute : NUnit.Framework.TestAttribute + { + } + + [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)] + public sealed class TestInitializeAttribute : NUnit.Framework.SetUpAttribute + { + } + + [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)] + public sealed class IgnoreAttribute : NUnit.Framework.IgnoreAttribute + { + } + + [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)] + public sealed class ExpectedExceptionAttribute : NUnit.Framework.ExpectedExceptionAttribute + { + public ExpectedExceptionAttribute(Type type) : base(type) + { } + } + + public class Assert : NUnit.Framework.Assert + { + [Obsolete("Do not use AreEqual on Byte[], use TestUtil.AssertBytesEqual(,)")] + public static void AreEqual(byte[] b1, byte[] b2) + { + NUnit.Framework.Assert.AreEqual(b1, b2); + } + + [Obsolete("No not use assert with miss-matched types.")] + public static new void AreEqual(object b1, object b2) + { + NUnit.Framework.Assert.AreEqual(b1, b2); + } + + //Allowed if the types match + public static void AreEqual(T b1, T b2) + { + NUnit.Framework.Assert.AreEqual(b1, b2); + } + } +} +#endif \ No newline at end of file diff --git a/csharp/lib/NUnit-config/nunit-console.v2.0.config b/csharp/lib/NUnit-config/nunit-console.v2.0.config new file mode 100644 index 00000000..30453c9b --- /dev/null +++ b/csharp/lib/NUnit-config/nunit-console.v2.0.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/lib/NUnit-config/nunit-console.v3.5.config b/csharp/lib/NUnit-config/nunit-console.v3.5.config new file mode 100644 index 00000000..30453c9b --- /dev/null +++ b/csharp/lib/NUnit-config/nunit-console.v3.5.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/lib/NUnit-config/nunit-console.v4.0.config b/csharp/lib/NUnit-config/nunit-console.v4.0.config new file mode 100644 index 00000000..08ee9547 --- /dev/null +++ b/csharp/lib/NUnit-config/nunit-console.v4.0.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/lib/README.md b/csharp/lib/README.md new file mode 100644 index 00000000..d31885be --- /dev/null +++ b/csharp/lib/README.md @@ -0,0 +1,13 @@ +This directory used to contain the binary dependencies, but they were removed during a cleanup associated with importing the project +into google/protobuf repository. Before we figure a better way to manage the dependencies, you will have to manually download the dependencies +to be able to build the test projects: + +1. Download https://github.com/jskeet/protobuf-csharp-port/archive/2.4.1.555.zip +2. Open the archive and copy following files into this directory: + * `lib/Microsoft.Silverlight.Testing/` + * `lib/NUnit/` + * `lib/proto.exe` + +After that, you should be able to fully build the C# protobufs Visual Studio solutions. + +TODO(jtattermusch): the way we pull in dependencies needs to change diff --git a/csharp/mono/buildall.sh b/csharp/mono/buildall.sh new file mode 100755 index 00000000..bdd0490b --- /dev/null +++ b/csharp/mono/buildall.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Adjust these to reflect the location of NUnit in your system, +# and how you want NUnit to run +NUNIT=~/protobuf/NUnit-2.5.0.9122/bin/net-2.0/nunit-console.exe +NUNIT_OPTIONS=-noshadow + +# The rest should be okay. + +SRC=../src +LIB=../lib +KEYFILE=../keys/Google.ProtocolBuffers.snk + +rm -rf bin +mkdir bin + +# Running the unit tests requires the dependencies are +# in the bin directory too +cp -f $LIB/{Rhino.Mocks.dll,nunit.framework.dll} bin + +echo Building main library +gmcs -target:library -out:bin/Google.ProtocolBuffers.dll `find $SRC/ProtocolBuffers -name '*.cs'` -keyfile:$KEYFILE + +echo Building main library tests +gmcs -target:library -out:bin/Google.ProtocolBuffers.Test.dll `find $SRC/ProtocolBuffers.Test -name '*.cs'` -keyfile:$KEYFILE -r:bin/Google.ProtocolBuffers.dll -r:$LIB/nunit.framework.dll -r:$LIB/Rhino.Mocks.dll + +echo Running main library tests +mono $NUNIT bin/Google.ProtocolBuffers.Test.dll $NUNIT_OPTIONS + +echo Building ProtoGen +gmcs -target:exe -out:bin/ProtoGen.exe `find $SRC/ProtoGen -name '*.cs'` -keyfile:$KEYFILE -r:bin/Google.ProtocolBuffers.dll + +echo Building ProtoGen tests +gmcs -target:library -out:bin/Google.ProtocolBuffers.ProtoGen.Test.dll `find $SRC/ProtoGen.Test -name '*.cs'` -keyfile:$KEYFILE -r:bin/Google.ProtocolBuffers.dll -r:$LIB/nunit.framework.dll -r:bin/ProtoGen.exe + +echo Running ProtoGen tests +mono $NUNIT bin/Google.ProtocolBuffers.ProtoGen.Test.dll $NUNIT_OPTIONS diff --git a/csharp/mono/generatesource.sh b/csharp/mono/generatesource.sh new file mode 100755 index 00000000..218449e2 --- /dev/null +++ b/csharp/mono/generatesource.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +echo Compiling protobufs +rm -rf tmp +mkdir tmp +PROTOS_DIR=../protos + +./protoc --proto_path=$PROTOS_DIR --descriptor_set_out=tmp/compiled.pb \ + $PROTOS_DIR/google/protobuf/descriptor.proto \ + $PROTOS_DIR/google/protobuf/csharp_options.proto \ + $PROTOS_DIR/google/protobuf/unittest.proto \ + $PROTOS_DIR/google/protobuf/unittest_csharp_options.proto \ + $PROTOS_DIR/google/protobuf/unittest_custom_options.proto \ + $PROTOS_DIR/google/protobuf/unittest_embed_optimize_for.proto \ + $PROTOS_DIR/google/protobuf/unittest_import.proto \ + $PROTOS_DIR/google/protobuf/unittest_mset.proto \ + $PROTOS_DIR/google/protobuf/unittest_optimize_for.proto \ + $PROTOS_DIR/tutorial/addressbook.proto + +cd tmp +echo Generating new source +mono ../bin/ProtoGen.exe compiled.pb + +echo Copying source into place +cp DescriptorProtoFile.cs CSharpOptions.cs ../../src/ProtocolBuffers/DescriptorProtos +cp UnitTest*.cs ../../src/ProtocolBuffers.Test/TestProtos +cp AddressBookProtos.cs ../../src/AddressBook +cd .. +rm -rf tmp diff --git a/csharp/mono/readme.txt b/csharp/mono/readme.txt new file mode 100644 index 00000000..ad873a58 --- /dev/null +++ b/csharp/mono/readme.txt @@ -0,0 +1,91 @@ +Getting started with Protocol Buffers on Mono +--------------------------------------------- + +Prerequisites: + +o Mono 2.4 or higher. Earlier versions of Mono had too + many issues with the weird and wonderful generic type + relationships in Protocol Buffers. (Even Mono 2.4 *did* + have a few compile-time problems, but I've worked round them.) + +o Some sort of Linux/Unix system + You can try running with Bash on Windows via MINGW32 or + something similar, but you're on your own :) It's easier + to build and test everything with .NET if you're on + Windows. + +o The native Protocol Buffers build for your system. + Get it from http://code.google.com/p/protobuf/ + After building it, copy the executable protoc + file into this directory. + +o The NUnit binaries from http://nunit.org + I generally just download the latest version, which + may not be the one which goes with nunit.framework.dll + in ../lib, but I've never found this to be a problem. + +Building the code with current sources +-------------------------------------- + +1) Edit buildall.sh to tell it where to find nunit-console.exe + (and possibly change other options) + +2) Run buildall.sh from this directory. It should build the + main library code + tests and ProtoGen code + tests, running + each set of tests after building it. + +Note that currently one test is ignored in ServiceTest.cs. This +made the Mono VM blow up - I suspect it's some interaction with +Rhino which doesn't quite work on Mono 2.4. If you want to see a +truly nasty stack trace, just comment out the Ignore attribute in +ServiceTest.cs and rerun. + +The binaries will be produced in a bin directory under this one. The +build currently starts from scratch each time, cleaning out the bin +directory first. Once I've decided on a full NAnt or xbuild +strategy, I'll do something a little cleaner. + +Rebuilding sources for generated code +------------------------------------- + +1) Build the current code first. The bootstrapping issue is why + the generated source code is in the source repository :) See + the steps above. + +2) Run generatesource.sh from this directory. This will create a + temporary directory, compile the .proto files into a binary + format, then run ProtoGen to generate .cs files from the binary + format. It will copy these files to the right places in the tree, + and finally delete the temporary directory. + +3) Rebuild to test that your newly generated sources work. (Optionally + regenerate as well, and hash the generated files to check that + the new build generates the same code as the old build :) + +Running the code +---------------- + +Once you've built the binaries, you should be able to use them just +as if you'd built them with .NET. (And indeed, you should be able to +use binaries built with .NET as if you'd built them with Mono :) + +See the getting started guide for more information: +http://code.google.com/p/protobuf-csharp-port/wiki/GettingStarted + +FAQ (Frequently Anticipated Questions) +-------------------------------------- + +Q) This build process sucks! Why aren't you doing X, Y, Z? +A) My Mono skills are limited. My NAnt skills are limited. My + MSBuild/xbuild skils are limited. My shell script skills are + limited. Any help is *very* welcome! + +Q) Why doesn't it build ProtoBench etc? +A) This is a first initial "release" I'll add more bits to + the build script. I'll be interested to see the results + of benchmarking it on Mono :) + +Any further questions or suggestions? Please email skeet@pobox.com +or leave a request at +http://code.google.com/p/protobuf-csharp-port/issues/list + diff --git a/csharp/protos/benchmarks/google_size.proto b/csharp/protos/benchmarks/google_size.proto new file mode 100644 index 00000000..1442ca23 --- /dev/null +++ b/csharp/protos/benchmarks/google_size.proto @@ -0,0 +1,140 @@ +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.ProtoBench"; +option (google.protobuf.csharp_file_options).umbrella_classname = "GoogleSizeProtoFile"; + +package benchmarks; + +option java_outer_classname = "GoogleSize"; +option optimize_for = CODE_SIZE; + +message SizeMessage1 { + required string field1 = 1; + optional string field9 = 9; + optional string field18 = 18; + optional bool field80 = 80 [default=false]; + optional bool field81 = 81 [default=true]; + required int32 field2 = 2; + required int32 field3 = 3; + optional int32 field280 = 280; + optional int32 field6 = 6 [default=0]; + optional int64 field22 = 22; + optional string field4 = 4; + repeated fixed64 field5 = 5; + optional bool field59 = 59 [default=false]; + optional string field7 = 7; + optional int32 field16 = 16; + optional int32 field130 = 130 [default=0]; + optional bool field12 = 12 [default=true]; + optional bool field17 = 17 [default=true]; + optional bool field13 = 13 [default=true]; + optional bool field14 = 14 [default=true]; + optional int32 field104 = 104 [default=0]; + optional int32 field100 = 100 [default=0]; + optional int32 field101 = 101 [default=0]; + optional string field102 = 102; + optional string field103 = 103; + optional int32 field29 = 29 [default=0]; + optional bool field30 = 30 [default=false]; + optional int32 field60 = 60 [default=-1]; + optional int32 field271 = 271 [default=-1]; + optional int32 field272 = 272 [default=-1]; + optional int32 field150 = 150; + optional int32 field23 = 23 [default=0]; + optional bool field24 = 24 [default=false]; + optional int32 field25 = 25 [default=0]; + optional SizeMessage1SubMessage field15 = 15; + optional bool field78 = 78; + optional int32 field67 = 67 [default=0]; + optional int32 field68 = 68; + optional int32 field128 = 128 [default=0]; + optional string field129 = 129 [default="xxxxxxxxxxxxxxxxxxxxx"]; + optional int32 field131 = 131 [default=0]; +} + +message SizeMessage1SubMessage { + optional int32 field1 = 1 [default=0]; + optional int32 field2 = 2 [default=0]; + optional int32 field3 = 3 [default=0]; + optional string field15 = 15; + optional bool field12 = 12 [default=true]; + optional int64 field13 = 13; + optional int64 field14 = 14; + optional int32 field16 = 16; + optional int32 field19 = 19 [default=2]; + optional bool field20 = 20 [default=true]; + optional bool field28 = 28 [default=true]; + optional fixed64 field21 = 21; + optional int32 field22 = 22; + optional bool field23 = 23 [ default=false ]; + optional bool field206 = 206 [default=false]; + optional fixed32 field203 = 203; + optional int32 field204 = 204; + optional string field205 = 205; + optional uint64 field207 = 207; + optional uint64 field300 = 300; +} + +message SizeMessage2 { + optional string field1 = 1; + optional int64 field3 = 3; + optional int64 field4 = 4; + optional int64 field30 = 30; + optional bool field75 = 75 [default=false]; + optional string field6 = 6; + optional bytes field2 = 2; + optional int32 field21 = 21 [default=0]; + optional int32 field71 = 71; + optional float field25 = 25; + optional int32 field109 = 109 [default=0]; + optional int32 field210 = 210 [default=0]; + optional int32 field211 = 211 [default=0]; + optional int32 field212 = 212 [default=0]; + optional int32 field213 = 213 [default=0]; + optional int32 field216 = 216 [default=0]; + optional int32 field217 = 217 [default=0]; + optional int32 field218 = 218 [default=0]; + optional int32 field220 = 220 [default=0]; + optional int32 field221 = 221 [default=0]; + optional float field222 = 222 [default=0.0]; + optional int32 field63 = 63; + + repeated group Group1 = 10 { + required float field11 = 11; + optional float field26 = 26; + optional string field12 = 12; + optional string field13 = 13; + repeated string field14 = 14; + required uint64 field15 = 15; + optional int32 field5 = 5; + optional string field27 = 27; + optional int32 field28 = 28; + optional string field29 = 29; + optional string field16 = 16; + repeated string field22 = 22; + repeated int32 field73 = 73; + optional int32 field20 = 20 [default=0]; + optional string field24 = 24; + optional SizeMessage2GroupedMessage field31 = 31; + } + repeated string field128 = 128; + optional int64 field131 = 131; + repeated string field127 = 127; + optional int32 field129 = 129; + repeated int64 field130 = 130; + optional bool field205 = 205 [default=false]; + optional bool field206 = 206 [default=false]; +} + +message SizeMessage2GroupedMessage { + optional float field1 = 1; + optional float field2 = 2; + optional float field3 = 3 [default=0.0]; + optional bool field4 = 4; + optional bool field5 = 5; + optional bool field6 = 6 [default=true]; + optional bool field7 = 7 [default=false]; + optional float field8 = 8; + optional bool field9 = 9; + optional float field10 = 10; + optional int64 field11 = 11; +} diff --git a/csharp/protos/benchmarks/google_speed.proto b/csharp/protos/benchmarks/google_speed.proto new file mode 100644 index 00000000..269eba80 --- /dev/null +++ b/csharp/protos/benchmarks/google_speed.proto @@ -0,0 +1,140 @@ +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.ProtoBench"; +option (google.protobuf.csharp_file_options).umbrella_classname = "GoogleSpeedProtoFile"; + +package benchmarks; + +option java_outer_classname = "GoogleSpeed"; +option optimize_for = SPEED; + +message SpeedMessage1 { + required string field1 = 1; + optional string field9 = 9; + optional string field18 = 18; + optional bool field80 = 80 [default=false]; + optional bool field81 = 81 [default=true]; + required int32 field2 = 2; + required int32 field3 = 3; + optional int32 field280 = 280; + optional int32 field6 = 6 [default=0]; + optional int64 field22 = 22; + optional string field4 = 4; + repeated fixed64 field5 = 5; + optional bool field59 = 59 [default=false]; + optional string field7 = 7; + optional int32 field16 = 16; + optional int32 field130 = 130 [default=0]; + optional bool field12 = 12 [default=true]; + optional bool field17 = 17 [default=true]; + optional bool field13 = 13 [default=true]; + optional bool field14 = 14 [default=true]; + optional int32 field104 = 104 [default=0]; + optional int32 field100 = 100 [default=0]; + optional int32 field101 = 101 [default=0]; + optional string field102 = 102; + optional string field103 = 103; + optional int32 field29 = 29 [default=0]; + optional bool field30 = 30 [default=false]; + optional int32 field60 = 60 [default=-1]; + optional int32 field271 = 271 [default=-1]; + optional int32 field272 = 272 [default=-1]; + optional int32 field150 = 150; + optional int32 field23 = 23 [default=0]; + optional bool field24 = 24 [default=false]; + optional int32 field25 = 25 [default=0]; + optional SpeedMessage1SubMessage field15 = 15; + optional bool field78 = 78; + optional int32 field67 = 67 [default=0]; + optional int32 field68 = 68; + optional int32 field128 = 128 [default=0]; + optional string field129 = 129 [default="xxxxxxxxxxxxxxxxxxxxx"]; + optional int32 field131 = 131 [default=0]; +} + +message SpeedMessage1SubMessage { + optional int32 field1 = 1 [default=0]; + optional int32 field2 = 2 [default=0]; + optional int32 field3 = 3 [default=0]; + optional string field15 = 15; + optional bool field12 = 12 [default=true]; + optional int64 field13 = 13; + optional int64 field14 = 14; + optional int32 field16 = 16; + optional int32 field19 = 19 [default=2]; + optional bool field20 = 20 [default=true]; + optional bool field28 = 28 [default=true]; + optional fixed64 field21 = 21; + optional int32 field22 = 22; + optional bool field23 = 23 [ default=false ]; + optional bool field206 = 206 [default=false]; + optional fixed32 field203 = 203; + optional int32 field204 = 204; + optional string field205 = 205; + optional uint64 field207 = 207; + optional uint64 field300 = 300; +} + +message SpeedMessage2 { + optional string field1 = 1; + optional int64 field3 = 3; + optional int64 field4 = 4; + optional int64 field30 = 30; + optional bool field75 = 75 [default=false]; + optional string field6 = 6; + optional bytes field2 = 2; + optional int32 field21 = 21 [default=0]; + optional int32 field71 = 71; + optional float field25 = 25; + optional int32 field109 = 109 [default=0]; + optional int32 field210 = 210 [default=0]; + optional int32 field211 = 211 [default=0]; + optional int32 field212 = 212 [default=0]; + optional int32 field213 = 213 [default=0]; + optional int32 field216 = 216 [default=0]; + optional int32 field217 = 217 [default=0]; + optional int32 field218 = 218 [default=0]; + optional int32 field220 = 220 [default=0]; + optional int32 field221 = 221 [default=0]; + optional float field222 = 222 [default=0.0]; + optional int32 field63 = 63; + + repeated group Group1 = 10 { + required float field11 = 11; + optional float field26 = 26; + optional string field12 = 12; + optional string field13 = 13; + repeated string field14 = 14; + required uint64 field15 = 15; + optional int32 field5 = 5; + optional string field27 = 27; + optional int32 field28 = 28; + optional string field29 = 29; + optional string field16 = 16; + repeated string field22 = 22; + repeated int32 field73 = 73; + optional int32 field20 = 20 [default=0]; + optional string field24 = 24; + optional SpeedMessage2GroupedMessage field31 = 31; + } + repeated string field128 = 128; + optional int64 field131 = 131; + repeated string field127 = 127; + optional int32 field129 = 129; + repeated int64 field130 = 130; + optional bool field205 = 205 [default=false]; + optional bool field206 = 206 [default=false]; +} + +message SpeedMessage2GroupedMessage { + optional float field1 = 1; + optional float field2 = 2; + optional float field3 = 3 [default=0.0]; + optional bool field4 = 4; + optional bool field5 = 5; + optional bool field6 = 6 [default=true]; + optional bool field7 = 7 [default=false]; + optional float field8 = 8; + optional bool field9 = 9; + optional float field10 = 10; + optional int64 field11 = 11; +} diff --git a/csharp/protos/extest/unittest_extras.proto b/csharp/protos/extest/unittest_extras.proto new file mode 100644 index 00000000..91f10fbd --- /dev/null +++ b/csharp/protos/extest/unittest_extras.proto @@ -0,0 +1,37 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasProtoFile"; +option (google.protobuf.csharp_file_options).add_serializable = true; + +package protobuf_unittest_extra; + +option java_package = "com.google.protobuf"; + +message TestUnpackedExtensions { + extensions 1 to max; +} + +extend TestUnpackedExtensions { + repeated int32 unpacked_int32_extension = 90; + repeated int64 unpacked_int64_extension = 91; + repeated uint32 unpacked_uint32_extension = 92; + repeated uint64 unpacked_uint64_extension = 93; + repeated sint32 unpacked_sint32_extension = 94; + repeated sint64 unpacked_sint64_extension = 95; + repeated fixed32 unpacked_fixed32_extension = 96; + repeated fixed64 unpacked_fixed64_extension = 97; + repeated sfixed32 unpacked_sfixed32_extension = 98; + repeated sfixed64 unpacked_sfixed64_extension = 99; + repeated float unpacked_float_extension = 100; + repeated double unpacked_double_extension = 101; + repeated bool unpacked_bool_extension = 102; + repeated UnpackedExtensionsForeignEnum unpacked_enum_extension = 103; +} + +enum UnpackedExtensionsForeignEnum { + FOREIGN_FOO = 4; + FOREIGN_BAR = 5; + FOREIGN_BAZ = 6; +} diff --git a/csharp/protos/extest/unittest_extras_full.proto b/csharp/protos/extest/unittest_extras_full.proto new file mode 100644 index 00000000..a334bbf1 --- /dev/null +++ b/csharp/protos/extest/unittest_extras_full.proto @@ -0,0 +1,72 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasFullProtoFile"; + +package protobuf_unittest_extra; + +option optimize_for = CODE_SIZE; + +option java_package = "com.google.protobuf"; + +message TestInteropPerson { + required string name = 1; + required int32 id = 2; + optional string email = 3; + repeated int32 codes = 10 [packed=true]; + + enum PhoneType { + MOBILE = 0; + HOME = 1; + WORK = 2; + } + + message PhoneNumber { + required string number = 1; + optional PhoneType type = 2 [default = HOME]; + } + + repeated PhoneNumber phone = 4; + + repeated group Addresses = 5 { + required string address = 1; + optional string address2 = 2; + required string city = 3; + required string state = 4; + required fixed32 zip = 5; + } + + extensions 100 to 199; +} + +message TestInteropEmployeeId { + required string number = 1; +} + +extend TestInteropPerson { + required TestInteropEmployeeId employee_id = 126; +} + +message TestMissingFieldsA { + required string name = 1; + required int32 id = 2; + optional string email = 3; + + message SubA { + required int32 count = 5; + repeated string values = 6; + } + optional SubA testA = 11; +} + +message TestMissingFieldsB { + required string name = 1; + required int32 id = 2; + optional string website = 4; + + message SubB { + repeated string values = 7; + } + optional SubB testB = 12; +} diff --git a/csharp/protos/extest/unittest_extras_lite.proto b/csharp/protos/extest/unittest_extras_lite.proto new file mode 100644 index 00000000..ea1bcd25 --- /dev/null +++ b/csharp/protos/extest/unittest_extras_lite.proto @@ -0,0 +1,117 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasLiteProtoFile"; +option (google.protobuf.csharp_file_options).add_serializable = true; + +package protobuf_unittest_extra; + +option optimize_for = LITE_RUNTIME; + +option java_package = "com.google.protobuf"; + +message TestRequiredLite { + required int32 d = 1; + required ExtraEnum en = 2 [default = DEFAULT]; +} + +enum ExtraEnum { + DEFAULT = 10; + EXLITE_FOO = 7; + EXLITE_BAR = 8; + EXLITE_BAZ = 9; +} + +message TestInteropPersonLite { + required string name = 1; + required int32 id = 2; + optional string email = 3; + repeated int32 codes = 10 [packed=true]; + + enum PhoneType { + MOBILE = 0; + HOME = 1; + WORK = 2; + } + + message PhoneNumber { + required string number = 1; + optional PhoneType type = 2 [default = HOME]; + } + + repeated PhoneNumber phone = 4; + + repeated group Addresses = 5 { + required string address = 1; + optional string address2 = 2; + required string city = 3; + required string state = 4; + required fixed32 zip = 5; + } + + extensions 100 to 199; +} + +message TestInteropEmployeeIdLite { + required string number = 1; +} + +extend TestInteropPersonLite { + required TestInteropEmployeeIdLite employee_id_lite = 126; +} + +/* Removed from unittest_lite.proto and added back here */ + +message TestUnpackedExtensionsLite { + extensions 1 to max; +} + +message TestUnpackedTypesLite { + repeated int32 unpacked_int32 = 90; + repeated int64 unpacked_int64 = 91; + repeated uint32 unpacked_uint32 = 92; + repeated uint64 unpacked_uint64 = 93; + repeated sint32 unpacked_sint32 = 94; + repeated sint64 unpacked_sint64 = 95; + repeated fixed32 unpacked_fixed32 = 96; + repeated fixed64 unpacked_fixed64 = 97; + repeated sfixed32 unpacked_sfixed32 = 98; + repeated sfixed64 unpacked_sfixed64 = 99; + repeated float unpacked_float = 100; + repeated double unpacked_double = 101; + repeated bool unpacked_bool = 102; + repeated UnpackedTypesForeignEnumLite unpacked_enum = 103; +} + +extend TestUnpackedExtensionsLite { + repeated int32 unpacked_int32_extension_lite = 90; + repeated int64 unpacked_int64_extension_lite = 91; + repeated uint32 unpacked_uint32_extension_lite = 92; + repeated uint64 unpacked_uint64_extension_lite = 93; + repeated sint32 unpacked_sint32_extension_lite = 94; + repeated sint64 unpacked_sint64_extension_lite = 95; + repeated fixed32 unpacked_fixed32_extension_lite = 96; + repeated fixed64 unpacked_fixed64_extension_lite = 97; + repeated sfixed32 unpacked_sfixed32_extension_lite = 98; + repeated sfixed64 unpacked_sfixed64_extension_lite = 99; + repeated float unpacked_float_extension_lite = 100; + repeated double unpacked_double_extension_lite = 101; + repeated bool unpacked_bool_extension_lite = 102; + repeated UnpackedTypesForeignEnumLite unpacked_enum_extension_lite = 103; +} + +enum UnpackedTypesForeignEnumLite { + FOREIGN_LITE_FOO = 4; + FOREIGN_LITE_BAR = 5; + FOREIGN_LITE_BAZ = 6; +} + +message BucketOfBytes { + optional bytes value = 1; + +} +message BucketOfBytesEx { + optional bytes value = 1; + optional bytes value2 = 255; +} \ No newline at end of file diff --git a/csharp/protos/extest/unittest_extras_xmltest.proto b/csharp/protos/extest/unittest_extras_xmltest.proto new file mode 100644 index 00000000..ab8088a7 --- /dev/null +++ b/csharp/protos/extest/unittest_extras_xmltest.proto @@ -0,0 +1,54 @@ +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestXmlSerializerTestProtoFile"; +option (google.protobuf.csharp_file_options).add_serializable = true; + +package protobuf_unittest_extra; + +option optimize_for = SPEED; + +enum EnumOptions { + ONE = 0; + TWO = 1; + THREE = 2; +} + +message TestXmlChild { + repeated EnumOptions options = 3; + optional bytes binary = 4; +} + +message TestXmlNoFields { +} + +message TestXmlRescursive { + optional TestXmlRescursive child = 1; +} + +message TestXmlMessage { + + optional int64 number = 6; + repeated int32 numbers = 2; + optional string text = 3; + repeated string textlines = 700; + optional bool valid = 5; + + optional TestXmlChild child = 1; + repeated group Children = 401 { + repeated EnumOptions options = 3; + optional bytes binary = 4; + } + +extensions 100 to 199; +} + +message TestXmlExtension { + required int32 number = 1; +} + +extend TestXmlMessage { + optional EnumOptions extension_enum = 101; + optional string extension_text = 102; + repeated int32 extension_number = 103 [packed = true]; + optional TestXmlExtension extension_message = 199; +} diff --git a/csharp/protos/extest/unittest_generic_services.proto b/csharp/protos/extest/unittest_generic_services.proto new file mode 100644 index 00000000..3fe2e8eb --- /dev/null +++ b/csharp/protos/extest/unittest_generic_services.proto @@ -0,0 +1,29 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +import "google/protobuf/unittest.proto"; +import "google/protobuf/unittest_custom_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestGenericServices"; + +option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +package protobuf_unittest; + +option optimize_for = SPEED; + +service TestGenericService { + rpc Foo(FooRequest) returns (FooResponse); + rpc Bar(BarRequest) returns (BarResponse); +} + +service TestGenericServiceWithCustomOptions { + option (service_opt1) = -9876543210; + + rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) { + option (method_opt1) = METHODOPT1_VAL2; + } +} + diff --git a/csharp/protos/extest/unittest_issues.proto b/csharp/protos/extest/unittest_issues.proto new file mode 100644 index 00000000..cb803791 --- /dev/null +++ b/csharp/protos/extest/unittest_issues.proto @@ -0,0 +1,137 @@ +// These proto descriptors have at one time been reported as an issue or defect. +// They are kept here to replicate the issue, and continue to verify the fix. +import "google/protobuf/csharp_options.proto"; + +// Issue: Non-"Google.Protobuffers" namespace will ensure that protobuffer library types are qualified +option (google.protobuf.csharp_file_options).namespace = "UnitTest.Issues.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestExtrasIssuesProtoFile"; + +package unittest_issues; +option optimize_for = SPEED; + +// The following is a representative set of features +/* +enum EnumOptions { + ONE = 0; + TWO = 1; + THREE = 2; +} + +message TestBasicChild +{ + repeated EnumOptions options = 3; + optional bytes binary = 4; +} + +message TestBasicNoFields { +} + +message TestBasicRescursive { + optional TestBasicRescursive child = 1; +} + +message TestBasicMessage { + + optional int64 number = 6; + repeated int32 numbers = 2; + optional string text = 3; + repeated string textlines = 700; + optional bool valid = 5; + + optional TestBasicChild child = 1; + repeated group Children = 401 + { + repeated EnumOptions options = 3; + optional bytes binary = 4; + } + + extensions 100 to 199; +} + +message TestBasicExtension { + required int32 number = 1; +} + +extend TestBasicMessage { + optional EnumOptions extension_enum = 101; + optional string extension_text = 102; + repeated int32 extension_number = 103 [packed = true]; + optional TestBasicExtension extension_message = 199; +} + +// Issue for non-qualified type reference in new services generation +option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH; + +service TestGenericService { + rpc Foo(TestBasicNoFields) returns (TestBasicMessage); + rpc Bar(TestBasicNoFields) returns (TestBasicMessage); +} +*/ +// Issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13 + +message A { + optional int32 _A = 1; +} + +message B { + optional int32 B_ = 1; +} + +message AB { + optional int32 a_b = 1; +} + +// Similar issue with numeric names +message NumberField { + optional int32 _01 = 1; +} + +// Issue 28: Circular message dependencies result in null defaults for DefaultInstance + +message MyMessageAReferenceB { + required MyMessageBReferenceA value = 1; +} + +message MyMessageBReferenceA { + required MyMessageAReferenceB value = 1; +} + +// issue 19 - negative enum values + +enum NegativeEnum { + FiveBelow = -5; + MinusOne = -1; + Zero = 0; +} + +message NegativeEnumMessage { + optional NegativeEnum value = 1; + repeated NegativeEnum values = 2; + repeated NegativeEnum packed_values = 3 [packed=true]; +} + +// Issue 21: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=21 +// Decorate fields with [deprecated=true] as [System.Obsolete] + +message DeprecatedChild { +} + +enum DeprecatedEnum { + one = 1; +} + +message DeprecatedFieldsMessage { + optional int32 PrimitiveValue = 1 [deprecated = true]; + repeated int32 PrimitiveArray = 2 [deprecated = true]; + + optional DeprecatedChild MessageValue = 3 [deprecated = true]; + repeated DeprecatedChild MessageArray = 4 [deprecated = true]; + + optional DeprecatedEnum EnumValue = 5 [deprecated = true]; + repeated DeprecatedEnum EnumArray = 6 [deprecated = true]; +} + +// Issue 45: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=45 +message ItemField { + optional int32 item = 1; +} diff --git a/csharp/protos/extest/unittest_rpc_interop.proto b/csharp/protos/extest/unittest_rpc_interop.proto new file mode 100644 index 00000000..dec5b872 --- /dev/null +++ b/csharp/protos/extest/unittest_rpc_interop.proto @@ -0,0 +1,41 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestRpcInterop"; + +option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH; + +option optimize_for = SPEED; + +message SearchRequest { + repeated string Criteria = 1; +} + +message SearchResponse { + message ResultItem { + required string url = 1; + optional string name = 2; + } + + repeated ResultItem results = 1; +} + +message RefineSearchRequest { + repeated string Criteria = 1; + required SearchResponse previous_results = 2; +} + +service SearchService { + /* + Add this option to specify the GuidAttribute on the service interface + option (google.protobuf.csharp_service_options).interface_id = "{A65F0925-FD11-4f94-B166-89AC4F027205}"; + */ + rpc Search (SearchRequest) returns (SearchResponse) + /* + Add this option to specify the DispIdAttribute on the service interface + { option (google.protobuf.csharp_method_options).dispatch_id = 5; } + */ ; + + rpc RefineSearch (RefineSearchRequest) returns (SearchResponse); +} diff --git a/csharp/protos/extest/unittest_rpc_interop_lite.proto b/csharp/protos/extest/unittest_rpc_interop_lite.proto new file mode 100644 index 00000000..62d1c6a6 --- /dev/null +++ b/csharp/protos/extest/unittest_rpc_interop_lite.proto @@ -0,0 +1,42 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestRpcInteropLite"; + +option (google.protobuf.csharp_file_options).service_generator_type = IRPCDISPATCH; + +option optimize_for = LITE_RUNTIME; +package unittest_rpc_interop_lite; + +message SearchRequest { + repeated string Criteria = 1; +} + +message SearchResponse { + message ResultItem { + required string url = 1; + optional string name = 2; + } + + repeated ResultItem results = 1; +} + +message RefineSearchRequest { + repeated string Criteria = 1; + required SearchResponse previous_results = 2; +} + +service SearchService { + /* + Add this option to specify the GuidAttribute on the service interface + option (google.protobuf.csharp_service_options).interface_id = "{A65F0925-FD11-4f94-B166-89AC4F027205}"; + */ + rpc Search (SearchRequest) returns (SearchResponse) + /* + Add this option to specify the DispIdAttribute on the service interface + { option (google.protobuf.csharp_method_options).dispatch_id = 5; } + */ ; + + rpc RefineSearch (RefineSearchRequest) returns (SearchResponse); +} diff --git a/csharp/protos/google/protobuf/compiler/plugin.proto b/csharp/protos/google/protobuf/compiler/plugin.proto new file mode 100644 index 00000000..866fba11 --- /dev/null +++ b/csharp/protos/google/protobuf/compiler/plugin.proto @@ -0,0 +1,147 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// +// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to +// change. +// +// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is +// just a program that reads a CodeGeneratorRequest from stdin and writes a +// CodeGeneratorResponse to stdout. +// +// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead +// of dealing with the raw protocol defined here. +// +// A plugin executable needs only to be placed somewhere in the path. The +// plugin should be named "protoc-gen-$NAME", and will then be used when the +// flag "--${NAME}_out" is passed to protoc. + +package google.protobuf.compiler; +option java_package = "com.google.protobuf.compiler"; +option java_outer_classname = "PluginProtos"; + +import "google/protobuf/descriptor.proto"; + +// An encoded CodeGeneratorRequest is written to the plugin's stdin. +message CodeGeneratorRequest { + // The .proto files that were explicitly listed on the command-line. The + // code generator should generate code only for these files. Each file's + // descriptor will be included in proto_file, below. + repeated string file_to_generate = 1; + + // The generator parameter passed on the command-line. + optional string parameter = 2; + + // FileDescriptorProtos for all files in files_to_generate and everything + // they import. The files will appear in topological order, so each file + // appears before any file that imports it. + // + // protoc guarantees that all proto_files will be written after + // the fields above, even though this is not technically guaranteed by the + // protobuf wire format. This theoretically could allow a plugin to stream + // in the FileDescriptorProtos and handle them one by one rather than read + // the entire set into memory at once. However, as of this writing, this + // is not similarly optimized on protoc's end -- it will store all fields in + // memory at once before sending them to the plugin. + repeated FileDescriptorProto proto_file = 15; +} + +// The plugin writes an encoded CodeGeneratorResponse to stdout. +message CodeGeneratorResponse { + // Error message. If non-empty, code generation failed. The plugin process + // should exit with status code zero even if it reports an error in this way. + // + // This should be used to indicate errors in .proto files which prevent the + // code generator from generating correct code. Errors which indicate a + // problem in protoc itself -- such as the input CodeGeneratorRequest being + // unparseable -- should be reported by writing a message to stderr and + // exiting with a non-zero status code. + optional string error = 1; + + // Represents a single generated file. + message File { + // The file name, relative to the output directory. The name must not + // contain "." or ".." components and must be relative, not be absolute (so, + // the file cannot lie outside the output directory). "/" must be used as + // the path separator, not "\". + // + // If the name is omitted, the content will be appended to the previous + // file. This allows the generator to break large files into small chunks, + // and allows the generated text to be streamed back to protoc so that large + // files need not reside completely in memory at one time. Note that as of + // this writing protoc does not optimize for this -- it will read the entire + // CodeGeneratorResponse before writing files to disk. + optional string name = 1; + + // If non-empty, indicates that the named file should already exist, and the + // content here is to be inserted into that file at a defined insertion + // point. This feature allows a code generator to extend the output + // produced by another code generator. The original generator may provide + // insertion points by placing special annotations in the file that look + // like: + // @@protoc_insertion_point(NAME) + // The annotation can have arbitrary text before and after it on the line, + // which allows it to be placed in a comment. NAME should be replaced with + // an identifier naming the point -- this is what other generators will use + // as the insertion_point. Code inserted at this point will be placed + // immediately above the line containing the insertion point (thus multiple + // insertions to the same point will come out in the order they were added). + // The double-@ is intended to make it unlikely that the generated code + // could contain things that look like insertion points by accident. + // + // For example, the C++ code generator places the following line in the + // .pb.h files that it generates: + // // @@protoc_insertion_point(namespace_scope) + // This line appears within the scope of the file's package namespace, but + // outside of any particular class. Another plugin can then specify the + // insertion_point "namespace_scope" to generate additional classes or + // other declarations that should be placed in this scope. + // + // Note that if the line containing the insertion point begins with + // whitespace, the same whitespace will be added to every line of the + // inserted text. This is useful for languages like Python, where + // indentation matters. In these languages, the insertion point comment + // should be indented the same amount as any inserted code will need to be + // in order to work correctly in that context. + // + // The code generator that generates the initial file and the one which + // inserts into it must both run as part of a single invocation of protoc. + // Code generators are executed in the order in which they appear on the + // command line. + // + // If |insertion_point| is present, |name| must also be present. + optional string insertion_point = 2; + + // The file contents. + optional string content = 15; + } + repeated File file = 15; +} diff --git a/csharp/protos/google/protobuf/csharp_options.proto b/csharp/protos/google/protobuf/csharp_options.proto new file mode 100644 index 00000000..f09b96aa --- /dev/null +++ b/csharp/protos/google/protobuf/csharp_options.proto @@ -0,0 +1,115 @@ +// Extra options for C# generator + +import "google/protobuf/descriptor.proto"; + +package google.protobuf; + +message CSharpFileOptions { + + // Namespace for generated classes; defaults to the package. + optional string namespace = 1; + + // Name of the "umbrella" class used for metadata about all + // the messages within this file. Default is based on the name + // of the file. + optional string umbrella_classname = 2; + + // Whether classes should be public (true) or internal (false) + optional bool public_classes = 3 [default = true]; + + // Whether to generate a single file for everything within the + // .proto file (false), or one file per message (true). + // This option is not currently honored; please log a feature + // request if you really want it. + optional bool multiple_files = 4; + + // Whether to nest messages within a single umbrella class (true) + // or create the umbrella class as a peer, with messages as + // top-level classes in the namespace (false) + optional bool nest_classes = 5; + + // Generate appropriate support for Code Contracts + // (Ongoing; support should improve over time) + optional bool code_contracts = 6; + + // Create subdirectories for namespaces, e.g. namespace "Foo.Bar" + // would generate files within [output directory]/Foo/Bar + optional bool expand_namespace_directories = 7; + + // Generate attributes indicating non-CLS-compliance + optional bool cls_compliance = 8 [default = true]; + + // Generate messages/builders with the [Serializable] attribute + optional bool add_serializable = 9 [default = false]; + + // Generates a private ctor for Message types + optional bool generate_private_ctor = 10 [default = true]; + + // The extension that should be appended to the umbrella_classname when creating files. + optional string file_extension = 221 [default = ".cs"]; + + // A nested namespace for the umbrella class. Helpful for name collisions caused by + // umbrella_classname conflicting with an existing type. This will be automatically + // set to 'Proto' if a collision is detected with types being generated. This value + // is ignored when nest_classes == true + optional string umbrella_namespace = 222; + + // The output path for the source file(s) generated + optional string output_directory = 223 [default = "."]; + + // Will ignore the type generations and remove dependencies for the descriptor proto + // files that declare their package to be "google.protobuf" + optional bool ignore_google_protobuf = 224 [default = false]; + + // Controls how services are generated, GENERIC is the deprecated original implementation + // INTERFACE generates service interfaces only, RPCINTEROP generates interfaces and + // implementations using the included Windows RPC interop libarary. + optional CSharpServiceType service_generator_type = 225 [default = NONE]; + + // Used to add the System.Runtime.CompilerServices.CompilerGeneratedAttribute and + // System.CodeDom.Compiler.GeneratedCodeAttribute attributes to generated code. + optional bool generated_code_attributes = 226 [default = false]; +} + +enum CSharpServiceType { + // Services are ignored by the generator + NONE = 0; + // Generates the original Java generic service implementations + GENERIC = 1; + // Generates an interface for the service and nothing else + INTERFACE = 2; + // Generates an interface for the service and client/server wrappers for the interface + IRPCDISPATCH = 3; +} + +extend FileOptions { + optional CSharpFileOptions csharp_file_options = 1000; +} + +extend FieldOptions { + optional CSharpFieldOptions csharp_field_options = 1000; +} + +message CSharpFieldOptions { + // Provides the ability to override the name of the property + // generated for this field. This is applied to all properties + // and methods to do with this field, including HasFoo, FooCount, + // FooList etc. + optional string property_name = 1; +} + +message CSharpServiceOptions { + optional string interface_id = 1; +} + +extend ServiceOptions { + optional CSharpServiceOptions csharp_service_options = 1000; +} + +message CSharpMethodOptions { + optional int32 dispatch_id = 1; +} + +extend MethodOptions { + optional CSharpMethodOptions csharp_method_options = 1000; +} \ No newline at end of file diff --git a/csharp/protos/google/protobuf/descriptor.proto b/csharp/protos/google/protobuf/descriptor.proto new file mode 100644 index 00000000..233f8794 --- /dev/null +++ b/csharp/protos/google/protobuf/descriptor.proto @@ -0,0 +1,533 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// The messages in this file describe the definitions found in .proto files. +// A valid .proto file can be translated directly to a FileDescriptorProto +// without any other information (e.g. without reading its imports). + + + +package google.protobuf; +option java_package = "com.google.protobuf"; +option java_outer_classname = "DescriptorProtos"; + +// descriptor.proto must be optimized for speed because reflection-based +// algorithms don't work during bootstrapping. +option optimize_for = SPEED; + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +message FileDescriptorSet { + repeated FileDescriptorProto file = 1; +} + +// Describes a complete .proto file. +message FileDescriptorProto { + optional string name = 1; // file name, relative to root of source tree + optional string package = 2; // e.g. "foo", "foo.bar", etc. + + // Names of files imported by this file. + repeated string dependency = 3; + + // All top-level definitions in this file. + repeated DescriptorProto message_type = 4; + repeated EnumDescriptorProto enum_type = 5; + repeated ServiceDescriptorProto service = 6; + repeated FieldDescriptorProto extension = 7; + + optional FileOptions options = 8; + + // This field contains optional information about the original source code. + // You may safely remove this entire field whithout harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + optional SourceCodeInfo source_code_info = 9; +} + +// Describes a message type. +message DescriptorProto { + optional string name = 1; + + repeated FieldDescriptorProto field = 2; + repeated FieldDescriptorProto extension = 6; + + repeated DescriptorProto nested_type = 3; + repeated EnumDescriptorProto enum_type = 4; + + message ExtensionRange { + optional int32 start = 1; + optional int32 end = 2; + } + repeated ExtensionRange extension_range = 5; + + optional MessageOptions options = 7; +} + +// Describes a field within a message. +message FieldDescriptorProto { + enum Type { + // 0 is reserved for errors. + // Order is weird for historical reasons. + TYPE_DOUBLE = 1; + TYPE_FLOAT = 2; + TYPE_INT64 = 3; // Not ZigZag encoded. Negative numbers + // take 10 bytes. Use TYPE_SINT64 if negative + // values are likely. + TYPE_UINT64 = 4; + TYPE_INT32 = 5; // Not ZigZag encoded. Negative numbers + // take 10 bytes. Use TYPE_SINT32 if negative + // values are likely. + TYPE_FIXED64 = 6; + TYPE_FIXED32 = 7; + TYPE_BOOL = 8; + TYPE_STRING = 9; + TYPE_GROUP = 10; // Tag-delimited aggregate. + TYPE_MESSAGE = 11; // Length-delimited aggregate. + + // New in version 2. + TYPE_BYTES = 12; + TYPE_UINT32 = 13; + TYPE_ENUM = 14; + TYPE_SFIXED32 = 15; + TYPE_SFIXED64 = 16; + TYPE_SINT32 = 17; // Uses ZigZag encoding. + TYPE_SINT64 = 18; // Uses ZigZag encoding. + }; + + enum Label { + // 0 is reserved for errors + LABEL_OPTIONAL = 1; + LABEL_REQUIRED = 2; + LABEL_REPEATED = 3; + // TODO(sanjay): Should we add LABEL_MAP? + }; + + optional string name = 1; + optional int32 number = 3; + optional Label label = 4; + + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be either TYPE_ENUM or TYPE_MESSAGE. + optional Type type = 5; + + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + optional string type_name = 6; + + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + optional string extendee = 2; + + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + optional string default_value = 7; + + optional FieldOptions options = 8; +} + +// Describes an enum type. +message EnumDescriptorProto { + optional string name = 1; + + repeated EnumValueDescriptorProto value = 2; + + optional EnumOptions options = 3; +} + +// Describes a value within an enum. +message EnumValueDescriptorProto { + optional string name = 1; + optional int32 number = 2; + + optional EnumValueOptions options = 3; +} + +// Describes a service. +message ServiceDescriptorProto { + optional string name = 1; + repeated MethodDescriptorProto method = 2; + + optional ServiceOptions options = 3; +} + +// Describes a method of a service. +message MethodDescriptorProto { + optional string name = 1; + + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + optional string input_type = 2; + optional string output_type = 3; + + optional MethodOptions options = 4; +} + +// =================================================================== +// Options + +// Each of the definitions above may have "options" attached. These are +// just annotations which may cause code to be generated slightly differently +// or may contain hints for code that manipulates protocol messages. +// +// Clients may define custom options as extensions of the *Options messages. +// These extensions may not yet be known at parsing time, so the parser cannot +// store the values in them. Instead it stores them in a field in the *Options +// message called uninterpreted_option. This field must have the same name +// across all *Options messages. We then use this field to populate the +// extensions when we build a descriptor, at which point all protos have been +// parsed and so all extensions are known. +// +// Extension numbers for custom options may be chosen as follows: +// * For options which will only be used within a single application or +// organization, or for experimental options, use field numbers 50000 +// through 99999. It is up to you to ensure that you do not use the +// same number for multiple options. +// * For options which will be published and used publicly by multiple +// independent entities, e-mail kenton@google.com to reserve extension +// numbers. Simply tell me how many you need and I'll send you back a +// set of numbers to use -- there's no need to explain how you intend to +// use them. If this turns out to be popular, a web service will be set up +// to automatically assign option numbers. + + +message FileOptions { + + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + optional string java_package = 1; + + + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + optional string java_outer_classname = 8; + + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + optional bool java_multiple_files = 10 [default=false]; + + // If set true, then the Java code generator will generate equals() and + // hashCode() methods for all messages defined in the .proto file. This is + // purely a speed optimization, as the AbstractMessage base class includes + // reflection-based implementations of these methods. + optional bool java_generate_equals_and_hash = 20 [default=false]; + + // Generated classes can be optimized for speed or code size. + enum OptimizeMode { + SPEED = 1; // Generate complete code for parsing, serialization, + // etc. + CODE_SIZE = 2; // Use ReflectionOps to implement these methods. + LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime. + } + optional OptimizeMode optimize_for = 9 [default=SPEED]; + + + + + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of proto2. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + optional bool cc_generic_services = 16 [default=false]; + optional bool java_generic_services = 17 [default=false]; + optional bool py_generic_services = 18 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MessageOptions { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + optional bool message_set_wire_format = 1 [default=false]; + + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + optional bool no_standard_descriptor_accessor = 2 [default=false]; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message FieldOptions { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + optional CType ctype = 1 [default = STRING]; + enum CType { + // Default mode. + STRING = 0; + + CORD = 1; + + STRING_PIECE = 2; + } + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. + optional bool packed = 2; + + + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + optional bool deprecated = 3 [default=false]; + + // EXPERIMENTAL. DO NOT USE. + // For "map" fields, the name of the field in the enclosed type that + // is the key for this map. For example, suppose we have: + // message Item { + // required string name = 1; + // required string value = 2; + // } + // message Config { + // repeated Item items = 1 [experimental_map_key="name"]; + // } + // In this situation, the map key for Item will be set to "name". + // TODO: Fully-implement this, then remove the "experimental_" prefix. + optional string experimental_map_key = 9; + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumOptions { + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message EnumValueOptions { + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message ServiceOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +message MethodOptions { + + // Note: Field numbers 1 through 32 are reserved for Google's internal RPC + // framework. We apologize for hoarding these numbers to ourselves, but + // we were already using them long before we decided to release Protocol + // Buffers. + + // The parser stores options it doesn't recognize here. See above. + repeated UninterpretedOption uninterpreted_option = 999; + + // Clients can define custom options in extensions of this message. See above. + extensions 1000 to max; +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +message UninterpretedOption { + // The name of the uninterpreted option. Each string represents a segment in + // a dot-separated name. is_extension is true iff a segment represents an + // extension (denoted with parentheses in options specs in .proto files). + // E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + // "foo.(bar.baz).qux". + message NamePart { + required string name_part = 1; + required bool is_extension = 2; + } + repeated NamePart name = 2; + + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + optional string identifier_value = 3; + optional uint64 positive_int_value = 4; + optional int64 negative_int_value = 5; + optional double double_value = 6; + optional bytes string_value = 7; + optional string aggregate_value = 8; +} + +// =================================================================== +// Optional source code info + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +message SourceCodeInfo { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + repeated Location location = 1; + message Location { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + repeated int32 path = 1 [packed=true]; + + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + repeated int32 span = 2 [packed=true]; + + // TODO(kenton): Record comments appearing before and after the + // declaration. + } +} diff --git a/csharp/protos/google/protobuf/unittest.proto b/csharp/protos/google/protobuf/unittest.proto new file mode 100644 index 00000000..7f05cf80 --- /dev/null +++ b/csharp/protos/google/protobuf/unittest.proto @@ -0,0 +1,636 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file we will use for unit testing. + + +// Some generic_services option(s) added automatically. +// See: http://go/proto2-generic-services-default +option cc_generic_services = true; // auto-added +option java_generic_services = true; // auto-added +option py_generic_services = true; // auto-added + +import "google/protobuf/unittest_import.proto"; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +// In test_util.h we do "using namespace unittest = protobuf_unittest". +package protobuf_unittest; + +// Protos optimized for SPEED use a strict superset of the generated code +// of equivalent ones optimized for CODE_SIZE, so we should optimize all our +// tests for speed unless explicitly testing code size optimization. +option optimize_for = SPEED; + +option java_outer_classname = "UnittestProto"; + +// This proto includes every type of field in both singular and repeated +// forms. +message TestAllTypes { + message NestedMessage { + // The field name "b" fails to compile in proto1 because it conflicts with + // a local variable named "b" in one of the generated methods. Doh. + // This file needs to compile in proto1 to test backwards-compatibility. + optional int32 bb = 1; + } + + enum NestedEnum { + FOO = 1; + BAR = 2; + BAZ = 3; + } + + // Singular + optional int32 optional_int32 = 1; + optional int64 optional_int64 = 2; + optional uint32 optional_uint32 = 3; + optional uint64 optional_uint64 = 4; + optional sint32 optional_sint32 = 5; + optional sint64 optional_sint64 = 6; + optional fixed32 optional_fixed32 = 7; + optional fixed64 optional_fixed64 = 8; + optional sfixed32 optional_sfixed32 = 9; + optional sfixed64 optional_sfixed64 = 10; + optional float optional_float = 11; + optional double optional_double = 12; + optional bool optional_bool = 13; + optional string optional_string = 14; + optional bytes optional_bytes = 15; + + optional group OptionalGroup = 16 { + optional int32 a = 17; + } + + optional NestedMessage optional_nested_message = 18; + optional ForeignMessage optional_foreign_message = 19; + optional protobuf_unittest_import.ImportMessage optional_import_message = 20; + + optional NestedEnum optional_nested_enum = 21; + optional ForeignEnum optional_foreign_enum = 22; + optional protobuf_unittest_import.ImportEnum optional_import_enum = 23; + + optional string optional_string_piece = 24 [ctype=STRING_PIECE]; + optional string optional_cord = 25 [ctype=CORD]; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated group RepeatedGroup = 46 { + optional int32 a = 47; + } + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + repeated protobuf_unittest_import.ImportMessage repeated_import_message = 50; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + repeated protobuf_unittest_import.ImportEnum repeated_import_enum = 53; + + repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; + repeated string repeated_cord = 55 [ctype=CORD]; + + // Singular with defaults + optional int32 default_int32 = 61 [default = 41 ]; + optional int64 default_int64 = 62 [default = 42 ]; + optional uint32 default_uint32 = 63 [default = 43 ]; + optional uint64 default_uint64 = 64 [default = 44 ]; + optional sint32 default_sint32 = 65 [default = -45 ]; + optional sint64 default_sint64 = 66 [default = 46 ]; + optional fixed32 default_fixed32 = 67 [default = 47 ]; + optional fixed64 default_fixed64 = 68 [default = 48 ]; + optional sfixed32 default_sfixed32 = 69 [default = 49 ]; + optional sfixed64 default_sfixed64 = 70 [default = -50 ]; + optional float default_float = 71 [default = 51.5 ]; + optional double default_double = 72 [default = 52e3 ]; + optional bool default_bool = 73 [default = true ]; + optional string default_string = 74 [default = "hello"]; + optional bytes default_bytes = 75 [default = "world"]; + + optional NestedEnum default_nested_enum = 81 [default = BAR ]; + optional ForeignEnum default_foreign_enum = 82 [default = FOREIGN_BAR]; + optional protobuf_unittest_import.ImportEnum + default_import_enum = 83 [default = IMPORT_BAR]; + + optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; + optional string default_cord = 85 [ctype=CORD,default="123"]; +} + +message TestDeprecatedFields { + optional int32 deprecated_int32 = 1 [deprecated=true]; +} + +// Define these after TestAllTypes to make sure the compiler can handle +// that. +message ForeignMessage { + optional int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_FOO = 4; + FOREIGN_BAR = 5; + FOREIGN_BAZ = 6; +} + +message TestAllExtensions { + extensions 1 to max; +} + +extend TestAllExtensions { + // Singular + optional int32 optional_int32_extension = 1; + optional int64 optional_int64_extension = 2; + optional uint32 optional_uint32_extension = 3; + optional uint64 optional_uint64_extension = 4; + optional sint32 optional_sint32_extension = 5; + optional sint64 optional_sint64_extension = 6; + optional fixed32 optional_fixed32_extension = 7; + optional fixed64 optional_fixed64_extension = 8; + optional sfixed32 optional_sfixed32_extension = 9; + optional sfixed64 optional_sfixed64_extension = 10; + optional float optional_float_extension = 11; + optional double optional_double_extension = 12; + optional bool optional_bool_extension = 13; + optional string optional_string_extension = 14; + optional bytes optional_bytes_extension = 15; + + optional group OptionalGroup_extension = 16 { + optional int32 a = 17; + } + + optional TestAllTypes.NestedMessage optional_nested_message_extension = 18; + optional ForeignMessage optional_foreign_message_extension = 19; + optional protobuf_unittest_import.ImportMessage + optional_import_message_extension = 20; + + optional TestAllTypes.NestedEnum optional_nested_enum_extension = 21; + optional ForeignEnum optional_foreign_enum_extension = 22; + optional protobuf_unittest_import.ImportEnum + optional_import_enum_extension = 23; + + optional string optional_string_piece_extension = 24 [ctype=STRING_PIECE]; + optional string optional_cord_extension = 25 [ctype=CORD]; + + // Repeated + repeated int32 repeated_int32_extension = 31; + repeated int64 repeated_int64_extension = 32; + repeated uint32 repeated_uint32_extension = 33; + repeated uint64 repeated_uint64_extension = 34; + repeated sint32 repeated_sint32_extension = 35; + repeated sint64 repeated_sint64_extension = 36; + repeated fixed32 repeated_fixed32_extension = 37; + repeated fixed64 repeated_fixed64_extension = 38; + repeated sfixed32 repeated_sfixed32_extension = 39; + repeated sfixed64 repeated_sfixed64_extension = 40; + repeated float repeated_float_extension = 41; + repeated double repeated_double_extension = 42; + repeated bool repeated_bool_extension = 43; + repeated string repeated_string_extension = 44; + repeated bytes repeated_bytes_extension = 45; + + repeated group RepeatedGroup_extension = 46 { + optional int32 a = 47; + } + + repeated TestAllTypes.NestedMessage repeated_nested_message_extension = 48; + repeated ForeignMessage repeated_foreign_message_extension = 49; + repeated protobuf_unittest_import.ImportMessage + repeated_import_message_extension = 50; + + repeated TestAllTypes.NestedEnum repeated_nested_enum_extension = 51; + repeated ForeignEnum repeated_foreign_enum_extension = 52; + repeated protobuf_unittest_import.ImportEnum + repeated_import_enum_extension = 53; + + repeated string repeated_string_piece_extension = 54 [ctype=STRING_PIECE]; + repeated string repeated_cord_extension = 55 [ctype=CORD]; + + // Singular with defaults + optional int32 default_int32_extension = 61 [default = 41 ]; + optional int64 default_int64_extension = 62 [default = 42 ]; + optional uint32 default_uint32_extension = 63 [default = 43 ]; + optional uint64 default_uint64_extension = 64 [default = 44 ]; + optional sint32 default_sint32_extension = 65 [default = -45 ]; + optional sint64 default_sint64_extension = 66 [default = 46 ]; + optional fixed32 default_fixed32_extension = 67 [default = 47 ]; + optional fixed64 default_fixed64_extension = 68 [default = 48 ]; + optional sfixed32 default_sfixed32_extension = 69 [default = 49 ]; + optional sfixed64 default_sfixed64_extension = 70 [default = -50 ]; + optional float default_float_extension = 71 [default = 51.5 ]; + optional double default_double_extension = 72 [default = 52e3 ]; + optional bool default_bool_extension = 73 [default = true ]; + optional string default_string_extension = 74 [default = "hello"]; + optional bytes default_bytes_extension = 75 [default = "world"]; + + optional TestAllTypes.NestedEnum + default_nested_enum_extension = 81 [default = BAR]; + optional ForeignEnum + default_foreign_enum_extension = 82 [default = FOREIGN_BAR]; + optional protobuf_unittest_import.ImportEnum + default_import_enum_extension = 83 [default = IMPORT_BAR]; + + optional string default_string_piece_extension = 84 [ctype=STRING_PIECE, + default="abc"]; + optional string default_cord_extension = 85 [ctype=CORD, default="123"]; +} + +message TestNestedExtension { + extend TestAllExtensions { + // Check for bug where string extensions declared in tested scope did not + // compile. + optional string test = 1002 [default="test"]; + } +} + +// We have separate messages for testing required fields because it's +// annoying to have to fill in required fields in TestProto in order to +// do anything with it. Note that we don't need to test every type of +// required filed because the code output is basically identical to +// optional fields for all types. +message TestRequired { + required int32 a = 1; + optional int32 dummy2 = 2; + required int32 b = 3; + + extend TestAllExtensions { + optional TestRequired single = 1000; + repeated TestRequired multi = 1001; + } + + // Pad the field count to 32 so that we can test that IsInitialized() + // properly checks multiple elements of has_bits_. + optional int32 dummy4 = 4; + optional int32 dummy5 = 5; + optional int32 dummy6 = 6; + optional int32 dummy7 = 7; + optional int32 dummy8 = 8; + optional int32 dummy9 = 9; + optional int32 dummy10 = 10; + optional int32 dummy11 = 11; + optional int32 dummy12 = 12; + optional int32 dummy13 = 13; + optional int32 dummy14 = 14; + optional int32 dummy15 = 15; + optional int32 dummy16 = 16; + optional int32 dummy17 = 17; + optional int32 dummy18 = 18; + optional int32 dummy19 = 19; + optional int32 dummy20 = 20; + optional int32 dummy21 = 21; + optional int32 dummy22 = 22; + optional int32 dummy23 = 23; + optional int32 dummy24 = 24; + optional int32 dummy25 = 25; + optional int32 dummy26 = 26; + optional int32 dummy27 = 27; + optional int32 dummy28 = 28; + optional int32 dummy29 = 29; + optional int32 dummy30 = 30; + optional int32 dummy31 = 31; + optional int32 dummy32 = 32; + + required int32 c = 33; +} + +message TestRequiredForeign { + optional TestRequired optional_message = 1; + repeated TestRequired repeated_message = 2; + optional int32 dummy = 3; +} + +// Test that we can use NestedMessage from outside TestAllTypes. +message TestForeignNested { + optional TestAllTypes.NestedMessage foreign_nested = 1; +} + +// TestEmptyMessage is used to test unknown field support. +message TestEmptyMessage { +} + +// Like above, but declare all field numbers as potential extensions. No +// actual extensions should ever be defined for this type. +message TestEmptyMessageWithExtensions { + extensions 1 to max; +} + +message TestMultipleExtensionRanges { + extensions 42; + extensions 4143 to 4243; + extensions 65536 to max; +} + +// Test that really large tag numbers don't break anything. +message TestReallyLargeTagNumber { + // The largest possible tag number is 2^28 - 1, since the wire format uses + // three bits to communicate wire type. + optional int32 a = 1; + optional int32 bb = 268435455; +} + +message TestRecursiveMessage { + optional TestRecursiveMessage a = 1; + optional int32 i = 2; +} + +// Test that mutual recursion works. +message TestMutualRecursionA { + optional TestMutualRecursionB bb = 1; +} + +message TestMutualRecursionB { + optional TestMutualRecursionA a = 1; + optional int32 optional_int32 = 2; +} + +// Test that groups have disjoint field numbers from their siblings and +// parents. This is NOT possible in proto1; only proto2. When attempting +// to compile with proto1, this will emit an error; so we only include it +// in protobuf_unittest_proto. +message TestDupFieldNumber { // NO_PROTO1 + optional int32 a = 1; // NO_PROTO1 + optional group Foo = 2 { optional int32 a = 1; } // NO_PROTO1 + optional group Bar = 3 { optional int32 a = 1; } // NO_PROTO1 +} // NO_PROTO1 + + +// Needed for a Python test. +message TestNestedMessageHasBits { + message NestedMessage { + repeated int32 nestedmessage_repeated_int32 = 1; + repeated ForeignMessage nestedmessage_repeated_foreignmessage = 2; + } + optional NestedMessage optional_nested_message = 1; +} + + +// Test an enum that has multiple values with the same number. +enum TestEnumWithDupValue { + FOO1 = 1; + BAR1 = 2; + BAZ = 3; + FOO2 = 1; + BAR2 = 2; +} + +// Test an enum with large, unordered values. +enum TestSparseEnum { + SPARSE_A = 123; + SPARSE_B = 62374; + SPARSE_C = 12589234; + SPARSE_D = -15; + SPARSE_E = -53452; + SPARSE_F = 0; + SPARSE_G = 2; +} + +// Test message with CamelCase field names. This violates Protocol Buffer +// standard style. +message TestCamelCaseFieldNames { + optional int32 PrimitiveField = 1; + optional string StringField = 2; + optional ForeignEnum EnumField = 3; + optional ForeignMessage MessageField = 4; + optional string StringPieceField = 5 [ctype=STRING_PIECE]; + optional string CordField = 6 [ctype=CORD]; + + repeated int32 RepeatedPrimitiveField = 7; + repeated string RepeatedStringField = 8; + repeated ForeignEnum RepeatedEnumField = 9; + repeated ForeignMessage RepeatedMessageField = 10; + repeated string RepeatedStringPieceField = 11 [ctype=STRING_PIECE]; + repeated string RepeatedCordField = 12 [ctype=CORD]; +} + + +// We list fields out of order, to ensure that we're using field number and not +// field index to determine serialization order. +message TestFieldOrderings { + optional string my_string = 11; + extensions 2 to 10; + optional int64 my_int = 1; + extensions 12 to 100; + optional float my_float = 101; +} + + +extend TestFieldOrderings { + optional string my_extension_string = 50; + optional int32 my_extension_int = 5; +} + + +message TestExtremeDefaultValues { + optional bytes escaped_bytes = 1 [default = "\0\001\a\b\f\n\r\t\v\\\'\"\xfe"]; + optional uint32 large_uint32 = 2 [default = 0xFFFFFFFF]; + optional uint64 large_uint64 = 3 [default = 0xFFFFFFFFFFFFFFFF]; + optional int32 small_int32 = 4 [default = -0x7FFFFFFF]; + optional int64 small_int64 = 5 [default = -0x7FFFFFFFFFFFFFFF]; + + // The default value here is UTF-8 for "\u1234". (We could also just type + // the UTF-8 text directly into this text file rather than escape it, but + // lots of people use editors that would be confused by this.) + optional string utf8_string = 6 [default = "\341\210\264"]; + + // Tests for single-precision floating-point values. + optional float zero_float = 7 [default = 0]; + optional float one_float = 8 [default = 1]; + optional float small_float = 9 [default = 1.5]; + optional float negative_one_float = 10 [default = -1]; + optional float negative_float = 11 [default = -1.5]; + // Using exponents + optional float large_float = 12 [default = 2E8]; + optional float small_negative_float = 13 [default = -8e-28]; + + // Text for nonfinite floating-point values. + optional double inf_double = 14 [default = inf]; + optional double neg_inf_double = 15 [default = -inf]; + optional double nan_double = 16 [default = nan]; + optional float inf_float = 17 [default = inf]; + optional float neg_inf_float = 18 [default = -inf]; + optional float nan_float = 19 [default = nan]; + + // Tests for C++ trigraphs. + // Trigraphs should be escaped in C++ generated files, but they should not be + // escaped for other languages. + // Note that in .proto file, "\?" is a valid way to escape ? in string + // literals. + optional string cpp_trigraph = 20 [default = "? \? ?? \?? \??? ??/ ?\?-"]; +} + +message SparseEnumMessage { + optional TestSparseEnum sparse_enum = 1; +} + +// Test String and Bytes: string is for valid UTF-8 strings +message OneString { + optional string data = 1; +} + +message OneBytes { + optional bytes data = 1; +} + +// Test messages for packed fields + +message TestPackedTypes { + repeated int32 packed_int32 = 90 [packed = true]; + repeated int64 packed_int64 = 91 [packed = true]; + repeated uint32 packed_uint32 = 92 [packed = true]; + repeated uint64 packed_uint64 = 93 [packed = true]; + repeated sint32 packed_sint32 = 94 [packed = true]; + repeated sint64 packed_sint64 = 95 [packed = true]; + repeated fixed32 packed_fixed32 = 96 [packed = true]; + repeated fixed64 packed_fixed64 = 97 [packed = true]; + repeated sfixed32 packed_sfixed32 = 98 [packed = true]; + repeated sfixed64 packed_sfixed64 = 99 [packed = true]; + repeated float packed_float = 100 [packed = true]; + repeated double packed_double = 101 [packed = true]; + repeated bool packed_bool = 102 [packed = true]; + repeated ForeignEnum packed_enum = 103 [packed = true]; +} + +// A message with the same fields as TestPackedTypes, but without packing. Used +// to test packed <-> unpacked wire compatibility. +message TestUnpackedTypes { + repeated int32 unpacked_int32 = 90 [packed = false]; + repeated int64 unpacked_int64 = 91 [packed = false]; + repeated uint32 unpacked_uint32 = 92 [packed = false]; + repeated uint64 unpacked_uint64 = 93 [packed = false]; + repeated sint32 unpacked_sint32 = 94 [packed = false]; + repeated sint64 unpacked_sint64 = 95 [packed = false]; + repeated fixed32 unpacked_fixed32 = 96 [packed = false]; + repeated fixed64 unpacked_fixed64 = 97 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 98 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 99 [packed = false]; + repeated float unpacked_float = 100 [packed = false]; + repeated double unpacked_double = 101 [packed = false]; + repeated bool unpacked_bool = 102 [packed = false]; + repeated ForeignEnum unpacked_enum = 103 [packed = false]; +} + +message TestPackedExtensions { + extensions 1 to max; +} + +extend TestPackedExtensions { + repeated int32 packed_int32_extension = 90 [packed = true]; + repeated int64 packed_int64_extension = 91 [packed = true]; + repeated uint32 packed_uint32_extension = 92 [packed = true]; + repeated uint64 packed_uint64_extension = 93 [packed = true]; + repeated sint32 packed_sint32_extension = 94 [packed = true]; + repeated sint64 packed_sint64_extension = 95 [packed = true]; + repeated fixed32 packed_fixed32_extension = 96 [packed = true]; + repeated fixed64 packed_fixed64_extension = 97 [packed = true]; + repeated sfixed32 packed_sfixed32_extension = 98 [packed = true]; + repeated sfixed64 packed_sfixed64_extension = 99 [packed = true]; + repeated float packed_float_extension = 100 [packed = true]; + repeated double packed_double_extension = 101 [packed = true]; + repeated bool packed_bool_extension = 102 [packed = true]; + repeated ForeignEnum packed_enum_extension = 103 [packed = true]; +} + +// Used by ExtensionSetTest/DynamicExtensions. The test actually builds +// a set of extensions to TestAllExtensions dynamically, based on the fields +// of this message type. +message TestDynamicExtensions { + enum DynamicEnumType { + DYNAMIC_FOO = 2200; + DYNAMIC_BAR = 2201; + DYNAMIC_BAZ = 2202; + } + message DynamicMessageType { + optional int32 dynamic_field = 2100; + } + + optional fixed32 scalar_extension = 2000; + optional ForeignEnum enum_extension = 2001; + optional DynamicEnumType dynamic_enum_extension = 2002; + + optional ForeignMessage message_extension = 2003; + optional DynamicMessageType dynamic_message_extension = 2004; + + repeated string repeated_extension = 2005; + repeated sint32 packed_extension = 2006 [packed = true]; +} + +message TestRepeatedScalarDifferentTagSizes { + // Parsing repeated fixed size values used to fail. This message needs to be + // used in order to get a tag of the right size; all of the repeated fields + // in TestAllTypes didn't trigger the check. + repeated fixed32 repeated_fixed32 = 12; + // Check for a varint type, just for good measure. + repeated int32 repeated_int32 = 13; + + // These have two-byte tags. + repeated fixed64 repeated_fixed64 = 2046; + repeated int64 repeated_int64 = 2047; + + // Three byte tags. + repeated float repeated_float = 262142; + repeated uint64 repeated_uint64 = 262143; +} + + +// Test that RPC services work. +message FooRequest {} +message FooResponse {} + +service TestService { + rpc Foo(FooRequest) returns (FooResponse); + rpc Bar(BarRequest) returns (BarResponse); +} + + +message BarRequest {} +message BarResponse {} diff --git a/csharp/protos/google/protobuf/unittest_csharp_options.proto b/csharp/protos/google/protobuf/unittest_csharp_options.proto new file mode 100644 index 00000000..37693292 --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_csharp_options.proto @@ -0,0 +1,52 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: jonskeet@google.com (Jon Skeet) +// +// A proto file for unit testing the custom C# options + +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestCSharpOptionsProtoFile"; +//option (google.protobuf.csharp_file_options).nest_classes = true; + +package protobuf_unittest; + +message OptionsMessage { + + // Will be left as Normal + optional string normal = 1; + + // Will be converted to OptionsMessage_ + optional string options_message = 2; + + // Will be converted to CustomName + optional string customized = 3 [(google.protobuf.csharp_field_options).property_name = "CustomName"]; +} diff --git a/csharp/protos/google/protobuf/unittest_custom_options.proto b/csharp/protos/google/protobuf/unittest_custom_options.proto new file mode 100644 index 00000000..201fb32a --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_custom_options.proto @@ -0,0 +1,372 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestCustomOptionsProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: benjy@google.com (Benjy Weinberger) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file used to test the "custom options" feature of proto2. + + +// Some generic_services option(s) added automatically. +// See: http://go/proto2-generic-services-default +option cc_generic_services = true; // auto-added +option java_generic_services = true; // auto-added +option py_generic_services = true; + +// A custom file option (defined below). +option (file_opt1) = 9876543210; + +import "google/protobuf/descriptor.proto"; + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +package protobuf_unittest; + + +// Some simple test custom options of various types. + +extend google.protobuf.FileOptions { + optional uint64 file_opt1 = 7736974; +} + +extend google.protobuf.MessageOptions { + optional int32 message_opt1 = 7739036; +} + +extend google.protobuf.FieldOptions { + optional fixed64 field_opt1 = 7740936; + // This is useful for testing that we correctly register default values for + // extension options. + optional int32 field_opt2 = 7753913 [default=42]; +} + +extend google.protobuf.EnumOptions { + optional sfixed32 enum_opt1 = 7753576; +} + +extend google.protobuf.EnumValueOptions { + optional int32 enum_value_opt1 = 1560678; +} + +extend google.protobuf.ServiceOptions { + optional sint64 service_opt1 = 7887650; +} + +enum MethodOpt1 { + METHODOPT1_VAL1 = 1; + METHODOPT1_VAL2 = 2; +} + +extend google.protobuf.MethodOptions { + optional MethodOpt1 method_opt1 = 7890860; +} + +// A test message with custom options at all possible locations (and also some +// regular options, to make sure they interact nicely). +message TestMessageWithCustomOptions { + option message_set_wire_format = false; + + option (message_opt1) = -56; + + optional string field1 = 1 [ctype=CORD, + (field_opt1)=8765432109]; + + enum AnEnum { + option (enum_opt1) = -789; + + ANENUM_VAL1 = 1; + ANENUM_VAL2 = 2 [(enum_value_opt1) = 123]; + } +} + + +// A test RPC service with custom options at all possible locations (and also +// some regular options, to make sure they interact nicely). +message CustomOptionFooRequest { +} + +message CustomOptionFooResponse { +} + +service TestServiceWithCustomOptions { + option (service_opt1) = -9876543210; + + rpc Foo(CustomOptionFooRequest) returns (CustomOptionFooResponse) { + option (method_opt1) = METHODOPT1_VAL2; + } +} + + + +// Options of every possible field type, so we can test them all exhaustively. + +message DummyMessageContainingEnum { + enum TestEnumType { + TEST_OPTION_ENUM_TYPE1 = 22; + TEST_OPTION_ENUM_TYPE2 = -23; + } +} + +message DummyMessageInvalidAsOptionType { +} + +extend google.protobuf.MessageOptions { + optional bool bool_opt = 7706090; + optional int32 int32_opt = 7705709; + optional int64 int64_opt = 7705542; + optional uint32 uint32_opt = 7704880; + optional uint64 uint64_opt = 7702367; + optional sint32 sint32_opt = 7701568; + optional sint64 sint64_opt = 7700863; + optional fixed32 fixed32_opt = 7700307; + optional fixed64 fixed64_opt = 7700194; + optional sfixed32 sfixed32_opt = 7698645; + optional sfixed64 sfixed64_opt = 7685475; + optional float float_opt = 7675390; + optional double double_opt = 7673293; + optional string string_opt = 7673285; + optional bytes bytes_opt = 7673238; + optional DummyMessageContainingEnum.TestEnumType enum_opt = 7673233; + optional DummyMessageInvalidAsOptionType message_type_opt = 7665967; +} + +message CustomOptionMinIntegerValues { + option (bool_opt) = false; + option (int32_opt) = -0x80000000; + option (int64_opt) = -0x8000000000000000; + option (uint32_opt) = 0; + option (uint64_opt) = 0; + option (sint32_opt) = -0x80000000; + option (sint64_opt) = -0x8000000000000000; + option (fixed32_opt) = 0; + option (fixed64_opt) = 0; + option (sfixed32_opt) = -0x80000000; + option (sfixed64_opt) = -0x8000000000000000; +} + +message CustomOptionMaxIntegerValues { + option (bool_opt) = true; + option (int32_opt) = 0x7FFFFFFF; + option (int64_opt) = 0x7FFFFFFFFFFFFFFF; + option (uint32_opt) = 0xFFFFFFFF; + option (uint64_opt) = 0xFFFFFFFFFFFFFFFF; + option (sint32_opt) = 0x7FFFFFFF; + option (sint64_opt) = 0x7FFFFFFFFFFFFFFF; + option (fixed32_opt) = 0xFFFFFFFF; + option (fixed64_opt) = 0xFFFFFFFFFFFFFFFF; + option (sfixed32_opt) = 0x7FFFFFFF; + option (sfixed64_opt) = 0x7FFFFFFFFFFFFFFF; +} + +message CustomOptionOtherValues { + option (int32_opt) = -100; // To test sign-extension. + option (float_opt) = 12.3456789; + option (double_opt) = 1.234567890123456789; + option (string_opt) = "Hello, \"World\""; + option (bytes_opt) = "Hello\0World"; + option (enum_opt) = TEST_OPTION_ENUM_TYPE2; +} + +message SettingRealsFromPositiveInts { + option (float_opt) = 12; + option (double_opt) = 154; +} + +message SettingRealsFromNegativeInts { + option (float_opt) = -12; + option (double_opt) = -154; +} + +// Options of complex message types, themselves combined and extended in +// various ways. + +message ComplexOptionType1 { + optional int32 foo = 1; + optional int32 foo2 = 2; + optional int32 foo3 = 3; + + extensions 100 to max; +} + +message ComplexOptionType2 { + optional ComplexOptionType1 bar = 1; + optional int32 baz = 2; + + message ComplexOptionType4 { + optional int32 waldo = 1; + + extend google.protobuf.MessageOptions { + optional ComplexOptionType4 complex_opt4 = 7633546; + } + } + + optional ComplexOptionType4 fred = 3; + + extensions 100 to max; +} + +message ComplexOptionType3 { + optional int32 qux = 1; + + optional group ComplexOptionType5 = 2 { + optional int32 plugh = 3; + } +} + +extend ComplexOptionType1 { + optional int32 quux = 7663707; + optional ComplexOptionType3 corge = 7663442; +} + +extend ComplexOptionType2 { + optional int32 grault = 7650927; + optional ComplexOptionType1 garply = 7649992; +} + +extend google.protobuf.MessageOptions { + optional protobuf_unittest.ComplexOptionType1 complex_opt1 = 7646756; + optional ComplexOptionType2 complex_opt2 = 7636949; + optional ComplexOptionType3 complex_opt3 = 7636463; + optional group ComplexOpt6 = 7595468 { + optional int32 xyzzy = 7593951; + } +} + +// Note that we try various different ways of naming the same extension. +message VariousComplexOptions { + option (.protobuf_unittest.complex_opt1).foo = 42; + option (protobuf_unittest.complex_opt1).(.protobuf_unittest.quux) = 324; + option (.protobuf_unittest.complex_opt1).(protobuf_unittest.corge).qux = 876; + option (complex_opt2).baz = 987; + option (complex_opt2).(grault) = 654; + option (complex_opt2).bar.foo = 743; + option (complex_opt2).bar.(quux) = 1999; + option (complex_opt2).bar.(protobuf_unittest.corge).qux = 2008; + option (complex_opt2).(garply).foo = 741; + option (complex_opt2).(garply).(.protobuf_unittest.quux) = 1998; + option (complex_opt2).(protobuf_unittest.garply).(corge).qux = 2121; + option (ComplexOptionType2.ComplexOptionType4.complex_opt4).waldo = 1971; + option (complex_opt2).fred.waldo = 321; + option (protobuf_unittest.complex_opt3).qux = 9; + option (complex_opt3).complexoptiontype5.plugh = 22; + option (complexopt6).xyzzy = 24; +} + +// ------------------------------------------------------ +// Definitions for testing aggregate option parsing. +// See descriptor_unittest.cc. + +message AggregateMessageSet { + option message_set_wire_format = true; + extensions 4 to max; +} + +message AggregateMessageSetElement { + extend AggregateMessageSet { + optional AggregateMessageSetElement message_set_extension = 15447542; + } + optional string s = 1; +} + +// A helper type used to test aggregate option parsing +message Aggregate { + optional int32 i = 1; + optional string s = 2; + + // A nested object + optional Aggregate sub = 3; + + // To test the parsing of extensions inside aggregate values + optional google.protobuf.FileOptions file = 4; + extend google.protobuf.FileOptions { + optional Aggregate nested = 15476903; + } + + // An embedded message set + optional AggregateMessageSet mset = 5; +} + +// Allow Aggregate to be used as an option at all possible locations +// in the .proto grammer. +extend google.protobuf.FileOptions { optional Aggregate fileopt = 15478479; } +extend google.protobuf.MessageOptions { optional Aggregate msgopt = 15480088; } +extend google.protobuf.FieldOptions { optional Aggregate fieldopt = 15481374; } +extend google.protobuf.EnumOptions { optional Aggregate enumopt_renamed = 15483218; } +extend google.protobuf.EnumValueOptions { optional Aggregate enumvalopt = 15486921; } +extend google.protobuf.ServiceOptions { optional Aggregate serviceopt = 15497145; } +extend google.protobuf.MethodOptions { optional Aggregate methodopt = 15512713; } + +// Try using AggregateOption at different points in the proto grammar +option (fileopt) = { + s: 'FileAnnotation' + // Also test the handling of comments + /* of both types */ i: 100 + + sub { s: 'NestedFileAnnotation' } + + // Include a google.protobuf.FileOptions and recursively extend it with + // another fileopt. + file { + [protobuf_unittest.fileopt] { + s:'FileExtensionAnnotation' + } + } + + // A message set inside an option value + mset { + [protobuf_unittest.AggregateMessageSetElement.message_set_extension] { + s: 'EmbeddedMessageSetElement' + } + } +}; + +message AggregateMessage { + option (msgopt) = { i:101 s:'MessageAnnotation' }; + optional int32 fieldname = 1 [(fieldopt) = { s:'FieldAnnotation' }]; +} + +service AggregateService { + option (serviceopt) = { s:'ServiceAnnotation' }; + rpc Method (AggregateMessage) returns (AggregateMessage) { + option (methodopt) = { s:'MethodAnnotation' }; + } +} + +enum AggregateEnum { + option (enumopt_renamed) = { s:'EnumAnnotation' }; + VALUE = 1 [(enumvalopt) = { s:'EnumValueAnnotation' }]; +} diff --git a/csharp/protos/google/protobuf/unittest_embed_optimize_for.proto b/csharp/protos/google/protobuf/unittest_embed_optimize_for.proto new file mode 100644 index 00000000..56255385 --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_embed_optimize_for.proto @@ -0,0 +1,56 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestEmbedOptimizeForProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file which imports a proto file that uses optimize_for = CODE_SIZE. + +import "google/protobuf/unittest_optimize_for.proto"; + +package protobuf_unittest; + +// We optimize for speed here, but we are importing a proto that is optimized +// for code size. +option optimize_for = SPEED; + +message TestEmbedOptimizedForSize { + // Test that embedding a message which has optimize_for = CODE_SIZE into + // one optimized for speed works. + optional TestOptimizedForSize optional_message = 1; + repeated TestOptimizedForSize repeated_message = 2; +} diff --git a/csharp/protos/google/protobuf/unittest_empty.proto b/csharp/protos/google/protobuf/unittest_empty.proto new file mode 100644 index 00000000..f6b532a8 --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_empty.proto @@ -0,0 +1,43 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestEmptyProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// This file intentionally left blank. (At one point this wouldn't compile +// correctly.) + diff --git a/csharp/protos/google/protobuf/unittest_enormous_descriptor.proto b/csharp/protos/google/protobuf/unittest_enormous_descriptor.proto new file mode 100644 index 00000000..fa97778e --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_enormous_descriptor.proto @@ -0,0 +1,1052 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestEnormousDescriptorProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file that has an extremely large descriptor. Used to test that +// descriptors over 64k don't break the string literal length limit in Java. + + +package google.protobuf; +option java_package = "com.google.protobuf"; + +// Avoid generating insanely long methods. +option optimize_for = CODE_SIZE; + +message TestEnormousDescriptor { + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1 = 1 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_2 = 2 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_3 = 3 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_4 = 4 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_5 = 5 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_6 = 6 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_7 = 7 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_8 = 8 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_9 = 9 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_10 = 10 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_11 = 11 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_12 = 12 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_13 = 13 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_14 = 14 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_15 = 15 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_16 = 16 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_17 = 17 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_18 = 18 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_19 = 19 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_20 = 20 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_21 = 21 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_22 = 22 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_23 = 23 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_24 = 24 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_25 = 25 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_26 = 26 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_27 = 27 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_28 = 28 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_29 = 29 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_30 = 30 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_31 = 31 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_32 = 32 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_33 = 33 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_34 = 34 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_35 = 35 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_36 = 36 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_37 = 37 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_38 = 38 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_39 = 39 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_40 = 40 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_41 = 41 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_42 = 42 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_43 = 43 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_44 = 44 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_45 = 45 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_46 = 46 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_47 = 47 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_48 = 48 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_49 = 49 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_50 = 50 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_51 = 51 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_52 = 52 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_53 = 53 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_54 = 54 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_55 = 55 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_56 = 56 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_57 = 57 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_58 = 58 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_59 = 59 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_60 = 60 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_61 = 61 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_62 = 62 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_63 = 63 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_64 = 64 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_65 = 65 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_66 = 66 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_67 = 67 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_68 = 68 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_69 = 69 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_70 = 70 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_71 = 71 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_72 = 72 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_73 = 73 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_74 = 74 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_75 = 75 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_76 = 76 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_77 = 77 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_78 = 78 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_79 = 79 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_80 = 80 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_81 = 81 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_82 = 82 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_83 = 83 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_84 = 84 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_85 = 85 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_86 = 86 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_87 = 87 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_88 = 88 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_89 = 89 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_90 = 90 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_91 = 91 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_92 = 92 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_93 = 93 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_94 = 94 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_95 = 95 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_96 = 96 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_97 = 97 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_98 = 98 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_99 = 99 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_100 = 100 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_101 = 101 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_102 = 102 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_103 = 103 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_104 = 104 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_105 = 105 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_106 = 106 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_107 = 107 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_108 = 108 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_109 = 109 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_110 = 110 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_111 = 111 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_112 = 112 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_113 = 113 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_114 = 114 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_115 = 115 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_116 = 116 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_117 = 117 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_118 = 118 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_119 = 119 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_120 = 120 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_121 = 121 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_122 = 122 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_123 = 123 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_124 = 124 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_125 = 125 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_126 = 126 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_127 = 127 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_128 = 128 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_129 = 129 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_130 = 130 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_131 = 131 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_132 = 132 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_133 = 133 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_134 = 134 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_135 = 135 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_136 = 136 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_137 = 137 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_138 = 138 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_139 = 139 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_140 = 140 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_141 = 141 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_142 = 142 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_143 = 143 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_144 = 144 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_145 = 145 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_146 = 146 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_147 = 147 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_148 = 148 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_149 = 149 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_150 = 150 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_151 = 151 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_152 = 152 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_153 = 153 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_154 = 154 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_155 = 155 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_156 = 156 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_157 = 157 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_158 = 158 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_159 = 159 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_160 = 160 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_161 = 161 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_162 = 162 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_163 = 163 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_164 = 164 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_165 = 165 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_166 = 166 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_167 = 167 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_168 = 168 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_169 = 169 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_170 = 170 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_171 = 171 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_172 = 172 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_173 = 173 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_174 = 174 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_175 = 175 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_176 = 176 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_177 = 177 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_178 = 178 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_179 = 179 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_180 = 180 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_181 = 181 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_182 = 182 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_183 = 183 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_184 = 184 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_185 = 185 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_186 = 186 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_187 = 187 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_188 = 188 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_189 = 189 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_190 = 190 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_191 = 191 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_192 = 192 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_193 = 193 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_194 = 194 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_195 = 195 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_196 = 196 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_197 = 197 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_198 = 198 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_199 = 199 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_200 = 200 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_201 = 201 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_202 = 202 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_203 = 203 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_204 = 204 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_205 = 205 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_206 = 206 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_207 = 207 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_208 = 208 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_209 = 209 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_210 = 210 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_211 = 211 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_212 = 212 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_213 = 213 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_214 = 214 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_215 = 215 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_216 = 216 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_217 = 217 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_218 = 218 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_219 = 219 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_220 = 220 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_221 = 221 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_222 = 222 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_223 = 223 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_224 = 224 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_225 = 225 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_226 = 226 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_227 = 227 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_228 = 228 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_229 = 229 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_230 = 230 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_231 = 231 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_232 = 232 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_233 = 233 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_234 = 234 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_235 = 235 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_236 = 236 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_237 = 237 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_238 = 238 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_239 = 239 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_240 = 240 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_241 = 241 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_242 = 242 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_243 = 243 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_244 = 244 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_245 = 245 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_246 = 246 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_247 = 247 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_248 = 248 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_249 = 249 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_250 = 250 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_251 = 251 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_252 = 252 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_253 = 253 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_254 = 254 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_255 = 255 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_256 = 256 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_257 = 257 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_258 = 258 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_259 = 259 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_260 = 260 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_261 = 261 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_262 = 262 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_263 = 263 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_264 = 264 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_265 = 265 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_266 = 266 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_267 = 267 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_268 = 268 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_269 = 269 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_270 = 270 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_271 = 271 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_272 = 272 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_273 = 273 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_274 = 274 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_275 = 275 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_276 = 276 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_277 = 277 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_278 = 278 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_279 = 279 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_280 = 280 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_281 = 281 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_282 = 282 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_283 = 283 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_284 = 284 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_285 = 285 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_286 = 286 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_287 = 287 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_288 = 288 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_289 = 289 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_290 = 290 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_291 = 291 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_292 = 292 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_293 = 293 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_294 = 294 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_295 = 295 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_296 = 296 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_297 = 297 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_298 = 298 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_299 = 299 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_300 = 300 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_301 = 301 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_302 = 302 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_303 = 303 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_304 = 304 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_305 = 305 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_306 = 306 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_307 = 307 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_308 = 308 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_309 = 309 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_310 = 310 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_311 = 311 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_312 = 312 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_313 = 313 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_314 = 314 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_315 = 315 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_316 = 316 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_317 = 317 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_318 = 318 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_319 = 319 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_320 = 320 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_321 = 321 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_322 = 322 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_323 = 323 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_324 = 324 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_325 = 325 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_326 = 326 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_327 = 327 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_328 = 328 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_329 = 329 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_330 = 330 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_331 = 331 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_332 = 332 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_333 = 333 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_334 = 334 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_335 = 335 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_336 = 336 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_337 = 337 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_338 = 338 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_339 = 339 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_340 = 340 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_341 = 341 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_342 = 342 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_343 = 343 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_344 = 344 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_345 = 345 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_346 = 346 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_347 = 347 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_348 = 348 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_349 = 349 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_350 = 350 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_351 = 351 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_352 = 352 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_353 = 353 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_354 = 354 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_355 = 355 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_356 = 356 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_357 = 357 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_358 = 358 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_359 = 359 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_360 = 360 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_361 = 361 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_362 = 362 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_363 = 363 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_364 = 364 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_365 = 365 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_366 = 366 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_367 = 367 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_368 = 368 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_369 = 369 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_370 = 370 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_371 = 371 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_372 = 372 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_373 = 373 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_374 = 374 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_375 = 375 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_376 = 376 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_377 = 377 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_378 = 378 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_379 = 379 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_380 = 380 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_381 = 381 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_382 = 382 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_383 = 383 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_384 = 384 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_385 = 385 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_386 = 386 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_387 = 387 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_388 = 388 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_389 = 389 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_390 = 390 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_391 = 391 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_392 = 392 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_393 = 393 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_394 = 394 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_395 = 395 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_396 = 396 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_397 = 397 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_398 = 398 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_399 = 399 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_400 = 400 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_401 = 401 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_402 = 402 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_403 = 403 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_404 = 404 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_405 = 405 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_406 = 406 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_407 = 407 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_408 = 408 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_409 = 409 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_410 = 410 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_411 = 411 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_412 = 412 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_413 = 413 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_414 = 414 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_415 = 415 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_416 = 416 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_417 = 417 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_418 = 418 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_419 = 419 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_420 = 420 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_421 = 421 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_422 = 422 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_423 = 423 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_424 = 424 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_425 = 425 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_426 = 426 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_427 = 427 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_428 = 428 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_429 = 429 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_430 = 430 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_431 = 431 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_432 = 432 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_433 = 433 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_434 = 434 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_435 = 435 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_436 = 436 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_437 = 437 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_438 = 438 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_439 = 439 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_440 = 440 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_441 = 441 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_442 = 442 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_443 = 443 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_444 = 444 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_445 = 445 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_446 = 446 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_447 = 447 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_448 = 448 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_449 = 449 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_450 = 450 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_451 = 451 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_452 = 452 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_453 = 453 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_454 = 454 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_455 = 455 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_456 = 456 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_457 = 457 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_458 = 458 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_459 = 459 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_460 = 460 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_461 = 461 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_462 = 462 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_463 = 463 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_464 = 464 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_465 = 465 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_466 = 466 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_467 = 467 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_468 = 468 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_469 = 469 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_470 = 470 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_471 = 471 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_472 = 472 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_473 = 473 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_474 = 474 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_475 = 475 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_476 = 476 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_477 = 477 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_478 = 478 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_479 = 479 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_480 = 480 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_481 = 481 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_482 = 482 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_483 = 483 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_484 = 484 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_485 = 485 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_486 = 486 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_487 = 487 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_488 = 488 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_489 = 489 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_490 = 490 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_491 = 491 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_492 = 492 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_493 = 493 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_494 = 494 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_495 = 495 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_496 = 496 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_497 = 497 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_498 = 498 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_499 = 499 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_500 = 500 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_501 = 501 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_502 = 502 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_503 = 503 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_504 = 504 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_505 = 505 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_506 = 506 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_507 = 507 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_508 = 508 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_509 = 509 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_510 = 510 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_511 = 511 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_512 = 512 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_513 = 513 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_514 = 514 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_515 = 515 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_516 = 516 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_517 = 517 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_518 = 518 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_519 = 519 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_520 = 520 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_521 = 521 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_522 = 522 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_523 = 523 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_524 = 524 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_525 = 525 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_526 = 526 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_527 = 527 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_528 = 528 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_529 = 529 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_530 = 530 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_531 = 531 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_532 = 532 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_533 = 533 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_534 = 534 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_535 = 535 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_536 = 536 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_537 = 537 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_538 = 538 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_539 = 539 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_540 = 540 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_541 = 541 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_542 = 542 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_543 = 543 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_544 = 544 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_545 = 545 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_546 = 546 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_547 = 547 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_548 = 548 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_549 = 549 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_550 = 550 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_551 = 551 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_552 = 552 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_553 = 553 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_554 = 554 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_555 = 555 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_556 = 556 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_557 = 557 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_558 = 558 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_559 = 559 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_560 = 560 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_561 = 561 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_562 = 562 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_563 = 563 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_564 = 564 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_565 = 565 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_566 = 566 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_567 = 567 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_568 = 568 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_569 = 569 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_570 = 570 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_571 = 571 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_572 = 572 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_573 = 573 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_574 = 574 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_575 = 575 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_576 = 576 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_577 = 577 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_578 = 578 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_579 = 579 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_580 = 580 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_581 = 581 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_582 = 582 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_583 = 583 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_584 = 584 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_585 = 585 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_586 = 586 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_587 = 587 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_588 = 588 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_589 = 589 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_590 = 590 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_591 = 591 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_592 = 592 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_593 = 593 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_594 = 594 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_595 = 595 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_596 = 596 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_597 = 597 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_598 = 598 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_599 = 599 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_600 = 600 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_601 = 601 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_602 = 602 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_603 = 603 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_604 = 604 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_605 = 605 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_606 = 606 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_607 = 607 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_608 = 608 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_609 = 609 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_610 = 610 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_611 = 611 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_612 = 612 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_613 = 613 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_614 = 614 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_615 = 615 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_616 = 616 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_617 = 617 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_618 = 618 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_619 = 619 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_620 = 620 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_621 = 621 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_622 = 622 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_623 = 623 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_624 = 624 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_625 = 625 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_626 = 626 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_627 = 627 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_628 = 628 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_629 = 629 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_630 = 630 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_631 = 631 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_632 = 632 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_633 = 633 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_634 = 634 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_635 = 635 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_636 = 636 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_637 = 637 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_638 = 638 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_639 = 639 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_640 = 640 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_641 = 641 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_642 = 642 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_643 = 643 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_644 = 644 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_645 = 645 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_646 = 646 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_647 = 647 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_648 = 648 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_649 = 649 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_650 = 650 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_651 = 651 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_652 = 652 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_653 = 653 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_654 = 654 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_655 = 655 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_656 = 656 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_657 = 657 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_658 = 658 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_659 = 659 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_660 = 660 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_661 = 661 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_662 = 662 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_663 = 663 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_664 = 664 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_665 = 665 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_666 = 666 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_667 = 667 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_668 = 668 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_669 = 669 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_670 = 670 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_671 = 671 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_672 = 672 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_673 = 673 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_674 = 674 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_675 = 675 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_676 = 676 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_677 = 677 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_678 = 678 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_679 = 679 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_680 = 680 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_681 = 681 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_682 = 682 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_683 = 683 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_684 = 684 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_685 = 685 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_686 = 686 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_687 = 687 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_688 = 688 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_689 = 689 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_690 = 690 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_691 = 691 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_692 = 692 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_693 = 693 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_694 = 694 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_695 = 695 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_696 = 696 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_697 = 697 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_698 = 698 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_699 = 699 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_700 = 700 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_701 = 701 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_702 = 702 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_703 = 703 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_704 = 704 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_705 = 705 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_706 = 706 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_707 = 707 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_708 = 708 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_709 = 709 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_710 = 710 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_711 = 711 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_712 = 712 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_713 = 713 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_714 = 714 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_715 = 715 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_716 = 716 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_717 = 717 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_718 = 718 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_719 = 719 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_720 = 720 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_721 = 721 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_722 = 722 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_723 = 723 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_724 = 724 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_725 = 725 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_726 = 726 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_727 = 727 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_728 = 728 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_729 = 729 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_730 = 730 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_731 = 731 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_732 = 732 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_733 = 733 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_734 = 734 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_735 = 735 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_736 = 736 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_737 = 737 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_738 = 738 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_739 = 739 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_740 = 740 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_741 = 741 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_742 = 742 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_743 = 743 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_744 = 744 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_745 = 745 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_746 = 746 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_747 = 747 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_748 = 748 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_749 = 749 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_750 = 750 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_751 = 751 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_752 = 752 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_753 = 753 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_754 = 754 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_755 = 755 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_756 = 756 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_757 = 757 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_758 = 758 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_759 = 759 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_760 = 760 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_761 = 761 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_762 = 762 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_763 = 763 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_764 = 764 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_765 = 765 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_766 = 766 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_767 = 767 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_768 = 768 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_769 = 769 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_770 = 770 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_771 = 771 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_772 = 772 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_773 = 773 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_774 = 774 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_775 = 775 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_776 = 776 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_777 = 777 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_778 = 778 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_779 = 779 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_780 = 780 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_781 = 781 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_782 = 782 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_783 = 783 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_784 = 784 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_785 = 785 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_786 = 786 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_787 = 787 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_788 = 788 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_789 = 789 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_790 = 790 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_791 = 791 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_792 = 792 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_793 = 793 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_794 = 794 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_795 = 795 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_796 = 796 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_797 = 797 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_798 = 798 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_799 = 799 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_800 = 800 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_801 = 801 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_802 = 802 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_803 = 803 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_804 = 804 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_805 = 805 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_806 = 806 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_807 = 807 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_808 = 808 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_809 = 809 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_810 = 810 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_811 = 811 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_812 = 812 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_813 = 813 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_814 = 814 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_815 = 815 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_816 = 816 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_817 = 817 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_818 = 818 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_819 = 819 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_820 = 820 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_821 = 821 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_822 = 822 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_823 = 823 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_824 = 824 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_825 = 825 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_826 = 826 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_827 = 827 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_828 = 828 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_829 = 829 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_830 = 830 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_831 = 831 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_832 = 832 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_833 = 833 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_834 = 834 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_835 = 835 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_836 = 836 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_837 = 837 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_838 = 838 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_839 = 839 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_840 = 840 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_841 = 841 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_842 = 842 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_843 = 843 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_844 = 844 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_845 = 845 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_846 = 846 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_847 = 847 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_848 = 848 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_849 = 849 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_850 = 850 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_851 = 851 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_852 = 852 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_853 = 853 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_854 = 854 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_855 = 855 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_856 = 856 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_857 = 857 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_858 = 858 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_859 = 859 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_860 = 860 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_861 = 861 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_862 = 862 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_863 = 863 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_864 = 864 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_865 = 865 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_866 = 866 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_867 = 867 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_868 = 868 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_869 = 869 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_870 = 870 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_871 = 871 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_872 = 872 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_873 = 873 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_874 = 874 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_875 = 875 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_876 = 876 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_877 = 877 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_878 = 878 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_879 = 879 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_880 = 880 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_881 = 881 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_882 = 882 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_883 = 883 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_884 = 884 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_885 = 885 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_886 = 886 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_887 = 887 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_888 = 888 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_889 = 889 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_890 = 890 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_891 = 891 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_892 = 892 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_893 = 893 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_894 = 894 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_895 = 895 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_896 = 896 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_897 = 897 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_898 = 898 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_899 = 899 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_900 = 900 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_901 = 901 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_902 = 902 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_903 = 903 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_904 = 904 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_905 = 905 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_906 = 906 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_907 = 907 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_908 = 908 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_909 = 909 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_910 = 910 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_911 = 911 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_912 = 912 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_913 = 913 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_914 = 914 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_915 = 915 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_916 = 916 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_917 = 917 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_918 = 918 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_919 = 919 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_920 = 920 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_921 = 921 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_922 = 922 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_923 = 923 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_924 = 924 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_925 = 925 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_926 = 926 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_927 = 927 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_928 = 928 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_929 = 929 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_930 = 930 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_931 = 931 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_932 = 932 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_933 = 933 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_934 = 934 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_935 = 935 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_936 = 936 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_937 = 937 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_938 = 938 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_939 = 939 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_940 = 940 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_941 = 941 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_942 = 942 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_943 = 943 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_944 = 944 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_945 = 945 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_946 = 946 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_947 = 947 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_948 = 948 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_949 = 949 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_950 = 950 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_951 = 951 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_952 = 952 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_953 = 953 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_954 = 954 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_955 = 955 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_956 = 956 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_957 = 957 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_958 = 958 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_959 = 959 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_960 = 960 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_961 = 961 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_962 = 962 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_963 = 963 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_964 = 964 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_965 = 965 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_966 = 966 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_967 = 967 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_968 = 968 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_969 = 969 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_970 = 970 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_971 = 971 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_972 = 972 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_973 = 973 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_974 = 974 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_975 = 975 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_976 = 976 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_977 = 977 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_978 = 978 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_979 = 979 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_980 = 980 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_981 = 981 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_982 = 982 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_983 = 983 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_984 = 984 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_985 = 985 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_986 = 986 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_987 = 987 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_988 = 988 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_989 = 989 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_990 = 990 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_991 = 991 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_992 = 992 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_993 = 993 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_994 = 994 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_995 = 995 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_996 = 996 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_997 = 997 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_998 = 998 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_999 = 999 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; + optional string long_field_name_is_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_1000 = 1000 [default="long default value is also loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong"]; +} diff --git a/csharp/protos/google/protobuf/unittest_import.proto b/csharp/protos/google/protobuf/unittest_import.proto new file mode 100644 index 00000000..aa68c864 --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_import.proto @@ -0,0 +1,67 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestImportProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file which is imported by unittest.proto to test importing. + + +// We don't put this in a package within proto2 because we need to make sure +// that the generated code doesn't depend on being in the proto2 namespace. +// In test_util.h we do +// "using namespace unittest_import = protobuf_unittest_import". +package protobuf_unittest_import; + +option optimize_for = SPEED; + +// Excercise the java_package option. +option java_package = "com.google.protobuf.test"; + +// Do not set a java_outer_classname here to verify that Proto2 works without +// one. + +message ImportMessage { + optional int32 d = 1; +} + +enum ImportEnum { + IMPORT_FOO = 7; + IMPORT_BAR = 8; + IMPORT_BAZ = 9; +} + diff --git a/csharp/protos/google/protobuf/unittest_import_lite.proto b/csharp/protos/google/protobuf/unittest_import_lite.proto new file mode 100644 index 00000000..d8755d0e --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_import_lite.proto @@ -0,0 +1,55 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestImportLiteProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// +// This is like unittest_import.proto but with optimize_for = LITE_RUNTIME. + +package protobuf_unittest_import; + +option optimize_for = LITE_RUNTIME; + +option java_package = "com.google.protobuf"; + +message ImportMessageLite { + optional int32 d = 1; +} + +enum ImportEnumLite { + IMPORT_LITE_FOO = 7; + IMPORT_LITE_BAR = 8; + IMPORT_LITE_BAZ = 9; +} diff --git a/csharp/protos/google/protobuf/unittest_lite.proto b/csharp/protos/google/protobuf/unittest_lite.proto new file mode 100644 index 00000000..823fa1dd --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_lite.proto @@ -0,0 +1,318 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestLiteProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// +// This is like unittest.proto but with optimize_for = LITE_RUNTIME. + +package protobuf_unittest; + +import "google/protobuf/unittest_import_lite.proto"; + +option optimize_for = LITE_RUNTIME; + +option java_package = "com.google.protobuf"; + +// Same as TestAllTypes but with the lite runtime. +message TestAllTypesLite { + message NestedMessage { + optional int32 bb = 1; + } + + enum NestedEnum { + FOO = 1; + BAR = 2; + BAZ = 3; + } + + // Singular + optional int32 optional_int32 = 1; + optional int64 optional_int64 = 2; + optional uint32 optional_uint32 = 3; + optional uint64 optional_uint64 = 4; + optional sint32 optional_sint32 = 5; + optional sint64 optional_sint64 = 6; + optional fixed32 optional_fixed32 = 7; + optional fixed64 optional_fixed64 = 8; + optional sfixed32 optional_sfixed32 = 9; + optional sfixed64 optional_sfixed64 = 10; + optional float optional_float = 11; + optional double optional_double = 12; + optional bool optional_bool = 13; + optional string optional_string = 14; + optional bytes optional_bytes = 15; + + optional group OptionalGroup = 16 { + optional int32 a = 17; + } + + optional NestedMessage optional_nested_message = 18; + optional ForeignMessageLite optional_foreign_message = 19; + optional protobuf_unittest_import.ImportMessageLite + optional_import_message = 20; + + optional NestedEnum optional_nested_enum = 21; + optional ForeignEnumLite optional_foreign_enum = 22; + optional protobuf_unittest_import.ImportEnumLite optional_import_enum = 23; + + optional string optional_string_piece = 24 [ctype=STRING_PIECE]; + optional string optional_cord = 25 [ctype=CORD]; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated group RepeatedGroup = 46 { + optional int32 a = 47; + } + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessageLite repeated_foreign_message = 49; + repeated protobuf_unittest_import.ImportMessageLite + repeated_import_message = 50; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnumLite repeated_foreign_enum = 52; + repeated protobuf_unittest_import.ImportEnumLite repeated_import_enum = 53; + + repeated string repeated_string_piece = 54 [ctype=STRING_PIECE]; + repeated string repeated_cord = 55 [ctype=CORD]; + + // Singular with defaults + optional int32 default_int32 = 61 [default = 41 ]; + optional int64 default_int64 = 62 [default = 42 ]; + optional uint32 default_uint32 = 63 [default = 43 ]; + optional uint64 default_uint64 = 64 [default = 44 ]; + optional sint32 default_sint32 = 65 [default = -45 ]; + optional sint64 default_sint64 = 66 [default = 46 ]; + optional fixed32 default_fixed32 = 67 [default = 47 ]; + optional fixed64 default_fixed64 = 68 [default = 48 ]; + optional sfixed32 default_sfixed32 = 69 [default = 49 ]; + optional sfixed64 default_sfixed64 = 70 [default = -50 ]; + optional float default_float = 71 [default = 51.5 ]; + optional double default_double = 72 [default = 52e3 ]; + optional bool default_bool = 73 [default = true ]; + optional string default_string = 74 [default = "hello"]; + optional bytes default_bytes = 75 [default = "world"]; + + optional NestedEnum default_nested_enum = 81 [default = BAR]; + optional ForeignEnumLite default_foreign_enum = 82 + [default = FOREIGN_LITE_BAR]; + optional protobuf_unittest_import.ImportEnumLite + default_import_enum = 83 [default = IMPORT_LITE_BAR]; + + optional string default_string_piece = 84 [ctype=STRING_PIECE,default="abc"]; + optional string default_cord = 85 [ctype=CORD,default="123"]; +} + +message ForeignMessageLite { + optional int32 c = 1; +} + +enum ForeignEnumLite { + FOREIGN_LITE_FOO = 4; + FOREIGN_LITE_BAR = 5; + FOREIGN_LITE_BAZ = 6; +} + +message TestPackedTypesLite { + repeated int32 packed_int32 = 90 [packed = true]; + repeated int64 packed_int64 = 91 [packed = true]; + repeated uint32 packed_uint32 = 92 [packed = true]; + repeated uint64 packed_uint64 = 93 [packed = true]; + repeated sint32 packed_sint32 = 94 [packed = true]; + repeated sint64 packed_sint64 = 95 [packed = true]; + repeated fixed32 packed_fixed32 = 96 [packed = true]; + repeated fixed64 packed_fixed64 = 97 [packed = true]; + repeated sfixed32 packed_sfixed32 = 98 [packed = true]; + repeated sfixed64 packed_sfixed64 = 99 [packed = true]; + repeated float packed_float = 100 [packed = true]; + repeated double packed_double = 101 [packed = true]; + repeated bool packed_bool = 102 [packed = true]; + repeated ForeignEnumLite packed_enum = 103 [packed = true]; +} + +message TestAllExtensionsLite { + extensions 1 to max; +} + +extend TestAllExtensionsLite { + // Singular + optional int32 optional_int32_extension_lite = 1; + optional int64 optional_int64_extension_lite = 2; + optional uint32 optional_uint32_extension_lite = 3; + optional uint64 optional_uint64_extension_lite = 4; + optional sint32 optional_sint32_extension_lite = 5; + optional sint64 optional_sint64_extension_lite = 6; + optional fixed32 optional_fixed32_extension_lite = 7; + optional fixed64 optional_fixed64_extension_lite = 8; + optional sfixed32 optional_sfixed32_extension_lite = 9; + optional sfixed64 optional_sfixed64_extension_lite = 10; + optional float optional_float_extension_lite = 11; + optional double optional_double_extension_lite = 12; + optional bool optional_bool_extension_lite = 13; + optional string optional_string_extension_lite = 14; + optional bytes optional_bytes_extension_lite = 15; + + optional group OptionalGroup_extension_lite = 16 { + optional int32 a = 17; + } + + optional TestAllTypesLite.NestedMessage optional_nested_message_extension_lite + = 18; + optional ForeignMessageLite optional_foreign_message_extension_lite = 19; + optional protobuf_unittest_import.ImportMessageLite + optional_import_message_extension_lite = 20; + + optional TestAllTypesLite.NestedEnum optional_nested_enum_extension_lite = 21; + optional ForeignEnumLite optional_foreign_enum_extension_lite = 22; + optional protobuf_unittest_import.ImportEnumLite + optional_import_enum_extension_lite = 23; + + optional string optional_string_piece_extension_lite = 24 + [ctype=STRING_PIECE]; + optional string optional_cord_extension_lite = 25 [ctype=CORD]; + + // Repeated + repeated int32 repeated_int32_extension_lite = 31; + repeated int64 repeated_int64_extension_lite = 32; + repeated uint32 repeated_uint32_extension_lite = 33; + repeated uint64 repeated_uint64_extension_lite = 34; + repeated sint32 repeated_sint32_extension_lite = 35; + repeated sint64 repeated_sint64_extension_lite = 36; + repeated fixed32 repeated_fixed32_extension_lite = 37; + repeated fixed64 repeated_fixed64_extension_lite = 38; + repeated sfixed32 repeated_sfixed32_extension_lite = 39; + repeated sfixed64 repeated_sfixed64_extension_lite = 40; + repeated float repeated_float_extension_lite = 41; + repeated double repeated_double_extension_lite = 42; + repeated bool repeated_bool_extension_lite = 43; + repeated string repeated_string_extension_lite = 44; + repeated bytes repeated_bytes_extension_lite = 45; + + repeated group RepeatedGroup_extension_lite = 46 { + optional int32 a = 47; + } + + repeated TestAllTypesLite.NestedMessage repeated_nested_message_extension_lite + = 48; + repeated ForeignMessageLite repeated_foreign_message_extension_lite = 49; + repeated protobuf_unittest_import.ImportMessageLite + repeated_import_message_extension_lite = 50; + + repeated TestAllTypesLite.NestedEnum repeated_nested_enum_extension_lite = 51; + repeated ForeignEnumLite repeated_foreign_enum_extension_lite = 52; + repeated protobuf_unittest_import.ImportEnumLite + repeated_import_enum_extension_lite = 53; + + repeated string repeated_string_piece_extension_lite = 54 + [ctype=STRING_PIECE]; + repeated string repeated_cord_extension_lite = 55 [ctype=CORD]; + + // Singular with defaults + optional int32 default_int32_extension_lite = 61 [default = 41 ]; + optional int64 default_int64_extension_lite = 62 [default = 42 ]; + optional uint32 default_uint32_extension_lite = 63 [default = 43 ]; + optional uint64 default_uint64_extension_lite = 64 [default = 44 ]; + optional sint32 default_sint32_extension_lite = 65 [default = -45 ]; + optional sint64 default_sint64_extension_lite = 66 [default = 46 ]; + optional fixed32 default_fixed32_extension_lite = 67 [default = 47 ]; + optional fixed64 default_fixed64_extension_lite = 68 [default = 48 ]; + optional sfixed32 default_sfixed32_extension_lite = 69 [default = 49 ]; + optional sfixed64 default_sfixed64_extension_lite = 70 [default = -50 ]; + optional float default_float_extension_lite = 71 [default = 51.5 ]; + optional double default_double_extension_lite = 72 [default = 52e3 ]; + optional bool default_bool_extension_lite = 73 [default = true ]; + optional string default_string_extension_lite = 74 [default = "hello"]; + optional bytes default_bytes_extension_lite = 75 [default = "world"]; + + optional TestAllTypesLite.NestedEnum + default_nested_enum_extension_lite = 81 [default = BAR]; + optional ForeignEnumLite + default_foreign_enum_extension_lite = 82 [default = FOREIGN_LITE_BAR]; + optional protobuf_unittest_import.ImportEnumLite + default_import_enum_extension_lite = 83 [default = IMPORT_LITE_BAR]; + + optional string default_string_piece_extension_lite = 84 [ctype=STRING_PIECE, + default="abc"]; + optional string default_cord_extension_lite = 85 [ctype=CORD, default="123"]; +} + +message TestPackedExtensionsLite { + extensions 1 to max; +} + +extend TestPackedExtensionsLite { + repeated int32 packed_int32_extension_lite = 90 [packed = true]; + repeated int64 packed_int64_extension_lite = 91 [packed = true]; + repeated uint32 packed_uint32_extension_lite = 92 [packed = true]; + repeated uint64 packed_uint64_extension_lite = 93 [packed = true]; + repeated sint32 packed_sint32_extension_lite = 94 [packed = true]; + repeated sint64 packed_sint64_extension_lite = 95 [packed = true]; + repeated fixed32 packed_fixed32_extension_lite = 96 [packed = true]; + repeated fixed64 packed_fixed64_extension_lite = 97 [packed = true]; + repeated sfixed32 packed_sfixed32_extension_lite = 98 [packed = true]; + repeated sfixed64 packed_sfixed64_extension_lite = 99 [packed = true]; + repeated float packed_float_extension_lite = 100 [packed = true]; + repeated double packed_double_extension_lite = 101 [packed = true]; + repeated bool packed_bool_extension_lite = 102 [packed = true]; + repeated ForeignEnumLite packed_enum_extension_lite = 103 [packed = true]; +} + +message TestNestedExtensionLite { + extend TestAllExtensionsLite { + optional int32 nested_extension = 12345; + } +} + +// Test that deprecated fields work. We only verify that they compile (at one +// point this failed). +message TestDeprecatedLite { + optional int32 deprecated_field = 1 [deprecated = true]; +} diff --git a/csharp/protos/google/protobuf/unittest_lite_imports_nonlite.proto b/csharp/protos/google/protobuf/unittest_lite_imports_nonlite.proto new file mode 100644 index 00000000..8f18f4d6 --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_lite_imports_nonlite.proto @@ -0,0 +1,49 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestLiteImportNonLiteProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// +// Tests that a "lite" message can import a regular message. + +package protobuf_unittest; + +import "google/protobuf/unittest.proto"; + +option optimize_for = LITE_RUNTIME; + +message TestLiteImportsNonlite { + optional TestAllTypes message = 1; +} diff --git a/csharp/protos/google/protobuf/unittest_mset.proto b/csharp/protos/google/protobuf/unittest_mset.proto new file mode 100644 index 00000000..8c74ef4b --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_mset.proto @@ -0,0 +1,78 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestMessageSetProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// This file contains messages for testing message_set_wire_format. + +package protobuf_unittest; + +option optimize_for = SPEED; + +// A message with message_set_wire_format. +message TestMessageSet { + option message_set_wire_format = true; + extensions 4 to max; +} + +message TestMessageSetContainer { + optional TestMessageSet message_set = 1; +} + +message TestMessageSetExtension1 { + extend TestMessageSet { + optional TestMessageSetExtension1 message_set_extension = 1545008; + } + optional int32 i = 15; +} + +message TestMessageSetExtension2 { + extend TestMessageSet { + optional TestMessageSetExtension2 message_set_extension = 1547769; + } + optional string str = 25; +} + +// MessageSet wire format is equivalent to this. +message RawMessageSet { + repeated group Item = 1 { + required int32 type_id = 2; + required bytes message = 3; + } +} + diff --git a/csharp/protos/google/protobuf/unittest_no_generic_services.proto b/csharp/protos/google/protobuf/unittest_no_generic_services.proto new file mode 100644 index 00000000..5ab533bf --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_no_generic_services.proto @@ -0,0 +1,58 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos.NoGenericService"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestNoGenericServicesProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) + +package google.protobuf.no_generic_services_test; + +// *_generic_services are false by default. + +message TestMessage { + optional int32 a = 1; + extensions 1000 to max; +} + +enum TestEnum { + FOO = 1; +} + +extend TestMessage { + optional int32 test_extension = 1000; +} + +service TestService { + rpc Foo(TestMessage) returns(TestMessage); +} diff --git a/csharp/protos/google/protobuf/unittest_optimize_for.proto b/csharp/protos/google/protobuf/unittest_optimize_for.proto new file mode 100644 index 00000000..99efad64 --- /dev/null +++ b/csharp/protos/google/protobuf/unittest_optimize_for.proto @@ -0,0 +1,67 @@ +// Additional options required for C# generation. File from copyright +// line onwards is as per original distribution. +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestOptimizeForProtoFile"; + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://code.google.com/p/protobuf/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. +// +// A proto file which uses optimize_for = CODE_SIZE. + +import "google/protobuf/unittest.proto"; + +package protobuf_unittest; + +option optimize_for = CODE_SIZE; + +message TestOptimizedForSize { + optional int32 i = 1; + optional ForeignMessage msg = 19; + + extensions 1000 to max; + + extend TestOptimizedForSize { + optional int32 test_extension = 1234; + optional TestRequiredOptimizedForSize test_extension2 = 1235; + } +} + +message TestRequiredOptimizedForSize { + required int32 x = 1; +} + +message TestOptionalOptimizedForSize { + optional TestRequiredOptimizedForSize o = 1; +} diff --git a/csharp/protos/google/test/google_size.proto b/csharp/protos/google/test/google_size.proto new file mode 100644 index 00000000..2e777df2 --- /dev/null +++ b/csharp/protos/google/test/google_size.proto @@ -0,0 +1,140 @@ +package unittest_google_size; + +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestGoogleSizeProtoFile"; + +option java_outer_classname = "GoogleSize"; +option optimize_for = CODE_SIZE; + +message SizeMessage1 { + required string field1 = 1; + optional string field9 = 9; + optional string field18 = 18; + optional bool field80 = 80 [default=false]; + optional bool field81 = 81 [default=true]; + required int32 field2 = 2; + required int32 field3 = 3; + optional int32 field280 = 280; + optional int32 field6 = 6 [default=0]; + optional int64 field22 = 22; + optional string field4 = 4; + repeated fixed64 field5 = 5; + optional bool field59 = 59 [default=false]; + optional string field7 = 7; + optional int32 field16 = 16; + optional int32 field130 = 130 [default=0]; + optional bool field12 = 12 [default=true]; + optional bool field17 = 17 [default=true]; + optional bool field13 = 13 [default=true]; + optional bool field14 = 14 [default=true]; + optional int32 field104 = 104 [default=0]; + optional int32 field100 = 100 [default=0]; + optional int32 field101 = 101 [default=0]; + optional string field102 = 102; + optional string field103 = 103; + optional int32 field29 = 29 [default=0]; + optional bool field30 = 30 [default=false]; + optional int32 field60 = 60 [default=-1]; + optional int32 field271 = 271 [default=-1]; + optional int32 field272 = 272 [default=-1]; + optional int32 field150 = 150; + optional int32 field23 = 23 [default=0]; + optional bool field24 = 24 [default=false]; + optional int32 field25 = 25 [default=0]; + optional SizeMessage1SubMessage field15 = 15; + optional bool field78 = 78; + optional int32 field67 = 67 [default=0]; + optional int32 field68 = 68; + optional int32 field128 = 128 [default=0]; + optional string field129 = 129 [default="xxxxxxxxxxxxxxxxxxxxx"]; + optional int32 field131 = 131 [default=0]; +} + +message SizeMessage1SubMessage { + optional int32 field1 = 1 [default=0]; + optional int32 field2 = 2 [default=0]; + optional int32 field3 = 3 [default=0]; + optional string field15 = 15; + optional bool field12 = 12 [default=true]; + optional int64 field13 = 13; + optional int64 field14 = 14; + optional int32 field16 = 16; + optional int32 field19 = 19 [default=2]; + optional bool field20 = 20 [default=true]; + optional bool field28 = 28 [default=true]; + optional fixed64 field21 = 21; + optional int32 field22 = 22; + optional bool field23 = 23 [ default=false ]; + optional bool field206 = 206 [default=false]; + optional fixed32 field203 = 203; + optional int32 field204 = 204; + optional string field205 = 205; + optional uint64 field207 = 207; + optional uint64 field300 = 300; +} + +message SizeMessage2 { + optional string field1 = 1; + optional int64 field3 = 3; + optional int64 field4 = 4; + optional int64 field30 = 30; + optional bool field75 = 75 [default=false]; + optional string field6 = 6; + optional bytes field2 = 2; + optional int32 field21 = 21 [default=0]; + optional int32 field71 = 71; + optional float field25 = 25; + optional int32 field109 = 109 [default=0]; + optional int32 field210 = 210 [default=0]; + optional int32 field211 = 211 [default=0]; + optional int32 field212 = 212 [default=0]; + optional int32 field213 = 213 [default=0]; + optional int32 field216 = 216 [default=0]; + optional int32 field217 = 217 [default=0]; + optional int32 field218 = 218 [default=0]; + optional int32 field220 = 220 [default=0]; + optional int32 field221 = 221 [default=0]; + optional float field222 = 222 [default=0.0]; + optional int32 field63 = 63; + + repeated group Group1 = 10 { + required float field11 = 11; + optional float field26 = 26; + optional string field12 = 12; + optional string field13 = 13; + repeated string field14 = 14; + required uint64 field15 = 15; + optional int32 field5 = 5; + optional string field27 = 27; + optional int32 field28 = 28; + optional string field29 = 29; + optional string field16 = 16; + repeated string field22 = 22; + repeated int32 field73 = 73; + optional int32 field20 = 20 [default=0]; + optional string field24 = 24; + optional SizeMessage2GroupedMessage field31 = 31; + } + repeated string field128 = 128; + optional int64 field131 = 131; + repeated string field127 = 127; + optional int32 field129 = 129; + repeated int64 field130 = 130; + optional bool field205 = 205 [default=false]; + optional bool field206 = 206 [default=false]; +} + +message SizeMessage2GroupedMessage { + optional float field1 = 1; + optional float field2 = 2; + optional float field3 = 3 [default=0.0]; + optional bool field4 = 4; + optional bool field5 = 5; + optional bool field6 = 6 [default=true]; + optional bool field7 = 7 [default=false]; + optional float field8 = 8; + optional bool field9 = 9; + optional float field10 = 10; + optional int64 field11 = 11; +} diff --git a/csharp/protos/google/test/google_speed.proto b/csharp/protos/google/test/google_speed.proto new file mode 100644 index 00000000..eef2a07e --- /dev/null +++ b/csharp/protos/google/test/google_speed.proto @@ -0,0 +1,140 @@ +package unittest_google_speed; + +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.TestProtos"; +option (google.protobuf.csharp_file_options).umbrella_classname = "UnitTestGoogleSpeedProtoFile"; + +option java_outer_classname = "GoogleSpeed"; +option optimize_for = SPEED; + +message SpeedMessage1 { + required string field1 = 1; + optional string field9 = 9; + optional string field18 = 18; + optional bool field80 = 80 [default=false]; + optional bool field81 = 81 [default=true]; + required int32 field2 = 2; + required int32 field3 = 3; + optional int32 field280 = 280; + optional int32 field6 = 6 [default=0]; + optional int64 field22 = 22; + optional string field4 = 4; + repeated fixed64 field5 = 5; + optional bool field59 = 59 [default=false]; + optional string field7 = 7; + optional int32 field16 = 16; + optional int32 field130 = 130 [default=0]; + optional bool field12 = 12 [default=true]; + optional bool field17 = 17 [default=true]; + optional bool field13 = 13 [default=true]; + optional bool field14 = 14 [default=true]; + optional int32 field104 = 104 [default=0]; + optional int32 field100 = 100 [default=0]; + optional int32 field101 = 101 [default=0]; + optional string field102 = 102; + optional string field103 = 103; + optional int32 field29 = 29 [default=0]; + optional bool field30 = 30 [default=false]; + optional int32 field60 = 60 [default=-1]; + optional int32 field271 = 271 [default=-1]; + optional int32 field272 = 272 [default=-1]; + optional int32 field150 = 150; + optional int32 field23 = 23 [default=0]; + optional bool field24 = 24 [default=false]; + optional int32 field25 = 25 [default=0]; + optional SpeedMessage1SubMessage field15 = 15; + optional bool field78 = 78; + optional int32 field67 = 67 [default=0]; + optional int32 field68 = 68; + optional int32 field128 = 128 [default=0]; + optional string field129 = 129 [default="xxxxxxxxxxxxxxxxxxxxx"]; + optional int32 field131 = 131 [default=0]; +} + +message SpeedMessage1SubMessage { + optional int32 field1 = 1 [default=0]; + optional int32 field2 = 2 [default=0]; + optional int32 field3 = 3 [default=0]; + optional string field15 = 15; + optional bool field12 = 12 [default=true]; + optional int64 field13 = 13; + optional int64 field14 = 14; + optional int32 field16 = 16; + optional int32 field19 = 19 [default=2]; + optional bool field20 = 20 [default=true]; + optional bool field28 = 28 [default=true]; + optional fixed64 field21 = 21; + optional int32 field22 = 22; + optional bool field23 = 23 [ default=false ]; + optional bool field206 = 206 [default=false]; + optional fixed32 field203 = 203; + optional int32 field204 = 204; + optional string field205 = 205; + optional uint64 field207 = 207; + optional uint64 field300 = 300; +} + +message SpeedMessage2 { + optional string field1 = 1; + optional int64 field3 = 3; + optional int64 field4 = 4; + optional int64 field30 = 30; + optional bool field75 = 75 [default=false]; + optional string field6 = 6; + optional bytes field2 = 2; + optional int32 field21 = 21 [default=0]; + optional int32 field71 = 71; + optional float field25 = 25; + optional int32 field109 = 109 [default=0]; + optional int32 field210 = 210 [default=0]; + optional int32 field211 = 211 [default=0]; + optional int32 field212 = 212 [default=0]; + optional int32 field213 = 213 [default=0]; + optional int32 field216 = 216 [default=0]; + optional int32 field217 = 217 [default=0]; + optional int32 field218 = 218 [default=0]; + optional int32 field220 = 220 [default=0]; + optional int32 field221 = 221 [default=0]; + optional float field222 = 222 [default=0.0]; + optional int32 field63 = 63; + + repeated group Group1 = 10 { + required float field11 = 11; + optional float field26 = 26; + optional string field12 = 12; + optional string field13 = 13; + repeated string field14 = 14; + required uint64 field15 = 15; + optional int32 field5 = 5; + optional string field27 = 27; + optional int32 field28 = 28; + optional string field29 = 29; + optional string field16 = 16; + repeated string field22 = 22; + repeated int32 field73 = 73; + optional int32 field20 = 20 [default=0]; + optional string field24 = 24; + optional SpeedMessage2GroupedMessage field31 = 31; + } + repeated string field128 = 128; + optional int64 field131 = 131; + repeated string field127 = 127; + optional int32 field129 = 129; + repeated int64 field130 = 130; + optional bool field205 = 205 [default=false]; + optional bool field206 = 206 [default=false]; +} + +message SpeedMessage2GroupedMessage { + optional float field1 = 1; + optional float field2 = 2; + optional float field3 = 3 [default=0.0]; + optional bool field4 = 4; + optional bool field5 = 5; + optional bool field6 = 6 [default=true]; + optional bool field7 = 7 [default=false]; + optional float field8 = 8; + optional bool field9 = 9; + optional float field10 = 10; + optional int64 field11 = 11; +} diff --git a/csharp/protos/npp.language.xml b/csharp/protos/npp.language.xml new file mode 100644 index 00000000..c6122180 --- /dev/null +++ b/csharp/protos/npp.language.xml @@ -0,0 +1,44 @@ + + + + + + + + + + [00]00 + { + } + = + 1option 1package 1import 2; 0// + message enum service extend + required optional repeated extensions to rpc returns + double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64 sfixed32 sfixed64 bool string bytes + + + + + + + + + + + + + + + + + + + + diff --git a/csharp/protos/tutorial/addressbook.proto b/csharp/protos/tutorial/addressbook.proto new file mode 100644 index 00000000..5abe35ce --- /dev/null +++ b/csharp/protos/tutorial/addressbook.proto @@ -0,0 +1,31 @@ +package tutorial; + +import "google/protobuf/csharp_options.proto"; +option (google.protobuf.csharp_file_options).namespace = "Google.ProtocolBuffers.Examples.AddressBook"; +option (google.protobuf.csharp_file_options).umbrella_classname = "AddressBookProtos"; + +option optimize_for = SPEED; + +message Person { + required string name = 1; + required int32 id = 2; // Unique ID number for this person. + optional string email = 3; + + enum PhoneType { + MOBILE = 0; + HOME = 1; + WORK = 2; + } + + message PhoneNumber { + required string number = 1; + optional PhoneType type = 2 [default = HOME]; + } + + repeated PhoneNumber phone = 4; +} + +// Our address book file is just one of these. +message AddressBook { + repeated Person person = 1; +} diff --git a/csharp/src/AddressBook/AddPerson.cs b/csharp/src/AddressBook/AddPerson.cs new file mode 100644 index 00000000..462b0c56 --- /dev/null +++ b/csharp/src/AddressBook/AddPerson.cs @@ -0,0 +1,136 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers.Examples.AddressBook +{ + internal class AddPerson + { + /// + /// Builds a person based on user input + /// + private static Person PromptForAddress(TextReader input, TextWriter output) + { + Person.Builder person = Person.CreateBuilder(); + + output.Write("Enter person ID: "); + person.Id = int.Parse(input.ReadLine()); + + output.Write("Enter name: "); + person.Name = input.ReadLine(); + + output.Write("Enter email address (blank for none): "); + string email = input.ReadLine(); + if (email.Length > 0) + { + person.Email = email; + } + + while (true) + { + output.Write("Enter a phone number (or leave blank to finish): "); + string number = input.ReadLine(); + if (number.Length == 0) + { + break; + } + + Person.Types.PhoneNumber.Builder phoneNumber = + Person.Types.PhoneNumber.CreateBuilder().SetNumber(number); + + output.Write("Is this a mobile, home, or work phone? "); + String type = input.ReadLine(); + switch (type) + { + case "mobile": + phoneNumber.Type = Person.Types.PhoneType.MOBILE; + break; + case "home": + phoneNumber.Type = Person.Types.PhoneType.HOME; + break; + case "work": + phoneNumber.Type = Person.Types.PhoneType.WORK; + break; + default: + output.Write("Unknown phone type. Using default."); + break; + } + + person.AddPhone(phoneNumber); + } + return person.Build(); + } + + /// + /// Entry point - loads an existing addressbook or creates a new one, + /// then writes it back to the file. + /// + public static int Main(string[] args) + { + if (args.Length != 1) + { + Console.Error.WriteLine("Usage: AddPerson ADDRESS_BOOK_FILE"); + return -1; + } + + AddressBook.Builder addressBook = AddressBook.CreateBuilder(); + + if (File.Exists(args[0])) + { + using (Stream file = File.OpenRead(args[0])) + { + addressBook.MergeFrom(file); + } + } + else + { + Console.WriteLine("{0}: File not found. Creating a new file.", args[0]); + } + + // Add an address. + addressBook.AddPerson(PromptForAddress(Console.In, Console.Out)); + + // Write the new address book back to disk. + using (Stream output = File.OpenWrite(args[0])) + { + addressBook.Build().WriteTo(output); + } + return 0; + } + } +} \ No newline at end of file diff --git a/csharp/src/AddressBook/AddressBook.csproj b/csharp/src/AddressBook/AddressBook.csproj new file mode 100644 index 00000000..5d27ee7d --- /dev/null +++ b/csharp/src/AddressBook/AddressBook.csproj @@ -0,0 +1,75 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {A31F5FB2-4FF3-432A-B35B-5CD203606311} + Exe + Properties + Google.ProtocolBuffers.Examples.AddressBook + AddressBook + v3.5 + 512 + Google.ProtocolBuffers.Examples.AddressBook.Program + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE + prompt + 4 + true + true + Off + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + \ No newline at end of file diff --git a/csharp/src/AddressBook/AddressBookProtos.cs b/csharp/src/AddressBook/AddressBookProtos.cs new file mode 100644 index 00000000..23276dd5 --- /dev/null +++ b/csharp/src/AddressBook/AddressBookProtos.cs @@ -0,0 +1,1160 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.Examples.AddressBook { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class AddressBookProtos { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_tutorial_Person__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_tutorial_Person_PhoneNumber__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_tutorial_AddressBook__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_tutorial_AddressBook__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static AddressBookProtos() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Chp0dXRvcmlhbC9hZGRyZXNzYm9vay5wcm90bxIIdHV0b3JpYWwaJGdvb2ds", + "ZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90byLaAQoGUGVyc29uEgwK", + "BG5hbWUYASACKAkSCgoCaWQYAiACKAUSDQoFZW1haWwYAyABKAkSKwoFcGhv", + "bmUYBCADKAsyHC50dXRvcmlhbC5QZXJzb24uUGhvbmVOdW1iZXIaTQoLUGhv", + "bmVOdW1iZXISDgoGbnVtYmVyGAEgAigJEi4KBHR5cGUYAiABKA4yGi50dXRv", + "cmlhbC5QZXJzb24uUGhvbmVUeXBlOgRIT01FIisKCVBob25lVHlwZRIKCgZN", + "T0JJTEUQABIICgRIT01FEAESCAoEV09SSxACIi8KC0FkZHJlc3NCb29rEiAK", + "BnBlcnNvbhgBIAMoCzIQLnR1dG9yaWFsLlBlcnNvbkJFSAHCPkAKK0dvb2ds", + "ZS5Qcm90b2NvbEJ1ZmZlcnMuRXhhbXBsZXMuQWRkcmVzc0Jvb2sSEUFkZHJl", + "c3NCb29rUHJvdG9z")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_tutorial_Person__Descriptor = Descriptor.MessageTypes[0]; + internal__static_tutorial_Person__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_tutorial_Person__Descriptor, + new string[] { "Name", "Id", "Email", "Phone", }); + internal__static_tutorial_Person_PhoneNumber__Descriptor = internal__static_tutorial_Person__Descriptor.NestedTypes[0]; + internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_tutorial_Person_PhoneNumber__Descriptor, + new string[] { "Number", "Type", }); + internal__static_tutorial_AddressBook__Descriptor = Descriptor.MessageTypes[1]; + internal__static_tutorial_AddressBook__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_tutorial_AddressBook__Descriptor, + new string[] { "Person", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Person : pb::GeneratedMessage { + private Person() { } + private static readonly Person defaultInstance = new Person().MakeReadOnly(); + private static readonly string[] _personFieldNames = new string[] { "email", "id", "name", "phone" }; + private static readonly uint[] _personFieldTags = new uint[] { 26, 16, 10, 34 }; + public static Person DefaultInstance { + get { return defaultInstance; } + } + + public override Person DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Person ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_Person__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_Person__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum PhoneType { + MOBILE = 0, + HOME = 1, + WORK = 2, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class PhoneNumber : pb::GeneratedMessage { + private PhoneNumber() { } + private static readonly PhoneNumber defaultInstance = new PhoneNumber().MakeReadOnly(); + private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; + private static readonly uint[] _phoneNumberFieldTags = new uint[] { 10, 16 }; + public static PhoneNumber DefaultInstance { + get { return defaultInstance; } + } + + public override PhoneNumber DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override PhoneNumber ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_Person_PhoneNumber__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_Person_PhoneNumber__FieldAccessorTable; } + } + + public const int NumberFieldNumber = 1; + private bool hasNumber; + private string number_ = ""; + public bool HasNumber { + get { return hasNumber; } + } + public string Number { + get { return number_; } + } + + public const int TypeFieldNumber = 2; + private bool hasType; + private global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType type_ = global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME; + public bool HasType { + get { return hasType; } + } + public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType Type { + get { return type_; } + } + + public override bool IsInitialized { + get { + if (!hasNumber) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _phoneNumberFieldNames; + if (hasNumber) { + output.WriteString(1, field_names[0], Number); + } + if (hasType) { + output.WriteEnum(2, field_names[1], (int) Type, Type); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasNumber) { + size += pb::CodedOutputStream.ComputeStringSize(1, Number); + } + if (hasType) { + size += pb::CodedOutputStream.ComputeEnumSize(2, (int) Type); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static PhoneNumber ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static PhoneNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static PhoneNumber ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static PhoneNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static PhoneNumber ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static PhoneNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static PhoneNumber ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static PhoneNumber ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static PhoneNumber ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static PhoneNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private PhoneNumber MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(PhoneNumber prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(PhoneNumber cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private PhoneNumber result; + + private PhoneNumber PrepareBuilder() { + if (resultIsReadOnly) { + PhoneNumber original = result; + result = new PhoneNumber(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override PhoneNumber MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Descriptor; } + } + + public override PhoneNumber DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.DefaultInstance; } + } + + public override PhoneNumber BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is PhoneNumber) { + return MergeFrom((PhoneNumber) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(PhoneNumber other) { + if (other == global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasNumber) { + Number = other.Number; + } + if (other.HasType) { + Type = other.Type; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_phoneNumberFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _phoneNumberFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasNumber = input.ReadString(ref result.number_); + break; + } + case 16: { + object unknown; + if(input.ReadEnum(ref result.type_, out unknown)) { + result.hasType = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(2, (ulong)(int)unknown); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasNumber { + get { return result.hasNumber; } + } + public string Number { + get { return result.Number; } + set { SetNumber(value); } + } + public Builder SetNumber(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasNumber = true; + result.number_ = value; + return this; + } + public Builder ClearNumber() { + PrepareBuilder(); + result.hasNumber = false; + result.number_ = ""; + return this; + } + + public bool HasType { + get { return result.hasType; } + } + public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType Type { + get { return result.Type; } + set { SetType(value); } + } + public Builder SetType(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType value) { + PrepareBuilder(); + result.hasType = true; + result.type_ = value; + return this; + } + public Builder ClearType() { + PrepareBuilder(); + result.hasType = false; + result.type_ = global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneType.HOME; + return this; + } + } + static PhoneNumber() { + object.ReferenceEquals(global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.Descriptor, null); + } + } + + } + #endregion + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int IdFieldNumber = 2; + private bool hasId; + private int id_; + public bool HasId { + get { return hasId; } + } + public int Id { + get { return id_; } + } + + public const int EmailFieldNumber = 3; + private bool hasEmail; + private string email_ = ""; + public bool HasEmail { + get { return hasEmail; } + } + public string Email { + get { return email_; } + } + + public const int PhoneFieldNumber = 4; + private pbc::PopsicleList phone_ = new pbc::PopsicleList(); + public scg::IList PhoneList { + get { return phone_; } + } + public int PhoneCount { + get { return phone_.Count; } + } + public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber GetPhone(int index) { + return phone_[index]; + } + + public override bool IsInitialized { + get { + if (!hasName) return false; + if (!hasId) return false; + foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in PhoneList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _personFieldNames; + if (hasName) { + output.WriteString(1, field_names[2], Name); + } + if (hasId) { + output.WriteInt32(2, field_names[1], Id); + } + if (hasEmail) { + output.WriteString(3, field_names[0], Email); + } + if (phone_.Count > 0) { + output.WriteMessageArray(4, field_names[3], phone_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + if (hasId) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Id); + } + if (hasEmail) { + size += pb::CodedOutputStream.ComputeStringSize(3, Email); + } + foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber element in PhoneList) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Person ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Person ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Person ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Person ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Person ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Person ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Person ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Person ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Person ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Person ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Person MakeReadOnly() { + phone_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Person prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Person cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Person result; + + private Person PrepareBuilder() { + if (resultIsReadOnly) { + Person original = result; + result = new Person(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Person MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.Person.Descriptor; } + } + + public override Person DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.Person.DefaultInstance; } + } + + public override Person BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Person) { + return MergeFrom((Person) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Person other) { + if (other == global::Google.ProtocolBuffers.Examples.AddressBook.Person.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.HasId) { + Id = other.Id; + } + if (other.HasEmail) { + Email = other.Email; + } + if (other.phone_.Count != 0) { + result.phone_.Add(other.phone_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_personFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _personFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 16: { + result.hasId = input.ReadInt32(ref result.id_); + break; + } + case 26: { + result.hasEmail = input.ReadString(ref result.email_); + break; + } + case 34: { + input.ReadMessageArray(tag, field_name, result.phone_, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasId { + get { return result.hasId; } + } + public int Id { + get { return result.Id; } + set { SetId(value); } + } + public Builder SetId(int value) { + PrepareBuilder(); + result.hasId = true; + result.id_ = value; + return this; + } + public Builder ClearId() { + PrepareBuilder(); + result.hasId = false; + result.id_ = 0; + return this; + } + + public bool HasEmail { + get { return result.hasEmail; } + } + public string Email { + get { return result.Email; } + set { SetEmail(value); } + } + public Builder SetEmail(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasEmail = true; + result.email_ = value; + return this; + } + public Builder ClearEmail() { + PrepareBuilder(); + result.hasEmail = false; + result.email_ = ""; + return this; + } + + public pbc::IPopsicleList PhoneList { + get { return PrepareBuilder().phone_; } + } + public int PhoneCount { + get { return result.PhoneCount; } + } + public global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber GetPhone(int index) { + return result.GetPhone(index); + } + public Builder SetPhone(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.phone_[index] = value; + return this; + } + public Builder SetPhone(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.phone_[index] = builderForValue.Build(); + return this; + } + public Builder AddPhone(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.phone_.Add(value); + return this; + } + public Builder AddPhone(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Types.PhoneNumber.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.phone_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangePhone(scg::IEnumerable values) { + PrepareBuilder(); + result.phone_.Add(values); + return this; + } + public Builder ClearPhone() { + PrepareBuilder(); + result.phone_.Clear(); + return this; + } + } + static Person() { + object.ReferenceEquals(global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class AddressBook : pb::GeneratedMessage { + private AddressBook() { } + private static readonly AddressBook defaultInstance = new AddressBook().MakeReadOnly(); + private static readonly string[] _addressBookFieldNames = new string[] { "person" }; + private static readonly uint[] _addressBookFieldTags = new uint[] { 10 }; + public static AddressBook DefaultInstance { + get { return defaultInstance; } + } + + public override AddressBook DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override AddressBook ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_AddressBook__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.internal__static_tutorial_AddressBook__FieldAccessorTable; } + } + + public const int PersonFieldNumber = 1; + private pbc::PopsicleList person_ = new pbc::PopsicleList(); + public scg::IList PersonList { + get { return person_; } + } + public int PersonCount { + get { return person_.Count; } + } + public global::Google.ProtocolBuffers.Examples.AddressBook.Person GetPerson(int index) { + return person_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _addressBookFieldNames; + if (person_.Count > 0) { + output.WriteMessageArray(1, field_names[0], person_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.Examples.AddressBook.Person element in PersonList) { + size += pb::CodedOutputStream.ComputeMessageSize(1, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static AddressBook ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AddressBook ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AddressBook ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AddressBook ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AddressBook ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AddressBook ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static AddressBook ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static AddressBook ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static AddressBook ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AddressBook ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private AddressBook MakeReadOnly() { + person_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(AddressBook prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(AddressBook cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private AddressBook result; + + private AddressBook PrepareBuilder() { + if (resultIsReadOnly) { + AddressBook original = result; + result = new AddressBook(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override AddressBook MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook.Descriptor; } + } + + public override AddressBook DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook.DefaultInstance; } + } + + public override AddressBook BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is AddressBook) { + return MergeFrom((AddressBook) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(AddressBook other) { + if (other == global::Google.ProtocolBuffers.Examples.AddressBook.AddressBook.DefaultInstance) return this; + PrepareBuilder(); + if (other.person_.Count != 0) { + result.person_.Add(other.person_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_addressBookFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _addressBookFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadMessageArray(tag, field_name, result.person_, global::Google.ProtocolBuffers.Examples.AddressBook.Person.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList PersonList { + get { return PrepareBuilder().person_; } + } + public int PersonCount { + get { return result.PersonCount; } + } + public global::Google.ProtocolBuffers.Examples.AddressBook.Person GetPerson(int index) { + return result.GetPerson(index); + } + public Builder SetPerson(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.person_[index] = value; + return this; + } + public Builder SetPerson(int index, global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.person_[index] = builderForValue.Build(); + return this; + } + public Builder AddPerson(global::Google.ProtocolBuffers.Examples.AddressBook.Person value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.person_.Add(value); + return this; + } + public Builder AddPerson(global::Google.ProtocolBuffers.Examples.AddressBook.Person.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.person_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangePerson(scg::IEnumerable values) { + PrepareBuilder(); + result.person_.Add(values); + return this; + } + public Builder ClearPerson() { + PrepareBuilder(); + result.person_.Clear(); + return this; + } + } + static AddressBook() { + object.ReferenceEquals(global::Google.ProtocolBuffers.Examples.AddressBook.AddressBookProtos.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/AddressBook/ListPeople.cs b/csharp/src/AddressBook/ListPeople.cs new file mode 100644 index 00000000..fe6f52d8 --- /dev/null +++ b/csharp/src/AddressBook/ListPeople.cs @@ -0,0 +1,103 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers.Examples.AddressBook +{ + internal class ListPeople + { + /// + /// Iterates though all people in the AddressBook and prints info about them. + /// + private static void Print(AddressBook addressBook) + { + foreach (Person person in addressBook.PersonList) + { + Console.WriteLine("Person ID: {0}", person.Id); + Console.WriteLine(" Name: {0}", person.Name); + if (person.HasEmail) + { + Console.WriteLine(" E-mail address: {0}", person.Email); + } + + foreach (Person.Types.PhoneNumber phoneNumber in person.PhoneList) + { + switch (phoneNumber.Type) + { + case Person.Types.PhoneType.MOBILE: + Console.Write(" Mobile phone #: "); + break; + case Person.Types.PhoneType.HOME: + Console.Write(" Home phone #: "); + break; + case Person.Types.PhoneType.WORK: + Console.Write(" Work phone #: "); + break; + } + Console.WriteLine(phoneNumber.Number); + } + } + } + + /// + /// Entry point - loads the addressbook and then displays it. + /// + public static int Main(string[] args) + { + if (args.Length != 1) + { + Console.Error.WriteLine("Usage: ListPeople ADDRESS_BOOK_FILE"); + return 1; + } + + if (!File.Exists(args[0])) + { + Console.WriteLine("{0} doesn't exist. Add a person to create the file first.", args[0]); + return 0; + } + + // Read the existing address book. + using (Stream stream = File.OpenRead(args[0])) + { + AddressBook addressBook = AddressBook.ParseFrom(stream); + Print(addressBook); + } + return 0; + } + } +} \ No newline at end of file diff --git a/csharp/src/AddressBook/Program.cs b/csharp/src/AddressBook/Program.cs new file mode 100644 index 00000000..e0d6d49b --- /dev/null +++ b/csharp/src/AddressBook/Program.cs @@ -0,0 +1,99 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers.Examples.AddressBook +{ + /// + /// Entry point. Repeatedly prompts user for an action to take, delegating actual behaviour + /// to individual actions. Each action has its own Main method, so that it can be used as an + /// invidual complete program. + /// + internal class Program + { + private static int Main(string[] args) + { + if (args.Length > 1) + { + Console.Error.WriteLine("Usage: AddressBook [file]"); + Console.Error.WriteLine("If the filename isn't specified, \"addressbook.data\" is used instead."); + return 1; + } + string addressBookFile = args.Length > 0 ? args[0] : "addressbook.data"; + + bool stopping = false; + while (!stopping) + { + Console.WriteLine("Options:"); + Console.WriteLine(" L: List contents"); + Console.WriteLine(" A: Add new person"); + Console.WriteLine(" Q: Quit"); + Console.Write("Action? "); + Console.Out.Flush(); + char choice = Console.ReadKey().KeyChar; + Console.WriteLine(); + try + { + switch (choice) + { + case 'A': + case 'a': + AddPerson.Main(new string[] {addressBookFile}); + break; + case 'L': + case 'l': + ListPeople.Main(new string[] {addressBookFile}); + break; + case 'Q': + case 'q': + stopping = true; + break; + default: + Console.WriteLine("Unknown option: {0}", choice); + break; + } + } + catch (Exception e) + { + Console.WriteLine("Exception executing action: {0}", e); + } + Console.WriteLine(); + } + return 0; + } + } +} \ No newline at end of file diff --git a/csharp/src/AddressBook/Properties/AssemblyInfo.cs b/csharp/src/AddressBook/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..e9c40dce --- /dev/null +++ b/csharp/src/AddressBook/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("AddressBook")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AddressBook")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.4.1.555")] + +[assembly: AssemblyVersion("2.4.1.555")] +[assembly: AssemblyFileVersion("2.4.1.555")] \ No newline at end of file diff --git a/csharp/src/AddressBook/SampleUsage.cs b/csharp/src/AddressBook/SampleUsage.cs new file mode 100644 index 00000000..084b1655 --- /dev/null +++ b/csharp/src/AddressBook/SampleUsage.cs @@ -0,0 +1,44 @@ +using System; +using System.IO; + +namespace Google.ProtocolBuffers.Examples.AddressBook +{ + internal class SampleUsage + { + private static void Main() + { + byte[] bytes; + //Create a builder to start building a message + Person.Builder newContact = Person.CreateBuilder(); + //Set the primitive properties + newContact.SetId(1) + .SetName("Foo") + .SetEmail("foo@bar"); + //Now add an item to a list (repeating) field + newContact.AddPhone( + //Create the child message inline + Person.Types.PhoneNumber.CreateBuilder().SetNumber("555-1212").Build() + ); + //Now build the final message: + Person person = newContact.Build(); + //The builder is no longer valid (at least not now, scheduled for 2.4): + newContact = null; + using (MemoryStream stream = new MemoryStream()) + { + //Save the person to a stream + person.WriteTo(stream); + bytes = stream.ToArray(); + } + //Create another builder, merge the byte[], and build the message: + Person copy = Person.CreateBuilder().MergeFrom(bytes).Build(); + + //A more streamlined approach might look like this: + bytes = AddressBook.CreateBuilder().AddPerson(copy).Build().ToByteArray(); + //And read the address book back again + AddressBook restored = AddressBook.CreateBuilder().MergeFrom(bytes).Build(); + //The message performs a deep-comparison on equality: + if (restored.PersonCount != 1 || !person.Equals(restored.PersonList[0])) + throw new ApplicationException("There is a bad person in here!"); + } + } +} \ No newline at end of file diff --git a/csharp/src/AddressBook/app.config b/csharp/src/AddressBook/app.config new file mode 100644 index 00000000..0df7832f --- /dev/null +++ b/csharp/src/AddressBook/app.config @@ -0,0 +1,3 @@ + + + diff --git a/csharp/src/ProtoBench/Program.cs b/csharp/src/ProtoBench/Program.cs new file mode 100644 index 00000000..820fc124 --- /dev/null +++ b/csharp/src/ProtoBench/Program.cs @@ -0,0 +1,538 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Diagnostics; +using System.IO; +using System.Runtime.Serialization.Json; +using System.Text; +using System.Threading; +using System.Xml; +using Google.ProtocolBuffers.Serialization; +using Google.ProtocolBuffers.TestProtos; + +namespace Google.ProtocolBuffers.ProtoBench +{ + /// + /// Simple benchmarking of arbitrary messages. + /// + public sealed class Program + { + private static TimeSpan MinSampleTime = TimeSpan.FromSeconds(2); + private static TimeSpan TargetTime = TimeSpan.FromSeconds(30); + private static bool Verbose = false, FastTest = false, OtherFormats = false; + // Avoid a .NET 3.5 dependency + private delegate void Action(); + + private delegate void BenchmarkTest(string name, long dataSize, Action action); + + private static BenchmarkTest RunBenchmark; + + private static string _logFile; + static void WriteLine(string format, params object[] arg) + { + if (arg.Length > 0) format = String.Format(format, arg); + Console.Out.WriteLine(format); + if (!String.IsNullOrEmpty(_logFile)) + File.AppendAllText(_logFile, format + Environment.NewLine); + } + + [STAThread] + public static int Main(string[] args) + { + List temp = new List(args); + + Verbose = temp.Remove("/verbose") || temp.Remove("-verbose"); + OtherFormats = temp.Remove("/formats") || temp.Remove("-formats"); + + foreach (string arg in temp) + { + if (arg.StartsWith("/log:", StringComparison.OrdinalIgnoreCase) || arg.StartsWith("-log:", StringComparison.OrdinalIgnoreCase)) + { + _logFile = arg.Substring(5); + if (!String.IsNullOrEmpty(_logFile)) + File.AppendAllText(_logFile, Environment.NewLine + "Started benchmarks at " + DateTime.Now + Environment.NewLine); + temp.Remove(arg); + break; + } + } + + if (true == (FastTest = (temp.Remove("/fast") || temp.Remove("-fast")))) + { + TargetTime = TimeSpan.FromSeconds(10); + } + + RunBenchmark = BenchmarkV1; + if (temp.Remove("/v2") || temp.Remove("-v2")) + { + Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.RealTime; + Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(1); + RunBenchmark = BenchmarkV2; + } + if (temp.Remove("/all") || temp.Remove("-all")) + { + if (FastTest) + { + TargetTime = TimeSpan.FromSeconds(5); + } + foreach (KeyValuePair item in MakeTests()) + { + temp.Add(item.Key); + temp.Add(item.Value); + } + } + args = temp.ToArray(); + + if (args.Length < 2 || (args.Length%2) != 0) + { + Console.Error.WriteLine("Usage: ProtoBench [/fast] "); + Console.Error.WriteLine("The descriptor type name is the fully-qualified message name,"); + Console.Error.WriteLine( + "including assembly - e.g. Google.ProtocolBuffers.BenchmarkProtos.Message1,ProtoBench"); + Console.Error.WriteLine("(You can specify multiple pairs of descriptor type name and input data.)"); + return 1; + } + + bool success = true; + for (int i = 0; i < args.Length; i += 2) + { + success &= RunTest(args[i], args[i + 1], null); + } + return success ? 0 : 1; + } + + /// + /// Runs a single test. Error messages are displayed to Console.Error, and the return value indicates + /// general success/failure. + /// + public static bool RunTest(string typeName, string file, byte[] inputData) + { + WriteLine("Benchmarking {0} with file {1}", typeName, file); + IMessage defaultMessage; + try + { + defaultMessage = MessageUtil.GetDefaultMessage(typeName); + } + catch (ArgumentException e) + { + Console.Error.WriteLine(e.Message); + return false; + } + try + { + ExtensionRegistry registry = ExtensionRegistry.Empty; + inputData = inputData ?? File.ReadAllBytes(file); + MemoryStream inputStream = new MemoryStream(inputData); + ByteString inputString = ByteString.CopyFrom(inputData); + IMessage sampleMessage = + defaultMessage.WeakCreateBuilderForType().WeakMergeFrom(inputString, registry).WeakBuild(); + + IDictionary dictionary = null; + byte[] jsonBytes = null, xmlBytes = null; /*no pun intended, well... maybe for xml*/ + if (OtherFormats) + { + using (MemoryStream temp = new MemoryStream()) + { + XmlFormatWriter.CreateInstance(temp).WriteMessage(sampleMessage); + xmlBytes = temp.ToArray(); + } + using (MemoryStream temp = new MemoryStream()) + { + JsonFormatWriter.CreateInstance(temp).WriteMessage(sampleMessage); + jsonBytes = temp.ToArray(); + } + dictionary = new Dictionary(StringComparer.Ordinal); + new DictionaryWriter(dictionary).WriteMessage(sampleMessage); + } + + //Serializers + if (!FastTest) + { + RunBenchmark("Serialize to byte string", inputData.Length, () => sampleMessage.ToByteString()); + } + RunBenchmark("Serialize to byte array", inputData.Length, () => sampleMessage.ToByteArray()); + if (!FastTest) + { + RunBenchmark("Serialize to memory stream", inputData.Length, + () => sampleMessage.WriteTo(new MemoryStream())); + } + + if (OtherFormats) + { + RunBenchmark("Serialize to xml", xmlBytes.Length, + () => + { + XmlFormatWriter.CreateInstance(new MemoryStream(), Encoding.UTF8).WriteMessage(sampleMessage); + }); + RunBenchmark("Serialize to json", jsonBytes.Length, + () => { JsonFormatWriter.CreateInstance().WriteMessage(sampleMessage); }); + RunBenchmark("Serialize to json via xml", jsonBytes.Length, + () => + XmlFormatWriter.CreateInstance( + JsonReaderWriterFactory.CreateJsonWriter(new MemoryStream(), Encoding.UTF8)) + .SetOptions(XmlWriterOptions.OutputJsonTypes) + .WriteMessage(sampleMessage) + ); + + RunBenchmark("Serialize to dictionary", sampleMessage.SerializedSize, + () => new DictionaryWriter().WriteMessage(sampleMessage)); + } + //Deserializers + if (!FastTest) + { + RunBenchmark("Deserialize from byte string", inputData.Length, + () => defaultMessage.WeakCreateBuilderForType() + .WeakMergeFrom(inputString, registry) + .WeakBuild() + ); + } + + RunBenchmark("Deserialize from byte array", inputData.Length, + () => defaultMessage.WeakCreateBuilderForType() + .WeakMergeFrom(CodedInputStream.CreateInstance(inputData), registry) + .WeakBuild() + ); + if (!FastTest) + { + RunBenchmark("Deserialize from memory stream", inputData.Length, + () => + { + inputStream.Position = 0; + defaultMessage.WeakCreateBuilderForType().WeakMergeFrom( + CodedInputStream.CreateInstance(inputStream), registry) + .WeakBuild(); + }); + } + + if (OtherFormats) + { + RunBenchmark("Deserialize from xml", xmlBytes.Length, + () => + XmlFormatReader.CreateInstance(xmlBytes).Merge( + defaultMessage.WeakCreateBuilderForType()).WeakBuild()); + RunBenchmark("Deserialize from json", jsonBytes.Length, + () => + JsonFormatReader.CreateInstance(jsonBytes).Merge( + defaultMessage.WeakCreateBuilderForType()).WeakBuild()); + RunBenchmark("Deserialize from json via xml", jsonBytes.Length, + () => + XmlFormatReader.CreateInstance(JsonReaderWriterFactory.CreateJsonReader(jsonBytes, XmlDictionaryReaderQuotas.Max)) + .SetOptions(XmlReaderOptions.ReadNestedArrays).Merge( + defaultMessage.WeakCreateBuilderForType()).WeakBuild()); + + RunBenchmark("Deserialize from dictionary", sampleMessage.SerializedSize, + () => + new DictionaryReader(dictionary).Merge(defaultMessage.WeakCreateBuilderForType()). + WeakBuild()); + } + WriteLine(String.Empty); + return true; + } + catch (Exception e) + { + Console.Error.WriteLine("Error: {0}", e.Message); + Console.Error.WriteLine(); + Console.Error.WriteLine("Detailed exception information: {0}", e); + return false; + } + } + + private static void BenchmarkV2(string name, long dataSize, Action action) + { + Thread.BeginThreadAffinity(); + TimeSpan elapsed = TimeSpan.Zero; + long runs = 0; + long totalCount = 0; + double best = double.MinValue, worst = double.MaxValue; + + action(); + // Run it progressively more times until we've got a reasonable sample + + int iterations = 100; + elapsed = TimeAction(action, iterations); + while (elapsed.TotalMilliseconds < 1000) + { + elapsed += TimeAction(action, iterations); + iterations *= 2; + } + + TimeSpan target = TimeSpan.FromSeconds(1); + + elapsed = TimeAction(action, iterations); + iterations = (int) ((target.Ticks*iterations)/(double) elapsed.Ticks); + elapsed = TimeAction(action, iterations); + iterations = (int) ((target.Ticks*iterations)/(double) elapsed.Ticks); + elapsed = TimeAction(action, iterations); + iterations = (int) ((target.Ticks*iterations)/(double) elapsed.Ticks); + + double first = (iterations*dataSize)/(elapsed.TotalSeconds*1024*1024); + if (Verbose) + { + WriteLine("Round ---: Count = {1,6}, Bps = {2,8:f3}", 0, iterations, first); + } + elapsed = TimeSpan.Zero; + int max = (int) TargetTime.TotalSeconds; + + while (runs < max) + { + TimeSpan cycle = TimeAction(action, iterations); + // Accumulate and scale for next cycle. + + double bps = (iterations*dataSize)/(cycle.TotalSeconds*1024*1024); + if (Verbose) + { + WriteLine("Round {1,3}: Count = {2,6}, Bps = {3,8:f3}", + 0, runs, iterations, bps); + } + + best = Math.Max(best, bps); + worst = Math.Min(worst, bps); + + runs++; + elapsed += cycle; + totalCount += iterations; + iterations = (int) ((target.Ticks*totalCount)/(double) elapsed.Ticks); + } + + Thread.EndThreadAffinity(); + WriteLine( + "{1}: averages {2} per {3:f3}s for {4} runs; avg: {5:f3}mbps; best: {6:f3}mbps; worst: {7:f3}mbps", + 0, name, totalCount/runs, elapsed.TotalSeconds/runs, runs, + (totalCount*dataSize)/(elapsed.TotalSeconds*1024*1024), best, worst); + } + + private static void BenchmarkV1(string name, long dataSize, Action action) + { + // Make sure it's JITted + action(); + // Run it progressively more times until we've got a reasonable sample + + int iterations = 1; + TimeSpan elapsed = TimeAction(action, iterations); + while (elapsed < MinSampleTime) + { + iterations *= 2; + elapsed = TimeAction(action, iterations); + } + // Upscale the sample to the target time. Do this in floating point arithmetic + // to avoid overflow issues. + iterations = (int) ((TargetTime.Ticks/(double) elapsed.Ticks)*iterations); + elapsed = TimeAction(action, iterations); + WriteLine("{0}: {1} iterations in {2:f3}s; {3:f3}MB/s", + name, iterations, elapsed.TotalSeconds, + (iterations*dataSize)/(elapsed.TotalSeconds*1024*1024)); + } + + private static TimeSpan TimeAction(Action action, int iterations) + { + GC.Collect(); + GC.GetTotalMemory(true); + GC.WaitForPendingFinalizers(); + + Stopwatch sw = Stopwatch.StartNew(); + for (int i = 0; i < iterations; i++) + { + action(); + } + sw.Stop(); + return sw.Elapsed; + } + + private static IEnumerable> MakeTests() + { + //Aggregate Tests + yield return MakeWorkItem("all-types", MakeTestAllTypes()); + yield return MakeWorkItem("repeated-100", MakeRepeatedTestAllTypes(100)); + yield return MakeWorkItem("packed-100", MakeTestPackedTypes(100)); + + //Discrete Tests + foreach (KeyValuePair> item in MakeTestAllTypes()) + { + yield return MakeWorkItem(item.Key, new[] {item}); + } + + foreach (KeyValuePair> item in MakeRepeatedTestAllTypes(100)) + { + yield return MakeWorkItem(item.Key, new[] {item}); + } + + foreach (KeyValuePair> item in MakeTestPackedTypes(100)) + { + yield return MakeWorkItem(item.Key, new[] {item}); + } + } + + private static IEnumerable>> MakeTestAllTypes() + { + // Many of the raw type serializers below perform poorly due to the numerous fields defined + // in TestAllTypes. + + //single values + yield return MakeItem("int32", 1, x => x.SetOptionalInt32(1001)); + yield return MakeItem("int64", 1, x => x.SetOptionalInt64(1001)); + yield return MakeItem("uint32", 1, x => x.SetOptionalUint32(1001)); + yield return MakeItem("uint64", 1, x => x.SetOptionalUint64(1001)); + yield return MakeItem("sint32", 1, x => x.SetOptionalSint32(-1001)); + yield return MakeItem("sint64", 1, x => x.SetOptionalSint64(-1001)); + yield return MakeItem("fixed32", 1, x => x.SetOptionalFixed32(1001)); + yield return MakeItem("fixed64", 1, x => x.SetOptionalFixed64(1001)); + yield return MakeItem("sfixed32", 1, x => x.SetOptionalSfixed32(-1001)); + yield return MakeItem("sfixed64", 1, x => x.SetOptionalSfixed64(-1001)); + yield return MakeItem("float", 1, x => x.SetOptionalFloat(1001.1001f)); + yield return MakeItem("double", 1, x => x.SetOptionalDouble(1001.1001)); + yield return MakeItem("bool", 1, x => x.SetOptionalBool(true)); + yield return MakeItem("string", 1, x => x.SetOptionalString("this is a string value")) + ; + yield return + MakeItem("bytes", 1, + x => + x.SetOptionalBytes(ByteString.CopyFromUtf8("this is an array of bytes"))) + ; + yield return + MakeItem("group", 1, + x => + x.SetOptionalGroup( + new TestAllTypes.Types.OptionalGroup.Builder().SetA(1001))); + yield return + MakeItem("message", 1, + x => + x.SetOptionalNestedMessage( + new TestAllTypes.Types.NestedMessage.Builder().SetBb(1001))); + yield return + MakeItem("enum", 1, + x => x.SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.FOO)); + } + + private static IEnumerable>> MakeRepeatedTestAllTypes(int size) + { + //repeated values + yield return MakeItem("repeated-int32", size, x => x.AddRepeatedInt32(1001)); + yield return MakeItem("repeated-int64", size, x => x.AddRepeatedInt64(1001)); + yield return MakeItem("repeated-uint32", size, x => x.AddRepeatedUint32(1001)); + yield return MakeItem("repeated-uint64", size, x => x.AddRepeatedUint64(1001)); + yield return MakeItem("repeated-sint32", size, x => x.AddRepeatedSint32(-1001)); + yield return MakeItem("repeated-sint64", size, x => x.AddRepeatedSint64(-1001)); + yield return MakeItem("repeated-fixed32", size, x => x.AddRepeatedFixed32(1001)); + yield return MakeItem("repeated-fixed64", size, x => x.AddRepeatedFixed64(1001)); + yield return MakeItem("repeated-sfixed32", size, x => x.AddRepeatedSfixed32(-1001)); + yield return MakeItem("repeated-sfixed64", size, x => x.AddRepeatedSfixed64(-1001)); + yield return MakeItem("repeated-float", size, x => x.AddRepeatedFloat(1001.1001f)); + yield return MakeItem("repeated-double", size, x => x.AddRepeatedDouble(1001.1001)); + yield return MakeItem("repeated-bool", size, x => x.AddRepeatedBool(true)); + yield return + MakeItem("repeated-string", size, + x => x.AddRepeatedString("this is a string value")); + yield return + MakeItem("repeated-bytes", size, + x => + x.AddRepeatedBytes(ByteString.CopyFromUtf8("this is an array of bytes"))) + ; + yield return + MakeItem("repeated-group", size, + x => + x.AddRepeatedGroup( + new TestAllTypes.Types.RepeatedGroup.Builder().SetA(1001))); + yield return + MakeItem("repeated-message", size, + x => + x.AddRepeatedNestedMessage( + new TestAllTypes.Types.NestedMessage.Builder().SetBb(1001))); + yield return + MakeItem("repeated-enum", size, + x => x.AddRepeatedNestedEnum(TestAllTypes.Types.NestedEnum.FOO)); + } + + private static IEnumerable>> MakeTestPackedTypes(int size) + { + //packed values + yield return MakeItem("packed-int32", size, x => x.AddPackedInt32(1001)); + yield return MakeItem("packed-int64", size, x => x.AddPackedInt64(1001)); + yield return MakeItem("packed-uint32", size, x => x.AddPackedUint32(1001)); + yield return MakeItem("packed-uint64", size, x => x.AddPackedUint64(1001)); + yield return MakeItem("packed-sint32", size, x => x.AddPackedSint32(-1001)); + yield return MakeItem("packed-sint64", size, x => x.AddPackedSint64(-1001)); + yield return MakeItem("packed-fixed32", size, x => x.AddPackedFixed32(1001)); + yield return MakeItem("packed-fixed64", size, x => x.AddPackedFixed64(1001)); + yield return MakeItem("packed-sfixed32", size, x => x.AddPackedSfixed32(-1001)); + yield return MakeItem("packed-sfixed64", size, x => x.AddPackedSfixed64(-1001)); + yield return MakeItem("packed-float", size, x => x.AddPackedFloat(1001.1001f)); + yield return MakeItem("packed-double", size, x => x.AddPackedDouble(1001.1001)); + yield return MakeItem("packed-bool", size, x => x.AddPackedBool(true)); + yield return + MakeItem("packed-enum", size, x => x.AddPackedEnum(ForeignEnum.FOREIGN_FOO)); + } + + private static KeyValuePair> MakeItem(string name, int repeated, Action build) + where T : IBuilderLite, new() + { + if (repeated == 1) + { + return new KeyValuePair>(name, build); + } + + return new KeyValuePair>( + String.Format("{0}[{1}]", name, repeated), + x => + { + for (int i = 0; i < repeated; i++) + { + build(x); + } + } + ); + } + + private static KeyValuePair MakeWorkItem(string name, + IEnumerable>> + builders) where T : IBuilderLite, new() + { + T builder = new T(); + + foreach (KeyValuePair> item in builders) + { + item.Value(builder); + } + + IMessageLite msg = builder.WeakBuild(); + string fname = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "unittest_" + name + ".dat"); + File.WriteAllBytes(fname, msg.ToByteArray()); + return + new KeyValuePair( + String.Format("{0},{1}", msg.GetType().FullName, msg.GetType().Assembly.GetName().Name), fname); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoBench/Properties/AssemblyInfo.cs b/csharp/src/ProtoBench/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..8600c13e --- /dev/null +++ b/csharp/src/ProtoBench/Properties/AssemblyInfo.cs @@ -0,0 +1,32 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("ProtoBench")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtoBench")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: CLSCompliant(true)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.4.1.555")] + +[assembly: AssemblyVersion("2.4.1.555")] +[assembly: AssemblyFileVersion("2.4.1.555")] \ No newline at end of file diff --git a/csharp/src/ProtoBench/ProtoBench.csproj b/csharp/src/ProtoBench/ProtoBench.csproj new file mode 100644 index 00000000..9df47745 --- /dev/null +++ b/csharp/src/ProtoBench/ProtoBench.csproj @@ -0,0 +1,88 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {C7A4A435-2813-41C8-AA87-BD914BA5223D} + Exe + Properties + Google.ProtocolBuffers.ProtoBench + ProtoBench + v3.5 + 512 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE + prompt + 4 + true + true + Off + + + + + + + + + + + + + + + + + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + True + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + True + + + + + Always + + + Always + + + + + \ No newline at end of file diff --git a/csharp/src/ProtoBench/TestProtos/GoogleSizeProtoFile.cs b/csharp/src/ProtoBench/TestProtos/GoogleSizeProtoFile.cs new file mode 100644 index 00000000..aa6c5076 --- /dev/null +++ b/csharp/src/ProtoBench/TestProtos/GoogleSizeProtoFile.cs @@ -0,0 +1,4572 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.ProtoBench { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class GoogleSizeProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_benchmarks_SizeMessage1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SizeMessage1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_benchmarks_SizeMessage1SubMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SizeMessage1SubMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_benchmarks_SizeMessage2__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SizeMessage2__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_benchmarks_SizeMessage2_Group1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SizeMessage2_Group1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_benchmarks_SizeMessage2GroupedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SizeMessage2GroupedMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static GoogleSizeProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChxiZW5jaG1hcmtzL2dvb2dsZV9zaXplLnByb3RvEgpiZW5jaG1hcmtzGiRn", + "b29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8i9gYKDFNpemVN", + "ZXNzYWdlMRIOCgZmaWVsZDEYASACKAkSDgoGZmllbGQ5GAkgASgJEg8KB2Zp", + "ZWxkMTgYEiABKAkSFgoHZmllbGQ4MBhQIAEoCDoFZmFsc2USFQoHZmllbGQ4", + "MRhRIAEoCDoEdHJ1ZRIOCgZmaWVsZDIYAiACKAUSDgoGZmllbGQzGAMgAigF", + "EhEKCGZpZWxkMjgwGJgCIAEoBRIRCgZmaWVsZDYYBiABKAU6ATASDwoHZmll", + "bGQyMhgWIAEoAxIOCgZmaWVsZDQYBCABKAkSDgoGZmllbGQ1GAUgAygGEhYK", + "B2ZpZWxkNTkYOyABKAg6BWZhbHNlEg4KBmZpZWxkNxgHIAEoCRIPCgdmaWVs", + "ZDE2GBAgASgFEhQKCGZpZWxkMTMwGIIBIAEoBToBMBIVCgdmaWVsZDEyGAwg", + "ASgIOgR0cnVlEhUKB2ZpZWxkMTcYESABKAg6BHRydWUSFQoHZmllbGQxMxgN", + "IAEoCDoEdHJ1ZRIVCgdmaWVsZDE0GA4gASgIOgR0cnVlEhMKCGZpZWxkMTA0", + "GGggASgFOgEwEhMKCGZpZWxkMTAwGGQgASgFOgEwEhMKCGZpZWxkMTAxGGUg", + "ASgFOgEwEhAKCGZpZWxkMTAyGGYgASgJEhAKCGZpZWxkMTAzGGcgASgJEhIK", + "B2ZpZWxkMjkYHSABKAU6ATASFgoHZmllbGQzMBgeIAEoCDoFZmFsc2USEwoH", + "ZmllbGQ2MBg8IAEoBToCLTESFQoIZmllbGQyNzEYjwIgASgFOgItMRIVCghm", + "aWVsZDI3MhiQAiABKAU6Ai0xEhEKCGZpZWxkMTUwGJYBIAEoBRISCgdmaWVs", + "ZDIzGBcgASgFOgEwEhYKB2ZpZWxkMjQYGCABKAg6BWZhbHNlEhIKB2ZpZWxk", + "MjUYGSABKAU6ATASMwoHZmllbGQxNRgPIAEoCzIiLmJlbmNobWFya3MuU2l6", + "ZU1lc3NhZ2UxU3ViTWVzc2FnZRIPCgdmaWVsZDc4GE4gASgIEhIKB2ZpZWxk", + "NjcYQyABKAU6ATASDwoHZmllbGQ2OBhEIAEoBRIUCghmaWVsZDEyOBiAASAB", + "KAU6ATASKAoIZmllbGQxMjkYgQEgASgJOhV4eHh4eHh4eHh4eHh4eHh4eHh4", + "eHgSFAoIZmllbGQxMzEYgwEgASgFOgEwIqEDChZTaXplTWVzc2FnZTFTdWJN", + "ZXNzYWdlEhEKBmZpZWxkMRgBIAEoBToBMBIRCgZmaWVsZDIYAiABKAU6ATAS", + "EQoGZmllbGQzGAMgASgFOgEwEg8KB2ZpZWxkMTUYDyABKAkSFQoHZmllbGQx", + "MhgMIAEoCDoEdHJ1ZRIPCgdmaWVsZDEzGA0gASgDEg8KB2ZpZWxkMTQYDiAB", + "KAMSDwoHZmllbGQxNhgQIAEoBRISCgdmaWVsZDE5GBMgASgFOgEyEhUKB2Zp", + "ZWxkMjAYFCABKAg6BHRydWUSFQoHZmllbGQyOBgcIAEoCDoEdHJ1ZRIPCgdm", + "aWVsZDIxGBUgASgGEg8KB2ZpZWxkMjIYFiABKAUSFgoHZmllbGQyMxgXIAEo", + "CDoFZmFsc2USGAoIZmllbGQyMDYYzgEgASgIOgVmYWxzZRIRCghmaWVsZDIw", + "MxjLASABKAcSEQoIZmllbGQyMDQYzAEgASgFEhEKCGZpZWxkMjA1GM0BIAEo", + "CRIRCghmaWVsZDIwNxjPASABKAQSEQoIZmllbGQzMDAYrAIgASgEIscHCgxT", + "aXplTWVzc2FnZTISDgoGZmllbGQxGAEgASgJEg4KBmZpZWxkMxgDIAEoAxIO", + "CgZmaWVsZDQYBCABKAMSDwoHZmllbGQzMBgeIAEoAxIWCgdmaWVsZDc1GEsg", + "ASgIOgVmYWxzZRIOCgZmaWVsZDYYBiABKAkSDgoGZmllbGQyGAIgASgMEhIK", + "B2ZpZWxkMjEYFSABKAU6ATASDwoHZmllbGQ3MRhHIAEoBRIPCgdmaWVsZDI1", + "GBkgASgCEhMKCGZpZWxkMTA5GG0gASgFOgEwEhQKCGZpZWxkMjEwGNIBIAEo", + "BToBMBIUCghmaWVsZDIxMRjTASABKAU6ATASFAoIZmllbGQyMTIY1AEgASgF", + "OgEwEhQKCGZpZWxkMjEzGNUBIAEoBToBMBIUCghmaWVsZDIxNhjYASABKAU6", + "ATASFAoIZmllbGQyMTcY2QEgASgFOgEwEhQKCGZpZWxkMjE4GNoBIAEoBToB", + "MBIUCghmaWVsZDIyMBjcASABKAU6ATASFAoIZmllbGQyMjEY3QEgASgFOgEw", + "EhQKCGZpZWxkMjIyGN4BIAEoAjoBMBIPCgdmaWVsZDYzGD8gASgFEi8KBmdy", + "b3VwMRgKIAMoCjIfLmJlbmNobWFya3MuU2l6ZU1lc3NhZ2UyLkdyb3VwMRIR", + "CghmaWVsZDEyOBiAASADKAkSEQoIZmllbGQxMzEYgwEgASgDEhAKCGZpZWxk", + "MTI3GH8gAygJEhEKCGZpZWxkMTI5GIEBIAEoBRIRCghmaWVsZDEzMBiCASAD", + "KAMSGAoIZmllbGQyMDUYzQEgASgIOgVmYWxzZRIYCghmaWVsZDIwNhjOASAB", + "KAg6BWZhbHNlGsICCgZHcm91cDESDwoHZmllbGQxMRgLIAIoAhIPCgdmaWVs", + "ZDI2GBogASgCEg8KB2ZpZWxkMTIYDCABKAkSDwoHZmllbGQxMxgNIAEoCRIP", + "CgdmaWVsZDE0GA4gAygJEg8KB2ZpZWxkMTUYDyACKAQSDgoGZmllbGQ1GAUg", + "ASgFEg8KB2ZpZWxkMjcYGyABKAkSDwoHZmllbGQyOBgcIAEoBRIPCgdmaWVs", + "ZDI5GB0gASgJEg8KB2ZpZWxkMTYYECABKAkSDwoHZmllbGQyMhgWIAMoCRIP", + "CgdmaWVsZDczGEkgAygFEhIKB2ZpZWxkMjAYFCABKAU6ATASDwoHZmllbGQy", + "NBgYIAEoCRI3CgdmaWVsZDMxGB8gASgLMiYuYmVuY2htYXJrcy5TaXplTWVz", + "c2FnZTJHcm91cGVkTWVzc2FnZSLeAQoaU2l6ZU1lc3NhZ2UyR3JvdXBlZE1l", + "c3NhZ2USDgoGZmllbGQxGAEgASgCEg4KBmZpZWxkMhgCIAEoAhIRCgZmaWVs", + "ZDMYAyABKAI6ATASDgoGZmllbGQ0GAQgASgIEg4KBmZpZWxkNRgFIAEoCBIU", + "CgZmaWVsZDYYBiABKAg6BHRydWUSFQoGZmllbGQ3GAcgASgIOgVmYWxzZRIO", + "CgZmaWVsZDgYCCABKAISDgoGZmllbGQ5GAkgASgIEg8KB2ZpZWxkMTAYCiAB", + "KAISDwoHZmllbGQxMRgLIAEoA0JJQgpHb29nbGVTaXplSALCPjgKIUdvb2ds", + "ZS5Qcm90b2NvbEJ1ZmZlcnMuUHJvdG9CZW5jaBITR29vZ2xlU2l6ZVByb3Rv", + "RmlsZQ==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_benchmarks_SizeMessage1__Descriptor = Descriptor.MessageTypes[0]; + internal__static_benchmarks_SizeMessage1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SizeMessage1__Descriptor, + new string[] { "Field1", "Field9", "Field18", "Field80", "Field81", "Field2", "Field3", "Field280", "Field6", "Field22", "Field4", "Field5", "Field59", "Field7", "Field16", "Field130", "Field12", "Field17", "Field13", "Field14", "Field104", "Field100", "Field101", "Field102", "Field103", "Field29", "Field30", "Field60", "Field271", "Field272", "Field150", "Field23", "Field24", "Field25", "Field15", "Field78", "Field67", "Field68", "Field128", "Field129", "Field131", }); + internal__static_benchmarks_SizeMessage1SubMessage__Descriptor = Descriptor.MessageTypes[1]; + internal__static_benchmarks_SizeMessage1SubMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SizeMessage1SubMessage__Descriptor, + new string[] { "Field1", "Field2", "Field3", "Field15", "Field12", "Field13", "Field14", "Field16", "Field19", "Field20", "Field28", "Field21", "Field22", "Field23", "Field206", "Field203", "Field204", "Field205", "Field207", "Field300", }); + internal__static_benchmarks_SizeMessage2__Descriptor = Descriptor.MessageTypes[2]; + internal__static_benchmarks_SizeMessage2__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SizeMessage2__Descriptor, + new string[] { "Field1", "Field3", "Field4", "Field30", "Field75", "Field6", "Field2", "Field21", "Field71", "Field25", "Field109", "Field210", "Field211", "Field212", "Field213", "Field216", "Field217", "Field218", "Field220", "Field221", "Field222", "Field63", "Group1", "Field128", "Field131", "Field127", "Field129", "Field130", "Field205", "Field206", }); + internal__static_benchmarks_SizeMessage2_Group1__Descriptor = internal__static_benchmarks_SizeMessage2__Descriptor.NestedTypes[0]; + internal__static_benchmarks_SizeMessage2_Group1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SizeMessage2_Group1__Descriptor, + new string[] { "Field11", "Field26", "Field12", "Field13", "Field14", "Field15", "Field5", "Field27", "Field28", "Field29", "Field16", "Field22", "Field73", "Field20", "Field24", "Field31", }); + internal__static_benchmarks_SizeMessage2GroupedMessage__Descriptor = Descriptor.MessageTypes[3]; + internal__static_benchmarks_SizeMessage2GroupedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SizeMessage2GroupedMessage__Descriptor, + new string[] { "Field1", "Field2", "Field3", "Field4", "Field5", "Field6", "Field7", "Field8", "Field9", "Field10", "Field11", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SizeMessage1 : pb::GeneratedMessage { + private SizeMessage1() { } + private static readonly SizeMessage1 defaultInstance = new SizeMessage1().MakeReadOnly(); + public static SizeMessage1 DefaultInstance { + get { return defaultInstance; } + } + + public override SizeMessage1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SizeMessage1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage1__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private string field1_ = ""; + public bool HasField1 { + get { return hasField1; } + } + public string Field1 { + get { return field1_; } + } + + public const int Field9FieldNumber = 9; + private bool hasField9; + private string field9_ = ""; + public bool HasField9 { + get { return hasField9; } + } + public string Field9 { + get { return field9_; } + } + + public const int Field18FieldNumber = 18; + private bool hasField18; + private string field18_ = ""; + public bool HasField18 { + get { return hasField18; } + } + public string Field18 { + get { return field18_; } + } + + public const int Field80FieldNumber = 80; + private bool hasField80; + private bool field80_; + public bool HasField80 { + get { return hasField80; } + } + public bool Field80 { + get { return field80_; } + } + + public const int Field81FieldNumber = 81; + private bool hasField81; + private bool field81_ = true; + public bool HasField81 { + get { return hasField81; } + } + public bool Field81 { + get { return field81_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private int field2_; + public bool HasField2 { + get { return hasField2; } + } + public int Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private int field3_; + public bool HasField3 { + get { return hasField3; } + } + public int Field3 { + get { return field3_; } + } + + public const int Field280FieldNumber = 280; + private bool hasField280; + private int field280_; + public bool HasField280 { + get { return hasField280; } + } + public int Field280 { + get { return field280_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private int field6_; + public bool HasField6 { + get { return hasField6; } + } + public int Field6 { + get { return field6_; } + } + + public const int Field22FieldNumber = 22; + private bool hasField22; + private long field22_; + public bool HasField22 { + get { return hasField22; } + } + public long Field22 { + get { return field22_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private string field4_ = ""; + public bool HasField4 { + get { return hasField4; } + } + public string Field4 { + get { return field4_; } + } + + public const int Field5FieldNumber = 5; + private pbc::PopsicleList field5_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList Field5List { + get { return pbc::Lists.AsReadOnly(field5_); } + } + public int Field5Count { + get { return field5_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetField5(int index) { + return field5_[index]; + } + + public const int Field59FieldNumber = 59; + private bool hasField59; + private bool field59_; + public bool HasField59 { + get { return hasField59; } + } + public bool Field59 { + get { return field59_; } + } + + public const int Field7FieldNumber = 7; + private bool hasField7; + private string field7_ = ""; + public bool HasField7 { + get { return hasField7; } + } + public string Field7 { + get { return field7_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private int field16_; + public bool HasField16 { + get { return hasField16; } + } + public int Field16 { + get { return field16_; } + } + + public const int Field130FieldNumber = 130; + private bool hasField130; + private int field130_; + public bool HasField130 { + get { return hasField130; } + } + public int Field130 { + get { return field130_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private bool field12_ = true; + public bool HasField12 { + get { return hasField12; } + } + public bool Field12 { + get { return field12_; } + } + + public const int Field17FieldNumber = 17; + private bool hasField17; + private bool field17_ = true; + public bool HasField17 { + get { return hasField17; } + } + public bool Field17 { + get { return field17_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private bool field13_ = true; + public bool HasField13 { + get { return hasField13; } + } + public bool Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private bool hasField14; + private bool field14_ = true; + public bool HasField14 { + get { return hasField14; } + } + public bool Field14 { + get { return field14_; } + } + + public const int Field104FieldNumber = 104; + private bool hasField104; + private int field104_; + public bool HasField104 { + get { return hasField104; } + } + public int Field104 { + get { return field104_; } + } + + public const int Field100FieldNumber = 100; + private bool hasField100; + private int field100_; + public bool HasField100 { + get { return hasField100; } + } + public int Field100 { + get { return field100_; } + } + + public const int Field101FieldNumber = 101; + private bool hasField101; + private int field101_; + public bool HasField101 { + get { return hasField101; } + } + public int Field101 { + get { return field101_; } + } + + public const int Field102FieldNumber = 102; + private bool hasField102; + private string field102_ = ""; + public bool HasField102 { + get { return hasField102; } + } + public string Field102 { + get { return field102_; } + } + + public const int Field103FieldNumber = 103; + private bool hasField103; + private string field103_ = ""; + public bool HasField103 { + get { return hasField103; } + } + public string Field103 { + get { return field103_; } + } + + public const int Field29FieldNumber = 29; + private bool hasField29; + private int field29_; + public bool HasField29 { + get { return hasField29; } + } + public int Field29 { + get { return field29_; } + } + + public const int Field30FieldNumber = 30; + private bool hasField30; + private bool field30_; + public bool HasField30 { + get { return hasField30; } + } + public bool Field30 { + get { return field30_; } + } + + public const int Field60FieldNumber = 60; + private bool hasField60; + private int field60_ = -1; + public bool HasField60 { + get { return hasField60; } + } + public int Field60 { + get { return field60_; } + } + + public const int Field271FieldNumber = 271; + private bool hasField271; + private int field271_ = -1; + public bool HasField271 { + get { return hasField271; } + } + public int Field271 { + get { return field271_; } + } + + public const int Field272FieldNumber = 272; + private bool hasField272; + private int field272_ = -1; + public bool HasField272 { + get { return hasField272; } + } + public int Field272 { + get { return field272_; } + } + + public const int Field150FieldNumber = 150; + private bool hasField150; + private int field150_; + public bool HasField150 { + get { return hasField150; } + } + public int Field150 { + get { return field150_; } + } + + public const int Field23FieldNumber = 23; + private bool hasField23; + private int field23_; + public bool HasField23 { + get { return hasField23; } + } + public int Field23 { + get { return field23_; } + } + + public const int Field24FieldNumber = 24; + private bool hasField24; + private bool field24_; + public bool HasField24 { + get { return hasField24; } + } + public bool Field24 { + get { return field24_; } + } + + public const int Field25FieldNumber = 25; + private bool hasField25; + private int field25_; + public bool HasField25 { + get { return hasField25; } + } + public int Field25 { + get { return field25_; } + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage field15_; + public bool HasField15 { + get { return hasField15; } + } + public global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage Field15 { + get { return field15_ ?? global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage.DefaultInstance; } + } + + public const int Field78FieldNumber = 78; + private bool hasField78; + private bool field78_; + public bool HasField78 { + get { return hasField78; } + } + public bool Field78 { + get { return field78_; } + } + + public const int Field67FieldNumber = 67; + private bool hasField67; + private int field67_; + public bool HasField67 { + get { return hasField67; } + } + public int Field67 { + get { return field67_; } + } + + public const int Field68FieldNumber = 68; + private bool hasField68; + private int field68_; + public bool HasField68 { + get { return hasField68; } + } + public int Field68 { + get { return field68_; } + } + + public const int Field128FieldNumber = 128; + private bool hasField128; + private int field128_; + public bool HasField128 { + get { return hasField128; } + } + public int Field128 { + get { return field128_; } + } + + public const int Field129FieldNumber = 129; + private bool hasField129; + private string field129_ = "xxxxxxxxxxxxxxxxxxxxx"; + public bool HasField129 { + get { return hasField129; } + } + public string Field129 { + get { return field129_; } + } + + public const int Field131FieldNumber = 131; + private bool hasField131; + private int field131_; + public bool HasField131 { + get { return hasField131; } + } + public int Field131 { + get { return field131_; } + } + + public static SizeMessage1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SizeMessage1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SizeMessage1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SizeMessage1 MakeReadOnly() { + field5_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SizeMessage1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SizeMessage1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SizeMessage1 result; + + private SizeMessage1 PrepareBuilder() { + if (resultIsReadOnly) { + SizeMessage1 original = result; + result = new SizeMessage1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SizeMessage1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage1.Descriptor; } + } + + public override SizeMessage1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage1.DefaultInstance; } + } + + public override SizeMessage1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public string Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = ""; + return this; + } + + public bool HasField9 { + get { return result.hasField9; } + } + public string Field9 { + get { return result.Field9; } + set { SetField9(value); } + } + public Builder SetField9(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField9 = true; + result.field9_ = value; + return this; + } + public Builder ClearField9() { + PrepareBuilder(); + result.hasField9 = false; + result.field9_ = ""; + return this; + } + + public bool HasField18 { + get { return result.hasField18; } + } + public string Field18 { + get { return result.Field18; } + set { SetField18(value); } + } + public Builder SetField18(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField18 = true; + result.field18_ = value; + return this; + } + public Builder ClearField18() { + PrepareBuilder(); + result.hasField18 = false; + result.field18_ = ""; + return this; + } + + public bool HasField80 { + get { return result.hasField80; } + } + public bool Field80 { + get { return result.Field80; } + set { SetField80(value); } + } + public Builder SetField80(bool value) { + PrepareBuilder(); + result.hasField80 = true; + result.field80_ = value; + return this; + } + public Builder ClearField80() { + PrepareBuilder(); + result.hasField80 = false; + result.field80_ = false; + return this; + } + + public bool HasField81 { + get { return result.hasField81; } + } + public bool Field81 { + get { return result.Field81; } + set { SetField81(value); } + } + public Builder SetField81(bool value) { + PrepareBuilder(); + result.hasField81 = true; + result.field81_ = value; + return this; + } + public Builder ClearField81() { + PrepareBuilder(); + result.hasField81 = false; + result.field81_ = true; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public int Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(int value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public int Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(int value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0; + return this; + } + + public bool HasField280 { + get { return result.hasField280; } + } + public int Field280 { + get { return result.Field280; } + set { SetField280(value); } + } + public Builder SetField280(int value) { + PrepareBuilder(); + result.hasField280 = true; + result.field280_ = value; + return this; + } + public Builder ClearField280() { + PrepareBuilder(); + result.hasField280 = false; + result.field280_ = 0; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public int Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(int value) { + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = 0; + return this; + } + + public bool HasField22 { + get { return result.hasField22; } + } + public long Field22 { + get { return result.Field22; } + set { SetField22(value); } + } + public Builder SetField22(long value) { + PrepareBuilder(); + result.hasField22 = true; + result.field22_ = value; + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.hasField22 = false; + result.field22_ = 0L; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public string Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = ""; + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList Field5List { + get { return PrepareBuilder().field5_; } + } + public int Field5Count { + get { return result.Field5Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetField5(int index) { + return result.GetField5(index); + } + [global::System.CLSCompliant(false)] + public Builder SetField5(int index, ulong value) { + PrepareBuilder(); + result.field5_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddField5(ulong value) { + PrepareBuilder(); + result.field5_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeField5(scg::IEnumerable values) { + PrepareBuilder(); + result.field5_.Add(values); + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.field5_.Clear(); + return this; + } + + public bool HasField59 { + get { return result.hasField59; } + } + public bool Field59 { + get { return result.Field59; } + set { SetField59(value); } + } + public Builder SetField59(bool value) { + PrepareBuilder(); + result.hasField59 = true; + result.field59_ = value; + return this; + } + public Builder ClearField59() { + PrepareBuilder(); + result.hasField59 = false; + result.field59_ = false; + return this; + } + + public bool HasField7 { + get { return result.hasField7; } + } + public string Field7 { + get { return result.Field7; } + set { SetField7(value); } + } + public Builder SetField7(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField7 = true; + result.field7_ = value; + return this; + } + public Builder ClearField7() { + PrepareBuilder(); + result.hasField7 = false; + result.field7_ = ""; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public int Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(int value) { + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = 0; + return this; + } + + public bool HasField130 { + get { return result.hasField130; } + } + public int Field130 { + get { return result.Field130; } + set { SetField130(value); } + } + public Builder SetField130(int value) { + PrepareBuilder(); + result.hasField130 = true; + result.field130_ = value; + return this; + } + public Builder ClearField130() { + PrepareBuilder(); + result.hasField130 = false; + result.field130_ = 0; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public bool Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(bool value) { + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = true; + return this; + } + + public bool HasField17 { + get { return result.hasField17; } + } + public bool Field17 { + get { return result.Field17; } + set { SetField17(value); } + } + public Builder SetField17(bool value) { + PrepareBuilder(); + result.hasField17 = true; + result.field17_ = value; + return this; + } + public Builder ClearField17() { + PrepareBuilder(); + result.hasField17 = false; + result.field17_ = true; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public bool Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(bool value) { + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = true; + return this; + } + + public bool HasField14 { + get { return result.hasField14; } + } + public bool Field14 { + get { return result.Field14; } + set { SetField14(value); } + } + public Builder SetField14(bool value) { + PrepareBuilder(); + result.hasField14 = true; + result.field14_ = value; + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.hasField14 = false; + result.field14_ = true; + return this; + } + + public bool HasField104 { + get { return result.hasField104; } + } + public int Field104 { + get { return result.Field104; } + set { SetField104(value); } + } + public Builder SetField104(int value) { + PrepareBuilder(); + result.hasField104 = true; + result.field104_ = value; + return this; + } + public Builder ClearField104() { + PrepareBuilder(); + result.hasField104 = false; + result.field104_ = 0; + return this; + } + + public bool HasField100 { + get { return result.hasField100; } + } + public int Field100 { + get { return result.Field100; } + set { SetField100(value); } + } + public Builder SetField100(int value) { + PrepareBuilder(); + result.hasField100 = true; + result.field100_ = value; + return this; + } + public Builder ClearField100() { + PrepareBuilder(); + result.hasField100 = false; + result.field100_ = 0; + return this; + } + + public bool HasField101 { + get { return result.hasField101; } + } + public int Field101 { + get { return result.Field101; } + set { SetField101(value); } + } + public Builder SetField101(int value) { + PrepareBuilder(); + result.hasField101 = true; + result.field101_ = value; + return this; + } + public Builder ClearField101() { + PrepareBuilder(); + result.hasField101 = false; + result.field101_ = 0; + return this; + } + + public bool HasField102 { + get { return result.hasField102; } + } + public string Field102 { + get { return result.Field102; } + set { SetField102(value); } + } + public Builder SetField102(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField102 = true; + result.field102_ = value; + return this; + } + public Builder ClearField102() { + PrepareBuilder(); + result.hasField102 = false; + result.field102_ = ""; + return this; + } + + public bool HasField103 { + get { return result.hasField103; } + } + public string Field103 { + get { return result.Field103; } + set { SetField103(value); } + } + public Builder SetField103(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField103 = true; + result.field103_ = value; + return this; + } + public Builder ClearField103() { + PrepareBuilder(); + result.hasField103 = false; + result.field103_ = ""; + return this; + } + + public bool HasField29 { + get { return result.hasField29; } + } + public int Field29 { + get { return result.Field29; } + set { SetField29(value); } + } + public Builder SetField29(int value) { + PrepareBuilder(); + result.hasField29 = true; + result.field29_ = value; + return this; + } + public Builder ClearField29() { + PrepareBuilder(); + result.hasField29 = false; + result.field29_ = 0; + return this; + } + + public bool HasField30 { + get { return result.hasField30; } + } + public bool Field30 { + get { return result.Field30; } + set { SetField30(value); } + } + public Builder SetField30(bool value) { + PrepareBuilder(); + result.hasField30 = true; + result.field30_ = value; + return this; + } + public Builder ClearField30() { + PrepareBuilder(); + result.hasField30 = false; + result.field30_ = false; + return this; + } + + public bool HasField60 { + get { return result.hasField60; } + } + public int Field60 { + get { return result.Field60; } + set { SetField60(value); } + } + public Builder SetField60(int value) { + PrepareBuilder(); + result.hasField60 = true; + result.field60_ = value; + return this; + } + public Builder ClearField60() { + PrepareBuilder(); + result.hasField60 = false; + result.field60_ = -1; + return this; + } + + public bool HasField271 { + get { return result.hasField271; } + } + public int Field271 { + get { return result.Field271; } + set { SetField271(value); } + } + public Builder SetField271(int value) { + PrepareBuilder(); + result.hasField271 = true; + result.field271_ = value; + return this; + } + public Builder ClearField271() { + PrepareBuilder(); + result.hasField271 = false; + result.field271_ = -1; + return this; + } + + public bool HasField272 { + get { return result.hasField272; } + } + public int Field272 { + get { return result.Field272; } + set { SetField272(value); } + } + public Builder SetField272(int value) { + PrepareBuilder(); + result.hasField272 = true; + result.field272_ = value; + return this; + } + public Builder ClearField272() { + PrepareBuilder(); + result.hasField272 = false; + result.field272_ = -1; + return this; + } + + public bool HasField150 { + get { return result.hasField150; } + } + public int Field150 { + get { return result.Field150; } + set { SetField150(value); } + } + public Builder SetField150(int value) { + PrepareBuilder(); + result.hasField150 = true; + result.field150_ = value; + return this; + } + public Builder ClearField150() { + PrepareBuilder(); + result.hasField150 = false; + result.field150_ = 0; + return this; + } + + public bool HasField23 { + get { return result.hasField23; } + } + public int Field23 { + get { return result.Field23; } + set { SetField23(value); } + } + public Builder SetField23(int value) { + PrepareBuilder(); + result.hasField23 = true; + result.field23_ = value; + return this; + } + public Builder ClearField23() { + PrepareBuilder(); + result.hasField23 = false; + result.field23_ = 0; + return this; + } + + public bool HasField24 { + get { return result.hasField24; } + } + public bool Field24 { + get { return result.Field24; } + set { SetField24(value); } + } + public Builder SetField24(bool value) { + PrepareBuilder(); + result.hasField24 = true; + result.field24_ = value; + return this; + } + public Builder ClearField24() { + PrepareBuilder(); + result.hasField24 = false; + result.field24_ = false; + return this; + } + + public bool HasField25 { + get { return result.hasField25; } + } + public int Field25 { + get { return result.Field25; } + set { SetField25(value); } + } + public Builder SetField25(int value) { + PrepareBuilder(); + result.hasField25 = true; + result.field25_ = value; + return this; + } + public Builder ClearField25() { + PrepareBuilder(); + result.hasField25 = false; + result.field25_ = 0; + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + public global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + public Builder SetField15(global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder SetField15(global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = builderForValue.Build(); + return this; + } + public Builder MergeField15(global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasField15 && + result.field15_ != global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage.DefaultInstance) { + result.field15_ = global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage.CreateBuilder(result.field15_).MergeFrom(value).BuildPartial(); + } else { + result.field15_ = value; + } + result.hasField15 = true; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = null; + return this; + } + + public bool HasField78 { + get { return result.hasField78; } + } + public bool Field78 { + get { return result.Field78; } + set { SetField78(value); } + } + public Builder SetField78(bool value) { + PrepareBuilder(); + result.hasField78 = true; + result.field78_ = value; + return this; + } + public Builder ClearField78() { + PrepareBuilder(); + result.hasField78 = false; + result.field78_ = false; + return this; + } + + public bool HasField67 { + get { return result.hasField67; } + } + public int Field67 { + get { return result.Field67; } + set { SetField67(value); } + } + public Builder SetField67(int value) { + PrepareBuilder(); + result.hasField67 = true; + result.field67_ = value; + return this; + } + public Builder ClearField67() { + PrepareBuilder(); + result.hasField67 = false; + result.field67_ = 0; + return this; + } + + public bool HasField68 { + get { return result.hasField68; } + } + public int Field68 { + get { return result.Field68; } + set { SetField68(value); } + } + public Builder SetField68(int value) { + PrepareBuilder(); + result.hasField68 = true; + result.field68_ = value; + return this; + } + public Builder ClearField68() { + PrepareBuilder(); + result.hasField68 = false; + result.field68_ = 0; + return this; + } + + public bool HasField128 { + get { return result.hasField128; } + } + public int Field128 { + get { return result.Field128; } + set { SetField128(value); } + } + public Builder SetField128(int value) { + PrepareBuilder(); + result.hasField128 = true; + result.field128_ = value; + return this; + } + public Builder ClearField128() { + PrepareBuilder(); + result.hasField128 = false; + result.field128_ = 0; + return this; + } + + public bool HasField129 { + get { return result.hasField129; } + } + public string Field129 { + get { return result.Field129; } + set { SetField129(value); } + } + public Builder SetField129(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField129 = true; + result.field129_ = value; + return this; + } + public Builder ClearField129() { + PrepareBuilder(); + result.hasField129 = false; + result.field129_ = "xxxxxxxxxxxxxxxxxxxxx"; + return this; + } + + public bool HasField131 { + get { return result.hasField131; } + } + public int Field131 { + get { return result.Field131; } + set { SetField131(value); } + } + public Builder SetField131(int value) { + PrepareBuilder(); + result.hasField131 = true; + result.field131_ = value; + return this; + } + public Builder ClearField131() { + PrepareBuilder(); + result.hasField131 = false; + result.field131_ = 0; + return this; + } + } + static SizeMessage1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SizeMessage1SubMessage : pb::GeneratedMessage { + private SizeMessage1SubMessage() { } + private static readonly SizeMessage1SubMessage defaultInstance = new SizeMessage1SubMessage().MakeReadOnly(); + public static SizeMessage1SubMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SizeMessage1SubMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SizeMessage1SubMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage1SubMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage1SubMessage__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private int field1_; + public bool HasField1 { + get { return hasField1; } + } + public int Field1 { + get { return field1_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private int field2_; + public bool HasField2 { + get { return hasField2; } + } + public int Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private int field3_; + public bool HasField3 { + get { return hasField3; } + } + public int Field3 { + get { return field3_; } + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private string field15_ = ""; + public bool HasField15 { + get { return hasField15; } + } + public string Field15 { + get { return field15_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private bool field12_ = true; + public bool HasField12 { + get { return hasField12; } + } + public bool Field12 { + get { return field12_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private long field13_; + public bool HasField13 { + get { return hasField13; } + } + public long Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private bool hasField14; + private long field14_; + public bool HasField14 { + get { return hasField14; } + } + public long Field14 { + get { return field14_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private int field16_; + public bool HasField16 { + get { return hasField16; } + } + public int Field16 { + get { return field16_; } + } + + public const int Field19FieldNumber = 19; + private bool hasField19; + private int field19_ = 2; + public bool HasField19 { + get { return hasField19; } + } + public int Field19 { + get { return field19_; } + } + + public const int Field20FieldNumber = 20; + private bool hasField20; + private bool field20_ = true; + public bool HasField20 { + get { return hasField20; } + } + public bool Field20 { + get { return field20_; } + } + + public const int Field28FieldNumber = 28; + private bool hasField28; + private bool field28_ = true; + public bool HasField28 { + get { return hasField28; } + } + public bool Field28 { + get { return field28_; } + } + + public const int Field21FieldNumber = 21; + private bool hasField21; + private ulong field21_; + public bool HasField21 { + get { return hasField21; } + } + [global::System.CLSCompliant(false)] + public ulong Field21 { + get { return field21_; } + } + + public const int Field22FieldNumber = 22; + private bool hasField22; + private int field22_; + public bool HasField22 { + get { return hasField22; } + } + public int Field22 { + get { return field22_; } + } + + public const int Field23FieldNumber = 23; + private bool hasField23; + private bool field23_; + public bool HasField23 { + get { return hasField23; } + } + public bool Field23 { + get { return field23_; } + } + + public const int Field206FieldNumber = 206; + private bool hasField206; + private bool field206_; + public bool HasField206 { + get { return hasField206; } + } + public bool Field206 { + get { return field206_; } + } + + public const int Field203FieldNumber = 203; + private bool hasField203; + private uint field203_; + public bool HasField203 { + get { return hasField203; } + } + [global::System.CLSCompliant(false)] + public uint Field203 { + get { return field203_; } + } + + public const int Field204FieldNumber = 204; + private bool hasField204; + private int field204_; + public bool HasField204 { + get { return hasField204; } + } + public int Field204 { + get { return field204_; } + } + + public const int Field205FieldNumber = 205; + private bool hasField205; + private string field205_ = ""; + public bool HasField205 { + get { return hasField205; } + } + public string Field205 { + get { return field205_; } + } + + public const int Field207FieldNumber = 207; + private bool hasField207; + private ulong field207_; + public bool HasField207 { + get { return hasField207; } + } + [global::System.CLSCompliant(false)] + public ulong Field207 { + get { return field207_; } + } + + public const int Field300FieldNumber = 300; + private bool hasField300; + private ulong field300_; + public bool HasField300 { + get { return hasField300; } + } + [global::System.CLSCompliant(false)] + public ulong Field300 { + get { return field300_; } + } + + public static SizeMessage1SubMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SizeMessage1SubMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SizeMessage1SubMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SizeMessage1SubMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SizeMessage1SubMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SizeMessage1SubMessage result; + + private SizeMessage1SubMessage PrepareBuilder() { + if (resultIsReadOnly) { + SizeMessage1SubMessage original = result; + result = new SizeMessage1SubMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SizeMessage1SubMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage.Descriptor; } + } + + public override SizeMessage1SubMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage1SubMessage.DefaultInstance; } + } + + public override SizeMessage1SubMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public int Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(int value) { + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = 0; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public int Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(int value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public int Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(int value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0; + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + public string Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + public Builder SetField15(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = ""; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public bool Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(bool value) { + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = true; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public long Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(long value) { + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = 0L; + return this; + } + + public bool HasField14 { + get { return result.hasField14; } + } + public long Field14 { + get { return result.Field14; } + set { SetField14(value); } + } + public Builder SetField14(long value) { + PrepareBuilder(); + result.hasField14 = true; + result.field14_ = value; + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.hasField14 = false; + result.field14_ = 0L; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public int Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(int value) { + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = 0; + return this; + } + + public bool HasField19 { + get { return result.hasField19; } + } + public int Field19 { + get { return result.Field19; } + set { SetField19(value); } + } + public Builder SetField19(int value) { + PrepareBuilder(); + result.hasField19 = true; + result.field19_ = value; + return this; + } + public Builder ClearField19() { + PrepareBuilder(); + result.hasField19 = false; + result.field19_ = 2; + return this; + } + + public bool HasField20 { + get { return result.hasField20; } + } + public bool Field20 { + get { return result.Field20; } + set { SetField20(value); } + } + public Builder SetField20(bool value) { + PrepareBuilder(); + result.hasField20 = true; + result.field20_ = value; + return this; + } + public Builder ClearField20() { + PrepareBuilder(); + result.hasField20 = false; + result.field20_ = true; + return this; + } + + public bool HasField28 { + get { return result.hasField28; } + } + public bool Field28 { + get { return result.Field28; } + set { SetField28(value); } + } + public Builder SetField28(bool value) { + PrepareBuilder(); + result.hasField28 = true; + result.field28_ = value; + return this; + } + public Builder ClearField28() { + PrepareBuilder(); + result.hasField28 = false; + result.field28_ = true; + return this; + } + + public bool HasField21 { + get { return result.hasField21; } + } + [global::System.CLSCompliant(false)] + public ulong Field21 { + get { return result.Field21; } + set { SetField21(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField21(ulong value) { + PrepareBuilder(); + result.hasField21 = true; + result.field21_ = value; + return this; + } + public Builder ClearField21() { + PrepareBuilder(); + result.hasField21 = false; + result.field21_ = 0; + return this; + } + + public bool HasField22 { + get { return result.hasField22; } + } + public int Field22 { + get { return result.Field22; } + set { SetField22(value); } + } + public Builder SetField22(int value) { + PrepareBuilder(); + result.hasField22 = true; + result.field22_ = value; + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.hasField22 = false; + result.field22_ = 0; + return this; + } + + public bool HasField23 { + get { return result.hasField23; } + } + public bool Field23 { + get { return result.Field23; } + set { SetField23(value); } + } + public Builder SetField23(bool value) { + PrepareBuilder(); + result.hasField23 = true; + result.field23_ = value; + return this; + } + public Builder ClearField23() { + PrepareBuilder(); + result.hasField23 = false; + result.field23_ = false; + return this; + } + + public bool HasField206 { + get { return result.hasField206; } + } + public bool Field206 { + get { return result.Field206; } + set { SetField206(value); } + } + public Builder SetField206(bool value) { + PrepareBuilder(); + result.hasField206 = true; + result.field206_ = value; + return this; + } + public Builder ClearField206() { + PrepareBuilder(); + result.hasField206 = false; + result.field206_ = false; + return this; + } + + public bool HasField203 { + get { return result.hasField203; } + } + [global::System.CLSCompliant(false)] + public uint Field203 { + get { return result.Field203; } + set { SetField203(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField203(uint value) { + PrepareBuilder(); + result.hasField203 = true; + result.field203_ = value; + return this; + } + public Builder ClearField203() { + PrepareBuilder(); + result.hasField203 = false; + result.field203_ = 0; + return this; + } + + public bool HasField204 { + get { return result.hasField204; } + } + public int Field204 { + get { return result.Field204; } + set { SetField204(value); } + } + public Builder SetField204(int value) { + PrepareBuilder(); + result.hasField204 = true; + result.field204_ = value; + return this; + } + public Builder ClearField204() { + PrepareBuilder(); + result.hasField204 = false; + result.field204_ = 0; + return this; + } + + public bool HasField205 { + get { return result.hasField205; } + } + public string Field205 { + get { return result.Field205; } + set { SetField205(value); } + } + public Builder SetField205(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField205 = true; + result.field205_ = value; + return this; + } + public Builder ClearField205() { + PrepareBuilder(); + result.hasField205 = false; + result.field205_ = ""; + return this; + } + + public bool HasField207 { + get { return result.hasField207; } + } + [global::System.CLSCompliant(false)] + public ulong Field207 { + get { return result.Field207; } + set { SetField207(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField207(ulong value) { + PrepareBuilder(); + result.hasField207 = true; + result.field207_ = value; + return this; + } + public Builder ClearField207() { + PrepareBuilder(); + result.hasField207 = false; + result.field207_ = 0UL; + return this; + } + + public bool HasField300 { + get { return result.hasField300; } + } + [global::System.CLSCompliant(false)] + public ulong Field300 { + get { return result.Field300; } + set { SetField300(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField300(ulong value) { + PrepareBuilder(); + result.hasField300 = true; + result.field300_ = value; + return this; + } + public Builder ClearField300() { + PrepareBuilder(); + result.hasField300 = false; + result.field300_ = 0UL; + return this; + } + } + static SizeMessage1SubMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SizeMessage2 : pb::GeneratedMessage { + private SizeMessage2() { } + private static readonly SizeMessage2 defaultInstance = new SizeMessage2().MakeReadOnly(); + public static SizeMessage2 DefaultInstance { + get { return defaultInstance; } + } + + public override SizeMessage2 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SizeMessage2 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage2__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage2__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Group1 : pb::GeneratedMessage { + private Group1() { } + private static readonly Group1 defaultInstance = new Group1().MakeReadOnly(); + public static Group1 DefaultInstance { + get { return defaultInstance; } + } + + public override Group1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Group1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage2_Group1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage2_Group1__FieldAccessorTable; } + } + + public const int Field11FieldNumber = 11; + private bool hasField11; + private float field11_; + public bool HasField11 { + get { return hasField11; } + } + public float Field11 { + get { return field11_; } + } + + public const int Field26FieldNumber = 26; + private bool hasField26; + private float field26_; + public bool HasField26 { + get { return hasField26; } + } + public float Field26 { + get { return field26_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private string field12_ = ""; + public bool HasField12 { + get { return hasField12; } + } + public string Field12 { + get { return field12_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private string field13_ = ""; + public bool HasField13 { + get { return hasField13; } + } + public string Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private pbc::PopsicleList field14_ = new pbc::PopsicleList(); + public scg::IList Field14List { + get { return pbc::Lists.AsReadOnly(field14_); } + } + public int Field14Count { + get { return field14_.Count; } + } + public string GetField14(int index) { + return field14_[index]; + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private ulong field15_; + public bool HasField15 { + get { return hasField15; } + } + [global::System.CLSCompliant(false)] + public ulong Field15 { + get { return field15_; } + } + + public const int Field5FieldNumber = 5; + private bool hasField5; + private int field5_; + public bool HasField5 { + get { return hasField5; } + } + public int Field5 { + get { return field5_; } + } + + public const int Field27FieldNumber = 27; + private bool hasField27; + private string field27_ = ""; + public bool HasField27 { + get { return hasField27; } + } + public string Field27 { + get { return field27_; } + } + + public const int Field28FieldNumber = 28; + private bool hasField28; + private int field28_; + public bool HasField28 { + get { return hasField28; } + } + public int Field28 { + get { return field28_; } + } + + public const int Field29FieldNumber = 29; + private bool hasField29; + private string field29_ = ""; + public bool HasField29 { + get { return hasField29; } + } + public string Field29 { + get { return field29_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private string field16_ = ""; + public bool HasField16 { + get { return hasField16; } + } + public string Field16 { + get { return field16_; } + } + + public const int Field22FieldNumber = 22; + private pbc::PopsicleList field22_ = new pbc::PopsicleList(); + public scg::IList Field22List { + get { return pbc::Lists.AsReadOnly(field22_); } + } + public int Field22Count { + get { return field22_.Count; } + } + public string GetField22(int index) { + return field22_[index]; + } + + public const int Field73FieldNumber = 73; + private pbc::PopsicleList field73_ = new pbc::PopsicleList(); + public scg::IList Field73List { + get { return pbc::Lists.AsReadOnly(field73_); } + } + public int Field73Count { + get { return field73_.Count; } + } + public int GetField73(int index) { + return field73_[index]; + } + + public const int Field20FieldNumber = 20; + private bool hasField20; + private int field20_; + public bool HasField20 { + get { return hasField20; } + } + public int Field20 { + get { return field20_; } + } + + public const int Field24FieldNumber = 24; + private bool hasField24; + private string field24_ = ""; + public bool HasField24 { + get { return hasField24; } + } + public string Field24 { + get { return field24_; } + } + + public const int Field31FieldNumber = 31; + private bool hasField31; + private global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage field31_; + public bool HasField31 { + get { return hasField31; } + } + public global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage Field31 { + get { return field31_ ?? global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage.DefaultInstance; } + } + + public static Group1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Group1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Group1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Group1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Group1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Group1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Group1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Group1 MakeReadOnly() { + field14_.MakeReadOnly(); + field22_.MakeReadOnly(); + field73_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Group1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Group1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Group1 result; + + private Group1 PrepareBuilder() { + if (resultIsReadOnly) { + Group1 original = result; + result = new Group1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Group1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.Types.Group1.Descriptor; } + } + + public override Group1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.Types.Group1.DefaultInstance; } + } + + public override Group1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField11 { + get { return result.hasField11; } + } + public float Field11 { + get { return result.Field11; } + set { SetField11(value); } + } + public Builder SetField11(float value) { + PrepareBuilder(); + result.hasField11 = true; + result.field11_ = value; + return this; + } + public Builder ClearField11() { + PrepareBuilder(); + result.hasField11 = false; + result.field11_ = 0F; + return this; + } + + public bool HasField26 { + get { return result.hasField26; } + } + public float Field26 { + get { return result.Field26; } + set { SetField26(value); } + } + public Builder SetField26(float value) { + PrepareBuilder(); + result.hasField26 = true; + result.field26_ = value; + return this; + } + public Builder ClearField26() { + PrepareBuilder(); + result.hasField26 = false; + result.field26_ = 0F; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public string Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = ""; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public string Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = ""; + return this; + } + + public pbc::IPopsicleList Field14List { + get { return PrepareBuilder().field14_; } + } + public int Field14Count { + get { return result.Field14Count; } + } + public string GetField14(int index) { + return result.GetField14(index); + } + public Builder SetField14(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field14_[index] = value; + return this; + } + public Builder AddField14(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field14_.Add(value); + return this; + } + public Builder AddRangeField14(scg::IEnumerable values) { + PrepareBuilder(); + result.field14_.Add(values); + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.field14_.Clear(); + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + [global::System.CLSCompliant(false)] + public ulong Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField15(ulong value) { + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = 0UL; + return this; + } + + public bool HasField5 { + get { return result.hasField5; } + } + public int Field5 { + get { return result.Field5; } + set { SetField5(value); } + } + public Builder SetField5(int value) { + PrepareBuilder(); + result.hasField5 = true; + result.field5_ = value; + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.hasField5 = false; + result.field5_ = 0; + return this; + } + + public bool HasField27 { + get { return result.hasField27; } + } + public string Field27 { + get { return result.Field27; } + set { SetField27(value); } + } + public Builder SetField27(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField27 = true; + result.field27_ = value; + return this; + } + public Builder ClearField27() { + PrepareBuilder(); + result.hasField27 = false; + result.field27_ = ""; + return this; + } + + public bool HasField28 { + get { return result.hasField28; } + } + public int Field28 { + get { return result.Field28; } + set { SetField28(value); } + } + public Builder SetField28(int value) { + PrepareBuilder(); + result.hasField28 = true; + result.field28_ = value; + return this; + } + public Builder ClearField28() { + PrepareBuilder(); + result.hasField28 = false; + result.field28_ = 0; + return this; + } + + public bool HasField29 { + get { return result.hasField29; } + } + public string Field29 { + get { return result.Field29; } + set { SetField29(value); } + } + public Builder SetField29(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField29 = true; + result.field29_ = value; + return this; + } + public Builder ClearField29() { + PrepareBuilder(); + result.hasField29 = false; + result.field29_ = ""; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public string Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = ""; + return this; + } + + public pbc::IPopsicleList Field22List { + get { return PrepareBuilder().field22_; } + } + public int Field22Count { + get { return result.Field22Count; } + } + public string GetField22(int index) { + return result.GetField22(index); + } + public Builder SetField22(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field22_[index] = value; + return this; + } + public Builder AddField22(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field22_.Add(value); + return this; + } + public Builder AddRangeField22(scg::IEnumerable values) { + PrepareBuilder(); + result.field22_.Add(values); + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.field22_.Clear(); + return this; + } + + public pbc::IPopsicleList Field73List { + get { return PrepareBuilder().field73_; } + } + public int Field73Count { + get { return result.Field73Count; } + } + public int GetField73(int index) { + return result.GetField73(index); + } + public Builder SetField73(int index, int value) { + PrepareBuilder(); + result.field73_[index] = value; + return this; + } + public Builder AddField73(int value) { + PrepareBuilder(); + result.field73_.Add(value); + return this; + } + public Builder AddRangeField73(scg::IEnumerable values) { + PrepareBuilder(); + result.field73_.Add(values); + return this; + } + public Builder ClearField73() { + PrepareBuilder(); + result.field73_.Clear(); + return this; + } + + public bool HasField20 { + get { return result.hasField20; } + } + public int Field20 { + get { return result.Field20; } + set { SetField20(value); } + } + public Builder SetField20(int value) { + PrepareBuilder(); + result.hasField20 = true; + result.field20_ = value; + return this; + } + public Builder ClearField20() { + PrepareBuilder(); + result.hasField20 = false; + result.field20_ = 0; + return this; + } + + public bool HasField24 { + get { return result.hasField24; } + } + public string Field24 { + get { return result.Field24; } + set { SetField24(value); } + } + public Builder SetField24(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField24 = true; + result.field24_ = value; + return this; + } + public Builder ClearField24() { + PrepareBuilder(); + result.hasField24 = false; + result.field24_ = ""; + return this; + } + + public bool HasField31 { + get { return result.hasField31; } + } + public global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage Field31 { + get { return result.Field31; } + set { SetField31(value); } + } + public Builder SetField31(global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField31 = true; + result.field31_ = value; + return this; + } + public Builder SetField31(global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasField31 = true; + result.field31_ = builderForValue.Build(); + return this; + } + public Builder MergeField31(global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasField31 && + result.field31_ != global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage.DefaultInstance) { + result.field31_ = global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage.CreateBuilder(result.field31_).MergeFrom(value).BuildPartial(); + } else { + result.field31_ = value; + } + result.hasField31 = true; + return this; + } + public Builder ClearField31() { + PrepareBuilder(); + result.hasField31 = false; + result.field31_ = null; + return this; + } + } + static Group1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int Field1FieldNumber = 1; + private bool hasField1; + private string field1_ = ""; + public bool HasField1 { + get { return hasField1; } + } + public string Field1 { + get { return field1_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private long field3_; + public bool HasField3 { + get { return hasField3; } + } + public long Field3 { + get { return field3_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private long field4_; + public bool HasField4 { + get { return hasField4; } + } + public long Field4 { + get { return field4_; } + } + + public const int Field30FieldNumber = 30; + private bool hasField30; + private long field30_; + public bool HasField30 { + get { return hasField30; } + } + public long Field30 { + get { return field30_; } + } + + public const int Field75FieldNumber = 75; + private bool hasField75; + private bool field75_; + public bool HasField75 { + get { return hasField75; } + } + public bool Field75 { + get { return field75_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private string field6_ = ""; + public bool HasField6 { + get { return hasField6; } + } + public string Field6 { + get { return field6_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private pb::ByteString field2_ = pb::ByteString.Empty; + public bool HasField2 { + get { return hasField2; } + } + public pb::ByteString Field2 { + get { return field2_; } + } + + public const int Field21FieldNumber = 21; + private bool hasField21; + private int field21_; + public bool HasField21 { + get { return hasField21; } + } + public int Field21 { + get { return field21_; } + } + + public const int Field71FieldNumber = 71; + private bool hasField71; + private int field71_; + public bool HasField71 { + get { return hasField71; } + } + public int Field71 { + get { return field71_; } + } + + public const int Field25FieldNumber = 25; + private bool hasField25; + private float field25_; + public bool HasField25 { + get { return hasField25; } + } + public float Field25 { + get { return field25_; } + } + + public const int Field109FieldNumber = 109; + private bool hasField109; + private int field109_; + public bool HasField109 { + get { return hasField109; } + } + public int Field109 { + get { return field109_; } + } + + public const int Field210FieldNumber = 210; + private bool hasField210; + private int field210_; + public bool HasField210 { + get { return hasField210; } + } + public int Field210 { + get { return field210_; } + } + + public const int Field211FieldNumber = 211; + private bool hasField211; + private int field211_; + public bool HasField211 { + get { return hasField211; } + } + public int Field211 { + get { return field211_; } + } + + public const int Field212FieldNumber = 212; + private bool hasField212; + private int field212_; + public bool HasField212 { + get { return hasField212; } + } + public int Field212 { + get { return field212_; } + } + + public const int Field213FieldNumber = 213; + private bool hasField213; + private int field213_; + public bool HasField213 { + get { return hasField213; } + } + public int Field213 { + get { return field213_; } + } + + public const int Field216FieldNumber = 216; + private bool hasField216; + private int field216_; + public bool HasField216 { + get { return hasField216; } + } + public int Field216 { + get { return field216_; } + } + + public const int Field217FieldNumber = 217; + private bool hasField217; + private int field217_; + public bool HasField217 { + get { return hasField217; } + } + public int Field217 { + get { return field217_; } + } + + public const int Field218FieldNumber = 218; + private bool hasField218; + private int field218_; + public bool HasField218 { + get { return hasField218; } + } + public int Field218 { + get { return field218_; } + } + + public const int Field220FieldNumber = 220; + private bool hasField220; + private int field220_; + public bool HasField220 { + get { return hasField220; } + } + public int Field220 { + get { return field220_; } + } + + public const int Field221FieldNumber = 221; + private bool hasField221; + private int field221_; + public bool HasField221 { + get { return hasField221; } + } + public int Field221 { + get { return field221_; } + } + + public const int Field222FieldNumber = 222; + private bool hasField222; + private float field222_; + public bool HasField222 { + get { return hasField222; } + } + public float Field222 { + get { return field222_; } + } + + public const int Field63FieldNumber = 63; + private bool hasField63; + private int field63_; + public bool HasField63 { + get { return hasField63; } + } + public int Field63 { + get { return field63_; } + } + + public const int Group1FieldNumber = 10; + private pbc::PopsicleList group1_ = new pbc::PopsicleList(); + public scg::IList Group1List { + get { return group1_; } + } + public int Group1Count { + get { return group1_.Count; } + } + public global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.Types.Group1 GetGroup1(int index) { + return group1_[index]; + } + + public const int Field128FieldNumber = 128; + private pbc::PopsicleList field128_ = new pbc::PopsicleList(); + public scg::IList Field128List { + get { return pbc::Lists.AsReadOnly(field128_); } + } + public int Field128Count { + get { return field128_.Count; } + } + public string GetField128(int index) { + return field128_[index]; + } + + public const int Field131FieldNumber = 131; + private bool hasField131; + private long field131_; + public bool HasField131 { + get { return hasField131; } + } + public long Field131 { + get { return field131_; } + } + + public const int Field127FieldNumber = 127; + private pbc::PopsicleList field127_ = new pbc::PopsicleList(); + public scg::IList Field127List { + get { return pbc::Lists.AsReadOnly(field127_); } + } + public int Field127Count { + get { return field127_.Count; } + } + public string GetField127(int index) { + return field127_[index]; + } + + public const int Field129FieldNumber = 129; + private bool hasField129; + private int field129_; + public bool HasField129 { + get { return hasField129; } + } + public int Field129 { + get { return field129_; } + } + + public const int Field130FieldNumber = 130; + private pbc::PopsicleList field130_ = new pbc::PopsicleList(); + public scg::IList Field130List { + get { return pbc::Lists.AsReadOnly(field130_); } + } + public int Field130Count { + get { return field130_.Count; } + } + public long GetField130(int index) { + return field130_[index]; + } + + public const int Field205FieldNumber = 205; + private bool hasField205; + private bool field205_; + public bool HasField205 { + get { return hasField205; } + } + public bool Field205 { + get { return field205_; } + } + + public const int Field206FieldNumber = 206; + private bool hasField206; + private bool field206_; + public bool HasField206 { + get { return hasField206; } + } + public bool Field206 { + get { return field206_; } + } + + public static SizeMessage2 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SizeMessage2 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SizeMessage2 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SizeMessage2 MakeReadOnly() { + group1_.MakeReadOnly(); + field128_.MakeReadOnly(); + field127_.MakeReadOnly(); + field130_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SizeMessage2 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SizeMessage2 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SizeMessage2 result; + + private SizeMessage2 PrepareBuilder() { + if (resultIsReadOnly) { + SizeMessage2 original = result; + result = new SizeMessage2(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SizeMessage2 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.Descriptor; } + } + + public override SizeMessage2 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.DefaultInstance; } + } + + public override SizeMessage2 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public string Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = ""; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public long Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(long value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0L; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public long Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(long value) { + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = 0L; + return this; + } + + public bool HasField30 { + get { return result.hasField30; } + } + public long Field30 { + get { return result.Field30; } + set { SetField30(value); } + } + public Builder SetField30(long value) { + PrepareBuilder(); + result.hasField30 = true; + result.field30_ = value; + return this; + } + public Builder ClearField30() { + PrepareBuilder(); + result.hasField30 = false; + result.field30_ = 0L; + return this; + } + + public bool HasField75 { + get { return result.hasField75; } + } + public bool Field75 { + get { return result.Field75; } + set { SetField75(value); } + } + public Builder SetField75(bool value) { + PrepareBuilder(); + result.hasField75 = true; + result.field75_ = value; + return this; + } + public Builder ClearField75() { + PrepareBuilder(); + result.hasField75 = false; + result.field75_ = false; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public string Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = ""; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public pb::ByteString Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = pb::ByteString.Empty; + return this; + } + + public bool HasField21 { + get { return result.hasField21; } + } + public int Field21 { + get { return result.Field21; } + set { SetField21(value); } + } + public Builder SetField21(int value) { + PrepareBuilder(); + result.hasField21 = true; + result.field21_ = value; + return this; + } + public Builder ClearField21() { + PrepareBuilder(); + result.hasField21 = false; + result.field21_ = 0; + return this; + } + + public bool HasField71 { + get { return result.hasField71; } + } + public int Field71 { + get { return result.Field71; } + set { SetField71(value); } + } + public Builder SetField71(int value) { + PrepareBuilder(); + result.hasField71 = true; + result.field71_ = value; + return this; + } + public Builder ClearField71() { + PrepareBuilder(); + result.hasField71 = false; + result.field71_ = 0; + return this; + } + + public bool HasField25 { + get { return result.hasField25; } + } + public float Field25 { + get { return result.Field25; } + set { SetField25(value); } + } + public Builder SetField25(float value) { + PrepareBuilder(); + result.hasField25 = true; + result.field25_ = value; + return this; + } + public Builder ClearField25() { + PrepareBuilder(); + result.hasField25 = false; + result.field25_ = 0F; + return this; + } + + public bool HasField109 { + get { return result.hasField109; } + } + public int Field109 { + get { return result.Field109; } + set { SetField109(value); } + } + public Builder SetField109(int value) { + PrepareBuilder(); + result.hasField109 = true; + result.field109_ = value; + return this; + } + public Builder ClearField109() { + PrepareBuilder(); + result.hasField109 = false; + result.field109_ = 0; + return this; + } + + public bool HasField210 { + get { return result.hasField210; } + } + public int Field210 { + get { return result.Field210; } + set { SetField210(value); } + } + public Builder SetField210(int value) { + PrepareBuilder(); + result.hasField210 = true; + result.field210_ = value; + return this; + } + public Builder ClearField210() { + PrepareBuilder(); + result.hasField210 = false; + result.field210_ = 0; + return this; + } + + public bool HasField211 { + get { return result.hasField211; } + } + public int Field211 { + get { return result.Field211; } + set { SetField211(value); } + } + public Builder SetField211(int value) { + PrepareBuilder(); + result.hasField211 = true; + result.field211_ = value; + return this; + } + public Builder ClearField211() { + PrepareBuilder(); + result.hasField211 = false; + result.field211_ = 0; + return this; + } + + public bool HasField212 { + get { return result.hasField212; } + } + public int Field212 { + get { return result.Field212; } + set { SetField212(value); } + } + public Builder SetField212(int value) { + PrepareBuilder(); + result.hasField212 = true; + result.field212_ = value; + return this; + } + public Builder ClearField212() { + PrepareBuilder(); + result.hasField212 = false; + result.field212_ = 0; + return this; + } + + public bool HasField213 { + get { return result.hasField213; } + } + public int Field213 { + get { return result.Field213; } + set { SetField213(value); } + } + public Builder SetField213(int value) { + PrepareBuilder(); + result.hasField213 = true; + result.field213_ = value; + return this; + } + public Builder ClearField213() { + PrepareBuilder(); + result.hasField213 = false; + result.field213_ = 0; + return this; + } + + public bool HasField216 { + get { return result.hasField216; } + } + public int Field216 { + get { return result.Field216; } + set { SetField216(value); } + } + public Builder SetField216(int value) { + PrepareBuilder(); + result.hasField216 = true; + result.field216_ = value; + return this; + } + public Builder ClearField216() { + PrepareBuilder(); + result.hasField216 = false; + result.field216_ = 0; + return this; + } + + public bool HasField217 { + get { return result.hasField217; } + } + public int Field217 { + get { return result.Field217; } + set { SetField217(value); } + } + public Builder SetField217(int value) { + PrepareBuilder(); + result.hasField217 = true; + result.field217_ = value; + return this; + } + public Builder ClearField217() { + PrepareBuilder(); + result.hasField217 = false; + result.field217_ = 0; + return this; + } + + public bool HasField218 { + get { return result.hasField218; } + } + public int Field218 { + get { return result.Field218; } + set { SetField218(value); } + } + public Builder SetField218(int value) { + PrepareBuilder(); + result.hasField218 = true; + result.field218_ = value; + return this; + } + public Builder ClearField218() { + PrepareBuilder(); + result.hasField218 = false; + result.field218_ = 0; + return this; + } + + public bool HasField220 { + get { return result.hasField220; } + } + public int Field220 { + get { return result.Field220; } + set { SetField220(value); } + } + public Builder SetField220(int value) { + PrepareBuilder(); + result.hasField220 = true; + result.field220_ = value; + return this; + } + public Builder ClearField220() { + PrepareBuilder(); + result.hasField220 = false; + result.field220_ = 0; + return this; + } + + public bool HasField221 { + get { return result.hasField221; } + } + public int Field221 { + get { return result.Field221; } + set { SetField221(value); } + } + public Builder SetField221(int value) { + PrepareBuilder(); + result.hasField221 = true; + result.field221_ = value; + return this; + } + public Builder ClearField221() { + PrepareBuilder(); + result.hasField221 = false; + result.field221_ = 0; + return this; + } + + public bool HasField222 { + get { return result.hasField222; } + } + public float Field222 { + get { return result.Field222; } + set { SetField222(value); } + } + public Builder SetField222(float value) { + PrepareBuilder(); + result.hasField222 = true; + result.field222_ = value; + return this; + } + public Builder ClearField222() { + PrepareBuilder(); + result.hasField222 = false; + result.field222_ = 0F; + return this; + } + + public bool HasField63 { + get { return result.hasField63; } + } + public int Field63 { + get { return result.Field63; } + set { SetField63(value); } + } + public Builder SetField63(int value) { + PrepareBuilder(); + result.hasField63 = true; + result.field63_ = value; + return this; + } + public Builder ClearField63() { + PrepareBuilder(); + result.hasField63 = false; + result.field63_ = 0; + return this; + } + + public pbc::IPopsicleList Group1List { + get { return PrepareBuilder().group1_; } + } + public int Group1Count { + get { return result.Group1Count; } + } + public global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.Types.Group1 GetGroup1(int index) { + return result.GetGroup1(index); + } + public Builder SetGroup1(int index, global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.Types.Group1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.group1_[index] = value; + return this; + } + public Builder SetGroup1(int index, global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.Types.Group1.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.group1_[index] = builderForValue.Build(); + return this; + } + public Builder AddGroup1(global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.Types.Group1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.group1_.Add(value); + return this; + } + public Builder AddGroup1(global::Google.ProtocolBuffers.ProtoBench.SizeMessage2.Types.Group1.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.group1_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeGroup1(scg::IEnumerable values) { + PrepareBuilder(); + result.group1_.Add(values); + return this; + } + public Builder ClearGroup1() { + PrepareBuilder(); + result.group1_.Clear(); + return this; + } + + public pbc::IPopsicleList Field128List { + get { return PrepareBuilder().field128_; } + } + public int Field128Count { + get { return result.Field128Count; } + } + public string GetField128(int index) { + return result.GetField128(index); + } + public Builder SetField128(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field128_[index] = value; + return this; + } + public Builder AddField128(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field128_.Add(value); + return this; + } + public Builder AddRangeField128(scg::IEnumerable values) { + PrepareBuilder(); + result.field128_.Add(values); + return this; + } + public Builder ClearField128() { + PrepareBuilder(); + result.field128_.Clear(); + return this; + } + + public bool HasField131 { + get { return result.hasField131; } + } + public long Field131 { + get { return result.Field131; } + set { SetField131(value); } + } + public Builder SetField131(long value) { + PrepareBuilder(); + result.hasField131 = true; + result.field131_ = value; + return this; + } + public Builder ClearField131() { + PrepareBuilder(); + result.hasField131 = false; + result.field131_ = 0L; + return this; + } + + public pbc::IPopsicleList Field127List { + get { return PrepareBuilder().field127_; } + } + public int Field127Count { + get { return result.Field127Count; } + } + public string GetField127(int index) { + return result.GetField127(index); + } + public Builder SetField127(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field127_[index] = value; + return this; + } + public Builder AddField127(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field127_.Add(value); + return this; + } + public Builder AddRangeField127(scg::IEnumerable values) { + PrepareBuilder(); + result.field127_.Add(values); + return this; + } + public Builder ClearField127() { + PrepareBuilder(); + result.field127_.Clear(); + return this; + } + + public bool HasField129 { + get { return result.hasField129; } + } + public int Field129 { + get { return result.Field129; } + set { SetField129(value); } + } + public Builder SetField129(int value) { + PrepareBuilder(); + result.hasField129 = true; + result.field129_ = value; + return this; + } + public Builder ClearField129() { + PrepareBuilder(); + result.hasField129 = false; + result.field129_ = 0; + return this; + } + + public pbc::IPopsicleList Field130List { + get { return PrepareBuilder().field130_; } + } + public int Field130Count { + get { return result.Field130Count; } + } + public long GetField130(int index) { + return result.GetField130(index); + } + public Builder SetField130(int index, long value) { + PrepareBuilder(); + result.field130_[index] = value; + return this; + } + public Builder AddField130(long value) { + PrepareBuilder(); + result.field130_.Add(value); + return this; + } + public Builder AddRangeField130(scg::IEnumerable values) { + PrepareBuilder(); + result.field130_.Add(values); + return this; + } + public Builder ClearField130() { + PrepareBuilder(); + result.field130_.Clear(); + return this; + } + + public bool HasField205 { + get { return result.hasField205; } + } + public bool Field205 { + get { return result.Field205; } + set { SetField205(value); } + } + public Builder SetField205(bool value) { + PrepareBuilder(); + result.hasField205 = true; + result.field205_ = value; + return this; + } + public Builder ClearField205() { + PrepareBuilder(); + result.hasField205 = false; + result.field205_ = false; + return this; + } + + public bool HasField206 { + get { return result.hasField206; } + } + public bool Field206 { + get { return result.Field206; } + set { SetField206(value); } + } + public Builder SetField206(bool value) { + PrepareBuilder(); + result.hasField206 = true; + result.field206_ = value; + return this; + } + public Builder ClearField206() { + PrepareBuilder(); + result.hasField206 = false; + result.field206_ = false; + return this; + } + } + static SizeMessage2() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SizeMessage2GroupedMessage : pb::GeneratedMessage { + private SizeMessage2GroupedMessage() { } + private static readonly SizeMessage2GroupedMessage defaultInstance = new SizeMessage2GroupedMessage().MakeReadOnly(); + public static SizeMessage2GroupedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SizeMessage2GroupedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SizeMessage2GroupedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage2GroupedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.internal__static_benchmarks_SizeMessage2GroupedMessage__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private float field1_; + public bool HasField1 { + get { return hasField1; } + } + public float Field1 { + get { return field1_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private float field2_; + public bool HasField2 { + get { return hasField2; } + } + public float Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private float field3_; + public bool HasField3 { + get { return hasField3; } + } + public float Field3 { + get { return field3_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private bool field4_; + public bool HasField4 { + get { return hasField4; } + } + public bool Field4 { + get { return field4_; } + } + + public const int Field5FieldNumber = 5; + private bool hasField5; + private bool field5_; + public bool HasField5 { + get { return hasField5; } + } + public bool Field5 { + get { return field5_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private bool field6_ = true; + public bool HasField6 { + get { return hasField6; } + } + public bool Field6 { + get { return field6_; } + } + + public const int Field7FieldNumber = 7; + private bool hasField7; + private bool field7_; + public bool HasField7 { + get { return hasField7; } + } + public bool Field7 { + get { return field7_; } + } + + public const int Field8FieldNumber = 8; + private bool hasField8; + private float field8_; + public bool HasField8 { + get { return hasField8; } + } + public float Field8 { + get { return field8_; } + } + + public const int Field9FieldNumber = 9; + private bool hasField9; + private bool field9_; + public bool HasField9 { + get { return hasField9; } + } + public bool Field9 { + get { return field9_; } + } + + public const int Field10FieldNumber = 10; + private bool hasField10; + private float field10_; + public bool HasField10 { + get { return hasField10; } + } + public float Field10 { + get { return field10_; } + } + + public const int Field11FieldNumber = 11; + private bool hasField11; + private long field11_; + public bool HasField11 { + get { return hasField11; } + } + public long Field11 { + get { return field11_; } + } + + public static SizeMessage2GroupedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SizeMessage2GroupedMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SizeMessage2GroupedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SizeMessage2GroupedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SizeMessage2GroupedMessage result; + + private SizeMessage2GroupedMessage PrepareBuilder() { + if (resultIsReadOnly) { + SizeMessage2GroupedMessage original = result; + result = new SizeMessage2GroupedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SizeMessage2GroupedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage.Descriptor; } + } + + public override SizeMessage2GroupedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SizeMessage2GroupedMessage.DefaultInstance; } + } + + public override SizeMessage2GroupedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public float Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(float value) { + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = 0F; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public float Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(float value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0F; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public float Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(float value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0F; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public bool Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(bool value) { + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = false; + return this; + } + + public bool HasField5 { + get { return result.hasField5; } + } + public bool Field5 { + get { return result.Field5; } + set { SetField5(value); } + } + public Builder SetField5(bool value) { + PrepareBuilder(); + result.hasField5 = true; + result.field5_ = value; + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.hasField5 = false; + result.field5_ = false; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public bool Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(bool value) { + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = true; + return this; + } + + public bool HasField7 { + get { return result.hasField7; } + } + public bool Field7 { + get { return result.Field7; } + set { SetField7(value); } + } + public Builder SetField7(bool value) { + PrepareBuilder(); + result.hasField7 = true; + result.field7_ = value; + return this; + } + public Builder ClearField7() { + PrepareBuilder(); + result.hasField7 = false; + result.field7_ = false; + return this; + } + + public bool HasField8 { + get { return result.hasField8; } + } + public float Field8 { + get { return result.Field8; } + set { SetField8(value); } + } + public Builder SetField8(float value) { + PrepareBuilder(); + result.hasField8 = true; + result.field8_ = value; + return this; + } + public Builder ClearField8() { + PrepareBuilder(); + result.hasField8 = false; + result.field8_ = 0F; + return this; + } + + public bool HasField9 { + get { return result.hasField9; } + } + public bool Field9 { + get { return result.Field9; } + set { SetField9(value); } + } + public Builder SetField9(bool value) { + PrepareBuilder(); + result.hasField9 = true; + result.field9_ = value; + return this; + } + public Builder ClearField9() { + PrepareBuilder(); + result.hasField9 = false; + result.field9_ = false; + return this; + } + + public bool HasField10 { + get { return result.hasField10; } + } + public float Field10 { + get { return result.Field10; } + set { SetField10(value); } + } + public Builder SetField10(float value) { + PrepareBuilder(); + result.hasField10 = true; + result.field10_ = value; + return this; + } + public Builder ClearField10() { + PrepareBuilder(); + result.hasField10 = false; + result.field10_ = 0F; + return this; + } + + public bool HasField11 { + get { return result.hasField11; } + } + public long Field11 { + get { return result.Field11; } + set { SetField11(value); } + } + public Builder SetField11(long value) { + PrepareBuilder(); + result.hasField11 = true; + result.field11_ = value; + return this; + } + public Builder ClearField11() { + PrepareBuilder(); + result.hasField11 = false; + result.field11_ = 0L; + return this; + } + } + static SizeMessage2GroupedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSizeProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtoBench/TestProtos/GoogleSpeedProtoFile.cs b/csharp/src/ProtoBench/TestProtos/GoogleSpeedProtoFile.cs new file mode 100644 index 00000000..3a18950f --- /dev/null +++ b/csharp/src/ProtoBench/TestProtos/GoogleSpeedProtoFile.cs @@ -0,0 +1,6637 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.ProtoBench { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class GoogleSpeedProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_benchmarks_SpeedMessage1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SpeedMessage1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_benchmarks_SpeedMessage1SubMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SpeedMessage1SubMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_benchmarks_SpeedMessage2__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SpeedMessage2__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_benchmarks_SpeedMessage2_Group1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SpeedMessage2_Group1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_benchmarks_SpeedMessage2GroupedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_benchmarks_SpeedMessage2GroupedMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static GoogleSpeedProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch1iZW5jaG1hcmtzL2dvb2dsZV9zcGVlZC5wcm90bxIKYmVuY2htYXJrcxok", + "Z29vZ2xlL3Byb3RvYnVmL2NzaGFycF9vcHRpb25zLnByb3RvIvgGCg1TcGVl", + "ZE1lc3NhZ2UxEg4KBmZpZWxkMRgBIAIoCRIOCgZmaWVsZDkYCSABKAkSDwoH", + "ZmllbGQxOBgSIAEoCRIWCgdmaWVsZDgwGFAgASgIOgVmYWxzZRIVCgdmaWVs", + "ZDgxGFEgASgIOgR0cnVlEg4KBmZpZWxkMhgCIAIoBRIOCgZmaWVsZDMYAyAC", + "KAUSEQoIZmllbGQyODAYmAIgASgFEhEKBmZpZWxkNhgGIAEoBToBMBIPCgdm", + "aWVsZDIyGBYgASgDEg4KBmZpZWxkNBgEIAEoCRIOCgZmaWVsZDUYBSADKAYS", + "FgoHZmllbGQ1ORg7IAEoCDoFZmFsc2USDgoGZmllbGQ3GAcgASgJEg8KB2Zp", + "ZWxkMTYYECABKAUSFAoIZmllbGQxMzAYggEgASgFOgEwEhUKB2ZpZWxkMTIY", + "DCABKAg6BHRydWUSFQoHZmllbGQxNxgRIAEoCDoEdHJ1ZRIVCgdmaWVsZDEz", + "GA0gASgIOgR0cnVlEhUKB2ZpZWxkMTQYDiABKAg6BHRydWUSEwoIZmllbGQx", + "MDQYaCABKAU6ATASEwoIZmllbGQxMDAYZCABKAU6ATASEwoIZmllbGQxMDEY", + "ZSABKAU6ATASEAoIZmllbGQxMDIYZiABKAkSEAoIZmllbGQxMDMYZyABKAkS", + "EgoHZmllbGQyORgdIAEoBToBMBIWCgdmaWVsZDMwGB4gASgIOgVmYWxzZRIT", + "CgdmaWVsZDYwGDwgASgFOgItMRIVCghmaWVsZDI3MRiPAiABKAU6Ai0xEhUK", + "CGZpZWxkMjcyGJACIAEoBToCLTESEQoIZmllbGQxNTAYlgEgASgFEhIKB2Zp", + "ZWxkMjMYFyABKAU6ATASFgoHZmllbGQyNBgYIAEoCDoFZmFsc2USEgoHZmll", + "bGQyNRgZIAEoBToBMBI0CgdmaWVsZDE1GA8gASgLMiMuYmVuY2htYXJrcy5T", + "cGVlZE1lc3NhZ2UxU3ViTWVzc2FnZRIPCgdmaWVsZDc4GE4gASgIEhIKB2Zp", + "ZWxkNjcYQyABKAU6ATASDwoHZmllbGQ2OBhEIAEoBRIUCghmaWVsZDEyOBiA", + "ASABKAU6ATASKAoIZmllbGQxMjkYgQEgASgJOhV4eHh4eHh4eHh4eHh4eHh4", + "eHh4eHgSFAoIZmllbGQxMzEYgwEgASgFOgEwIqIDChdTcGVlZE1lc3NhZ2Ux", + "U3ViTWVzc2FnZRIRCgZmaWVsZDEYASABKAU6ATASEQoGZmllbGQyGAIgASgF", + "OgEwEhEKBmZpZWxkMxgDIAEoBToBMBIPCgdmaWVsZDE1GA8gASgJEhUKB2Zp", + "ZWxkMTIYDCABKAg6BHRydWUSDwoHZmllbGQxMxgNIAEoAxIPCgdmaWVsZDE0", + "GA4gASgDEg8KB2ZpZWxkMTYYECABKAUSEgoHZmllbGQxORgTIAEoBToBMhIV", + "CgdmaWVsZDIwGBQgASgIOgR0cnVlEhUKB2ZpZWxkMjgYHCABKAg6BHRydWUS", + "DwoHZmllbGQyMRgVIAEoBhIPCgdmaWVsZDIyGBYgASgFEhYKB2ZpZWxkMjMY", + "FyABKAg6BWZhbHNlEhgKCGZpZWxkMjA2GM4BIAEoCDoFZmFsc2USEQoIZmll", + "bGQyMDMYywEgASgHEhEKCGZpZWxkMjA0GMwBIAEoBRIRCghmaWVsZDIwNRjN", + "ASABKAkSEQoIZmllbGQyMDcYzwEgASgEEhEKCGZpZWxkMzAwGKwCIAEoBCLK", + "BwoNU3BlZWRNZXNzYWdlMhIOCgZmaWVsZDEYASABKAkSDgoGZmllbGQzGAMg", + "ASgDEg4KBmZpZWxkNBgEIAEoAxIPCgdmaWVsZDMwGB4gASgDEhYKB2ZpZWxk", + "NzUYSyABKAg6BWZhbHNlEg4KBmZpZWxkNhgGIAEoCRIOCgZmaWVsZDIYAiAB", + "KAwSEgoHZmllbGQyMRgVIAEoBToBMBIPCgdmaWVsZDcxGEcgASgFEg8KB2Zp", + "ZWxkMjUYGSABKAISEwoIZmllbGQxMDkYbSABKAU6ATASFAoIZmllbGQyMTAY", + "0gEgASgFOgEwEhQKCGZpZWxkMjExGNMBIAEoBToBMBIUCghmaWVsZDIxMhjU", + "ASABKAU6ATASFAoIZmllbGQyMTMY1QEgASgFOgEwEhQKCGZpZWxkMjE2GNgB", + "IAEoBToBMBIUCghmaWVsZDIxNxjZASABKAU6ATASFAoIZmllbGQyMTgY2gEg", + "ASgFOgEwEhQKCGZpZWxkMjIwGNwBIAEoBToBMBIUCghmaWVsZDIyMRjdASAB", + "KAU6ATASFAoIZmllbGQyMjIY3gEgASgCOgEwEg8KB2ZpZWxkNjMYPyABKAUS", + "MAoGZ3JvdXAxGAogAygKMiAuYmVuY2htYXJrcy5TcGVlZE1lc3NhZ2UyLkdy", + "b3VwMRIRCghmaWVsZDEyOBiAASADKAkSEQoIZmllbGQxMzEYgwEgASgDEhAK", + "CGZpZWxkMTI3GH8gAygJEhEKCGZpZWxkMTI5GIEBIAEoBRIRCghmaWVsZDEz", + "MBiCASADKAMSGAoIZmllbGQyMDUYzQEgASgIOgVmYWxzZRIYCghmaWVsZDIw", + "NhjOASABKAg6BWZhbHNlGsMCCgZHcm91cDESDwoHZmllbGQxMRgLIAIoAhIP", + "CgdmaWVsZDI2GBogASgCEg8KB2ZpZWxkMTIYDCABKAkSDwoHZmllbGQxMxgN", + "IAEoCRIPCgdmaWVsZDE0GA4gAygJEg8KB2ZpZWxkMTUYDyACKAQSDgoGZmll", + "bGQ1GAUgASgFEg8KB2ZpZWxkMjcYGyABKAkSDwoHZmllbGQyOBgcIAEoBRIP", + "CgdmaWVsZDI5GB0gASgJEg8KB2ZpZWxkMTYYECABKAkSDwoHZmllbGQyMhgW", + "IAMoCRIPCgdmaWVsZDczGEkgAygFEhIKB2ZpZWxkMjAYFCABKAU6ATASDwoH", + "ZmllbGQyNBgYIAEoCRI4CgdmaWVsZDMxGB8gASgLMicuYmVuY2htYXJrcy5T", + "cGVlZE1lc3NhZ2UyR3JvdXBlZE1lc3NhZ2Ui3wEKG1NwZWVkTWVzc2FnZTJH", + "cm91cGVkTWVzc2FnZRIOCgZmaWVsZDEYASABKAISDgoGZmllbGQyGAIgASgC", + "EhEKBmZpZWxkMxgDIAEoAjoBMBIOCgZmaWVsZDQYBCABKAgSDgoGZmllbGQ1", + "GAUgASgIEhQKBmZpZWxkNhgGIAEoCDoEdHJ1ZRIVCgZmaWVsZDcYByABKAg6", + "BWZhbHNlEg4KBmZpZWxkOBgIIAEoAhIOCgZmaWVsZDkYCSABKAgSDwoHZmll", + "bGQxMBgKIAEoAhIPCgdmaWVsZDExGAsgASgDQktCC0dvb2dsZVNwZWVkSAHC", + "PjkKIUdvb2dsZS5Qcm90b2NvbEJ1ZmZlcnMuUHJvdG9CZW5jaBIUR29vZ2xl", + "U3BlZWRQcm90b0ZpbGU=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_benchmarks_SpeedMessage1__Descriptor = Descriptor.MessageTypes[0]; + internal__static_benchmarks_SpeedMessage1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SpeedMessage1__Descriptor, + new string[] { "Field1", "Field9", "Field18", "Field80", "Field81", "Field2", "Field3", "Field280", "Field6", "Field22", "Field4", "Field5", "Field59", "Field7", "Field16", "Field130", "Field12", "Field17", "Field13", "Field14", "Field104", "Field100", "Field101", "Field102", "Field103", "Field29", "Field30", "Field60", "Field271", "Field272", "Field150", "Field23", "Field24", "Field25", "Field15", "Field78", "Field67", "Field68", "Field128", "Field129", "Field131", }); + internal__static_benchmarks_SpeedMessage1SubMessage__Descriptor = Descriptor.MessageTypes[1]; + internal__static_benchmarks_SpeedMessage1SubMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SpeedMessage1SubMessage__Descriptor, + new string[] { "Field1", "Field2", "Field3", "Field15", "Field12", "Field13", "Field14", "Field16", "Field19", "Field20", "Field28", "Field21", "Field22", "Field23", "Field206", "Field203", "Field204", "Field205", "Field207", "Field300", }); + internal__static_benchmarks_SpeedMessage2__Descriptor = Descriptor.MessageTypes[2]; + internal__static_benchmarks_SpeedMessage2__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SpeedMessage2__Descriptor, + new string[] { "Field1", "Field3", "Field4", "Field30", "Field75", "Field6", "Field2", "Field21", "Field71", "Field25", "Field109", "Field210", "Field211", "Field212", "Field213", "Field216", "Field217", "Field218", "Field220", "Field221", "Field222", "Field63", "Group1", "Field128", "Field131", "Field127", "Field129", "Field130", "Field205", "Field206", }); + internal__static_benchmarks_SpeedMessage2_Group1__Descriptor = internal__static_benchmarks_SpeedMessage2__Descriptor.NestedTypes[0]; + internal__static_benchmarks_SpeedMessage2_Group1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SpeedMessage2_Group1__Descriptor, + new string[] { "Field11", "Field26", "Field12", "Field13", "Field14", "Field15", "Field5", "Field27", "Field28", "Field29", "Field16", "Field22", "Field73", "Field20", "Field24", "Field31", }); + internal__static_benchmarks_SpeedMessage2GroupedMessage__Descriptor = Descriptor.MessageTypes[3]; + internal__static_benchmarks_SpeedMessage2GroupedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_benchmarks_SpeedMessage2GroupedMessage__Descriptor, + new string[] { "Field1", "Field2", "Field3", "Field4", "Field5", "Field6", "Field7", "Field8", "Field9", "Field10", "Field11", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SpeedMessage1 : pb::GeneratedMessage { + private SpeedMessage1() { } + private static readonly SpeedMessage1 defaultInstance = new SpeedMessage1().MakeReadOnly(); + private static readonly string[] _speedMessage1FieldNames = new string[] { "field1", "field100", "field101", "field102", "field103", "field104", "field12", "field128", "field129", "field13", "field130", "field131", "field14", "field15", "field150", "field16", "field17", "field18", "field2", "field22", "field23", "field24", "field25", "field271", "field272", "field280", "field29", "field3", "field30", "field4", "field5", "field59", "field6", "field60", "field67", "field68", "field7", "field78", "field80", "field81", "field9" }; + private static readonly uint[] _speedMessage1FieldTags = new uint[] { 10, 800, 808, 818, 826, 832, 96, 1024, 1034, 104, 1040, 1048, 112, 122, 1200, 128, 136, 146, 16, 176, 184, 192, 200, 2168, 2176, 2240, 232, 24, 240, 34, 41, 472, 48, 480, 536, 544, 58, 624, 640, 648, 74 }; + public static SpeedMessage1 DefaultInstance { + get { return defaultInstance; } + } + + public override SpeedMessage1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SpeedMessage1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage1__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private string field1_ = ""; + public bool HasField1 { + get { return hasField1; } + } + public string Field1 { + get { return field1_; } + } + + public const int Field9FieldNumber = 9; + private bool hasField9; + private string field9_ = ""; + public bool HasField9 { + get { return hasField9; } + } + public string Field9 { + get { return field9_; } + } + + public const int Field18FieldNumber = 18; + private bool hasField18; + private string field18_ = ""; + public bool HasField18 { + get { return hasField18; } + } + public string Field18 { + get { return field18_; } + } + + public const int Field80FieldNumber = 80; + private bool hasField80; + private bool field80_; + public bool HasField80 { + get { return hasField80; } + } + public bool Field80 { + get { return field80_; } + } + + public const int Field81FieldNumber = 81; + private bool hasField81; + private bool field81_ = true; + public bool HasField81 { + get { return hasField81; } + } + public bool Field81 { + get { return field81_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private int field2_; + public bool HasField2 { + get { return hasField2; } + } + public int Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private int field3_; + public bool HasField3 { + get { return hasField3; } + } + public int Field3 { + get { return field3_; } + } + + public const int Field280FieldNumber = 280; + private bool hasField280; + private int field280_; + public bool HasField280 { + get { return hasField280; } + } + public int Field280 { + get { return field280_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private int field6_; + public bool HasField6 { + get { return hasField6; } + } + public int Field6 { + get { return field6_; } + } + + public const int Field22FieldNumber = 22; + private bool hasField22; + private long field22_; + public bool HasField22 { + get { return hasField22; } + } + public long Field22 { + get { return field22_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private string field4_ = ""; + public bool HasField4 { + get { return hasField4; } + } + public string Field4 { + get { return field4_; } + } + + public const int Field5FieldNumber = 5; + private pbc::PopsicleList field5_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList Field5List { + get { return pbc::Lists.AsReadOnly(field5_); } + } + public int Field5Count { + get { return field5_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetField5(int index) { + return field5_[index]; + } + + public const int Field59FieldNumber = 59; + private bool hasField59; + private bool field59_; + public bool HasField59 { + get { return hasField59; } + } + public bool Field59 { + get { return field59_; } + } + + public const int Field7FieldNumber = 7; + private bool hasField7; + private string field7_ = ""; + public bool HasField7 { + get { return hasField7; } + } + public string Field7 { + get { return field7_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private int field16_; + public bool HasField16 { + get { return hasField16; } + } + public int Field16 { + get { return field16_; } + } + + public const int Field130FieldNumber = 130; + private bool hasField130; + private int field130_; + public bool HasField130 { + get { return hasField130; } + } + public int Field130 { + get { return field130_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private bool field12_ = true; + public bool HasField12 { + get { return hasField12; } + } + public bool Field12 { + get { return field12_; } + } + + public const int Field17FieldNumber = 17; + private bool hasField17; + private bool field17_ = true; + public bool HasField17 { + get { return hasField17; } + } + public bool Field17 { + get { return field17_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private bool field13_ = true; + public bool HasField13 { + get { return hasField13; } + } + public bool Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private bool hasField14; + private bool field14_ = true; + public bool HasField14 { + get { return hasField14; } + } + public bool Field14 { + get { return field14_; } + } + + public const int Field104FieldNumber = 104; + private bool hasField104; + private int field104_; + public bool HasField104 { + get { return hasField104; } + } + public int Field104 { + get { return field104_; } + } + + public const int Field100FieldNumber = 100; + private bool hasField100; + private int field100_; + public bool HasField100 { + get { return hasField100; } + } + public int Field100 { + get { return field100_; } + } + + public const int Field101FieldNumber = 101; + private bool hasField101; + private int field101_; + public bool HasField101 { + get { return hasField101; } + } + public int Field101 { + get { return field101_; } + } + + public const int Field102FieldNumber = 102; + private bool hasField102; + private string field102_ = ""; + public bool HasField102 { + get { return hasField102; } + } + public string Field102 { + get { return field102_; } + } + + public const int Field103FieldNumber = 103; + private bool hasField103; + private string field103_ = ""; + public bool HasField103 { + get { return hasField103; } + } + public string Field103 { + get { return field103_; } + } + + public const int Field29FieldNumber = 29; + private bool hasField29; + private int field29_; + public bool HasField29 { + get { return hasField29; } + } + public int Field29 { + get { return field29_; } + } + + public const int Field30FieldNumber = 30; + private bool hasField30; + private bool field30_; + public bool HasField30 { + get { return hasField30; } + } + public bool Field30 { + get { return field30_; } + } + + public const int Field60FieldNumber = 60; + private bool hasField60; + private int field60_ = -1; + public bool HasField60 { + get { return hasField60; } + } + public int Field60 { + get { return field60_; } + } + + public const int Field271FieldNumber = 271; + private bool hasField271; + private int field271_ = -1; + public bool HasField271 { + get { return hasField271; } + } + public int Field271 { + get { return field271_; } + } + + public const int Field272FieldNumber = 272; + private bool hasField272; + private int field272_ = -1; + public bool HasField272 { + get { return hasField272; } + } + public int Field272 { + get { return field272_; } + } + + public const int Field150FieldNumber = 150; + private bool hasField150; + private int field150_; + public bool HasField150 { + get { return hasField150; } + } + public int Field150 { + get { return field150_; } + } + + public const int Field23FieldNumber = 23; + private bool hasField23; + private int field23_; + public bool HasField23 { + get { return hasField23; } + } + public int Field23 { + get { return field23_; } + } + + public const int Field24FieldNumber = 24; + private bool hasField24; + private bool field24_; + public bool HasField24 { + get { return hasField24; } + } + public bool Field24 { + get { return field24_; } + } + + public const int Field25FieldNumber = 25; + private bool hasField25; + private int field25_; + public bool HasField25 { + get { return hasField25; } + } + public int Field25 { + get { return field25_; } + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage field15_; + public bool HasField15 { + get { return hasField15; } + } + public global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage Field15 { + get { return field15_ ?? global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage.DefaultInstance; } + } + + public const int Field78FieldNumber = 78; + private bool hasField78; + private bool field78_; + public bool HasField78 { + get { return hasField78; } + } + public bool Field78 { + get { return field78_; } + } + + public const int Field67FieldNumber = 67; + private bool hasField67; + private int field67_; + public bool HasField67 { + get { return hasField67; } + } + public int Field67 { + get { return field67_; } + } + + public const int Field68FieldNumber = 68; + private bool hasField68; + private int field68_; + public bool HasField68 { + get { return hasField68; } + } + public int Field68 { + get { return field68_; } + } + + public const int Field128FieldNumber = 128; + private bool hasField128; + private int field128_; + public bool HasField128 { + get { return hasField128; } + } + public int Field128 { + get { return field128_; } + } + + public const int Field129FieldNumber = 129; + private bool hasField129; + private string field129_ = "xxxxxxxxxxxxxxxxxxxxx"; + public bool HasField129 { + get { return hasField129; } + } + public string Field129 { + get { return field129_; } + } + + public const int Field131FieldNumber = 131; + private bool hasField131; + private int field131_; + public bool HasField131 { + get { return hasField131; } + } + public int Field131 { + get { return field131_; } + } + + public override bool IsInitialized { + get { + if (!hasField1) return false; + if (!hasField2) return false; + if (!hasField3) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _speedMessage1FieldNames; + if (hasField1) { + output.WriteString(1, field_names[0], Field1); + } + if (hasField2) { + output.WriteInt32(2, field_names[18], Field2); + } + if (hasField3) { + output.WriteInt32(3, field_names[27], Field3); + } + if (hasField4) { + output.WriteString(4, field_names[29], Field4); + } + if (field5_.Count > 0) { + output.WriteFixed64Array(5, field_names[30], field5_); + } + if (hasField6) { + output.WriteInt32(6, field_names[32], Field6); + } + if (hasField7) { + output.WriteString(7, field_names[36], Field7); + } + if (hasField9) { + output.WriteString(9, field_names[40], Field9); + } + if (hasField12) { + output.WriteBool(12, field_names[6], Field12); + } + if (hasField13) { + output.WriteBool(13, field_names[9], Field13); + } + if (hasField14) { + output.WriteBool(14, field_names[12], Field14); + } + if (hasField15) { + output.WriteMessage(15, field_names[13], Field15); + } + if (hasField16) { + output.WriteInt32(16, field_names[15], Field16); + } + if (hasField17) { + output.WriteBool(17, field_names[16], Field17); + } + if (hasField18) { + output.WriteString(18, field_names[17], Field18); + } + if (hasField22) { + output.WriteInt64(22, field_names[19], Field22); + } + if (hasField23) { + output.WriteInt32(23, field_names[20], Field23); + } + if (hasField24) { + output.WriteBool(24, field_names[21], Field24); + } + if (hasField25) { + output.WriteInt32(25, field_names[22], Field25); + } + if (hasField29) { + output.WriteInt32(29, field_names[26], Field29); + } + if (hasField30) { + output.WriteBool(30, field_names[28], Field30); + } + if (hasField59) { + output.WriteBool(59, field_names[31], Field59); + } + if (hasField60) { + output.WriteInt32(60, field_names[33], Field60); + } + if (hasField67) { + output.WriteInt32(67, field_names[34], Field67); + } + if (hasField68) { + output.WriteInt32(68, field_names[35], Field68); + } + if (hasField78) { + output.WriteBool(78, field_names[37], Field78); + } + if (hasField80) { + output.WriteBool(80, field_names[38], Field80); + } + if (hasField81) { + output.WriteBool(81, field_names[39], Field81); + } + if (hasField100) { + output.WriteInt32(100, field_names[1], Field100); + } + if (hasField101) { + output.WriteInt32(101, field_names[2], Field101); + } + if (hasField102) { + output.WriteString(102, field_names[3], Field102); + } + if (hasField103) { + output.WriteString(103, field_names[4], Field103); + } + if (hasField104) { + output.WriteInt32(104, field_names[5], Field104); + } + if (hasField128) { + output.WriteInt32(128, field_names[7], Field128); + } + if (hasField129) { + output.WriteString(129, field_names[8], Field129); + } + if (hasField130) { + output.WriteInt32(130, field_names[10], Field130); + } + if (hasField131) { + output.WriteInt32(131, field_names[11], Field131); + } + if (hasField150) { + output.WriteInt32(150, field_names[14], Field150); + } + if (hasField271) { + output.WriteInt32(271, field_names[23], Field271); + } + if (hasField272) { + output.WriteInt32(272, field_names[24], Field272); + } + if (hasField280) { + output.WriteInt32(280, field_names[25], Field280); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField1) { + size += pb::CodedOutputStream.ComputeStringSize(1, Field1); + } + if (hasField9) { + size += pb::CodedOutputStream.ComputeStringSize(9, Field9); + } + if (hasField18) { + size += pb::CodedOutputStream.ComputeStringSize(18, Field18); + } + if (hasField80) { + size += pb::CodedOutputStream.ComputeBoolSize(80, Field80); + } + if (hasField81) { + size += pb::CodedOutputStream.ComputeBoolSize(81, Field81); + } + if (hasField2) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Field2); + } + if (hasField3) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Field3); + } + if (hasField280) { + size += pb::CodedOutputStream.ComputeInt32Size(280, Field280); + } + if (hasField6) { + size += pb::CodedOutputStream.ComputeInt32Size(6, Field6); + } + if (hasField22) { + size += pb::CodedOutputStream.ComputeInt64Size(22, Field22); + } + if (hasField4) { + size += pb::CodedOutputStream.ComputeStringSize(4, Field4); + } + { + int dataSize = 0; + dataSize = 8 * field5_.Count; + size += dataSize; + size += 1 * field5_.Count; + } + if (hasField59) { + size += pb::CodedOutputStream.ComputeBoolSize(59, Field59); + } + if (hasField7) { + size += pb::CodedOutputStream.ComputeStringSize(7, Field7); + } + if (hasField16) { + size += pb::CodedOutputStream.ComputeInt32Size(16, Field16); + } + if (hasField130) { + size += pb::CodedOutputStream.ComputeInt32Size(130, Field130); + } + if (hasField12) { + size += pb::CodedOutputStream.ComputeBoolSize(12, Field12); + } + if (hasField17) { + size += pb::CodedOutputStream.ComputeBoolSize(17, Field17); + } + if (hasField13) { + size += pb::CodedOutputStream.ComputeBoolSize(13, Field13); + } + if (hasField14) { + size += pb::CodedOutputStream.ComputeBoolSize(14, Field14); + } + if (hasField104) { + size += pb::CodedOutputStream.ComputeInt32Size(104, Field104); + } + if (hasField100) { + size += pb::CodedOutputStream.ComputeInt32Size(100, Field100); + } + if (hasField101) { + size += pb::CodedOutputStream.ComputeInt32Size(101, Field101); + } + if (hasField102) { + size += pb::CodedOutputStream.ComputeStringSize(102, Field102); + } + if (hasField103) { + size += pb::CodedOutputStream.ComputeStringSize(103, Field103); + } + if (hasField29) { + size += pb::CodedOutputStream.ComputeInt32Size(29, Field29); + } + if (hasField30) { + size += pb::CodedOutputStream.ComputeBoolSize(30, Field30); + } + if (hasField60) { + size += pb::CodedOutputStream.ComputeInt32Size(60, Field60); + } + if (hasField271) { + size += pb::CodedOutputStream.ComputeInt32Size(271, Field271); + } + if (hasField272) { + size += pb::CodedOutputStream.ComputeInt32Size(272, Field272); + } + if (hasField150) { + size += pb::CodedOutputStream.ComputeInt32Size(150, Field150); + } + if (hasField23) { + size += pb::CodedOutputStream.ComputeInt32Size(23, Field23); + } + if (hasField24) { + size += pb::CodedOutputStream.ComputeBoolSize(24, Field24); + } + if (hasField25) { + size += pb::CodedOutputStream.ComputeInt32Size(25, Field25); + } + if (hasField15) { + size += pb::CodedOutputStream.ComputeMessageSize(15, Field15); + } + if (hasField78) { + size += pb::CodedOutputStream.ComputeBoolSize(78, Field78); + } + if (hasField67) { + size += pb::CodedOutputStream.ComputeInt32Size(67, Field67); + } + if (hasField68) { + size += pb::CodedOutputStream.ComputeInt32Size(68, Field68); + } + if (hasField128) { + size += pb::CodedOutputStream.ComputeInt32Size(128, Field128); + } + if (hasField129) { + size += pb::CodedOutputStream.ComputeStringSize(129, Field129); + } + if (hasField131) { + size += pb::CodedOutputStream.ComputeInt32Size(131, Field131); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SpeedMessage1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SpeedMessage1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SpeedMessage1 MakeReadOnly() { + field5_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SpeedMessage1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SpeedMessage1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SpeedMessage1 result; + + private SpeedMessage1 PrepareBuilder() { + if (resultIsReadOnly) { + SpeedMessage1 original = result; + result = new SpeedMessage1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SpeedMessage1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1.Descriptor; } + } + + public override SpeedMessage1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1.DefaultInstance; } + } + + public override SpeedMessage1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SpeedMessage1) { + return MergeFrom((SpeedMessage1) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SpeedMessage1 other) { + if (other == global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField1) { + Field1 = other.Field1; + } + if (other.HasField9) { + Field9 = other.Field9; + } + if (other.HasField18) { + Field18 = other.Field18; + } + if (other.HasField80) { + Field80 = other.Field80; + } + if (other.HasField81) { + Field81 = other.Field81; + } + if (other.HasField2) { + Field2 = other.Field2; + } + if (other.HasField3) { + Field3 = other.Field3; + } + if (other.HasField280) { + Field280 = other.Field280; + } + if (other.HasField6) { + Field6 = other.Field6; + } + if (other.HasField22) { + Field22 = other.Field22; + } + if (other.HasField4) { + Field4 = other.Field4; + } + if (other.field5_.Count != 0) { + result.field5_.Add(other.field5_); + } + if (other.HasField59) { + Field59 = other.Field59; + } + if (other.HasField7) { + Field7 = other.Field7; + } + if (other.HasField16) { + Field16 = other.Field16; + } + if (other.HasField130) { + Field130 = other.Field130; + } + if (other.HasField12) { + Field12 = other.Field12; + } + if (other.HasField17) { + Field17 = other.Field17; + } + if (other.HasField13) { + Field13 = other.Field13; + } + if (other.HasField14) { + Field14 = other.Field14; + } + if (other.HasField104) { + Field104 = other.Field104; + } + if (other.HasField100) { + Field100 = other.Field100; + } + if (other.HasField101) { + Field101 = other.Field101; + } + if (other.HasField102) { + Field102 = other.Field102; + } + if (other.HasField103) { + Field103 = other.Field103; + } + if (other.HasField29) { + Field29 = other.Field29; + } + if (other.HasField30) { + Field30 = other.Field30; + } + if (other.HasField60) { + Field60 = other.Field60; + } + if (other.HasField271) { + Field271 = other.Field271; + } + if (other.HasField272) { + Field272 = other.Field272; + } + if (other.HasField150) { + Field150 = other.Field150; + } + if (other.HasField23) { + Field23 = other.Field23; + } + if (other.HasField24) { + Field24 = other.Field24; + } + if (other.HasField25) { + Field25 = other.Field25; + } + if (other.HasField15) { + MergeField15(other.Field15); + } + if (other.HasField78) { + Field78 = other.Field78; + } + if (other.HasField67) { + Field67 = other.Field67; + } + if (other.HasField68) { + Field68 = other.Field68; + } + if (other.HasField128) { + Field128 = other.Field128; + } + if (other.HasField129) { + Field129 = other.Field129; + } + if (other.HasField131) { + Field131 = other.Field131; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_speedMessage1FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _speedMessage1FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasField1 = input.ReadString(ref result.field1_); + break; + } + case 16: { + result.hasField2 = input.ReadInt32(ref result.field2_); + break; + } + case 24: { + result.hasField3 = input.ReadInt32(ref result.field3_); + break; + } + case 34: { + result.hasField4 = input.ReadString(ref result.field4_); + break; + } + case 42: + case 41: { + input.ReadFixed64Array(tag, field_name, result.field5_); + break; + } + case 48: { + result.hasField6 = input.ReadInt32(ref result.field6_); + break; + } + case 58: { + result.hasField7 = input.ReadString(ref result.field7_); + break; + } + case 74: { + result.hasField9 = input.ReadString(ref result.field9_); + break; + } + case 96: { + result.hasField12 = input.ReadBool(ref result.field12_); + break; + } + case 104: { + result.hasField13 = input.ReadBool(ref result.field13_); + break; + } + case 112: { + result.hasField14 = input.ReadBool(ref result.field14_); + break; + } + case 122: { + global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage.Builder subBuilder = global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage.CreateBuilder(); + if (result.hasField15) { + subBuilder.MergeFrom(Field15); + } + input.ReadMessage(subBuilder, extensionRegistry); + Field15 = subBuilder.BuildPartial(); + break; + } + case 128: { + result.hasField16 = input.ReadInt32(ref result.field16_); + break; + } + case 136: { + result.hasField17 = input.ReadBool(ref result.field17_); + break; + } + case 146: { + result.hasField18 = input.ReadString(ref result.field18_); + break; + } + case 176: { + result.hasField22 = input.ReadInt64(ref result.field22_); + break; + } + case 184: { + result.hasField23 = input.ReadInt32(ref result.field23_); + break; + } + case 192: { + result.hasField24 = input.ReadBool(ref result.field24_); + break; + } + case 200: { + result.hasField25 = input.ReadInt32(ref result.field25_); + break; + } + case 232: { + result.hasField29 = input.ReadInt32(ref result.field29_); + break; + } + case 240: { + result.hasField30 = input.ReadBool(ref result.field30_); + break; + } + case 472: { + result.hasField59 = input.ReadBool(ref result.field59_); + break; + } + case 480: { + result.hasField60 = input.ReadInt32(ref result.field60_); + break; + } + case 536: { + result.hasField67 = input.ReadInt32(ref result.field67_); + break; + } + case 544: { + result.hasField68 = input.ReadInt32(ref result.field68_); + break; + } + case 624: { + result.hasField78 = input.ReadBool(ref result.field78_); + break; + } + case 640: { + result.hasField80 = input.ReadBool(ref result.field80_); + break; + } + case 648: { + result.hasField81 = input.ReadBool(ref result.field81_); + break; + } + case 800: { + result.hasField100 = input.ReadInt32(ref result.field100_); + break; + } + case 808: { + result.hasField101 = input.ReadInt32(ref result.field101_); + break; + } + case 818: { + result.hasField102 = input.ReadString(ref result.field102_); + break; + } + case 826: { + result.hasField103 = input.ReadString(ref result.field103_); + break; + } + case 832: { + result.hasField104 = input.ReadInt32(ref result.field104_); + break; + } + case 1024: { + result.hasField128 = input.ReadInt32(ref result.field128_); + break; + } + case 1034: { + result.hasField129 = input.ReadString(ref result.field129_); + break; + } + case 1040: { + result.hasField130 = input.ReadInt32(ref result.field130_); + break; + } + case 1048: { + result.hasField131 = input.ReadInt32(ref result.field131_); + break; + } + case 1200: { + result.hasField150 = input.ReadInt32(ref result.field150_); + break; + } + case 2168: { + result.hasField271 = input.ReadInt32(ref result.field271_); + break; + } + case 2176: { + result.hasField272 = input.ReadInt32(ref result.field272_); + break; + } + case 2240: { + result.hasField280 = input.ReadInt32(ref result.field280_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public string Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = ""; + return this; + } + + public bool HasField9 { + get { return result.hasField9; } + } + public string Field9 { + get { return result.Field9; } + set { SetField9(value); } + } + public Builder SetField9(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField9 = true; + result.field9_ = value; + return this; + } + public Builder ClearField9() { + PrepareBuilder(); + result.hasField9 = false; + result.field9_ = ""; + return this; + } + + public bool HasField18 { + get { return result.hasField18; } + } + public string Field18 { + get { return result.Field18; } + set { SetField18(value); } + } + public Builder SetField18(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField18 = true; + result.field18_ = value; + return this; + } + public Builder ClearField18() { + PrepareBuilder(); + result.hasField18 = false; + result.field18_ = ""; + return this; + } + + public bool HasField80 { + get { return result.hasField80; } + } + public bool Field80 { + get { return result.Field80; } + set { SetField80(value); } + } + public Builder SetField80(bool value) { + PrepareBuilder(); + result.hasField80 = true; + result.field80_ = value; + return this; + } + public Builder ClearField80() { + PrepareBuilder(); + result.hasField80 = false; + result.field80_ = false; + return this; + } + + public bool HasField81 { + get { return result.hasField81; } + } + public bool Field81 { + get { return result.Field81; } + set { SetField81(value); } + } + public Builder SetField81(bool value) { + PrepareBuilder(); + result.hasField81 = true; + result.field81_ = value; + return this; + } + public Builder ClearField81() { + PrepareBuilder(); + result.hasField81 = false; + result.field81_ = true; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public int Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(int value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public int Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(int value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0; + return this; + } + + public bool HasField280 { + get { return result.hasField280; } + } + public int Field280 { + get { return result.Field280; } + set { SetField280(value); } + } + public Builder SetField280(int value) { + PrepareBuilder(); + result.hasField280 = true; + result.field280_ = value; + return this; + } + public Builder ClearField280() { + PrepareBuilder(); + result.hasField280 = false; + result.field280_ = 0; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public int Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(int value) { + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = 0; + return this; + } + + public bool HasField22 { + get { return result.hasField22; } + } + public long Field22 { + get { return result.Field22; } + set { SetField22(value); } + } + public Builder SetField22(long value) { + PrepareBuilder(); + result.hasField22 = true; + result.field22_ = value; + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.hasField22 = false; + result.field22_ = 0L; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public string Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = ""; + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList Field5List { + get { return PrepareBuilder().field5_; } + } + public int Field5Count { + get { return result.Field5Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetField5(int index) { + return result.GetField5(index); + } + [global::System.CLSCompliant(false)] + public Builder SetField5(int index, ulong value) { + PrepareBuilder(); + result.field5_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddField5(ulong value) { + PrepareBuilder(); + result.field5_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeField5(scg::IEnumerable values) { + PrepareBuilder(); + result.field5_.Add(values); + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.field5_.Clear(); + return this; + } + + public bool HasField59 { + get { return result.hasField59; } + } + public bool Field59 { + get { return result.Field59; } + set { SetField59(value); } + } + public Builder SetField59(bool value) { + PrepareBuilder(); + result.hasField59 = true; + result.field59_ = value; + return this; + } + public Builder ClearField59() { + PrepareBuilder(); + result.hasField59 = false; + result.field59_ = false; + return this; + } + + public bool HasField7 { + get { return result.hasField7; } + } + public string Field7 { + get { return result.Field7; } + set { SetField7(value); } + } + public Builder SetField7(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField7 = true; + result.field7_ = value; + return this; + } + public Builder ClearField7() { + PrepareBuilder(); + result.hasField7 = false; + result.field7_ = ""; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public int Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(int value) { + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = 0; + return this; + } + + public bool HasField130 { + get { return result.hasField130; } + } + public int Field130 { + get { return result.Field130; } + set { SetField130(value); } + } + public Builder SetField130(int value) { + PrepareBuilder(); + result.hasField130 = true; + result.field130_ = value; + return this; + } + public Builder ClearField130() { + PrepareBuilder(); + result.hasField130 = false; + result.field130_ = 0; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public bool Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(bool value) { + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = true; + return this; + } + + public bool HasField17 { + get { return result.hasField17; } + } + public bool Field17 { + get { return result.Field17; } + set { SetField17(value); } + } + public Builder SetField17(bool value) { + PrepareBuilder(); + result.hasField17 = true; + result.field17_ = value; + return this; + } + public Builder ClearField17() { + PrepareBuilder(); + result.hasField17 = false; + result.field17_ = true; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public bool Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(bool value) { + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = true; + return this; + } + + public bool HasField14 { + get { return result.hasField14; } + } + public bool Field14 { + get { return result.Field14; } + set { SetField14(value); } + } + public Builder SetField14(bool value) { + PrepareBuilder(); + result.hasField14 = true; + result.field14_ = value; + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.hasField14 = false; + result.field14_ = true; + return this; + } + + public bool HasField104 { + get { return result.hasField104; } + } + public int Field104 { + get { return result.Field104; } + set { SetField104(value); } + } + public Builder SetField104(int value) { + PrepareBuilder(); + result.hasField104 = true; + result.field104_ = value; + return this; + } + public Builder ClearField104() { + PrepareBuilder(); + result.hasField104 = false; + result.field104_ = 0; + return this; + } + + public bool HasField100 { + get { return result.hasField100; } + } + public int Field100 { + get { return result.Field100; } + set { SetField100(value); } + } + public Builder SetField100(int value) { + PrepareBuilder(); + result.hasField100 = true; + result.field100_ = value; + return this; + } + public Builder ClearField100() { + PrepareBuilder(); + result.hasField100 = false; + result.field100_ = 0; + return this; + } + + public bool HasField101 { + get { return result.hasField101; } + } + public int Field101 { + get { return result.Field101; } + set { SetField101(value); } + } + public Builder SetField101(int value) { + PrepareBuilder(); + result.hasField101 = true; + result.field101_ = value; + return this; + } + public Builder ClearField101() { + PrepareBuilder(); + result.hasField101 = false; + result.field101_ = 0; + return this; + } + + public bool HasField102 { + get { return result.hasField102; } + } + public string Field102 { + get { return result.Field102; } + set { SetField102(value); } + } + public Builder SetField102(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField102 = true; + result.field102_ = value; + return this; + } + public Builder ClearField102() { + PrepareBuilder(); + result.hasField102 = false; + result.field102_ = ""; + return this; + } + + public bool HasField103 { + get { return result.hasField103; } + } + public string Field103 { + get { return result.Field103; } + set { SetField103(value); } + } + public Builder SetField103(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField103 = true; + result.field103_ = value; + return this; + } + public Builder ClearField103() { + PrepareBuilder(); + result.hasField103 = false; + result.field103_ = ""; + return this; + } + + public bool HasField29 { + get { return result.hasField29; } + } + public int Field29 { + get { return result.Field29; } + set { SetField29(value); } + } + public Builder SetField29(int value) { + PrepareBuilder(); + result.hasField29 = true; + result.field29_ = value; + return this; + } + public Builder ClearField29() { + PrepareBuilder(); + result.hasField29 = false; + result.field29_ = 0; + return this; + } + + public bool HasField30 { + get { return result.hasField30; } + } + public bool Field30 { + get { return result.Field30; } + set { SetField30(value); } + } + public Builder SetField30(bool value) { + PrepareBuilder(); + result.hasField30 = true; + result.field30_ = value; + return this; + } + public Builder ClearField30() { + PrepareBuilder(); + result.hasField30 = false; + result.field30_ = false; + return this; + } + + public bool HasField60 { + get { return result.hasField60; } + } + public int Field60 { + get { return result.Field60; } + set { SetField60(value); } + } + public Builder SetField60(int value) { + PrepareBuilder(); + result.hasField60 = true; + result.field60_ = value; + return this; + } + public Builder ClearField60() { + PrepareBuilder(); + result.hasField60 = false; + result.field60_ = -1; + return this; + } + + public bool HasField271 { + get { return result.hasField271; } + } + public int Field271 { + get { return result.Field271; } + set { SetField271(value); } + } + public Builder SetField271(int value) { + PrepareBuilder(); + result.hasField271 = true; + result.field271_ = value; + return this; + } + public Builder ClearField271() { + PrepareBuilder(); + result.hasField271 = false; + result.field271_ = -1; + return this; + } + + public bool HasField272 { + get { return result.hasField272; } + } + public int Field272 { + get { return result.Field272; } + set { SetField272(value); } + } + public Builder SetField272(int value) { + PrepareBuilder(); + result.hasField272 = true; + result.field272_ = value; + return this; + } + public Builder ClearField272() { + PrepareBuilder(); + result.hasField272 = false; + result.field272_ = -1; + return this; + } + + public bool HasField150 { + get { return result.hasField150; } + } + public int Field150 { + get { return result.Field150; } + set { SetField150(value); } + } + public Builder SetField150(int value) { + PrepareBuilder(); + result.hasField150 = true; + result.field150_ = value; + return this; + } + public Builder ClearField150() { + PrepareBuilder(); + result.hasField150 = false; + result.field150_ = 0; + return this; + } + + public bool HasField23 { + get { return result.hasField23; } + } + public int Field23 { + get { return result.Field23; } + set { SetField23(value); } + } + public Builder SetField23(int value) { + PrepareBuilder(); + result.hasField23 = true; + result.field23_ = value; + return this; + } + public Builder ClearField23() { + PrepareBuilder(); + result.hasField23 = false; + result.field23_ = 0; + return this; + } + + public bool HasField24 { + get { return result.hasField24; } + } + public bool Field24 { + get { return result.Field24; } + set { SetField24(value); } + } + public Builder SetField24(bool value) { + PrepareBuilder(); + result.hasField24 = true; + result.field24_ = value; + return this; + } + public Builder ClearField24() { + PrepareBuilder(); + result.hasField24 = false; + result.field24_ = false; + return this; + } + + public bool HasField25 { + get { return result.hasField25; } + } + public int Field25 { + get { return result.Field25; } + set { SetField25(value); } + } + public Builder SetField25(int value) { + PrepareBuilder(); + result.hasField25 = true; + result.field25_ = value; + return this; + } + public Builder ClearField25() { + PrepareBuilder(); + result.hasField25 = false; + result.field25_ = 0; + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + public global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + public Builder SetField15(global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder SetField15(global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = builderForValue.Build(); + return this; + } + public Builder MergeField15(global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasField15 && + result.field15_ != global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage.DefaultInstance) { + result.field15_ = global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage.CreateBuilder(result.field15_).MergeFrom(value).BuildPartial(); + } else { + result.field15_ = value; + } + result.hasField15 = true; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = null; + return this; + } + + public bool HasField78 { + get { return result.hasField78; } + } + public bool Field78 { + get { return result.Field78; } + set { SetField78(value); } + } + public Builder SetField78(bool value) { + PrepareBuilder(); + result.hasField78 = true; + result.field78_ = value; + return this; + } + public Builder ClearField78() { + PrepareBuilder(); + result.hasField78 = false; + result.field78_ = false; + return this; + } + + public bool HasField67 { + get { return result.hasField67; } + } + public int Field67 { + get { return result.Field67; } + set { SetField67(value); } + } + public Builder SetField67(int value) { + PrepareBuilder(); + result.hasField67 = true; + result.field67_ = value; + return this; + } + public Builder ClearField67() { + PrepareBuilder(); + result.hasField67 = false; + result.field67_ = 0; + return this; + } + + public bool HasField68 { + get { return result.hasField68; } + } + public int Field68 { + get { return result.Field68; } + set { SetField68(value); } + } + public Builder SetField68(int value) { + PrepareBuilder(); + result.hasField68 = true; + result.field68_ = value; + return this; + } + public Builder ClearField68() { + PrepareBuilder(); + result.hasField68 = false; + result.field68_ = 0; + return this; + } + + public bool HasField128 { + get { return result.hasField128; } + } + public int Field128 { + get { return result.Field128; } + set { SetField128(value); } + } + public Builder SetField128(int value) { + PrepareBuilder(); + result.hasField128 = true; + result.field128_ = value; + return this; + } + public Builder ClearField128() { + PrepareBuilder(); + result.hasField128 = false; + result.field128_ = 0; + return this; + } + + public bool HasField129 { + get { return result.hasField129; } + } + public string Field129 { + get { return result.Field129; } + set { SetField129(value); } + } + public Builder SetField129(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField129 = true; + result.field129_ = value; + return this; + } + public Builder ClearField129() { + PrepareBuilder(); + result.hasField129 = false; + result.field129_ = "xxxxxxxxxxxxxxxxxxxxx"; + return this; + } + + public bool HasField131 { + get { return result.hasField131; } + } + public int Field131 { + get { return result.Field131; } + set { SetField131(value); } + } + public Builder SetField131(int value) { + PrepareBuilder(); + result.hasField131 = true; + result.field131_ = value; + return this; + } + public Builder ClearField131() { + PrepareBuilder(); + result.hasField131 = false; + result.field131_ = 0; + return this; + } + } + static SpeedMessage1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SpeedMessage1SubMessage : pb::GeneratedMessage { + private SpeedMessage1SubMessage() { } + private static readonly SpeedMessage1SubMessage defaultInstance = new SpeedMessage1SubMessage().MakeReadOnly(); + private static readonly string[] _speedMessage1SubMessageFieldNames = new string[] { "field1", "field12", "field13", "field14", "field15", "field16", "field19", "field2", "field20", "field203", "field204", "field205", "field206", "field207", "field21", "field22", "field23", "field28", "field3", "field300" }; + private static readonly uint[] _speedMessage1SubMessageFieldTags = new uint[] { 8, 96, 104, 112, 122, 128, 152, 16, 160, 1629, 1632, 1642, 1648, 1656, 169, 176, 184, 224, 24, 2400 }; + public static SpeedMessage1SubMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SpeedMessage1SubMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SpeedMessage1SubMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage1SubMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage1SubMessage__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private int field1_; + public bool HasField1 { + get { return hasField1; } + } + public int Field1 { + get { return field1_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private int field2_; + public bool HasField2 { + get { return hasField2; } + } + public int Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private int field3_; + public bool HasField3 { + get { return hasField3; } + } + public int Field3 { + get { return field3_; } + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private string field15_ = ""; + public bool HasField15 { + get { return hasField15; } + } + public string Field15 { + get { return field15_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private bool field12_ = true; + public bool HasField12 { + get { return hasField12; } + } + public bool Field12 { + get { return field12_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private long field13_; + public bool HasField13 { + get { return hasField13; } + } + public long Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private bool hasField14; + private long field14_; + public bool HasField14 { + get { return hasField14; } + } + public long Field14 { + get { return field14_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private int field16_; + public bool HasField16 { + get { return hasField16; } + } + public int Field16 { + get { return field16_; } + } + + public const int Field19FieldNumber = 19; + private bool hasField19; + private int field19_ = 2; + public bool HasField19 { + get { return hasField19; } + } + public int Field19 { + get { return field19_; } + } + + public const int Field20FieldNumber = 20; + private bool hasField20; + private bool field20_ = true; + public bool HasField20 { + get { return hasField20; } + } + public bool Field20 { + get { return field20_; } + } + + public const int Field28FieldNumber = 28; + private bool hasField28; + private bool field28_ = true; + public bool HasField28 { + get { return hasField28; } + } + public bool Field28 { + get { return field28_; } + } + + public const int Field21FieldNumber = 21; + private bool hasField21; + private ulong field21_; + public bool HasField21 { + get { return hasField21; } + } + [global::System.CLSCompliant(false)] + public ulong Field21 { + get { return field21_; } + } + + public const int Field22FieldNumber = 22; + private bool hasField22; + private int field22_; + public bool HasField22 { + get { return hasField22; } + } + public int Field22 { + get { return field22_; } + } + + public const int Field23FieldNumber = 23; + private bool hasField23; + private bool field23_; + public bool HasField23 { + get { return hasField23; } + } + public bool Field23 { + get { return field23_; } + } + + public const int Field206FieldNumber = 206; + private bool hasField206; + private bool field206_; + public bool HasField206 { + get { return hasField206; } + } + public bool Field206 { + get { return field206_; } + } + + public const int Field203FieldNumber = 203; + private bool hasField203; + private uint field203_; + public bool HasField203 { + get { return hasField203; } + } + [global::System.CLSCompliant(false)] + public uint Field203 { + get { return field203_; } + } + + public const int Field204FieldNumber = 204; + private bool hasField204; + private int field204_; + public bool HasField204 { + get { return hasField204; } + } + public int Field204 { + get { return field204_; } + } + + public const int Field205FieldNumber = 205; + private bool hasField205; + private string field205_ = ""; + public bool HasField205 { + get { return hasField205; } + } + public string Field205 { + get { return field205_; } + } + + public const int Field207FieldNumber = 207; + private bool hasField207; + private ulong field207_; + public bool HasField207 { + get { return hasField207; } + } + [global::System.CLSCompliant(false)] + public ulong Field207 { + get { return field207_; } + } + + public const int Field300FieldNumber = 300; + private bool hasField300; + private ulong field300_; + public bool HasField300 { + get { return hasField300; } + } + [global::System.CLSCompliant(false)] + public ulong Field300 { + get { return field300_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _speedMessage1SubMessageFieldNames; + if (hasField1) { + output.WriteInt32(1, field_names[0], Field1); + } + if (hasField2) { + output.WriteInt32(2, field_names[7], Field2); + } + if (hasField3) { + output.WriteInt32(3, field_names[18], Field3); + } + if (hasField12) { + output.WriteBool(12, field_names[1], Field12); + } + if (hasField13) { + output.WriteInt64(13, field_names[2], Field13); + } + if (hasField14) { + output.WriteInt64(14, field_names[3], Field14); + } + if (hasField15) { + output.WriteString(15, field_names[4], Field15); + } + if (hasField16) { + output.WriteInt32(16, field_names[5], Field16); + } + if (hasField19) { + output.WriteInt32(19, field_names[6], Field19); + } + if (hasField20) { + output.WriteBool(20, field_names[8], Field20); + } + if (hasField21) { + output.WriteFixed64(21, field_names[14], Field21); + } + if (hasField22) { + output.WriteInt32(22, field_names[15], Field22); + } + if (hasField23) { + output.WriteBool(23, field_names[16], Field23); + } + if (hasField28) { + output.WriteBool(28, field_names[17], Field28); + } + if (hasField203) { + output.WriteFixed32(203, field_names[9], Field203); + } + if (hasField204) { + output.WriteInt32(204, field_names[10], Field204); + } + if (hasField205) { + output.WriteString(205, field_names[11], Field205); + } + if (hasField206) { + output.WriteBool(206, field_names[12], Field206); + } + if (hasField207) { + output.WriteUInt64(207, field_names[13], Field207); + } + if (hasField300) { + output.WriteUInt64(300, field_names[19], Field300); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField1) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Field1); + } + if (hasField2) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Field2); + } + if (hasField3) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Field3); + } + if (hasField15) { + size += pb::CodedOutputStream.ComputeStringSize(15, Field15); + } + if (hasField12) { + size += pb::CodedOutputStream.ComputeBoolSize(12, Field12); + } + if (hasField13) { + size += pb::CodedOutputStream.ComputeInt64Size(13, Field13); + } + if (hasField14) { + size += pb::CodedOutputStream.ComputeInt64Size(14, Field14); + } + if (hasField16) { + size += pb::CodedOutputStream.ComputeInt32Size(16, Field16); + } + if (hasField19) { + size += pb::CodedOutputStream.ComputeInt32Size(19, Field19); + } + if (hasField20) { + size += pb::CodedOutputStream.ComputeBoolSize(20, Field20); + } + if (hasField28) { + size += pb::CodedOutputStream.ComputeBoolSize(28, Field28); + } + if (hasField21) { + size += pb::CodedOutputStream.ComputeFixed64Size(21, Field21); + } + if (hasField22) { + size += pb::CodedOutputStream.ComputeInt32Size(22, Field22); + } + if (hasField23) { + size += pb::CodedOutputStream.ComputeBoolSize(23, Field23); + } + if (hasField206) { + size += pb::CodedOutputStream.ComputeBoolSize(206, Field206); + } + if (hasField203) { + size += pb::CodedOutputStream.ComputeFixed32Size(203, Field203); + } + if (hasField204) { + size += pb::CodedOutputStream.ComputeInt32Size(204, Field204); + } + if (hasField205) { + size += pb::CodedOutputStream.ComputeStringSize(205, Field205); + } + if (hasField207) { + size += pb::CodedOutputStream.ComputeUInt64Size(207, Field207); + } + if (hasField300) { + size += pb::CodedOutputStream.ComputeUInt64Size(300, Field300); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SpeedMessage1SubMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SpeedMessage1SubMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SpeedMessage1SubMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SpeedMessage1SubMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SpeedMessage1SubMessage result; + + private SpeedMessage1SubMessage PrepareBuilder() { + if (resultIsReadOnly) { + SpeedMessage1SubMessage original = result; + result = new SpeedMessage1SubMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SpeedMessage1SubMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage.Descriptor; } + } + + public override SpeedMessage1SubMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage.DefaultInstance; } + } + + public override SpeedMessage1SubMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SpeedMessage1SubMessage) { + return MergeFrom((SpeedMessage1SubMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SpeedMessage1SubMessage other) { + if (other == global::Google.ProtocolBuffers.ProtoBench.SpeedMessage1SubMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField1) { + Field1 = other.Field1; + } + if (other.HasField2) { + Field2 = other.Field2; + } + if (other.HasField3) { + Field3 = other.Field3; + } + if (other.HasField15) { + Field15 = other.Field15; + } + if (other.HasField12) { + Field12 = other.Field12; + } + if (other.HasField13) { + Field13 = other.Field13; + } + if (other.HasField14) { + Field14 = other.Field14; + } + if (other.HasField16) { + Field16 = other.Field16; + } + if (other.HasField19) { + Field19 = other.Field19; + } + if (other.HasField20) { + Field20 = other.Field20; + } + if (other.HasField28) { + Field28 = other.Field28; + } + if (other.HasField21) { + Field21 = other.Field21; + } + if (other.HasField22) { + Field22 = other.Field22; + } + if (other.HasField23) { + Field23 = other.Field23; + } + if (other.HasField206) { + Field206 = other.Field206; + } + if (other.HasField203) { + Field203 = other.Field203; + } + if (other.HasField204) { + Field204 = other.Field204; + } + if (other.HasField205) { + Field205 = other.Field205; + } + if (other.HasField207) { + Field207 = other.Field207; + } + if (other.HasField300) { + Field300 = other.Field300; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_speedMessage1SubMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _speedMessage1SubMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasField1 = input.ReadInt32(ref result.field1_); + break; + } + case 16: { + result.hasField2 = input.ReadInt32(ref result.field2_); + break; + } + case 24: { + result.hasField3 = input.ReadInt32(ref result.field3_); + break; + } + case 96: { + result.hasField12 = input.ReadBool(ref result.field12_); + break; + } + case 104: { + result.hasField13 = input.ReadInt64(ref result.field13_); + break; + } + case 112: { + result.hasField14 = input.ReadInt64(ref result.field14_); + break; + } + case 122: { + result.hasField15 = input.ReadString(ref result.field15_); + break; + } + case 128: { + result.hasField16 = input.ReadInt32(ref result.field16_); + break; + } + case 152: { + result.hasField19 = input.ReadInt32(ref result.field19_); + break; + } + case 160: { + result.hasField20 = input.ReadBool(ref result.field20_); + break; + } + case 169: { + result.hasField21 = input.ReadFixed64(ref result.field21_); + break; + } + case 176: { + result.hasField22 = input.ReadInt32(ref result.field22_); + break; + } + case 184: { + result.hasField23 = input.ReadBool(ref result.field23_); + break; + } + case 224: { + result.hasField28 = input.ReadBool(ref result.field28_); + break; + } + case 1629: { + result.hasField203 = input.ReadFixed32(ref result.field203_); + break; + } + case 1632: { + result.hasField204 = input.ReadInt32(ref result.field204_); + break; + } + case 1642: { + result.hasField205 = input.ReadString(ref result.field205_); + break; + } + case 1648: { + result.hasField206 = input.ReadBool(ref result.field206_); + break; + } + case 1656: { + result.hasField207 = input.ReadUInt64(ref result.field207_); + break; + } + case 2400: { + result.hasField300 = input.ReadUInt64(ref result.field300_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public int Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(int value) { + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = 0; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public int Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(int value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public int Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(int value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0; + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + public string Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + public Builder SetField15(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = ""; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public bool Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(bool value) { + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = true; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public long Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(long value) { + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = 0L; + return this; + } + + public bool HasField14 { + get { return result.hasField14; } + } + public long Field14 { + get { return result.Field14; } + set { SetField14(value); } + } + public Builder SetField14(long value) { + PrepareBuilder(); + result.hasField14 = true; + result.field14_ = value; + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.hasField14 = false; + result.field14_ = 0L; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public int Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(int value) { + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = 0; + return this; + } + + public bool HasField19 { + get { return result.hasField19; } + } + public int Field19 { + get { return result.Field19; } + set { SetField19(value); } + } + public Builder SetField19(int value) { + PrepareBuilder(); + result.hasField19 = true; + result.field19_ = value; + return this; + } + public Builder ClearField19() { + PrepareBuilder(); + result.hasField19 = false; + result.field19_ = 2; + return this; + } + + public bool HasField20 { + get { return result.hasField20; } + } + public bool Field20 { + get { return result.Field20; } + set { SetField20(value); } + } + public Builder SetField20(bool value) { + PrepareBuilder(); + result.hasField20 = true; + result.field20_ = value; + return this; + } + public Builder ClearField20() { + PrepareBuilder(); + result.hasField20 = false; + result.field20_ = true; + return this; + } + + public bool HasField28 { + get { return result.hasField28; } + } + public bool Field28 { + get { return result.Field28; } + set { SetField28(value); } + } + public Builder SetField28(bool value) { + PrepareBuilder(); + result.hasField28 = true; + result.field28_ = value; + return this; + } + public Builder ClearField28() { + PrepareBuilder(); + result.hasField28 = false; + result.field28_ = true; + return this; + } + + public bool HasField21 { + get { return result.hasField21; } + } + [global::System.CLSCompliant(false)] + public ulong Field21 { + get { return result.Field21; } + set { SetField21(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField21(ulong value) { + PrepareBuilder(); + result.hasField21 = true; + result.field21_ = value; + return this; + } + public Builder ClearField21() { + PrepareBuilder(); + result.hasField21 = false; + result.field21_ = 0; + return this; + } + + public bool HasField22 { + get { return result.hasField22; } + } + public int Field22 { + get { return result.Field22; } + set { SetField22(value); } + } + public Builder SetField22(int value) { + PrepareBuilder(); + result.hasField22 = true; + result.field22_ = value; + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.hasField22 = false; + result.field22_ = 0; + return this; + } + + public bool HasField23 { + get { return result.hasField23; } + } + public bool Field23 { + get { return result.Field23; } + set { SetField23(value); } + } + public Builder SetField23(bool value) { + PrepareBuilder(); + result.hasField23 = true; + result.field23_ = value; + return this; + } + public Builder ClearField23() { + PrepareBuilder(); + result.hasField23 = false; + result.field23_ = false; + return this; + } + + public bool HasField206 { + get { return result.hasField206; } + } + public bool Field206 { + get { return result.Field206; } + set { SetField206(value); } + } + public Builder SetField206(bool value) { + PrepareBuilder(); + result.hasField206 = true; + result.field206_ = value; + return this; + } + public Builder ClearField206() { + PrepareBuilder(); + result.hasField206 = false; + result.field206_ = false; + return this; + } + + public bool HasField203 { + get { return result.hasField203; } + } + [global::System.CLSCompliant(false)] + public uint Field203 { + get { return result.Field203; } + set { SetField203(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField203(uint value) { + PrepareBuilder(); + result.hasField203 = true; + result.field203_ = value; + return this; + } + public Builder ClearField203() { + PrepareBuilder(); + result.hasField203 = false; + result.field203_ = 0; + return this; + } + + public bool HasField204 { + get { return result.hasField204; } + } + public int Field204 { + get { return result.Field204; } + set { SetField204(value); } + } + public Builder SetField204(int value) { + PrepareBuilder(); + result.hasField204 = true; + result.field204_ = value; + return this; + } + public Builder ClearField204() { + PrepareBuilder(); + result.hasField204 = false; + result.field204_ = 0; + return this; + } + + public bool HasField205 { + get { return result.hasField205; } + } + public string Field205 { + get { return result.Field205; } + set { SetField205(value); } + } + public Builder SetField205(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField205 = true; + result.field205_ = value; + return this; + } + public Builder ClearField205() { + PrepareBuilder(); + result.hasField205 = false; + result.field205_ = ""; + return this; + } + + public bool HasField207 { + get { return result.hasField207; } + } + [global::System.CLSCompliant(false)] + public ulong Field207 { + get { return result.Field207; } + set { SetField207(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField207(ulong value) { + PrepareBuilder(); + result.hasField207 = true; + result.field207_ = value; + return this; + } + public Builder ClearField207() { + PrepareBuilder(); + result.hasField207 = false; + result.field207_ = 0UL; + return this; + } + + public bool HasField300 { + get { return result.hasField300; } + } + [global::System.CLSCompliant(false)] + public ulong Field300 { + get { return result.Field300; } + set { SetField300(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField300(ulong value) { + PrepareBuilder(); + result.hasField300 = true; + result.field300_ = value; + return this; + } + public Builder ClearField300() { + PrepareBuilder(); + result.hasField300 = false; + result.field300_ = 0UL; + return this; + } + } + static SpeedMessage1SubMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SpeedMessage2 : pb::GeneratedMessage { + private SpeedMessage2() { } + private static readonly SpeedMessage2 defaultInstance = new SpeedMessage2().MakeReadOnly(); + private static readonly string[] _speedMessage2FieldNames = new string[] { "field1", "field109", "field127", "field128", "field129", "field130", "field131", "field2", "field205", "field206", "field21", "field210", "field211", "field212", "field213", "field216", "field217", "field218", "field220", "field221", "field222", "field25", "field3", "field30", "field4", "field6", "field63", "field71", "field75", "group1" }; + private static readonly uint[] _speedMessage2FieldTags = new uint[] { 10, 872, 1018, 1026, 1032, 1040, 1048, 18, 1640, 1648, 168, 1680, 1688, 1696, 1704, 1728, 1736, 1744, 1760, 1768, 1781, 205, 24, 240, 32, 50, 504, 568, 600, 83 }; + public static SpeedMessage2 DefaultInstance { + get { return defaultInstance; } + } + + public override SpeedMessage2 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SpeedMessage2 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage2__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage2__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Group1 : pb::GeneratedMessage { + private Group1() { } + private static readonly Group1 defaultInstance = new Group1().MakeReadOnly(); + private static readonly string[] _group1FieldNames = new string[] { "field11", "field12", "field13", "field14", "field15", "field16", "field20", "field22", "field24", "field26", "field27", "field28", "field29", "field31", "field5", "field73" }; + private static readonly uint[] _group1FieldTags = new uint[] { 93, 98, 106, 114, 120, 130, 160, 178, 194, 213, 218, 224, 234, 250, 40, 584 }; + public static Group1 DefaultInstance { + get { return defaultInstance; } + } + + public override Group1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Group1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage2_Group1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage2_Group1__FieldAccessorTable; } + } + + public const int Field11FieldNumber = 11; + private bool hasField11; + private float field11_; + public bool HasField11 { + get { return hasField11; } + } + public float Field11 { + get { return field11_; } + } + + public const int Field26FieldNumber = 26; + private bool hasField26; + private float field26_; + public bool HasField26 { + get { return hasField26; } + } + public float Field26 { + get { return field26_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private string field12_ = ""; + public bool HasField12 { + get { return hasField12; } + } + public string Field12 { + get { return field12_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private string field13_ = ""; + public bool HasField13 { + get { return hasField13; } + } + public string Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private pbc::PopsicleList field14_ = new pbc::PopsicleList(); + public scg::IList Field14List { + get { return pbc::Lists.AsReadOnly(field14_); } + } + public int Field14Count { + get { return field14_.Count; } + } + public string GetField14(int index) { + return field14_[index]; + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private ulong field15_; + public bool HasField15 { + get { return hasField15; } + } + [global::System.CLSCompliant(false)] + public ulong Field15 { + get { return field15_; } + } + + public const int Field5FieldNumber = 5; + private bool hasField5; + private int field5_; + public bool HasField5 { + get { return hasField5; } + } + public int Field5 { + get { return field5_; } + } + + public const int Field27FieldNumber = 27; + private bool hasField27; + private string field27_ = ""; + public bool HasField27 { + get { return hasField27; } + } + public string Field27 { + get { return field27_; } + } + + public const int Field28FieldNumber = 28; + private bool hasField28; + private int field28_; + public bool HasField28 { + get { return hasField28; } + } + public int Field28 { + get { return field28_; } + } + + public const int Field29FieldNumber = 29; + private bool hasField29; + private string field29_ = ""; + public bool HasField29 { + get { return hasField29; } + } + public string Field29 { + get { return field29_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private string field16_ = ""; + public bool HasField16 { + get { return hasField16; } + } + public string Field16 { + get { return field16_; } + } + + public const int Field22FieldNumber = 22; + private pbc::PopsicleList field22_ = new pbc::PopsicleList(); + public scg::IList Field22List { + get { return pbc::Lists.AsReadOnly(field22_); } + } + public int Field22Count { + get { return field22_.Count; } + } + public string GetField22(int index) { + return field22_[index]; + } + + public const int Field73FieldNumber = 73; + private pbc::PopsicleList field73_ = new pbc::PopsicleList(); + public scg::IList Field73List { + get { return pbc::Lists.AsReadOnly(field73_); } + } + public int Field73Count { + get { return field73_.Count; } + } + public int GetField73(int index) { + return field73_[index]; + } + + public const int Field20FieldNumber = 20; + private bool hasField20; + private int field20_; + public bool HasField20 { + get { return hasField20; } + } + public int Field20 { + get { return field20_; } + } + + public const int Field24FieldNumber = 24; + private bool hasField24; + private string field24_ = ""; + public bool HasField24 { + get { return hasField24; } + } + public string Field24 { + get { return field24_; } + } + + public const int Field31FieldNumber = 31; + private bool hasField31; + private global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage field31_; + public bool HasField31 { + get { return hasField31; } + } + public global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage Field31 { + get { return field31_ ?? global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (!hasField11) return false; + if (!hasField15) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _group1FieldNames; + if (hasField5) { + output.WriteInt32(5, field_names[14], Field5); + } + if (hasField11) { + output.WriteFloat(11, field_names[0], Field11); + } + if (hasField12) { + output.WriteString(12, field_names[1], Field12); + } + if (hasField13) { + output.WriteString(13, field_names[2], Field13); + } + if (field14_.Count > 0) { + output.WriteStringArray(14, field_names[3], field14_); + } + if (hasField15) { + output.WriteUInt64(15, field_names[4], Field15); + } + if (hasField16) { + output.WriteString(16, field_names[5], Field16); + } + if (hasField20) { + output.WriteInt32(20, field_names[6], Field20); + } + if (field22_.Count > 0) { + output.WriteStringArray(22, field_names[7], field22_); + } + if (hasField24) { + output.WriteString(24, field_names[8], Field24); + } + if (hasField26) { + output.WriteFloat(26, field_names[9], Field26); + } + if (hasField27) { + output.WriteString(27, field_names[10], Field27); + } + if (hasField28) { + output.WriteInt32(28, field_names[11], Field28); + } + if (hasField29) { + output.WriteString(29, field_names[12], Field29); + } + if (hasField31) { + output.WriteMessage(31, field_names[13], Field31); + } + if (field73_.Count > 0) { + output.WriteInt32Array(73, field_names[15], field73_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField11) { + size += pb::CodedOutputStream.ComputeFloatSize(11, Field11); + } + if (hasField26) { + size += pb::CodedOutputStream.ComputeFloatSize(26, Field26); + } + if (hasField12) { + size += pb::CodedOutputStream.ComputeStringSize(12, Field12); + } + if (hasField13) { + size += pb::CodedOutputStream.ComputeStringSize(13, Field13); + } + { + int dataSize = 0; + foreach (string element in Field14List) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * field14_.Count; + } + if (hasField15) { + size += pb::CodedOutputStream.ComputeUInt64Size(15, Field15); + } + if (hasField5) { + size += pb::CodedOutputStream.ComputeInt32Size(5, Field5); + } + if (hasField27) { + size += pb::CodedOutputStream.ComputeStringSize(27, Field27); + } + if (hasField28) { + size += pb::CodedOutputStream.ComputeInt32Size(28, Field28); + } + if (hasField29) { + size += pb::CodedOutputStream.ComputeStringSize(29, Field29); + } + if (hasField16) { + size += pb::CodedOutputStream.ComputeStringSize(16, Field16); + } + { + int dataSize = 0; + foreach (string element in Field22List) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * field22_.Count; + } + { + int dataSize = 0; + foreach (int element in Field73List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * field73_.Count; + } + if (hasField20) { + size += pb::CodedOutputStream.ComputeInt32Size(20, Field20); + } + if (hasField24) { + size += pb::CodedOutputStream.ComputeStringSize(24, Field24); + } + if (hasField31) { + size += pb::CodedOutputStream.ComputeMessageSize(31, Field31); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Group1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Group1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Group1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Group1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Group1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Group1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Group1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Group1 MakeReadOnly() { + field14_.MakeReadOnly(); + field22_.MakeReadOnly(); + field73_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Group1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Group1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Group1 result; + + private Group1 PrepareBuilder() { + if (resultIsReadOnly) { + Group1 original = result; + result = new Group1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Group1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1.Descriptor; } + } + + public override Group1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1.DefaultInstance; } + } + + public override Group1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Group1) { + return MergeFrom((Group1) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Group1 other) { + if (other == global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField11) { + Field11 = other.Field11; + } + if (other.HasField26) { + Field26 = other.Field26; + } + if (other.HasField12) { + Field12 = other.Field12; + } + if (other.HasField13) { + Field13 = other.Field13; + } + if (other.field14_.Count != 0) { + result.field14_.Add(other.field14_); + } + if (other.HasField15) { + Field15 = other.Field15; + } + if (other.HasField5) { + Field5 = other.Field5; + } + if (other.HasField27) { + Field27 = other.Field27; + } + if (other.HasField28) { + Field28 = other.Field28; + } + if (other.HasField29) { + Field29 = other.Field29; + } + if (other.HasField16) { + Field16 = other.Field16; + } + if (other.field22_.Count != 0) { + result.field22_.Add(other.field22_); + } + if (other.field73_.Count != 0) { + result.field73_.Add(other.field73_); + } + if (other.HasField20) { + Field20 = other.Field20; + } + if (other.HasField24) { + Field24 = other.Field24; + } + if (other.HasField31) { + MergeField31(other.Field31); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_group1FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _group1FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 40: { + result.hasField5 = input.ReadInt32(ref result.field5_); + break; + } + case 93: { + result.hasField11 = input.ReadFloat(ref result.field11_); + break; + } + case 98: { + result.hasField12 = input.ReadString(ref result.field12_); + break; + } + case 106: { + result.hasField13 = input.ReadString(ref result.field13_); + break; + } + case 114: { + input.ReadStringArray(tag, field_name, result.field14_); + break; + } + case 120: { + result.hasField15 = input.ReadUInt64(ref result.field15_); + break; + } + case 130: { + result.hasField16 = input.ReadString(ref result.field16_); + break; + } + case 160: { + result.hasField20 = input.ReadInt32(ref result.field20_); + break; + } + case 178: { + input.ReadStringArray(tag, field_name, result.field22_); + break; + } + case 194: { + result.hasField24 = input.ReadString(ref result.field24_); + break; + } + case 213: { + result.hasField26 = input.ReadFloat(ref result.field26_); + break; + } + case 218: { + result.hasField27 = input.ReadString(ref result.field27_); + break; + } + case 224: { + result.hasField28 = input.ReadInt32(ref result.field28_); + break; + } + case 234: { + result.hasField29 = input.ReadString(ref result.field29_); + break; + } + case 250: { + global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage.Builder subBuilder = global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage.CreateBuilder(); + if (result.hasField31) { + subBuilder.MergeFrom(Field31); + } + input.ReadMessage(subBuilder, extensionRegistry); + Field31 = subBuilder.BuildPartial(); + break; + } + case 586: + case 584: { + input.ReadInt32Array(tag, field_name, result.field73_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField11 { + get { return result.hasField11; } + } + public float Field11 { + get { return result.Field11; } + set { SetField11(value); } + } + public Builder SetField11(float value) { + PrepareBuilder(); + result.hasField11 = true; + result.field11_ = value; + return this; + } + public Builder ClearField11() { + PrepareBuilder(); + result.hasField11 = false; + result.field11_ = 0F; + return this; + } + + public bool HasField26 { + get { return result.hasField26; } + } + public float Field26 { + get { return result.Field26; } + set { SetField26(value); } + } + public Builder SetField26(float value) { + PrepareBuilder(); + result.hasField26 = true; + result.field26_ = value; + return this; + } + public Builder ClearField26() { + PrepareBuilder(); + result.hasField26 = false; + result.field26_ = 0F; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public string Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = ""; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public string Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = ""; + return this; + } + + public pbc::IPopsicleList Field14List { + get { return PrepareBuilder().field14_; } + } + public int Field14Count { + get { return result.Field14Count; } + } + public string GetField14(int index) { + return result.GetField14(index); + } + public Builder SetField14(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field14_[index] = value; + return this; + } + public Builder AddField14(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field14_.Add(value); + return this; + } + public Builder AddRangeField14(scg::IEnumerable values) { + PrepareBuilder(); + result.field14_.Add(values); + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.field14_.Clear(); + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + [global::System.CLSCompliant(false)] + public ulong Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField15(ulong value) { + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = 0UL; + return this; + } + + public bool HasField5 { + get { return result.hasField5; } + } + public int Field5 { + get { return result.Field5; } + set { SetField5(value); } + } + public Builder SetField5(int value) { + PrepareBuilder(); + result.hasField5 = true; + result.field5_ = value; + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.hasField5 = false; + result.field5_ = 0; + return this; + } + + public bool HasField27 { + get { return result.hasField27; } + } + public string Field27 { + get { return result.Field27; } + set { SetField27(value); } + } + public Builder SetField27(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField27 = true; + result.field27_ = value; + return this; + } + public Builder ClearField27() { + PrepareBuilder(); + result.hasField27 = false; + result.field27_ = ""; + return this; + } + + public bool HasField28 { + get { return result.hasField28; } + } + public int Field28 { + get { return result.Field28; } + set { SetField28(value); } + } + public Builder SetField28(int value) { + PrepareBuilder(); + result.hasField28 = true; + result.field28_ = value; + return this; + } + public Builder ClearField28() { + PrepareBuilder(); + result.hasField28 = false; + result.field28_ = 0; + return this; + } + + public bool HasField29 { + get { return result.hasField29; } + } + public string Field29 { + get { return result.Field29; } + set { SetField29(value); } + } + public Builder SetField29(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField29 = true; + result.field29_ = value; + return this; + } + public Builder ClearField29() { + PrepareBuilder(); + result.hasField29 = false; + result.field29_ = ""; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public string Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = ""; + return this; + } + + public pbc::IPopsicleList Field22List { + get { return PrepareBuilder().field22_; } + } + public int Field22Count { + get { return result.Field22Count; } + } + public string GetField22(int index) { + return result.GetField22(index); + } + public Builder SetField22(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field22_[index] = value; + return this; + } + public Builder AddField22(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field22_.Add(value); + return this; + } + public Builder AddRangeField22(scg::IEnumerable values) { + PrepareBuilder(); + result.field22_.Add(values); + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.field22_.Clear(); + return this; + } + + public pbc::IPopsicleList Field73List { + get { return PrepareBuilder().field73_; } + } + public int Field73Count { + get { return result.Field73Count; } + } + public int GetField73(int index) { + return result.GetField73(index); + } + public Builder SetField73(int index, int value) { + PrepareBuilder(); + result.field73_[index] = value; + return this; + } + public Builder AddField73(int value) { + PrepareBuilder(); + result.field73_.Add(value); + return this; + } + public Builder AddRangeField73(scg::IEnumerable values) { + PrepareBuilder(); + result.field73_.Add(values); + return this; + } + public Builder ClearField73() { + PrepareBuilder(); + result.field73_.Clear(); + return this; + } + + public bool HasField20 { + get { return result.hasField20; } + } + public int Field20 { + get { return result.Field20; } + set { SetField20(value); } + } + public Builder SetField20(int value) { + PrepareBuilder(); + result.hasField20 = true; + result.field20_ = value; + return this; + } + public Builder ClearField20() { + PrepareBuilder(); + result.hasField20 = false; + result.field20_ = 0; + return this; + } + + public bool HasField24 { + get { return result.hasField24; } + } + public string Field24 { + get { return result.Field24; } + set { SetField24(value); } + } + public Builder SetField24(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField24 = true; + result.field24_ = value; + return this; + } + public Builder ClearField24() { + PrepareBuilder(); + result.hasField24 = false; + result.field24_ = ""; + return this; + } + + public bool HasField31 { + get { return result.hasField31; } + } + public global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage Field31 { + get { return result.Field31; } + set { SetField31(value); } + } + public Builder SetField31(global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField31 = true; + result.field31_ = value; + return this; + } + public Builder SetField31(global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasField31 = true; + result.field31_ = builderForValue.Build(); + return this; + } + public Builder MergeField31(global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasField31 && + result.field31_ != global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage.DefaultInstance) { + result.field31_ = global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage.CreateBuilder(result.field31_).MergeFrom(value).BuildPartial(); + } else { + result.field31_ = value; + } + result.hasField31 = true; + return this; + } + public Builder ClearField31() { + PrepareBuilder(); + result.hasField31 = false; + result.field31_ = null; + return this; + } + } + static Group1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int Field1FieldNumber = 1; + private bool hasField1; + private string field1_ = ""; + public bool HasField1 { + get { return hasField1; } + } + public string Field1 { + get { return field1_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private long field3_; + public bool HasField3 { + get { return hasField3; } + } + public long Field3 { + get { return field3_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private long field4_; + public bool HasField4 { + get { return hasField4; } + } + public long Field4 { + get { return field4_; } + } + + public const int Field30FieldNumber = 30; + private bool hasField30; + private long field30_; + public bool HasField30 { + get { return hasField30; } + } + public long Field30 { + get { return field30_; } + } + + public const int Field75FieldNumber = 75; + private bool hasField75; + private bool field75_; + public bool HasField75 { + get { return hasField75; } + } + public bool Field75 { + get { return field75_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private string field6_ = ""; + public bool HasField6 { + get { return hasField6; } + } + public string Field6 { + get { return field6_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private pb::ByteString field2_ = pb::ByteString.Empty; + public bool HasField2 { + get { return hasField2; } + } + public pb::ByteString Field2 { + get { return field2_; } + } + + public const int Field21FieldNumber = 21; + private bool hasField21; + private int field21_; + public bool HasField21 { + get { return hasField21; } + } + public int Field21 { + get { return field21_; } + } + + public const int Field71FieldNumber = 71; + private bool hasField71; + private int field71_; + public bool HasField71 { + get { return hasField71; } + } + public int Field71 { + get { return field71_; } + } + + public const int Field25FieldNumber = 25; + private bool hasField25; + private float field25_; + public bool HasField25 { + get { return hasField25; } + } + public float Field25 { + get { return field25_; } + } + + public const int Field109FieldNumber = 109; + private bool hasField109; + private int field109_; + public bool HasField109 { + get { return hasField109; } + } + public int Field109 { + get { return field109_; } + } + + public const int Field210FieldNumber = 210; + private bool hasField210; + private int field210_; + public bool HasField210 { + get { return hasField210; } + } + public int Field210 { + get { return field210_; } + } + + public const int Field211FieldNumber = 211; + private bool hasField211; + private int field211_; + public bool HasField211 { + get { return hasField211; } + } + public int Field211 { + get { return field211_; } + } + + public const int Field212FieldNumber = 212; + private bool hasField212; + private int field212_; + public bool HasField212 { + get { return hasField212; } + } + public int Field212 { + get { return field212_; } + } + + public const int Field213FieldNumber = 213; + private bool hasField213; + private int field213_; + public bool HasField213 { + get { return hasField213; } + } + public int Field213 { + get { return field213_; } + } + + public const int Field216FieldNumber = 216; + private bool hasField216; + private int field216_; + public bool HasField216 { + get { return hasField216; } + } + public int Field216 { + get { return field216_; } + } + + public const int Field217FieldNumber = 217; + private bool hasField217; + private int field217_; + public bool HasField217 { + get { return hasField217; } + } + public int Field217 { + get { return field217_; } + } + + public const int Field218FieldNumber = 218; + private bool hasField218; + private int field218_; + public bool HasField218 { + get { return hasField218; } + } + public int Field218 { + get { return field218_; } + } + + public const int Field220FieldNumber = 220; + private bool hasField220; + private int field220_; + public bool HasField220 { + get { return hasField220; } + } + public int Field220 { + get { return field220_; } + } + + public const int Field221FieldNumber = 221; + private bool hasField221; + private int field221_; + public bool HasField221 { + get { return hasField221; } + } + public int Field221 { + get { return field221_; } + } + + public const int Field222FieldNumber = 222; + private bool hasField222; + private float field222_; + public bool HasField222 { + get { return hasField222; } + } + public float Field222 { + get { return field222_; } + } + + public const int Field63FieldNumber = 63; + private bool hasField63; + private int field63_; + public bool HasField63 { + get { return hasField63; } + } + public int Field63 { + get { return field63_; } + } + + public const int Group1FieldNumber = 10; + private pbc::PopsicleList group1_ = new pbc::PopsicleList(); + public scg::IList Group1List { + get { return group1_; } + } + public int Group1Count { + get { return group1_.Count; } + } + public global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1 GetGroup1(int index) { + return group1_[index]; + } + + public const int Field128FieldNumber = 128; + private pbc::PopsicleList field128_ = new pbc::PopsicleList(); + public scg::IList Field128List { + get { return pbc::Lists.AsReadOnly(field128_); } + } + public int Field128Count { + get { return field128_.Count; } + } + public string GetField128(int index) { + return field128_[index]; + } + + public const int Field131FieldNumber = 131; + private bool hasField131; + private long field131_; + public bool HasField131 { + get { return hasField131; } + } + public long Field131 { + get { return field131_; } + } + + public const int Field127FieldNumber = 127; + private pbc::PopsicleList field127_ = new pbc::PopsicleList(); + public scg::IList Field127List { + get { return pbc::Lists.AsReadOnly(field127_); } + } + public int Field127Count { + get { return field127_.Count; } + } + public string GetField127(int index) { + return field127_[index]; + } + + public const int Field129FieldNumber = 129; + private bool hasField129; + private int field129_; + public bool HasField129 { + get { return hasField129; } + } + public int Field129 { + get { return field129_; } + } + + public const int Field130FieldNumber = 130; + private pbc::PopsicleList field130_ = new pbc::PopsicleList(); + public scg::IList Field130List { + get { return pbc::Lists.AsReadOnly(field130_); } + } + public int Field130Count { + get { return field130_.Count; } + } + public long GetField130(int index) { + return field130_[index]; + } + + public const int Field205FieldNumber = 205; + private bool hasField205; + private bool field205_; + public bool HasField205 { + get { return hasField205; } + } + public bool Field205 { + get { return field205_; } + } + + public const int Field206FieldNumber = 206; + private bool hasField206; + private bool field206_; + public bool HasField206 { + get { return hasField206; } + } + public bool Field206 { + get { return field206_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _speedMessage2FieldNames; + if (hasField1) { + output.WriteString(1, field_names[0], Field1); + } + if (hasField2) { + output.WriteBytes(2, field_names[7], Field2); + } + if (hasField3) { + output.WriteInt64(3, field_names[22], Field3); + } + if (hasField4) { + output.WriteInt64(4, field_names[24], Field4); + } + if (hasField6) { + output.WriteString(6, field_names[25], Field6); + } + if (group1_.Count > 0) { + output.WriteGroupArray(10, field_names[29], group1_); + } + if (hasField21) { + output.WriteInt32(21, field_names[10], Field21); + } + if (hasField25) { + output.WriteFloat(25, field_names[21], Field25); + } + if (hasField30) { + output.WriteInt64(30, field_names[23], Field30); + } + if (hasField63) { + output.WriteInt32(63, field_names[26], Field63); + } + if (hasField71) { + output.WriteInt32(71, field_names[27], Field71); + } + if (hasField75) { + output.WriteBool(75, field_names[28], Field75); + } + if (hasField109) { + output.WriteInt32(109, field_names[1], Field109); + } + if (field127_.Count > 0) { + output.WriteStringArray(127, field_names[2], field127_); + } + if (field128_.Count > 0) { + output.WriteStringArray(128, field_names[3], field128_); + } + if (hasField129) { + output.WriteInt32(129, field_names[4], Field129); + } + if (field130_.Count > 0) { + output.WriteInt64Array(130, field_names[5], field130_); + } + if (hasField131) { + output.WriteInt64(131, field_names[6], Field131); + } + if (hasField205) { + output.WriteBool(205, field_names[8], Field205); + } + if (hasField206) { + output.WriteBool(206, field_names[9], Field206); + } + if (hasField210) { + output.WriteInt32(210, field_names[11], Field210); + } + if (hasField211) { + output.WriteInt32(211, field_names[12], Field211); + } + if (hasField212) { + output.WriteInt32(212, field_names[13], Field212); + } + if (hasField213) { + output.WriteInt32(213, field_names[14], Field213); + } + if (hasField216) { + output.WriteInt32(216, field_names[15], Field216); + } + if (hasField217) { + output.WriteInt32(217, field_names[16], Field217); + } + if (hasField218) { + output.WriteInt32(218, field_names[17], Field218); + } + if (hasField220) { + output.WriteInt32(220, field_names[18], Field220); + } + if (hasField221) { + output.WriteInt32(221, field_names[19], Field221); + } + if (hasField222) { + output.WriteFloat(222, field_names[20], Field222); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField1) { + size += pb::CodedOutputStream.ComputeStringSize(1, Field1); + } + if (hasField3) { + size += pb::CodedOutputStream.ComputeInt64Size(3, Field3); + } + if (hasField4) { + size += pb::CodedOutputStream.ComputeInt64Size(4, Field4); + } + if (hasField30) { + size += pb::CodedOutputStream.ComputeInt64Size(30, Field30); + } + if (hasField75) { + size += pb::CodedOutputStream.ComputeBoolSize(75, Field75); + } + if (hasField6) { + size += pb::CodedOutputStream.ComputeStringSize(6, Field6); + } + if (hasField2) { + size += pb::CodedOutputStream.ComputeBytesSize(2, Field2); + } + if (hasField21) { + size += pb::CodedOutputStream.ComputeInt32Size(21, Field21); + } + if (hasField71) { + size += pb::CodedOutputStream.ComputeInt32Size(71, Field71); + } + if (hasField25) { + size += pb::CodedOutputStream.ComputeFloatSize(25, Field25); + } + if (hasField109) { + size += pb::CodedOutputStream.ComputeInt32Size(109, Field109); + } + if (hasField210) { + size += pb::CodedOutputStream.ComputeInt32Size(210, Field210); + } + if (hasField211) { + size += pb::CodedOutputStream.ComputeInt32Size(211, Field211); + } + if (hasField212) { + size += pb::CodedOutputStream.ComputeInt32Size(212, Field212); + } + if (hasField213) { + size += pb::CodedOutputStream.ComputeInt32Size(213, Field213); + } + if (hasField216) { + size += pb::CodedOutputStream.ComputeInt32Size(216, Field216); + } + if (hasField217) { + size += pb::CodedOutputStream.ComputeInt32Size(217, Field217); + } + if (hasField218) { + size += pb::CodedOutputStream.ComputeInt32Size(218, Field218); + } + if (hasField220) { + size += pb::CodedOutputStream.ComputeInt32Size(220, Field220); + } + if (hasField221) { + size += pb::CodedOutputStream.ComputeInt32Size(221, Field221); + } + if (hasField222) { + size += pb::CodedOutputStream.ComputeFloatSize(222, Field222); + } + if (hasField63) { + size += pb::CodedOutputStream.ComputeInt32Size(63, Field63); + } + foreach (global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1 element in Group1List) { + size += pb::CodedOutputStream.ComputeGroupSize(10, element); + } + { + int dataSize = 0; + foreach (string element in Field128List) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * field128_.Count; + } + if (hasField131) { + size += pb::CodedOutputStream.ComputeInt64Size(131, Field131); + } + { + int dataSize = 0; + foreach (string element in Field127List) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * field127_.Count; + } + if (hasField129) { + size += pb::CodedOutputStream.ComputeInt32Size(129, Field129); + } + { + int dataSize = 0; + foreach (long element in Field130List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * field130_.Count; + } + if (hasField205) { + size += pb::CodedOutputStream.ComputeBoolSize(205, Field205); + } + if (hasField206) { + size += pb::CodedOutputStream.ComputeBoolSize(206, Field206); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SpeedMessage2 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SpeedMessage2 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SpeedMessage2 MakeReadOnly() { + group1_.MakeReadOnly(); + field128_.MakeReadOnly(); + field127_.MakeReadOnly(); + field130_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SpeedMessage2 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SpeedMessage2 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SpeedMessage2 result; + + private SpeedMessage2 PrepareBuilder() { + if (resultIsReadOnly) { + SpeedMessage2 original = result; + result = new SpeedMessage2(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SpeedMessage2 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Descriptor; } + } + + public override SpeedMessage2 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.DefaultInstance; } + } + + public override SpeedMessage2 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SpeedMessage2) { + return MergeFrom((SpeedMessage2) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SpeedMessage2 other) { + if (other == global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField1) { + Field1 = other.Field1; + } + if (other.HasField3) { + Field3 = other.Field3; + } + if (other.HasField4) { + Field4 = other.Field4; + } + if (other.HasField30) { + Field30 = other.Field30; + } + if (other.HasField75) { + Field75 = other.Field75; + } + if (other.HasField6) { + Field6 = other.Field6; + } + if (other.HasField2) { + Field2 = other.Field2; + } + if (other.HasField21) { + Field21 = other.Field21; + } + if (other.HasField71) { + Field71 = other.Field71; + } + if (other.HasField25) { + Field25 = other.Field25; + } + if (other.HasField109) { + Field109 = other.Field109; + } + if (other.HasField210) { + Field210 = other.Field210; + } + if (other.HasField211) { + Field211 = other.Field211; + } + if (other.HasField212) { + Field212 = other.Field212; + } + if (other.HasField213) { + Field213 = other.Field213; + } + if (other.HasField216) { + Field216 = other.Field216; + } + if (other.HasField217) { + Field217 = other.Field217; + } + if (other.HasField218) { + Field218 = other.Field218; + } + if (other.HasField220) { + Field220 = other.Field220; + } + if (other.HasField221) { + Field221 = other.Field221; + } + if (other.HasField222) { + Field222 = other.Field222; + } + if (other.HasField63) { + Field63 = other.Field63; + } + if (other.group1_.Count != 0) { + result.group1_.Add(other.group1_); + } + if (other.field128_.Count != 0) { + result.field128_.Add(other.field128_); + } + if (other.HasField131) { + Field131 = other.Field131; + } + if (other.field127_.Count != 0) { + result.field127_.Add(other.field127_); + } + if (other.HasField129) { + Field129 = other.Field129; + } + if (other.field130_.Count != 0) { + result.field130_.Add(other.field130_); + } + if (other.HasField205) { + Field205 = other.Field205; + } + if (other.HasField206) { + Field206 = other.Field206; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_speedMessage2FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _speedMessage2FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasField1 = input.ReadString(ref result.field1_); + break; + } + case 18: { + result.hasField2 = input.ReadBytes(ref result.field2_); + break; + } + case 24: { + result.hasField3 = input.ReadInt64(ref result.field3_); + break; + } + case 32: { + result.hasField4 = input.ReadInt64(ref result.field4_); + break; + } + case 50: { + result.hasField6 = input.ReadString(ref result.field6_); + break; + } + case 83: { + input.ReadGroupArray(tag, field_name, result.group1_, global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1.DefaultInstance, extensionRegistry); + break; + } + case 168: { + result.hasField21 = input.ReadInt32(ref result.field21_); + break; + } + case 205: { + result.hasField25 = input.ReadFloat(ref result.field25_); + break; + } + case 240: { + result.hasField30 = input.ReadInt64(ref result.field30_); + break; + } + case 504: { + result.hasField63 = input.ReadInt32(ref result.field63_); + break; + } + case 568: { + result.hasField71 = input.ReadInt32(ref result.field71_); + break; + } + case 600: { + result.hasField75 = input.ReadBool(ref result.field75_); + break; + } + case 872: { + result.hasField109 = input.ReadInt32(ref result.field109_); + break; + } + case 1018: { + input.ReadStringArray(tag, field_name, result.field127_); + break; + } + case 1026: { + input.ReadStringArray(tag, field_name, result.field128_); + break; + } + case 1032: { + result.hasField129 = input.ReadInt32(ref result.field129_); + break; + } + case 1042: + case 1040: { + input.ReadInt64Array(tag, field_name, result.field130_); + break; + } + case 1048: { + result.hasField131 = input.ReadInt64(ref result.field131_); + break; + } + case 1640: { + result.hasField205 = input.ReadBool(ref result.field205_); + break; + } + case 1648: { + result.hasField206 = input.ReadBool(ref result.field206_); + break; + } + case 1680: { + result.hasField210 = input.ReadInt32(ref result.field210_); + break; + } + case 1688: { + result.hasField211 = input.ReadInt32(ref result.field211_); + break; + } + case 1696: { + result.hasField212 = input.ReadInt32(ref result.field212_); + break; + } + case 1704: { + result.hasField213 = input.ReadInt32(ref result.field213_); + break; + } + case 1728: { + result.hasField216 = input.ReadInt32(ref result.field216_); + break; + } + case 1736: { + result.hasField217 = input.ReadInt32(ref result.field217_); + break; + } + case 1744: { + result.hasField218 = input.ReadInt32(ref result.field218_); + break; + } + case 1760: { + result.hasField220 = input.ReadInt32(ref result.field220_); + break; + } + case 1768: { + result.hasField221 = input.ReadInt32(ref result.field221_); + break; + } + case 1781: { + result.hasField222 = input.ReadFloat(ref result.field222_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public string Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = ""; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public long Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(long value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0L; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public long Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(long value) { + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = 0L; + return this; + } + + public bool HasField30 { + get { return result.hasField30; } + } + public long Field30 { + get { return result.Field30; } + set { SetField30(value); } + } + public Builder SetField30(long value) { + PrepareBuilder(); + result.hasField30 = true; + result.field30_ = value; + return this; + } + public Builder ClearField30() { + PrepareBuilder(); + result.hasField30 = false; + result.field30_ = 0L; + return this; + } + + public bool HasField75 { + get { return result.hasField75; } + } + public bool Field75 { + get { return result.Field75; } + set { SetField75(value); } + } + public Builder SetField75(bool value) { + PrepareBuilder(); + result.hasField75 = true; + result.field75_ = value; + return this; + } + public Builder ClearField75() { + PrepareBuilder(); + result.hasField75 = false; + result.field75_ = false; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public string Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = ""; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public pb::ByteString Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = pb::ByteString.Empty; + return this; + } + + public bool HasField21 { + get { return result.hasField21; } + } + public int Field21 { + get { return result.Field21; } + set { SetField21(value); } + } + public Builder SetField21(int value) { + PrepareBuilder(); + result.hasField21 = true; + result.field21_ = value; + return this; + } + public Builder ClearField21() { + PrepareBuilder(); + result.hasField21 = false; + result.field21_ = 0; + return this; + } + + public bool HasField71 { + get { return result.hasField71; } + } + public int Field71 { + get { return result.Field71; } + set { SetField71(value); } + } + public Builder SetField71(int value) { + PrepareBuilder(); + result.hasField71 = true; + result.field71_ = value; + return this; + } + public Builder ClearField71() { + PrepareBuilder(); + result.hasField71 = false; + result.field71_ = 0; + return this; + } + + public bool HasField25 { + get { return result.hasField25; } + } + public float Field25 { + get { return result.Field25; } + set { SetField25(value); } + } + public Builder SetField25(float value) { + PrepareBuilder(); + result.hasField25 = true; + result.field25_ = value; + return this; + } + public Builder ClearField25() { + PrepareBuilder(); + result.hasField25 = false; + result.field25_ = 0F; + return this; + } + + public bool HasField109 { + get { return result.hasField109; } + } + public int Field109 { + get { return result.Field109; } + set { SetField109(value); } + } + public Builder SetField109(int value) { + PrepareBuilder(); + result.hasField109 = true; + result.field109_ = value; + return this; + } + public Builder ClearField109() { + PrepareBuilder(); + result.hasField109 = false; + result.field109_ = 0; + return this; + } + + public bool HasField210 { + get { return result.hasField210; } + } + public int Field210 { + get { return result.Field210; } + set { SetField210(value); } + } + public Builder SetField210(int value) { + PrepareBuilder(); + result.hasField210 = true; + result.field210_ = value; + return this; + } + public Builder ClearField210() { + PrepareBuilder(); + result.hasField210 = false; + result.field210_ = 0; + return this; + } + + public bool HasField211 { + get { return result.hasField211; } + } + public int Field211 { + get { return result.Field211; } + set { SetField211(value); } + } + public Builder SetField211(int value) { + PrepareBuilder(); + result.hasField211 = true; + result.field211_ = value; + return this; + } + public Builder ClearField211() { + PrepareBuilder(); + result.hasField211 = false; + result.field211_ = 0; + return this; + } + + public bool HasField212 { + get { return result.hasField212; } + } + public int Field212 { + get { return result.Field212; } + set { SetField212(value); } + } + public Builder SetField212(int value) { + PrepareBuilder(); + result.hasField212 = true; + result.field212_ = value; + return this; + } + public Builder ClearField212() { + PrepareBuilder(); + result.hasField212 = false; + result.field212_ = 0; + return this; + } + + public bool HasField213 { + get { return result.hasField213; } + } + public int Field213 { + get { return result.Field213; } + set { SetField213(value); } + } + public Builder SetField213(int value) { + PrepareBuilder(); + result.hasField213 = true; + result.field213_ = value; + return this; + } + public Builder ClearField213() { + PrepareBuilder(); + result.hasField213 = false; + result.field213_ = 0; + return this; + } + + public bool HasField216 { + get { return result.hasField216; } + } + public int Field216 { + get { return result.Field216; } + set { SetField216(value); } + } + public Builder SetField216(int value) { + PrepareBuilder(); + result.hasField216 = true; + result.field216_ = value; + return this; + } + public Builder ClearField216() { + PrepareBuilder(); + result.hasField216 = false; + result.field216_ = 0; + return this; + } + + public bool HasField217 { + get { return result.hasField217; } + } + public int Field217 { + get { return result.Field217; } + set { SetField217(value); } + } + public Builder SetField217(int value) { + PrepareBuilder(); + result.hasField217 = true; + result.field217_ = value; + return this; + } + public Builder ClearField217() { + PrepareBuilder(); + result.hasField217 = false; + result.field217_ = 0; + return this; + } + + public bool HasField218 { + get { return result.hasField218; } + } + public int Field218 { + get { return result.Field218; } + set { SetField218(value); } + } + public Builder SetField218(int value) { + PrepareBuilder(); + result.hasField218 = true; + result.field218_ = value; + return this; + } + public Builder ClearField218() { + PrepareBuilder(); + result.hasField218 = false; + result.field218_ = 0; + return this; + } + + public bool HasField220 { + get { return result.hasField220; } + } + public int Field220 { + get { return result.Field220; } + set { SetField220(value); } + } + public Builder SetField220(int value) { + PrepareBuilder(); + result.hasField220 = true; + result.field220_ = value; + return this; + } + public Builder ClearField220() { + PrepareBuilder(); + result.hasField220 = false; + result.field220_ = 0; + return this; + } + + public bool HasField221 { + get { return result.hasField221; } + } + public int Field221 { + get { return result.Field221; } + set { SetField221(value); } + } + public Builder SetField221(int value) { + PrepareBuilder(); + result.hasField221 = true; + result.field221_ = value; + return this; + } + public Builder ClearField221() { + PrepareBuilder(); + result.hasField221 = false; + result.field221_ = 0; + return this; + } + + public bool HasField222 { + get { return result.hasField222; } + } + public float Field222 { + get { return result.Field222; } + set { SetField222(value); } + } + public Builder SetField222(float value) { + PrepareBuilder(); + result.hasField222 = true; + result.field222_ = value; + return this; + } + public Builder ClearField222() { + PrepareBuilder(); + result.hasField222 = false; + result.field222_ = 0F; + return this; + } + + public bool HasField63 { + get { return result.hasField63; } + } + public int Field63 { + get { return result.Field63; } + set { SetField63(value); } + } + public Builder SetField63(int value) { + PrepareBuilder(); + result.hasField63 = true; + result.field63_ = value; + return this; + } + public Builder ClearField63() { + PrepareBuilder(); + result.hasField63 = false; + result.field63_ = 0; + return this; + } + + public pbc::IPopsicleList Group1List { + get { return PrepareBuilder().group1_; } + } + public int Group1Count { + get { return result.Group1Count; } + } + public global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1 GetGroup1(int index) { + return result.GetGroup1(index); + } + public Builder SetGroup1(int index, global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.group1_[index] = value; + return this; + } + public Builder SetGroup1(int index, global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.group1_[index] = builderForValue.Build(); + return this; + } + public Builder AddGroup1(global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.group1_.Add(value); + return this; + } + public Builder AddGroup1(global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2.Types.Group1.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.group1_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeGroup1(scg::IEnumerable values) { + PrepareBuilder(); + result.group1_.Add(values); + return this; + } + public Builder ClearGroup1() { + PrepareBuilder(); + result.group1_.Clear(); + return this; + } + + public pbc::IPopsicleList Field128List { + get { return PrepareBuilder().field128_; } + } + public int Field128Count { + get { return result.Field128Count; } + } + public string GetField128(int index) { + return result.GetField128(index); + } + public Builder SetField128(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field128_[index] = value; + return this; + } + public Builder AddField128(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field128_.Add(value); + return this; + } + public Builder AddRangeField128(scg::IEnumerable values) { + PrepareBuilder(); + result.field128_.Add(values); + return this; + } + public Builder ClearField128() { + PrepareBuilder(); + result.field128_.Clear(); + return this; + } + + public bool HasField131 { + get { return result.hasField131; } + } + public long Field131 { + get { return result.Field131; } + set { SetField131(value); } + } + public Builder SetField131(long value) { + PrepareBuilder(); + result.hasField131 = true; + result.field131_ = value; + return this; + } + public Builder ClearField131() { + PrepareBuilder(); + result.hasField131 = false; + result.field131_ = 0L; + return this; + } + + public pbc::IPopsicleList Field127List { + get { return PrepareBuilder().field127_; } + } + public int Field127Count { + get { return result.Field127Count; } + } + public string GetField127(int index) { + return result.GetField127(index); + } + public Builder SetField127(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field127_[index] = value; + return this; + } + public Builder AddField127(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field127_.Add(value); + return this; + } + public Builder AddRangeField127(scg::IEnumerable values) { + PrepareBuilder(); + result.field127_.Add(values); + return this; + } + public Builder ClearField127() { + PrepareBuilder(); + result.field127_.Clear(); + return this; + } + + public bool HasField129 { + get { return result.hasField129; } + } + public int Field129 { + get { return result.Field129; } + set { SetField129(value); } + } + public Builder SetField129(int value) { + PrepareBuilder(); + result.hasField129 = true; + result.field129_ = value; + return this; + } + public Builder ClearField129() { + PrepareBuilder(); + result.hasField129 = false; + result.field129_ = 0; + return this; + } + + public pbc::IPopsicleList Field130List { + get { return PrepareBuilder().field130_; } + } + public int Field130Count { + get { return result.Field130Count; } + } + public long GetField130(int index) { + return result.GetField130(index); + } + public Builder SetField130(int index, long value) { + PrepareBuilder(); + result.field130_[index] = value; + return this; + } + public Builder AddField130(long value) { + PrepareBuilder(); + result.field130_.Add(value); + return this; + } + public Builder AddRangeField130(scg::IEnumerable values) { + PrepareBuilder(); + result.field130_.Add(values); + return this; + } + public Builder ClearField130() { + PrepareBuilder(); + result.field130_.Clear(); + return this; + } + + public bool HasField205 { + get { return result.hasField205; } + } + public bool Field205 { + get { return result.Field205; } + set { SetField205(value); } + } + public Builder SetField205(bool value) { + PrepareBuilder(); + result.hasField205 = true; + result.field205_ = value; + return this; + } + public Builder ClearField205() { + PrepareBuilder(); + result.hasField205 = false; + result.field205_ = false; + return this; + } + + public bool HasField206 { + get { return result.hasField206; } + } + public bool Field206 { + get { return result.Field206; } + set { SetField206(value); } + } + public Builder SetField206(bool value) { + PrepareBuilder(); + result.hasField206 = true; + result.field206_ = value; + return this; + } + public Builder ClearField206() { + PrepareBuilder(); + result.hasField206 = false; + result.field206_ = false; + return this; + } + } + static SpeedMessage2() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SpeedMessage2GroupedMessage : pb::GeneratedMessage { + private SpeedMessage2GroupedMessage() { } + private static readonly SpeedMessage2GroupedMessage defaultInstance = new SpeedMessage2GroupedMessage().MakeReadOnly(); + private static readonly string[] _speedMessage2GroupedMessageFieldNames = new string[] { "field1", "field10", "field11", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9" }; + private static readonly uint[] _speedMessage2GroupedMessageFieldTags = new uint[] { 13, 85, 88, 21, 29, 32, 40, 48, 56, 69, 72 }; + public static SpeedMessage2GroupedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SpeedMessage2GroupedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SpeedMessage2GroupedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage2GroupedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.internal__static_benchmarks_SpeedMessage2GroupedMessage__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private float field1_; + public bool HasField1 { + get { return hasField1; } + } + public float Field1 { + get { return field1_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private float field2_; + public bool HasField2 { + get { return hasField2; } + } + public float Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private float field3_; + public bool HasField3 { + get { return hasField3; } + } + public float Field3 { + get { return field3_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private bool field4_; + public bool HasField4 { + get { return hasField4; } + } + public bool Field4 { + get { return field4_; } + } + + public const int Field5FieldNumber = 5; + private bool hasField5; + private bool field5_; + public bool HasField5 { + get { return hasField5; } + } + public bool Field5 { + get { return field5_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private bool field6_ = true; + public bool HasField6 { + get { return hasField6; } + } + public bool Field6 { + get { return field6_; } + } + + public const int Field7FieldNumber = 7; + private bool hasField7; + private bool field7_; + public bool HasField7 { + get { return hasField7; } + } + public bool Field7 { + get { return field7_; } + } + + public const int Field8FieldNumber = 8; + private bool hasField8; + private float field8_; + public bool HasField8 { + get { return hasField8; } + } + public float Field8 { + get { return field8_; } + } + + public const int Field9FieldNumber = 9; + private bool hasField9; + private bool field9_; + public bool HasField9 { + get { return hasField9; } + } + public bool Field9 { + get { return field9_; } + } + + public const int Field10FieldNumber = 10; + private bool hasField10; + private float field10_; + public bool HasField10 { + get { return hasField10; } + } + public float Field10 { + get { return field10_; } + } + + public const int Field11FieldNumber = 11; + private bool hasField11; + private long field11_; + public bool HasField11 { + get { return hasField11; } + } + public long Field11 { + get { return field11_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _speedMessage2GroupedMessageFieldNames; + if (hasField1) { + output.WriteFloat(1, field_names[0], Field1); + } + if (hasField2) { + output.WriteFloat(2, field_names[3], Field2); + } + if (hasField3) { + output.WriteFloat(3, field_names[4], Field3); + } + if (hasField4) { + output.WriteBool(4, field_names[5], Field4); + } + if (hasField5) { + output.WriteBool(5, field_names[6], Field5); + } + if (hasField6) { + output.WriteBool(6, field_names[7], Field6); + } + if (hasField7) { + output.WriteBool(7, field_names[8], Field7); + } + if (hasField8) { + output.WriteFloat(8, field_names[9], Field8); + } + if (hasField9) { + output.WriteBool(9, field_names[10], Field9); + } + if (hasField10) { + output.WriteFloat(10, field_names[1], Field10); + } + if (hasField11) { + output.WriteInt64(11, field_names[2], Field11); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField1) { + size += pb::CodedOutputStream.ComputeFloatSize(1, Field1); + } + if (hasField2) { + size += pb::CodedOutputStream.ComputeFloatSize(2, Field2); + } + if (hasField3) { + size += pb::CodedOutputStream.ComputeFloatSize(3, Field3); + } + if (hasField4) { + size += pb::CodedOutputStream.ComputeBoolSize(4, Field4); + } + if (hasField5) { + size += pb::CodedOutputStream.ComputeBoolSize(5, Field5); + } + if (hasField6) { + size += pb::CodedOutputStream.ComputeBoolSize(6, Field6); + } + if (hasField7) { + size += pb::CodedOutputStream.ComputeBoolSize(7, Field7); + } + if (hasField8) { + size += pb::CodedOutputStream.ComputeFloatSize(8, Field8); + } + if (hasField9) { + size += pb::CodedOutputStream.ComputeBoolSize(9, Field9); + } + if (hasField10) { + size += pb::CodedOutputStream.ComputeFloatSize(10, Field10); + } + if (hasField11) { + size += pb::CodedOutputStream.ComputeInt64Size(11, Field11); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SpeedMessage2GroupedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SpeedMessage2GroupedMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SpeedMessage2GroupedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SpeedMessage2GroupedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SpeedMessage2GroupedMessage result; + + private SpeedMessage2GroupedMessage PrepareBuilder() { + if (resultIsReadOnly) { + SpeedMessage2GroupedMessage original = result; + result = new SpeedMessage2GroupedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SpeedMessage2GroupedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage.Descriptor; } + } + + public override SpeedMessage2GroupedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage.DefaultInstance; } + } + + public override SpeedMessage2GroupedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SpeedMessage2GroupedMessage) { + return MergeFrom((SpeedMessage2GroupedMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SpeedMessage2GroupedMessage other) { + if (other == global::Google.ProtocolBuffers.ProtoBench.SpeedMessage2GroupedMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField1) { + Field1 = other.Field1; + } + if (other.HasField2) { + Field2 = other.Field2; + } + if (other.HasField3) { + Field3 = other.Field3; + } + if (other.HasField4) { + Field4 = other.Field4; + } + if (other.HasField5) { + Field5 = other.Field5; + } + if (other.HasField6) { + Field6 = other.Field6; + } + if (other.HasField7) { + Field7 = other.Field7; + } + if (other.HasField8) { + Field8 = other.Field8; + } + if (other.HasField9) { + Field9 = other.Field9; + } + if (other.HasField10) { + Field10 = other.Field10; + } + if (other.HasField11) { + Field11 = other.Field11; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_speedMessage2GroupedMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _speedMessage2GroupedMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 13: { + result.hasField1 = input.ReadFloat(ref result.field1_); + break; + } + case 21: { + result.hasField2 = input.ReadFloat(ref result.field2_); + break; + } + case 29: { + result.hasField3 = input.ReadFloat(ref result.field3_); + break; + } + case 32: { + result.hasField4 = input.ReadBool(ref result.field4_); + break; + } + case 40: { + result.hasField5 = input.ReadBool(ref result.field5_); + break; + } + case 48: { + result.hasField6 = input.ReadBool(ref result.field6_); + break; + } + case 56: { + result.hasField7 = input.ReadBool(ref result.field7_); + break; + } + case 69: { + result.hasField8 = input.ReadFloat(ref result.field8_); + break; + } + case 72: { + result.hasField9 = input.ReadBool(ref result.field9_); + break; + } + case 85: { + result.hasField10 = input.ReadFloat(ref result.field10_); + break; + } + case 88: { + result.hasField11 = input.ReadInt64(ref result.field11_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public float Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(float value) { + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = 0F; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public float Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(float value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0F; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public float Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(float value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0F; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public bool Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(bool value) { + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = false; + return this; + } + + public bool HasField5 { + get { return result.hasField5; } + } + public bool Field5 { + get { return result.Field5; } + set { SetField5(value); } + } + public Builder SetField5(bool value) { + PrepareBuilder(); + result.hasField5 = true; + result.field5_ = value; + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.hasField5 = false; + result.field5_ = false; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public bool Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(bool value) { + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = true; + return this; + } + + public bool HasField7 { + get { return result.hasField7; } + } + public bool Field7 { + get { return result.Field7; } + set { SetField7(value); } + } + public Builder SetField7(bool value) { + PrepareBuilder(); + result.hasField7 = true; + result.field7_ = value; + return this; + } + public Builder ClearField7() { + PrepareBuilder(); + result.hasField7 = false; + result.field7_ = false; + return this; + } + + public bool HasField8 { + get { return result.hasField8; } + } + public float Field8 { + get { return result.Field8; } + set { SetField8(value); } + } + public Builder SetField8(float value) { + PrepareBuilder(); + result.hasField8 = true; + result.field8_ = value; + return this; + } + public Builder ClearField8() { + PrepareBuilder(); + result.hasField8 = false; + result.field8_ = 0F; + return this; + } + + public bool HasField9 { + get { return result.hasField9; } + } + public bool Field9 { + get { return result.Field9; } + set { SetField9(value); } + } + public Builder SetField9(bool value) { + PrepareBuilder(); + result.hasField9 = true; + result.field9_ = value; + return this; + } + public Builder ClearField9() { + PrepareBuilder(); + result.hasField9 = false; + result.field9_ = false; + return this; + } + + public bool HasField10 { + get { return result.hasField10; } + } + public float Field10 { + get { return result.Field10; } + set { SetField10(value); } + } + public Builder SetField10(float value) { + PrepareBuilder(); + result.hasField10 = true; + result.field10_ = value; + return this; + } + public Builder ClearField10() { + PrepareBuilder(); + result.hasField10 = false; + result.field10_ = 0F; + return this; + } + + public bool HasField11 { + get { return result.hasField11; } + } + public long Field11 { + get { return result.Field11; } + set { SetField11(value); } + } + public Builder SetField11(long value) { + PrepareBuilder(); + result.hasField11 = true; + result.field11_ = value; + return this; + } + public Builder ClearField11() { + PrepareBuilder(); + result.hasField11 = false; + result.field11_ = 0L; + return this; + } + } + static SpeedMessage2GroupedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.ProtoBench.GoogleSpeedProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtoBench/TestProtos/UnitTestImportProtoFile.cs b/csharp/src/ProtoBench/TestProtos/UnitTestImportProtoFile.cs new file mode 100644 index 00000000..4cae2b8b --- /dev/null +++ b/csharp/src/ProtoBench/TestProtos/UnitTestImportProtoFile.cs @@ -0,0 +1,346 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestImportProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_import_ImportMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestImportProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0LnByb3RvEhhwcm90", + "b2J1Zl91bml0dGVzdF9pbXBvcnQaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBf", + "b3B0aW9ucy5wcm90byIaCg1JbXBvcnRNZXNzYWdlEgkKAWQYASABKAUqPAoK", + "SW1wb3J0RW51bRIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JBUhAIEg4K", + "CklNUE9SVF9CQVoQCUJbChhjb20uZ29vZ2xlLnByb3RvYnVmLnRlc3RIAcI+", + "PAohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEhdVbml0VGVz", + "dEltcG9ydFByb3RvRmlsZQ==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_import_ImportMessage__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_import_ImportMessage__Descriptor, + new string[] { "D", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum ImportEnum { + IMPORT_FOO = 7, + IMPORT_BAR = 8, + IMPORT_BAZ = 9, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ImportMessage : pb::GeneratedMessage { + private ImportMessage() { } + private static readonly ImportMessage defaultInstance = new ImportMessage().MakeReadOnly(); + private static readonly string[] _importMessageFieldNames = new string[] { "d" }; + private static readonly uint[] _importMessageFieldTags = new uint[] { 8 }; + public static ImportMessage DefaultInstance { + get { return defaultInstance; } + } + + public override ImportMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ImportMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; } + } + + public const int DFieldNumber = 1; + private bool hasD; + private int d_; + public bool HasD { + get { return hasD; } + } + public int D { + get { return d_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _importMessageFieldNames; + if (hasD) { + output.WriteInt32(1, field_names[0], D); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasD) { + size += pb::CodedOutputStream.ComputeInt32Size(1, D); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ImportMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ImportMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ImportMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ImportMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ImportMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ImportMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ImportMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ImportMessage result; + + private ImportMessage PrepareBuilder() { + if (resultIsReadOnly) { + ImportMessage original = result; + result = new ImportMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ImportMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.Descriptor; } + } + + public override ImportMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } + } + + public override ImportMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ImportMessage) { + return MergeFrom((ImportMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ImportMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasD) { + D = other.D; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_importMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _importMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasD = input.ReadInt32(ref result.d_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasD { + get { return result.hasD; } + } + public int D { + get { return result.D; } + set { SetD(value); } + } + public Builder SetD(int value) { + PrepareBuilder(); + result.hasD = true; + result.d_ = value; + return this; + } + public Builder ClearD() { + PrepareBuilder(); + result.hasD = false; + result.d_ = 0; + return this; + } + } + static ImportMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtoBench/TestProtos/UnitTestProtoFile.cs b/csharp/src/ProtoBench/TestProtos/UnitTestProtoFile.cs new file mode 100644 index 00000000..dd31c675 --- /dev/null +++ b/csharp/src/ProtoBench/TestProtos/UnitTestProtoFile.cs @@ -0,0 +1,21602 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBytesExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalGroupExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringPieceExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalCordExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBytesExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedGroupExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringPieceExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedCordExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBytesExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultNestedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultForeignEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultImportEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringPieceExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultCordExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionString); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionInt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Test); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestRequired.Single); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestRequired.Multi); + } + #endregion + #region Extensions + public const int OptionalInt32ExtensionFieldNumber = 1; + public static pb::GeneratedExtensionBase OptionalInt32Extension; + public const int OptionalInt64ExtensionFieldNumber = 2; + public static pb::GeneratedExtensionBase OptionalInt64Extension; + public const int OptionalUint32ExtensionFieldNumber = 3; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalUint32Extension; + public const int OptionalUint64ExtensionFieldNumber = 4; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalUint64Extension; + public const int OptionalSint32ExtensionFieldNumber = 5; + public static pb::GeneratedExtensionBase OptionalSint32Extension; + public const int OptionalSint64ExtensionFieldNumber = 6; + public static pb::GeneratedExtensionBase OptionalSint64Extension; + public const int OptionalFixed32ExtensionFieldNumber = 7; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalFixed32Extension; + public const int OptionalFixed64ExtensionFieldNumber = 8; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalFixed64Extension; + public const int OptionalSfixed32ExtensionFieldNumber = 9; + public static pb::GeneratedExtensionBase OptionalSfixed32Extension; + public const int OptionalSfixed64ExtensionFieldNumber = 10; + public static pb::GeneratedExtensionBase OptionalSfixed64Extension; + public const int OptionalFloatExtensionFieldNumber = 11; + public static pb::GeneratedExtensionBase OptionalFloatExtension; + public const int OptionalDoubleExtensionFieldNumber = 12; + public static pb::GeneratedExtensionBase OptionalDoubleExtension; + public const int OptionalBoolExtensionFieldNumber = 13; + public static pb::GeneratedExtensionBase OptionalBoolExtension; + public const int OptionalStringExtensionFieldNumber = 14; + public static pb::GeneratedExtensionBase OptionalStringExtension; + public const int OptionalBytesExtensionFieldNumber = 15; + public static pb::GeneratedExtensionBase OptionalBytesExtension; + public const int OptionalGroupExtensionFieldNumber = 16; + public static pb::GeneratedExtensionBase OptionalGroupExtension; + public const int OptionalNestedMessageExtensionFieldNumber = 18; + public static pb::GeneratedExtensionBase OptionalNestedMessageExtension; + public const int OptionalForeignMessageExtensionFieldNumber = 19; + public static pb::GeneratedExtensionBase OptionalForeignMessageExtension; + public const int OptionalImportMessageExtensionFieldNumber = 20; + public static pb::GeneratedExtensionBase OptionalImportMessageExtension; + public const int OptionalNestedEnumExtensionFieldNumber = 21; + public static pb::GeneratedExtensionBase OptionalNestedEnumExtension; + public const int OptionalForeignEnumExtensionFieldNumber = 22; + public static pb::GeneratedExtensionBase OptionalForeignEnumExtension; + public const int OptionalImportEnumExtensionFieldNumber = 23; + public static pb::GeneratedExtensionBase OptionalImportEnumExtension; + public const int OptionalStringPieceExtensionFieldNumber = 24; + public static pb::GeneratedExtensionBase OptionalStringPieceExtension; + public const int OptionalCordExtensionFieldNumber = 25; + public static pb::GeneratedExtensionBase OptionalCordExtension; + public const int RepeatedInt32ExtensionFieldNumber = 31; + public static pb::GeneratedExtensionBase> RepeatedInt32Extension; + public const int RepeatedInt64ExtensionFieldNumber = 32; + public static pb::GeneratedExtensionBase> RepeatedInt64Extension; + public const int RepeatedUint32ExtensionFieldNumber = 33; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedUint32Extension; + public const int RepeatedUint64ExtensionFieldNumber = 34; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedUint64Extension; + public const int RepeatedSint32ExtensionFieldNumber = 35; + public static pb::GeneratedExtensionBase> RepeatedSint32Extension; + public const int RepeatedSint64ExtensionFieldNumber = 36; + public static pb::GeneratedExtensionBase> RepeatedSint64Extension; + public const int RepeatedFixed32ExtensionFieldNumber = 37; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedFixed32Extension; + public const int RepeatedFixed64ExtensionFieldNumber = 38; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedFixed64Extension; + public const int RepeatedSfixed32ExtensionFieldNumber = 39; + public static pb::GeneratedExtensionBase> RepeatedSfixed32Extension; + public const int RepeatedSfixed64ExtensionFieldNumber = 40; + public static pb::GeneratedExtensionBase> RepeatedSfixed64Extension; + public const int RepeatedFloatExtensionFieldNumber = 41; + public static pb::GeneratedExtensionBase> RepeatedFloatExtension; + public const int RepeatedDoubleExtensionFieldNumber = 42; + public static pb::GeneratedExtensionBase> RepeatedDoubleExtension; + public const int RepeatedBoolExtensionFieldNumber = 43; + public static pb::GeneratedExtensionBase> RepeatedBoolExtension; + public const int RepeatedStringExtensionFieldNumber = 44; + public static pb::GeneratedExtensionBase> RepeatedStringExtension; + public const int RepeatedBytesExtensionFieldNumber = 45; + public static pb::GeneratedExtensionBase> RepeatedBytesExtension; + public const int RepeatedGroupExtensionFieldNumber = 46; + public static pb::GeneratedExtensionBase> RepeatedGroupExtension; + public const int RepeatedNestedMessageExtensionFieldNumber = 48; + public static pb::GeneratedExtensionBase> RepeatedNestedMessageExtension; + public const int RepeatedForeignMessageExtensionFieldNumber = 49; + public static pb::GeneratedExtensionBase> RepeatedForeignMessageExtension; + public const int RepeatedImportMessageExtensionFieldNumber = 50; + public static pb::GeneratedExtensionBase> RepeatedImportMessageExtension; + public const int RepeatedNestedEnumExtensionFieldNumber = 51; + public static pb::GeneratedExtensionBase> RepeatedNestedEnumExtension; + public const int RepeatedForeignEnumExtensionFieldNumber = 52; + public static pb::GeneratedExtensionBase> RepeatedForeignEnumExtension; + public const int RepeatedImportEnumExtensionFieldNumber = 53; + public static pb::GeneratedExtensionBase> RepeatedImportEnumExtension; + public const int RepeatedStringPieceExtensionFieldNumber = 54; + public static pb::GeneratedExtensionBase> RepeatedStringPieceExtension; + public const int RepeatedCordExtensionFieldNumber = 55; + public static pb::GeneratedExtensionBase> RepeatedCordExtension; + public const int DefaultInt32ExtensionFieldNumber = 61; + public static pb::GeneratedExtensionBase DefaultInt32Extension; + public const int DefaultInt64ExtensionFieldNumber = 62; + public static pb::GeneratedExtensionBase DefaultInt64Extension; + public const int DefaultUint32ExtensionFieldNumber = 63; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultUint32Extension; + public const int DefaultUint64ExtensionFieldNumber = 64; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultUint64Extension; + public const int DefaultSint32ExtensionFieldNumber = 65; + public static pb::GeneratedExtensionBase DefaultSint32Extension; + public const int DefaultSint64ExtensionFieldNumber = 66; + public static pb::GeneratedExtensionBase DefaultSint64Extension; + public const int DefaultFixed32ExtensionFieldNumber = 67; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultFixed32Extension; + public const int DefaultFixed64ExtensionFieldNumber = 68; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultFixed64Extension; + public const int DefaultSfixed32ExtensionFieldNumber = 69; + public static pb::GeneratedExtensionBase DefaultSfixed32Extension; + public const int DefaultSfixed64ExtensionFieldNumber = 70; + public static pb::GeneratedExtensionBase DefaultSfixed64Extension; + public const int DefaultFloatExtensionFieldNumber = 71; + public static pb::GeneratedExtensionBase DefaultFloatExtension; + public const int DefaultDoubleExtensionFieldNumber = 72; + public static pb::GeneratedExtensionBase DefaultDoubleExtension; + public const int DefaultBoolExtensionFieldNumber = 73; + public static pb::GeneratedExtensionBase DefaultBoolExtension; + public const int DefaultStringExtensionFieldNumber = 74; + public static pb::GeneratedExtensionBase DefaultStringExtension; + public const int DefaultBytesExtensionFieldNumber = 75; + public static pb::GeneratedExtensionBase DefaultBytesExtension; + public const int DefaultNestedEnumExtensionFieldNumber = 81; + public static pb::GeneratedExtensionBase DefaultNestedEnumExtension; + public const int DefaultForeignEnumExtensionFieldNumber = 82; + public static pb::GeneratedExtensionBase DefaultForeignEnumExtension; + public const int DefaultImportEnumExtensionFieldNumber = 83; + public static pb::GeneratedExtensionBase DefaultImportEnumExtension; + public const int DefaultStringPieceExtensionFieldNumber = 84; + public static pb::GeneratedExtensionBase DefaultStringPieceExtension; + public const int DefaultCordExtensionFieldNumber = 85; + public static pb::GeneratedExtensionBase DefaultCordExtension; + public const int MyExtensionStringFieldNumber = 50; + public static pb::GeneratedExtensionBase MyExtensionString; + public const int MyExtensionIntFieldNumber = 5; + public static pb::GeneratedExtensionBase MyExtensionInt; + public const int PackedInt32ExtensionFieldNumber = 90; + public static pb::GeneratedExtensionBase> PackedInt32Extension; + public const int PackedInt64ExtensionFieldNumber = 91; + public static pb::GeneratedExtensionBase> PackedInt64Extension; + public const int PackedUint32ExtensionFieldNumber = 92; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedUint32Extension; + public const int PackedUint64ExtensionFieldNumber = 93; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedUint64Extension; + public const int PackedSint32ExtensionFieldNumber = 94; + public static pb::GeneratedExtensionBase> PackedSint32Extension; + public const int PackedSint64ExtensionFieldNumber = 95; + public static pb::GeneratedExtensionBase> PackedSint64Extension; + public const int PackedFixed32ExtensionFieldNumber = 96; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedFixed32Extension; + public const int PackedFixed64ExtensionFieldNumber = 97; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedFixed64Extension; + public const int PackedSfixed32ExtensionFieldNumber = 98; + public static pb::GeneratedExtensionBase> PackedSfixed32Extension; + public const int PackedSfixed64ExtensionFieldNumber = 99; + public static pb::GeneratedExtensionBase> PackedSfixed64Extension; + public const int PackedFloatExtensionFieldNumber = 100; + public static pb::GeneratedExtensionBase> PackedFloatExtension; + public const int PackedDoubleExtensionFieldNumber = 101; + public static pb::GeneratedExtensionBase> PackedDoubleExtension; + public const int PackedBoolExtensionFieldNumber = 102; + public static pb::GeneratedExtensionBase> PackedBoolExtension; + public const int PackedEnumExtensionFieldNumber = 103; + public static pb::GeneratedExtensionBase> PackedEnumExtension; + #endregion + + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_ForeignMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OptionalGroup_extension__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_RepeatedGroup_extension__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestNestedExtension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestNestedExtension__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRequired__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRequired__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRequiredForeign__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRequiredForeign__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestForeignNested__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestEmptyMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestEmptyMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMultipleExtensionRanges__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDupFieldNumber__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDupFieldNumber_Foo__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDupFieldNumber_Bar__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestNestedMessageHasBits__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestFieldOrderings__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestExtremeDefaultValues__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_SparseEnumMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OneString__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OneString__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OneBytes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OneBytes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestPackedTypes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestPackedExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestPackedExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDynamicExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_FooRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_FooResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooResponse__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_BarRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_BarRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_BarResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_BarResponse__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch5nb29nbGUvcHJvdG9idWYvdW5pdHRlc3QucHJvdG8SEXByb3RvYnVmX3Vu", + "aXR0ZXN0GiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8a", + "JWdvb2dsZS9wcm90b2J1Zi91bml0dGVzdF9pbXBvcnQucHJvdG8iuxUKDFRl", + "c3RBbGxUeXBlcxIWCg5vcHRpb25hbF9pbnQzMhgBIAEoBRIWCg5vcHRpb25h", + "bF9pbnQ2NBgCIAEoAxIXCg9vcHRpb25hbF91aW50MzIYAyABKA0SFwoPb3B0", + "aW9uYWxfdWludDY0GAQgASgEEhcKD29wdGlvbmFsX3NpbnQzMhgFIAEoERIX", + "Cg9vcHRpb25hbF9zaW50NjQYBiABKBISGAoQb3B0aW9uYWxfZml4ZWQzMhgH", + "IAEoBxIYChBvcHRpb25hbF9maXhlZDY0GAggASgGEhkKEW9wdGlvbmFsX3Nm", + "aXhlZDMyGAkgASgPEhkKEW9wdGlvbmFsX3NmaXhlZDY0GAogASgQEhYKDm9w", + "dGlvbmFsX2Zsb2F0GAsgASgCEhcKD29wdGlvbmFsX2RvdWJsZRgMIAEoARIV", + "Cg1vcHRpb25hbF9ib29sGA0gASgIEhcKD29wdGlvbmFsX3N0cmluZxgOIAEo", + "CRIWCg5vcHRpb25hbF9ieXRlcxgPIAEoDBJECg1vcHRpb25hbGdyb3VwGBAg", + "ASgKMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbFR5cGVzLk9wdGlvbmFs", + "R3JvdXASTgoXb3B0aW9uYWxfbmVzdGVkX21lc3NhZ2UYEiABKAsyLS5wcm90", + "b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZRJDChhv", + "cHRpb25hbF9mb3JlaWduX21lc3NhZ2UYEyABKAsyIS5wcm90b2J1Zl91bml0", + "dGVzdC5Gb3JlaWduTWVzc2FnZRJIChdvcHRpb25hbF9pbXBvcnRfbWVzc2Fn", + "ZRgUIAEoCzInLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRNZXNz", + "YWdlEkgKFG9wdGlvbmFsX25lc3RlZF9lbnVtGBUgASgOMioucHJvdG9idWZf", + "dW5pdHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW0SPQoVb3B0aW9uYWxf", + "Zm9yZWlnbl9lbnVtGBYgASgOMh4ucHJvdG9idWZfdW5pdHRlc3QuRm9yZWln", + "bkVudW0SQgoUb3B0aW9uYWxfaW1wb3J0X2VudW0YFyABKA4yJC5wcm90b2J1", + "Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0RW51bRIhChVvcHRpb25hbF9zdHJp", + "bmdfcGllY2UYGCABKAlCAggCEhkKDW9wdGlvbmFsX2NvcmQYGSABKAlCAggB", + "EhYKDnJlcGVhdGVkX2ludDMyGB8gAygFEhYKDnJlcGVhdGVkX2ludDY0GCAg", + "AygDEhcKD3JlcGVhdGVkX3VpbnQzMhghIAMoDRIXCg9yZXBlYXRlZF91aW50", + "NjQYIiADKAQSFwoPcmVwZWF0ZWRfc2ludDMyGCMgAygREhcKD3JlcGVhdGVk", + "X3NpbnQ2NBgkIAMoEhIYChByZXBlYXRlZF9maXhlZDMyGCUgAygHEhgKEHJl", + "cGVhdGVkX2ZpeGVkNjQYJiADKAYSGQoRcmVwZWF0ZWRfc2ZpeGVkMzIYJyAD", + "KA8SGQoRcmVwZWF0ZWRfc2ZpeGVkNjQYKCADKBASFgoOcmVwZWF0ZWRfZmxv", + "YXQYKSADKAISFwoPcmVwZWF0ZWRfZG91YmxlGCogAygBEhUKDXJlcGVhdGVk", + "X2Jvb2wYKyADKAgSFwoPcmVwZWF0ZWRfc3RyaW5nGCwgAygJEhYKDnJlcGVh", + "dGVkX2J5dGVzGC0gAygMEkQKDXJlcGVhdGVkZ3JvdXAYLiADKAoyLS5wcm90", + "b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuUmVwZWF0ZWRHcm91cBJOChdy", + "ZXBlYXRlZF9uZXN0ZWRfbWVzc2FnZRgwIAMoCzItLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxUeXBlcy5OZXN0ZWRNZXNzYWdlEkMKGHJlcGVhdGVkX2Zv", + "cmVpZ25fbWVzc2FnZRgxIAMoCzIhLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVp", + "Z25NZXNzYWdlEkgKF3JlcGVhdGVkX2ltcG9ydF9tZXNzYWdlGDIgAygLMicu", + "cHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0LkltcG9ydE1lc3NhZ2USSAoUcmVw", + "ZWF0ZWRfbmVzdGVkX2VudW0YMyADKA4yKi5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0QWxsVHlwZXMuTmVzdGVkRW51bRI9ChVyZXBlYXRlZF9mb3JlaWduX2Vu", + "dW0YNCADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bRJCChRy", + "ZXBlYXRlZF9pbXBvcnRfZW51bRg1IAMoDjIkLnByb3RvYnVmX3VuaXR0ZXN0", + "X2ltcG9ydC5JbXBvcnRFbnVtEiEKFXJlcGVhdGVkX3N0cmluZ19waWVjZRg2", + "IAMoCUICCAISGQoNcmVwZWF0ZWRfY29yZBg3IAMoCUICCAESGQoNZGVmYXVs", + "dF9pbnQzMhg9IAEoBToCNDESGQoNZGVmYXVsdF9pbnQ2NBg+IAEoAzoCNDIS", + "GgoOZGVmYXVsdF91aW50MzIYPyABKA06AjQzEhoKDmRlZmF1bHRfdWludDY0", + "GEAgASgEOgI0NBIbCg5kZWZhdWx0X3NpbnQzMhhBIAEoEToDLTQ1EhoKDmRl", + "ZmF1bHRfc2ludDY0GEIgASgSOgI0NhIbCg9kZWZhdWx0X2ZpeGVkMzIYQyAB", + "KAc6AjQ3EhsKD2RlZmF1bHRfZml4ZWQ2NBhEIAEoBjoCNDgSHAoQZGVmYXVs", + "dF9zZml4ZWQzMhhFIAEoDzoCNDkSHQoQZGVmYXVsdF9zZml4ZWQ2NBhGIAEo", + "EDoDLTUwEhsKDWRlZmF1bHRfZmxvYXQYRyABKAI6BDUxLjUSHQoOZGVmYXVs", + "dF9kb3VibGUYSCABKAE6BTUyMDAwEhoKDGRlZmF1bHRfYm9vbBhJIAEoCDoE", + "dHJ1ZRIdCg5kZWZhdWx0X3N0cmluZxhKIAEoCToFaGVsbG8SHAoNZGVmYXVs", + "dF9ieXRlcxhLIAEoDDoFd29ybGQSTAoTZGVmYXVsdF9uZXN0ZWRfZW51bRhR", + "IAEoDjIqLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxUeXBlcy5OZXN0ZWRF", + "bnVtOgNCQVISSQoUZGVmYXVsdF9mb3JlaWduX2VudW0YUiABKA4yHi5wcm90", + "b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bToLRk9SRUlHTl9CQVISTQoTZGVm", + "YXVsdF9pbXBvcnRfZW51bRhTIAEoDjIkLnByb3RvYnVmX3VuaXR0ZXN0X2lt", + "cG9ydC5JbXBvcnRFbnVtOgpJTVBPUlRfQkFSEiUKFGRlZmF1bHRfc3RyaW5n", + "X3BpZWNlGFQgASgJOgNhYmNCAggCEh0KDGRlZmF1bHRfY29yZBhVIAEoCToD", + "MTIzQgIIARobCg1OZXN0ZWRNZXNzYWdlEgoKAmJiGAEgASgFGhoKDU9wdGlv", + "bmFsR3JvdXASCQoBYRgRIAEoBRoaCg1SZXBlYXRlZEdyb3VwEgkKAWEYLyAB", + "KAUiJwoKTmVzdGVkRW51bRIHCgNGT08QARIHCgNCQVIQAhIHCgNCQVoQAyI0", + "ChRUZXN0RGVwcmVjYXRlZEZpZWxkcxIcChBkZXByZWNhdGVkX2ludDMyGAEg", + "ASgFQgIYASIbCg5Gb3JlaWduTWVzc2FnZRIJCgFjGAEgASgFIh0KEVRlc3RB", + "bGxFeHRlbnNpb25zKggIARCAgICAAiIkChdPcHRpb25hbEdyb3VwX2V4dGVu", + "c2lvbhIJCgFhGBEgASgFIiQKF1JlcGVhdGVkR3JvdXBfZXh0ZW5zaW9uEgkK", + "AWEYLyABKAUiUAoTVGVzdE5lc3RlZEV4dGVuc2lvbjI5CgR0ZXN0EiQucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMY6gcgASgJOgR0ZXN0", + "ItUFCgxUZXN0UmVxdWlyZWQSCQoBYRgBIAIoBRIOCgZkdW1teTIYAiABKAUS", + "CQoBYhgDIAIoBRIOCgZkdW1teTQYBCABKAUSDgoGZHVtbXk1GAUgASgFEg4K", + "BmR1bW15NhgGIAEoBRIOCgZkdW1teTcYByABKAUSDgoGZHVtbXk4GAggASgF", + "Eg4KBmR1bW15ORgJIAEoBRIPCgdkdW1teTEwGAogASgFEg8KB2R1bW15MTEY", + "CyABKAUSDwoHZHVtbXkxMhgMIAEoBRIPCgdkdW1teTEzGA0gASgFEg8KB2R1", + "bW15MTQYDiABKAUSDwoHZHVtbXkxNRgPIAEoBRIPCgdkdW1teTE2GBAgASgF", + "Eg8KB2R1bW15MTcYESABKAUSDwoHZHVtbXkxOBgSIAEoBRIPCgdkdW1teTE5", + "GBMgASgFEg8KB2R1bW15MjAYFCABKAUSDwoHZHVtbXkyMRgVIAEoBRIPCgdk", + "dW1teTIyGBYgASgFEg8KB2R1bW15MjMYFyABKAUSDwoHZHVtbXkyNBgYIAEo", + "BRIPCgdkdW1teTI1GBkgASgFEg8KB2R1bW15MjYYGiABKAUSDwoHZHVtbXky", + "NxgbIAEoBRIPCgdkdW1teTI4GBwgASgFEg8KB2R1bW15MjkYHSABKAUSDwoH", + "ZHVtbXkzMBgeIAEoBRIPCgdkdW1teTMxGB8gASgFEg8KB2R1bW15MzIYICAB", + "KAUSCQoBYxghIAIoBTJWCgZzaW5nbGUSJC5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0QWxsRXh0ZW5zaW9ucxjoByABKAsyHy5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0UmVxdWlyZWQyVQoFbXVsdGkSJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxjpByADKAsyHy5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "UmVxdWlyZWQimgEKE1Rlc3RSZXF1aXJlZEZvcmVpZ24SOQoQb3B0aW9uYWxf", + "bWVzc2FnZRgBIAEoCzIfLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RSZXF1aXJl", + "ZBI5ChByZXBlYXRlZF9tZXNzYWdlGAIgAygLMh8ucHJvdG9idWZfdW5pdHRl", + "c3QuVGVzdFJlcXVpcmVkEg0KBWR1bW15GAMgASgFIloKEVRlc3RGb3JlaWdu", + "TmVzdGVkEkUKDmZvcmVpZ25fbmVzdGVkGAEgASgLMi0ucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZE1lc3NhZ2UiEgoQVGVzdEVtcHR5", + "TWVzc2FnZSIqCh5UZXN0RW1wdHlNZXNzYWdlV2l0aEV4dGVuc2lvbnMqCAgB", + "EICAgIACIjcKG1Rlc3RNdWx0aXBsZUV4dGVuc2lvblJhbmdlcyoECCoQKyoG", + "CK8gEJQhKgoIgIAEEICAgIACIjQKGFRlc3RSZWFsbHlMYXJnZVRhZ051bWJl", + "chIJCgFhGAEgASgFEg0KAmJiGP///38gASgFIlUKFFRlc3RSZWN1cnNpdmVN", + "ZXNzYWdlEjIKAWEYASABKAsyJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UmVj", + "dXJzaXZlTWVzc2FnZRIJCgFpGAIgASgFIksKFFRlc3RNdXR1YWxSZWN1cnNp", + "b25BEjMKAmJiGAEgASgLMicucHJvdG9idWZfdW5pdHRlc3QuVGVzdE11dHVh", + "bFJlY3Vyc2lvbkIiYgoUVGVzdE11dHVhbFJlY3Vyc2lvbkISMgoBYRgBIAEo", + "CzInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RNdXR1YWxSZWN1cnNpb25BEhYK", + "Dm9wdGlvbmFsX2ludDMyGAIgASgFIrMBChJUZXN0RHVwRmllbGROdW1iZXIS", + "CQoBYRgBIAEoBRI2CgNmb28YAiABKAoyKS5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0RHVwRmllbGROdW1iZXIuRm9vEjYKA2JhchgDIAEoCjIpLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3REdXBGaWVsZE51bWJlci5CYXIaEAoDRm9vEgkKAWEY", + "ASABKAUaEAoDQmFyEgkKAWEYASABKAUigAIKGFRlc3ROZXN0ZWRNZXNzYWdl", + "SGFzQml0cxJaChdvcHRpb25hbF9uZXN0ZWRfbWVzc2FnZRgBIAEoCzI5LnBy", + "b3RvYnVmX3VuaXR0ZXN0LlRlc3ROZXN0ZWRNZXNzYWdlSGFzQml0cy5OZXN0", + "ZWRNZXNzYWdlGocBCg1OZXN0ZWRNZXNzYWdlEiQKHG5lc3RlZG1lc3NhZ2Vf", + "cmVwZWF0ZWRfaW50MzIYASADKAUSUAolbmVzdGVkbWVzc2FnZV9yZXBlYXRl", + "ZF9mb3JlaWdubWVzc2FnZRgCIAMoCzIhLnByb3RvYnVmX3VuaXR0ZXN0LkZv", + "cmVpZ25NZXNzYWdlIuUDChdUZXN0Q2FtZWxDYXNlRmllbGROYW1lcxIWCg5Q", + "cmltaXRpdmVGaWVsZBgBIAEoBRITCgtTdHJpbmdGaWVsZBgCIAEoCRIxCglF", + "bnVtRmllbGQYAyABKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51", + "bRI3CgxNZXNzYWdlRmllbGQYBCABKAsyIS5wcm90b2J1Zl91bml0dGVzdC5G", + "b3JlaWduTWVzc2FnZRIcChBTdHJpbmdQaWVjZUZpZWxkGAUgASgJQgIIAhIV", + "CglDb3JkRmllbGQYBiABKAlCAggBEh4KFlJlcGVhdGVkUHJpbWl0aXZlRmll", + "bGQYByADKAUSGwoTUmVwZWF0ZWRTdHJpbmdGaWVsZBgIIAMoCRI5ChFSZXBl", + "YXRlZEVudW1GaWVsZBgJIAMoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVp", + "Z25FbnVtEj8KFFJlcGVhdGVkTWVzc2FnZUZpZWxkGAogAygLMiEucHJvdG9i", + "dWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USJAoYUmVwZWF0ZWRTdHJpbmdQ", + "aWVjZUZpZWxkGAsgAygJQgIIAhIdChFSZXBlYXRlZENvcmRGaWVsZBgMIAMo", + "CUICCAEiVQoSVGVzdEZpZWxkT3JkZXJpbmdzEhEKCW15X3N0cmluZxgLIAEo", + "CRIOCgZteV9pbnQYASABKAMSEAoIbXlfZmxvYXQYZSABKAIqBAgCEAsqBAgM", + "EGUiowUKGFRlc3RFeHRyZW1lRGVmYXVsdFZhbHVlcxI/Cg1lc2NhcGVkX2J5", + "dGVzGAEgASgMOihcMDAwXDAwMVwwMDdcMDEwXDAxNFxuXHJcdFwwMTNcXFwn", + "XCJcMzc2EiAKDGxhcmdlX3VpbnQzMhgCIAEoDToKNDI5NDk2NzI5NRIqCgxs", + "YXJnZV91aW50NjQYAyABKAQ6FDE4NDQ2NzQ0MDczNzA5NTUxNjE1EiAKC3Nt", + "YWxsX2ludDMyGAQgASgFOgstMjE0NzQ4MzY0NxIpCgtzbWFsbF9pbnQ2NBgF", + "IAEoAzoULTkyMjMzNzIwMzY4NTQ3NzU4MDcSGAoLdXRmOF9zdHJpbmcYBiAB", + "KAk6A+GItBIVCgp6ZXJvX2Zsb2F0GAcgASgCOgEwEhQKCW9uZV9mbG9hdBgI", + "IAEoAjoBMRIYCgtzbWFsbF9mbG9hdBgJIAEoAjoDMS41Eh4KEm5lZ2F0aXZl", + "X29uZV9mbG9hdBgKIAEoAjoCLTESHAoObmVnYXRpdmVfZmxvYXQYCyABKAI6", + "BC0xLjUSGwoLbGFyZ2VfZmxvYXQYDCABKAI6BjJlKzAwOBIlChRzbWFsbF9u", + "ZWdhdGl2ZV9mbG9hdBgNIAEoAjoHLThlLTAyOBIXCgppbmZfZG91YmxlGA4g", + "ASgBOgNpbmYSHAoObmVnX2luZl9kb3VibGUYDyABKAE6BC1pbmYSFwoKbmFu", + "X2RvdWJsZRgQIAEoAToDbmFuEhYKCWluZl9mbG9hdBgRIAEoAjoDaW5mEhsK", + "DW5lZ19pbmZfZmxvYXQYEiABKAI6BC1pbmYSFgoJbmFuX2Zsb2F0GBMgASgC", + "OgNuYW4SKwoMY3BwX3RyaWdyYXBoGBQgASgJOhU/ID8gPz8gPz8gPz8/ID8/", + "LyA/Py0iSwoRU3BhcnNlRW51bU1lc3NhZ2USNgoLc3BhcnNlX2VudW0YASAB", + "KA4yIS5wcm90b2J1Zl91bml0dGVzdC5UZXN0U3BhcnNlRW51bSIZCglPbmVT", + "dHJpbmcSDAoEZGF0YRgBIAEoCSIYCghPbmVCeXRlcxIMCgRkYXRhGAEgASgM", + "IqoDCg9UZXN0UGFja2VkVHlwZXMSGAoMcGFja2VkX2ludDMyGFogAygFQgIQ", + "ARIYCgxwYWNrZWRfaW50NjQYWyADKANCAhABEhkKDXBhY2tlZF91aW50MzIY", + "XCADKA1CAhABEhkKDXBhY2tlZF91aW50NjQYXSADKARCAhABEhkKDXBhY2tl", + "ZF9zaW50MzIYXiADKBFCAhABEhkKDXBhY2tlZF9zaW50NjQYXyADKBJCAhAB", + "EhoKDnBhY2tlZF9maXhlZDMyGGAgAygHQgIQARIaCg5wYWNrZWRfZml4ZWQ2", + "NBhhIAMoBkICEAESGwoPcGFja2VkX3NmaXhlZDMyGGIgAygPQgIQARIbCg9w", + "YWNrZWRfc2ZpeGVkNjQYYyADKBBCAhABEhgKDHBhY2tlZF9mbG9hdBhkIAMo", + "AkICEAESGQoNcGFja2VkX2RvdWJsZRhlIAMoAUICEAESFwoLcGFja2VkX2Jv", + "b2wYZiADKAhCAhABEjcKC3BhY2tlZF9lbnVtGGcgAygOMh4ucHJvdG9idWZf", + "dW5pdHRlc3QuRm9yZWlnbkVudW1CAhABIsgDChFUZXN0VW5wYWNrZWRUeXBl", + "cxIaCg51bnBhY2tlZF9pbnQzMhhaIAMoBUICEAASGgoOdW5wYWNrZWRfaW50", + "NjQYWyADKANCAhAAEhsKD3VucGFja2VkX3VpbnQzMhhcIAMoDUICEAASGwoP", + "dW5wYWNrZWRfdWludDY0GF0gAygEQgIQABIbCg91bnBhY2tlZF9zaW50MzIY", + "XiADKBFCAhAAEhsKD3VucGFja2VkX3NpbnQ2NBhfIAMoEkICEAASHAoQdW5w", + "YWNrZWRfZml4ZWQzMhhgIAMoB0ICEAASHAoQdW5wYWNrZWRfZml4ZWQ2NBhh", + "IAMoBkICEAASHQoRdW5wYWNrZWRfc2ZpeGVkMzIYYiADKA9CAhAAEh0KEXVu", + "cGFja2VkX3NmaXhlZDY0GGMgAygQQgIQABIaCg51bnBhY2tlZF9mbG9hdBhk", + "IAMoAkICEAASGwoPdW5wYWNrZWRfZG91YmxlGGUgAygBQgIQABIZCg11bnBh", + "Y2tlZF9ib29sGGYgAygIQgIQABI5Cg11bnBhY2tlZF9lbnVtGGcgAygOMh4u", + "cHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbkVudW1CAhAAIiAKFFRlc3RQYWNr", + "ZWRFeHRlbnNpb25zKggIARCAgICAAiKZBAoVVGVzdER5bmFtaWNFeHRlbnNp", + "b25zEhkKEHNjYWxhcl9leHRlbnNpb24Y0A8gASgHEjcKDmVudW1fZXh0ZW5z", + "aW9uGNEPIAEoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25FbnVtElkK", + "FmR5bmFtaWNfZW51bV9leHRlbnNpb24Y0g8gASgOMjgucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdER5bmFtaWNFeHRlbnNpb25zLkR5bmFtaWNFbnVtVHlwZRI9", + "ChFtZXNzYWdlX2V4dGVuc2lvbhjTDyABKAsyIS5wcm90b2J1Zl91bml0dGVz", + "dC5Gb3JlaWduTWVzc2FnZRJfChlkeW5hbWljX21lc3NhZ2VfZXh0ZW5zaW9u", + "GNQPIAEoCzI7LnByb3RvYnVmX3VuaXR0ZXN0LlRlc3REeW5hbWljRXh0ZW5z", + "aW9ucy5EeW5hbWljTWVzc2FnZVR5cGUSGwoScmVwZWF0ZWRfZXh0ZW5zaW9u", + "GNUPIAMoCRIdChBwYWNrZWRfZXh0ZW5zaW9uGNYPIAMoEUICEAEaLAoSRHlu", + "YW1pY01lc3NhZ2VUeXBlEhYKDWR5bmFtaWNfZmllbGQYtBAgASgFIkcKD0R5", + "bmFtaWNFbnVtVHlwZRIQCgtEWU5BTUlDX0ZPTxCYERIQCgtEWU5BTUlDX0JB", + "UhCZERIQCgtEWU5BTUlDX0JBWhCaESLAAQojVGVzdFJlcGVhdGVkU2NhbGFy", + "RGlmZmVyZW50VGFnU2l6ZXMSGAoQcmVwZWF0ZWRfZml4ZWQzMhgMIAMoBxIW", + "Cg5yZXBlYXRlZF9pbnQzMhgNIAMoBRIZChByZXBlYXRlZF9maXhlZDY0GP4P", + "IAMoBhIXCg5yZXBlYXRlZF9pbnQ2NBj/DyADKAMSGAoOcmVwZWF0ZWRfZmxv", + "YXQY/v8PIAMoAhIZCg9yZXBlYXRlZF91aW50NjQY//8PIAMoBCIMCgpGb29S", + "ZXF1ZXN0Ig0KC0Zvb1Jlc3BvbnNlIgwKCkJhclJlcXVlc3QiDQoLQmFyUmVz", + "cG9uc2UqQAoLRm9yZWlnbkVudW0SDwoLRk9SRUlHTl9GT08QBBIPCgtGT1JF", + "SUdOX0JBUhAFEg8KC0ZPUkVJR05fQkFaEAYqRwoUVGVzdEVudW1XaXRoRHVw", + "VmFsdWUSCAoERk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08yEAES", + "CAoEQkFSMhACKokBCg5UZXN0U3BhcnNlRW51bRIMCghTUEFSU0VfQRB7Eg4K", + "CFNQQVJTRV9CEKbnAxIPCghTUEFSU0VfQxCysYAGEhUKCFNQQVJTRV9EEPH/", + "/////////wESFQoIU1BBUlNFX0UQtN78////////ARIMCghTUEFSU0VfRhAA", + "EgwKCFNQQVJTRV9HEAIymQEKC1Rlc3RTZXJ2aWNlEkQKA0ZvbxIdLnByb3Rv", + "YnVmX3VuaXR0ZXN0LkZvb1JlcXVlc3QaHi5wcm90b2J1Zl91bml0dGVzdC5G", + "b29SZXNwb25zZRJECgNCYXISHS5wcm90b2J1Zl91bml0dGVzdC5CYXJSZXF1", + "ZXN0Gh4ucHJvdG9idWZfdW5pdHRlc3QuQmFyUmVzcG9uc2U6RgoYb3B0aW9u", + "YWxfaW50MzJfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFs", + "bEV4dGVuc2lvbnMYASABKAU6RgoYb3B0aW9uYWxfaW50NjRfZXh0ZW5zaW9u", + "EiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYAiABKAM6", + "RwoZb3B0aW9uYWxfdWludDMyX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxFeHRlbnNpb25zGAMgASgNOkcKGW9wdGlvbmFsX3VpbnQ2", + "NF9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5z", + "aW9ucxgEIAEoBDpHChlvcHRpb25hbF9zaW50MzJfZXh0ZW5zaW9uEiQucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYBSABKBE6RwoZb3B0", + "aW9uYWxfc2ludDY0X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RBbGxFeHRlbnNpb25zGAYgASgSOkgKGm9wdGlvbmFsX2ZpeGVkMzJfZXh0", + "ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMY", + "ByABKAc6SAoab3B0aW9uYWxfZml4ZWQ2NF9leHRlbnNpb24SJC5wcm90b2J1", + "Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgIIAEoBjpJChtvcHRpb25h", + "bF9zZml4ZWQzMl9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxgJIAEoDzpJChtvcHRpb25hbF9zZml4ZWQ2NF9leHRl", + "bnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgK", + "IAEoEDpGChhvcHRpb25hbF9mbG9hdF9leHRlbnNpb24SJC5wcm90b2J1Zl91", + "bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgLIAEoAjpHChlvcHRpb25hbF9k", + "b3VibGVfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYDCABKAE6RQoXb3B0aW9uYWxfYm9vbF9leHRlbnNpb24SJC5w", + "cm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgNIAEoCDpHChlv", + "cHRpb25hbF9zdHJpbmdfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3Qu", + "VGVzdEFsbEV4dGVuc2lvbnMYDiABKAk6RgoYb3B0aW9uYWxfYnl0ZXNfZXh0", + "ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMY", + "DyABKAw6cQoXb3B0aW9uYWxncm91cF9leHRlbnNpb24SJC5wcm90b2J1Zl91", + "bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgQIAEoCjIqLnByb3RvYnVmX3Vu", + "aXR0ZXN0Lk9wdGlvbmFsR3JvdXBfZXh0ZW5zaW9uOn4KIW9wdGlvbmFsX25l", + "c3RlZF9tZXNzYWdlX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RBbGxFeHRlbnNpb25zGBIgASgLMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVz", + "dEFsbFR5cGVzLk5lc3RlZE1lc3NhZ2U6cwoib3B0aW9uYWxfZm9yZWlnbl9t", + "ZXNzYWdlX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxF", + "eHRlbnNpb25zGBMgASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1l", + "c3NhZ2U6eAohb3B0aW9uYWxfaW1wb3J0X21lc3NhZ2VfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYFCABKAsyJy5w", + "cm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0TWVzc2FnZTp4Ch5vcHRp", + "b25hbF9uZXN0ZWRfZW51bV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVz", + "dC5UZXN0QWxsRXh0ZW5zaW9ucxgVIAEoDjIqLnByb3RvYnVmX3VuaXR0ZXN0", + "LlRlc3RBbGxUeXBlcy5OZXN0ZWRFbnVtOm0KH29wdGlvbmFsX2ZvcmVpZ25f", + "ZW51bV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0", + "ZW5zaW9ucxgWIAEoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25FbnVt", + "OnIKHm9wdGlvbmFsX2ltcG9ydF9lbnVtX2V4dGVuc2lvbhIkLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGBcgASgOMiQucHJvdG9idWZf", + "dW5pdHRlc3RfaW1wb3J0LkltcG9ydEVudW06UQofb3B0aW9uYWxfc3RyaW5n", + "X3BpZWNlX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxF", + "eHRlbnNpb25zGBggASgJQgIIAjpJChdvcHRpb25hbF9jb3JkX2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGBkgASgJ", + "QgIIATpGChhyZXBlYXRlZF9pbnQzMl9leHRlbnNpb24SJC5wcm90b2J1Zl91", + "bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgfIAMoBTpGChhyZXBlYXRlZF9p", + "bnQ2NF9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0", + "ZW5zaW9ucxggIAMoAzpHChlyZXBlYXRlZF91aW50MzJfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYISADKA06RwoZ", + "cmVwZWF0ZWRfdWludDY0X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0", + "LlRlc3RBbGxFeHRlbnNpb25zGCIgAygEOkcKGXJlcGVhdGVkX3NpbnQzMl9l", + "eHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9u", + "cxgjIAMoETpHChlyZXBlYXRlZF9zaW50NjRfZXh0ZW5zaW9uEiQucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYJCADKBI6SAoacmVwZWF0", + "ZWRfZml4ZWQzMl9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxglIAMoBzpIChpyZXBlYXRlZF9maXhlZDY0X2V4dGVu", + "c2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGCYg", + "AygGOkkKG3JlcGVhdGVkX3NmaXhlZDMyX2V4dGVuc2lvbhIkLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGCcgAygPOkkKG3JlcGVhdGVk", + "X3NmaXhlZDY0X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RB", + "bGxFeHRlbnNpb25zGCggAygQOkYKGHJlcGVhdGVkX2Zsb2F0X2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGCkgAygC", + "OkcKGXJlcGVhdGVkX2RvdWJsZV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0", + "dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgqIAMoATpFChdyZXBlYXRlZF9ib29s", + "X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNp", + "b25zGCsgAygIOkcKGXJlcGVhdGVkX3N0cmluZ19leHRlbnNpb24SJC5wcm90", + "b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgsIAMoCTpGChhyZXBl", + "YXRlZF9ieXRlc19leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxgtIAMoDDpxChdyZXBlYXRlZGdyb3VwX2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGC4gAygK", + "MioucHJvdG9idWZfdW5pdHRlc3QuUmVwZWF0ZWRHcm91cF9leHRlbnNpb246", + "fgohcmVwZWF0ZWRfbmVzdGVkX21lc3NhZ2VfZXh0ZW5zaW9uEiQucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYMCADKAsyLS5wcm90b2J1", + "Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZTpzCiJyZXBl", + "YXRlZF9mb3JlaWduX21lc3NhZ2VfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYMSADKAsyIS5wcm90b2J1Zl91bml0", + "dGVzdC5Gb3JlaWduTWVzc2FnZTp4CiFyZXBlYXRlZF9pbXBvcnRfbWVzc2Fn", + "ZV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5z", + "aW9ucxgyIAMoCzInLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRN", + "ZXNzYWdlOngKHnJlcGVhdGVkX25lc3RlZF9lbnVtX2V4dGVuc2lvbhIkLnBy", + "b3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGDMgAygOMioucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW06bQofcmVw", + "ZWF0ZWRfZm9yZWlnbl9lbnVtX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxFeHRlbnNpb25zGDQgAygOMh4ucHJvdG9idWZfdW5pdHRl", + "c3QuRm9yZWlnbkVudW06cgoecmVwZWF0ZWRfaW1wb3J0X2VudW1fZXh0ZW5z", + "aW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYNSAD", + "KA4yJC5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0RW51bTpRCh9y", + "ZXBlYXRlZF9zdHJpbmdfcGllY2VfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYNiADKAlCAggCOkkKF3JlcGVhdGVk", + "X2NvcmRfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYNyADKAlCAggBOkkKF2RlZmF1bHRfaW50MzJfZXh0ZW5zaW9u", + "EiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYPSABKAU6", + "AjQxOkkKF2RlZmF1bHRfaW50NjRfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYPiABKAM6AjQyOkoKGGRlZmF1bHRf", + "dWludDMyX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxF", + "eHRlbnNpb25zGD8gASgNOgI0MzpKChhkZWZhdWx0X3VpbnQ2NF9leHRlbnNp", + "b24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxhAIAEo", + "BDoCNDQ6SwoYZGVmYXVsdF9zaW50MzJfZXh0ZW5zaW9uEiQucHJvdG9idWZf", + "dW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYQSABKBE6Ay00NTpKChhkZWZh", + "dWx0X3NpbnQ2NF9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxhCIAEoEjoCNDY6SwoZZGVmYXVsdF9maXhlZDMyX2V4", + "dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25z", + "GEMgASgHOgI0NzpLChlkZWZhdWx0X2ZpeGVkNjRfZXh0ZW5zaW9uEiQucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYRCABKAY6AjQ4OkwK", + "GmRlZmF1bHRfc2ZpeGVkMzJfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRl", + "c3QuVGVzdEFsbEV4dGVuc2lvbnMYRSABKA86AjQ5Ok0KGmRlZmF1bHRfc2Zp", + "eGVkNjRfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYRiABKBA6Ay01MDpLChdkZWZhdWx0X2Zsb2F0X2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGEcgASgC", + "OgQ1MS41Ok0KGGRlZmF1bHRfZG91YmxlX2V4dGVuc2lvbhIkLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGEggASgBOgU1MjAwMDpKChZk", + "ZWZhdWx0X2Jvb2xfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVz", + "dEFsbEV4dGVuc2lvbnMYSSABKAg6BHRydWU6TQoYZGVmYXVsdF9zdHJpbmdf", + "ZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lv", + "bnMYSiABKAk6BWhlbGxvOkwKF2RlZmF1bHRfYnl0ZXNfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYSyABKAw6BXdv", + "cmxkOnwKHWRlZmF1bHRfbmVzdGVkX2VudW1fZXh0ZW5zaW9uEiQucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYUSABKA4yKi5wcm90b2J1", + "Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkRW51bToDQkFSOnkKHmRl", + "ZmF1bHRfZm9yZWlnbl9lbnVtX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxFeHRlbnNpb25zGFIgASgOMh4ucHJvdG9idWZfdW5pdHRl", + "c3QuRm9yZWlnbkVudW06C0ZPUkVJR05fQkFSOn0KHWRlZmF1bHRfaW1wb3J0", + "X2VudW1fZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYUyABKA4yJC5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1w", + "b3J0RW51bToKSU1QT1JUX0JBUjpVCh5kZWZhdWx0X3N0cmluZ19waWVjZV9l", + "eHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9u", + "cxhUIAEoCToDYWJjQgIIAjpNChZkZWZhdWx0X2NvcmRfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYVSABKAk6AzEy", + "M0ICCAE6QgoTbXlfZXh0ZW5zaW9uX3N0cmluZxIlLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RGaWVsZE9yZGVyaW5ncxgyIAEoCTo/ChBteV9leHRlbnNpb25f", + "aW50EiUucHJvdG9idWZfdW5pdHRlc3QuVGVzdEZpZWxkT3JkZXJpbmdzGAUg", + "ASgFOksKFnBhY2tlZF9pbnQzMl9leHRlbnNpb24SJy5wcm90b2J1Zl91bml0", + "dGVzdC5UZXN0UGFja2VkRXh0ZW5zaW9ucxhaIAMoBUICEAE6SwoWcGFja2Vk", + "X2ludDY0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNr", + "ZWRFeHRlbnNpb25zGFsgAygDQgIQATpMChdwYWNrZWRfdWludDMyX2V4dGVu", + "c2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNrZWRFeHRlbnNpb25z", + "GFwgAygNQgIQATpMChdwYWNrZWRfdWludDY0X2V4dGVuc2lvbhInLnByb3Rv", + "YnVmX3VuaXR0ZXN0LlRlc3RQYWNrZWRFeHRlbnNpb25zGF0gAygEQgIQATpM", + "ChdwYWNrZWRfc2ludDMyX2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0", + "LlRlc3RQYWNrZWRFeHRlbnNpb25zGF4gAygRQgIQATpMChdwYWNrZWRfc2lu", + "dDY0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNrZWRF", + "eHRlbnNpb25zGF8gAygSQgIQATpNChhwYWNrZWRfZml4ZWQzMl9leHRlbnNp", + "b24SJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UGFja2VkRXh0ZW5zaW9ucxhg", + "IAMoB0ICEAE6TQoYcGFja2VkX2ZpeGVkNjRfZXh0ZW5zaW9uEicucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdFBhY2tlZEV4dGVuc2lvbnMYYSADKAZCAhABOk4K", + "GXBhY2tlZF9zZml4ZWQzMl9leHRlbnNpb24SJy5wcm90b2J1Zl91bml0dGVz", + "dC5UZXN0UGFja2VkRXh0ZW5zaW9ucxhiIAMoD0ICEAE6TgoZcGFja2VkX3Nm", + "aXhlZDY0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNr", + "ZWRFeHRlbnNpb25zGGMgAygQQgIQATpLChZwYWNrZWRfZmxvYXRfZXh0ZW5z", + "aW9uEicucHJvdG9idWZfdW5pdHRlc3QuVGVzdFBhY2tlZEV4dGVuc2lvbnMY", + "ZCADKAJCAhABOkwKF3BhY2tlZF9kb3VibGVfZXh0ZW5zaW9uEicucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdFBhY2tlZEV4dGVuc2lvbnMYZSADKAFCAhABOkoK", + "FXBhY2tlZF9ib29sX2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RQYWNrZWRFeHRlbnNpb25zGGYgAygIQgIQATpqChVwYWNrZWRfZW51bV9l", + "eHRlbnNpb24SJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UGFja2VkRXh0ZW5z", + "aW9ucxhnIAMoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25FbnVtQgIQ", + "AUJTQg1Vbml0dGVzdFByb3RvSAGAAQGIAQGQAQHCPjYKIUdvb2dsZS5Qcm90", + "b2NvbEJ1ZmZlcnMuVGVzdFByb3RvcxIRVW5pdFRlc3RQcm90b0ZpbGU=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_TestAllTypes__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes__Descriptor, + new string[] { "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalGroup", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalImportMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalImportEnum", "OptionalStringPiece", "OptionalCord", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedGroup", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedImportMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedImportEnum", "RepeatedStringPiece", "RepeatedCord", "DefaultInt32", "DefaultInt64", "DefaultUint32", "DefaultUint64", "DefaultSint32", "DefaultSint64", "DefaultFixed32", "DefaultFixed64", "DefaultSfixed32", "DefaultSfixed64", "DefaultFloat", "DefaultDouble", "DefaultBool", "DefaultString", "DefaultBytes", "DefaultNestedEnum", "DefaultForeignEnum", "DefaultImportEnum", "DefaultStringPiece", "DefaultCord", }); + internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor = internal__static_protobuf_unittest_TestAllTypes__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor, + new string[] { "Bb", }); + internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor = internal__static_protobuf_unittest_TestAllTypes__Descriptor.NestedTypes[1]; + internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor = internal__static_protobuf_unittest_TestAllTypes__Descriptor.NestedTypes[2]; + internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor = Descriptor.MessageTypes[1]; + internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor, + new string[] { "DeprecatedInt32", }); + internal__static_protobuf_unittest_ForeignMessage__Descriptor = Descriptor.MessageTypes[2]; + internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_ForeignMessage__Descriptor, + new string[] { "C", }); + internal__static_protobuf_unittest_TestAllExtensions__Descriptor = Descriptor.MessageTypes[3]; + internal__static_protobuf_unittest_TestAllExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllExtensions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor = Descriptor.MessageTypes[4]; + internal__static_protobuf_unittest_OptionalGroup_extension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor = Descriptor.MessageTypes[5]; + internal__static_protobuf_unittest_RepeatedGroup_extension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestNestedExtension__Descriptor = Descriptor.MessageTypes[6]; + internal__static_protobuf_unittest_TestNestedExtension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestNestedExtension__Descriptor, + new string[] { }); + global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Test = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Descriptor.Extensions[0]); + internal__static_protobuf_unittest_TestRequired__Descriptor = Descriptor.MessageTypes[7]; + internal__static_protobuf_unittest_TestRequired__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRequired__Descriptor, + new string[] { "A", "Dummy2", "B", "Dummy4", "Dummy5", "Dummy6", "Dummy7", "Dummy8", "Dummy9", "Dummy10", "Dummy11", "Dummy12", "Dummy13", "Dummy14", "Dummy15", "Dummy16", "Dummy17", "Dummy18", "Dummy19", "Dummy20", "Dummy21", "Dummy22", "Dummy23", "Dummy24", "Dummy25", "Dummy26", "Dummy27", "Dummy28", "Dummy29", "Dummy30", "Dummy31", "Dummy32", "C", }); + global::Google.ProtocolBuffers.TestProtos.TestRequired.Single = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestRequired.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.TestRequired.Multi = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestRequired.Descriptor.Extensions[1]); + internal__static_protobuf_unittest_TestRequiredForeign__Descriptor = Descriptor.MessageTypes[8]; + internal__static_protobuf_unittest_TestRequiredForeign__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRequiredForeign__Descriptor, + new string[] { "OptionalMessage", "RepeatedMessage", "Dummy", }); + internal__static_protobuf_unittest_TestForeignNested__Descriptor = Descriptor.MessageTypes[9]; + internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestForeignNested__Descriptor, + new string[] { "ForeignNested", }); + internal__static_protobuf_unittest_TestEmptyMessage__Descriptor = Descriptor.MessageTypes[10]; + internal__static_protobuf_unittest_TestEmptyMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestEmptyMessage__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor = Descriptor.MessageTypes[11]; + internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor = Descriptor.MessageTypes[12]; + internal__static_protobuf_unittest_TestMultipleExtensionRanges__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor = Descriptor.MessageTypes[13]; + internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor, + new string[] { "A", "Bb", }); + internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor = Descriptor.MessageTypes[14]; + internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor, + new string[] { "A", "I", }); + internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor = Descriptor.MessageTypes[15]; + internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor, + new string[] { "Bb", }); + internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor = Descriptor.MessageTypes[16]; + internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor, + new string[] { "A", "OptionalInt32", }); + internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor = Descriptor.MessageTypes[17]; + internal__static_protobuf_unittest_TestDupFieldNumber__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor, + new string[] { "A", "Foo", "Bar", }); + internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor = internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestDupFieldNumber_Foo__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor = internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor.NestedTypes[1]; + internal__static_protobuf_unittest_TestDupFieldNumber_Bar__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor = Descriptor.MessageTypes[18]; + internal__static_protobuf_unittest_TestNestedMessageHasBits__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor, + new string[] { "OptionalNestedMessage", }); + internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor = internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor, + new string[] { "NestedmessageRepeatedInt32", "NestedmessageRepeatedForeignmessage", }); + internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor = Descriptor.MessageTypes[19]; + internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor, + new string[] { "PrimitiveField", "StringField", "EnumField", "MessageField", "StringPieceField", "CordField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedStringPieceField", "RepeatedCordField", }); + internal__static_protobuf_unittest_TestFieldOrderings__Descriptor = Descriptor.MessageTypes[20]; + internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestFieldOrderings__Descriptor, + new string[] { "MyString", "MyInt", "MyFloat", }); + internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor = Descriptor.MessageTypes[21]; + internal__static_protobuf_unittest_TestExtremeDefaultValues__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor, + new string[] { "EscapedBytes", "LargeUint32", "LargeUint64", "SmallInt32", "SmallInt64", "Utf8String", "ZeroFloat", "OneFloat", "SmallFloat", "NegativeOneFloat", "NegativeFloat", "LargeFloat", "SmallNegativeFloat", "InfDouble", "NegInfDouble", "NanDouble", "InfFloat", "NegInfFloat", "NanFloat", "CppTrigraph", }); + internal__static_protobuf_unittest_SparseEnumMessage__Descriptor = Descriptor.MessageTypes[22]; + internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_SparseEnumMessage__Descriptor, + new string[] { "SparseEnum", }); + internal__static_protobuf_unittest_OneString__Descriptor = Descriptor.MessageTypes[23]; + internal__static_protobuf_unittest_OneString__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OneString__Descriptor, + new string[] { "Data", }); + internal__static_protobuf_unittest_OneBytes__Descriptor = Descriptor.MessageTypes[24]; + internal__static_protobuf_unittest_OneBytes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OneBytes__Descriptor, + new string[] { "Data", }); + internal__static_protobuf_unittest_TestPackedTypes__Descriptor = Descriptor.MessageTypes[25]; + internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestPackedTypes__Descriptor, + new string[] { "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedEnum", }); + internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor = Descriptor.MessageTypes[26]; + internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor, + new string[] { "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedEnum", }); + internal__static_protobuf_unittest_TestPackedExtensions__Descriptor = Descriptor.MessageTypes[27]; + internal__static_protobuf_unittest_TestPackedExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestPackedExtensions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor = Descriptor.MessageTypes[28]; + internal__static_protobuf_unittest_TestDynamicExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor, + new string[] { "ScalarExtension", "EnumExtension", "DynamicEnumExtension", "MessageExtension", "DynamicMessageExtension", "RepeatedExtension", "PackedExtension", }); + internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor = internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor, + new string[] { "DynamicField", }); + internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor = Descriptor.MessageTypes[29]; + internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor, + new string[] { "RepeatedFixed32", "RepeatedInt32", "RepeatedFixed64", "RepeatedInt64", "RepeatedFloat", "RepeatedUint64", }); + internal__static_protobuf_unittest_FooRequest__Descriptor = Descriptor.MessageTypes[30]; + internal__static_protobuf_unittest_FooRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_FooRequest__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_FooResponse__Descriptor = Descriptor.MessageTypes[31]; + internal__static_protobuf_unittest_FooResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_FooResponse__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_BarRequest__Descriptor = Descriptor.MessageTypes[32]; + internal__static_protobuf_unittest_BarRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_BarRequest__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_BarResponse__Descriptor = Descriptor.MessageTypes[33]; + internal__static_protobuf_unittest_BarResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_BarResponse__Descriptor, + new string[] { }); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[1]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[2]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[3]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[4]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[5]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[6]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[7]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[8]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[9]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFloatExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[10]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalDoubleExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[11]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBoolExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[12]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[13]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBytesExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[14]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalGroupExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[15]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedMessageExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[16]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignMessageExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[17]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportMessageExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[18]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[19]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[20]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[21]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringPieceExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[22]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalCordExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[23]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[24]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[25]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[26]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[27]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[28]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[29]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[30]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[31]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[32]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[33]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFloatExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[34]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedDoubleExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[35]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBoolExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[36]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[37]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBytesExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[38]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedGroupExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[39]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedMessageExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[40]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignMessageExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[41]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportMessageExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[42]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[43]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[44]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[45]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringPieceExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[46]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedCordExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[47]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[48]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[49]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[50]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[51]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[52]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[53]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[54]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[55]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[56]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[57]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFloatExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[58]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultDoubleExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[59]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBoolExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[60]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[61]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBytesExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[62]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultNestedEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[63]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultForeignEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[64]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultImportEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[65]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringPieceExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[66]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultCordExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[67]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionString = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[68]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionInt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[69]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[70]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[71]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[72]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[73]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[74]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[75]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[76]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[77]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[78]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[79]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFloatExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[80]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedDoubleExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[81]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedBoolExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[82]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[83]); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum ForeignEnum { + FOREIGN_FOO = 4, + FOREIGN_BAR = 5, + FOREIGN_BAZ = 6, + } + + public enum TestEnumWithDupValue { + FOO1 = 1, + BAR1 = 2, + BAZ = 3, + FOO2 = 1, + BAR2 = 2, + } + + public enum TestSparseEnum { + SPARSE_A = 123, + SPARSE_B = 62374, + SPARSE_C = 12589234, + SPARSE_D = -15, + SPARSE_E = -53452, + SPARSE_F = 0, + SPARSE_G = 2, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestAllTypes : pb::GeneratedMessage { + private TestAllTypes() { } + private static readonly TestAllTypes defaultInstance = new TestAllTypes().MakeReadOnly(); + private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; + private static readonly uint[] _testAllTypesFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; + public static TestAllTypes DefaultInstance { + get { return defaultInstance; } + } + + public override TestAllTypes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestAllTypes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum NestedEnum { + FOO = 1, + BAR = 2, + BAZ = 3, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); + private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; + private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; + public static NestedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override NestedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NestedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable; } + } + + public const int BbFieldNumber = 1; + private bool hasBb; + private int bb_; + public bool HasBb { + get { return hasBb; } + } + public int Bb { + get { return bb_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _nestedMessageFieldNames; + if (hasBb) { + output.WriteInt32(1, field_names[0], Bb); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasBb) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Bb); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static NestedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NestedMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NestedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (resultIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NestedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Descriptor; } + } + + public override NestedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } + } + + public override NestedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NestedMessage) { + return MergeFrom((NestedMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NestedMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasBb) { + Bb = other.Bb; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_nestedMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _nestedMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasBb = input.ReadInt32(ref result.bb_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasBb { + get { return result.hasBb; } + } + public int Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(int value) { + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = 0; + return this; + } + } + static NestedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OptionalGroup : pb::GeneratedMessage { + private OptionalGroup() { } + private static readonly OptionalGroup defaultInstance = new OptionalGroup().MakeReadOnly(); + private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; + private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; + public static OptionalGroup DefaultInstance { + get { return defaultInstance; } + } + + public override OptionalGroup DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OptionalGroup ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__FieldAccessorTable; } + } + + public const int AFieldNumber = 17; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _optionalGroupFieldNames; + if (hasA) { + output.WriteInt32(17, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(17, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OptionalGroup ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OptionalGroup ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OptionalGroup MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OptionalGroup prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OptionalGroup cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OptionalGroup result; + + private OptionalGroup PrepareBuilder() { + if (resultIsReadOnly) { + OptionalGroup original = result; + result = new OptionalGroup(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OptionalGroup MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Descriptor; } + } + + public override OptionalGroup DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; } + } + + public override OptionalGroup BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OptionalGroup) { + return MergeFrom((OptionalGroup) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OptionalGroup other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_optionalGroupFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _optionalGroupFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 136: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static OptionalGroup() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RepeatedGroup : pb::GeneratedMessage { + private RepeatedGroup() { } + private static readonly RepeatedGroup defaultInstance = new RepeatedGroup().MakeReadOnly(); + private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; + private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; + public static RepeatedGroup DefaultInstance { + get { return defaultInstance; } + } + + public override RepeatedGroup DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RepeatedGroup ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__FieldAccessorTable; } + } + + public const int AFieldNumber = 47; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _repeatedGroupFieldNames; + if (hasA) { + output.WriteInt32(47, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(47, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static RepeatedGroup ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RepeatedGroup ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RepeatedGroup MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RepeatedGroup prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RepeatedGroup cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RepeatedGroup result; + + private RepeatedGroup PrepareBuilder() { + if (resultIsReadOnly) { + RepeatedGroup original = result; + result = new RepeatedGroup(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RepeatedGroup MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Descriptor; } + } + + public override RepeatedGroup DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance; } + } + + public override RepeatedGroup BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is RepeatedGroup) { + return MergeFrom((RepeatedGroup) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RepeatedGroup other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_repeatedGroupFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _repeatedGroupFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 376: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static RepeatedGroup() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int OptionalInt32FieldNumber = 1; + private bool hasOptionalInt32; + private int optionalInt32_; + public bool HasOptionalInt32 { + get { return hasOptionalInt32; } + } + public int OptionalInt32 { + get { return optionalInt32_; } + } + + public const int OptionalInt64FieldNumber = 2; + private bool hasOptionalInt64; + private long optionalInt64_; + public bool HasOptionalInt64 { + get { return hasOptionalInt64; } + } + public long OptionalInt64 { + get { return optionalInt64_; } + } + + public const int OptionalUint32FieldNumber = 3; + private bool hasOptionalUint32; + private uint optionalUint32_; + public bool HasOptionalUint32 { + get { return hasOptionalUint32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalUint32 { + get { return optionalUint32_; } + } + + public const int OptionalUint64FieldNumber = 4; + private bool hasOptionalUint64; + private ulong optionalUint64_; + public bool HasOptionalUint64 { + get { return hasOptionalUint64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalUint64 { + get { return optionalUint64_; } + } + + public const int OptionalSint32FieldNumber = 5; + private bool hasOptionalSint32; + private int optionalSint32_; + public bool HasOptionalSint32 { + get { return hasOptionalSint32; } + } + public int OptionalSint32 { + get { return optionalSint32_; } + } + + public const int OptionalSint64FieldNumber = 6; + private bool hasOptionalSint64; + private long optionalSint64_; + public bool HasOptionalSint64 { + get { return hasOptionalSint64; } + } + public long OptionalSint64 { + get { return optionalSint64_; } + } + + public const int OptionalFixed32FieldNumber = 7; + private bool hasOptionalFixed32; + private uint optionalFixed32_; + public bool HasOptionalFixed32 { + get { return hasOptionalFixed32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalFixed32 { + get { return optionalFixed32_; } + } + + public const int OptionalFixed64FieldNumber = 8; + private bool hasOptionalFixed64; + private ulong optionalFixed64_; + public bool HasOptionalFixed64 { + get { return hasOptionalFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalFixed64 { + get { return optionalFixed64_; } + } + + public const int OptionalSfixed32FieldNumber = 9; + private bool hasOptionalSfixed32; + private int optionalSfixed32_; + public bool HasOptionalSfixed32 { + get { return hasOptionalSfixed32; } + } + public int OptionalSfixed32 { + get { return optionalSfixed32_; } + } + + public const int OptionalSfixed64FieldNumber = 10; + private bool hasOptionalSfixed64; + private long optionalSfixed64_; + public bool HasOptionalSfixed64 { + get { return hasOptionalSfixed64; } + } + public long OptionalSfixed64 { + get { return optionalSfixed64_; } + } + + public const int OptionalFloatFieldNumber = 11; + private bool hasOptionalFloat; + private float optionalFloat_; + public bool HasOptionalFloat { + get { return hasOptionalFloat; } + } + public float OptionalFloat { + get { return optionalFloat_; } + } + + public const int OptionalDoubleFieldNumber = 12; + private bool hasOptionalDouble; + private double optionalDouble_; + public bool HasOptionalDouble { + get { return hasOptionalDouble; } + } + public double OptionalDouble { + get { return optionalDouble_; } + } + + public const int OptionalBoolFieldNumber = 13; + private bool hasOptionalBool; + private bool optionalBool_; + public bool HasOptionalBool { + get { return hasOptionalBool; } + } + public bool OptionalBool { + get { return optionalBool_; } + } + + public const int OptionalStringFieldNumber = 14; + private bool hasOptionalString; + private string optionalString_ = ""; + public bool HasOptionalString { + get { return hasOptionalString; } + } + public string OptionalString { + get { return optionalString_; } + } + + public const int OptionalBytesFieldNumber = 15; + private bool hasOptionalBytes; + private pb::ByteString optionalBytes_ = pb::ByteString.Empty; + public bool HasOptionalBytes { + get { return hasOptionalBytes; } + } + public pb::ByteString OptionalBytes { + get { return optionalBytes_; } + } + + public const int OptionalGroupFieldNumber = 16; + private bool hasOptionalGroup; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup optionalGroup_; + public bool HasOptionalGroup { + get { return hasOptionalGroup; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup OptionalGroup { + get { return optionalGroup_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; } + } + + public const int OptionalNestedMessageFieldNumber = 18; + private bool hasOptionalNestedMessage; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage optionalNestedMessage_; + public bool HasOptionalNestedMessage { + get { return hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage OptionalNestedMessage { + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } + } + + public const int OptionalForeignMessageFieldNumber = 19; + private bool hasOptionalForeignMessage; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage optionalForeignMessage_; + public bool HasOptionalForeignMessage { + get { return hasOptionalForeignMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage OptionalForeignMessage { + get { return optionalForeignMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public const int OptionalImportMessageFieldNumber = 20; + private bool hasOptionalImportMessage; + private global::Google.ProtocolBuffers.TestProtos.ImportMessage optionalImportMessage_; + public bool HasOptionalImportMessage { + get { return hasOptionalImportMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage OptionalImportMessage { + get { return optionalImportMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } + } + + public const int OptionalNestedEnumFieldNumber = 21; + private bool hasOptionalNestedEnum; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.FOO; + public bool HasOptionalNestedEnum { + get { return hasOptionalNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum OptionalNestedEnum { + get { return optionalNestedEnum_; } + } + + public const int OptionalForeignEnumFieldNumber = 22; + private bool hasOptionalForeignEnum; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + public bool HasOptionalForeignEnum { + get { return hasOptionalForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum OptionalForeignEnum { + get { return optionalForeignEnum_; } + } + + public const int OptionalImportEnumFieldNumber = 23; + private bool hasOptionalImportEnum; + private global::Google.ProtocolBuffers.TestProtos.ImportEnum optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_FOO; + public bool HasOptionalImportEnum { + get { return hasOptionalImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum OptionalImportEnum { + get { return optionalImportEnum_; } + } + + public const int OptionalStringPieceFieldNumber = 24; + private bool hasOptionalStringPiece; + private string optionalStringPiece_ = ""; + public bool HasOptionalStringPiece { + get { return hasOptionalStringPiece; } + } + public string OptionalStringPiece { + get { return optionalStringPiece_; } + } + + public const int OptionalCordFieldNumber = 25; + private bool hasOptionalCord; + private string optionalCord_ = ""; + public bool HasOptionalCord { + get { return hasOptionalCord; } + } + public string OptionalCord { + get { return optionalCord_; } + } + + public const int RepeatedInt32FieldNumber = 31; + private pbc::PopsicleList repeatedInt32_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt32List { + get { return pbc::Lists.AsReadOnly(repeatedInt32_); } + } + public int RepeatedInt32Count { + get { return repeatedInt32_.Count; } + } + public int GetRepeatedInt32(int index) { + return repeatedInt32_[index]; + } + + public const int RepeatedInt64FieldNumber = 32; + private pbc::PopsicleList repeatedInt64_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt64List { + get { return pbc::Lists.AsReadOnly(repeatedInt64_); } + } + public int RepeatedInt64Count { + get { return repeatedInt64_.Count; } + } + public long GetRepeatedInt64(int index) { + return repeatedInt64_[index]; + } + + public const int RepeatedUint32FieldNumber = 33; + private pbc::PopsicleList repeatedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint32List { + get { return pbc::Lists.AsReadOnly(repeatedUint32_); } + } + public int RepeatedUint32Count { + get { return repeatedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedUint32(int index) { + return repeatedUint32_[index]; + } + + public const int RepeatedUint64FieldNumber = 34; + private pbc::PopsicleList repeatedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint64List { + get { return pbc::Lists.AsReadOnly(repeatedUint64_); } + } + public int RepeatedUint64Count { + get { return repeatedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return repeatedUint64_[index]; + } + + public const int RepeatedSint32FieldNumber = 35; + private pbc::PopsicleList repeatedSint32_ = new pbc::PopsicleList(); + public scg::IList RepeatedSint32List { + get { return pbc::Lists.AsReadOnly(repeatedSint32_); } + } + public int RepeatedSint32Count { + get { return repeatedSint32_.Count; } + } + public int GetRepeatedSint32(int index) { + return repeatedSint32_[index]; + } + + public const int RepeatedSint64FieldNumber = 36; + private pbc::PopsicleList repeatedSint64_ = new pbc::PopsicleList(); + public scg::IList RepeatedSint64List { + get { return pbc::Lists.AsReadOnly(repeatedSint64_); } + } + public int RepeatedSint64Count { + get { return repeatedSint64_.Count; } + } + public long GetRepeatedSint64(int index) { + return repeatedSint64_[index]; + } + + public const int RepeatedFixed32FieldNumber = 37; + private pbc::PopsicleList repeatedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed32List { + get { return pbc::Lists.AsReadOnly(repeatedFixed32_); } + } + public int RepeatedFixed32Count { + get { return repeatedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return repeatedFixed32_[index]; + } + + public const int RepeatedFixed64FieldNumber = 38; + private pbc::PopsicleList repeatedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed64List { + get { return pbc::Lists.AsReadOnly(repeatedFixed64_); } + } + public int RepeatedFixed64Count { + get { return repeatedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return repeatedFixed64_[index]; + } + + public const int RepeatedSfixed32FieldNumber = 39; + private pbc::PopsicleList repeatedSfixed32_ = new pbc::PopsicleList(); + public scg::IList RepeatedSfixed32List { + get { return pbc::Lists.AsReadOnly(repeatedSfixed32_); } + } + public int RepeatedSfixed32Count { + get { return repeatedSfixed32_.Count; } + } + public int GetRepeatedSfixed32(int index) { + return repeatedSfixed32_[index]; + } + + public const int RepeatedSfixed64FieldNumber = 40; + private pbc::PopsicleList repeatedSfixed64_ = new pbc::PopsicleList(); + public scg::IList RepeatedSfixed64List { + get { return pbc::Lists.AsReadOnly(repeatedSfixed64_); } + } + public int RepeatedSfixed64Count { + get { return repeatedSfixed64_.Count; } + } + public long GetRepeatedSfixed64(int index) { + return repeatedSfixed64_[index]; + } + + public const int RepeatedFloatFieldNumber = 41; + private pbc::PopsicleList repeatedFloat_ = new pbc::PopsicleList(); + public scg::IList RepeatedFloatList { + get { return pbc::Lists.AsReadOnly(repeatedFloat_); } + } + public int RepeatedFloatCount { + get { return repeatedFloat_.Count; } + } + public float GetRepeatedFloat(int index) { + return repeatedFloat_[index]; + } + + public const int RepeatedDoubleFieldNumber = 42; + private pbc::PopsicleList repeatedDouble_ = new pbc::PopsicleList(); + public scg::IList RepeatedDoubleList { + get { return pbc::Lists.AsReadOnly(repeatedDouble_); } + } + public int RepeatedDoubleCount { + get { return repeatedDouble_.Count; } + } + public double GetRepeatedDouble(int index) { + return repeatedDouble_[index]; + } + + public const int RepeatedBoolFieldNumber = 43; + private pbc::PopsicleList repeatedBool_ = new pbc::PopsicleList(); + public scg::IList RepeatedBoolList { + get { return pbc::Lists.AsReadOnly(repeatedBool_); } + } + public int RepeatedBoolCount { + get { return repeatedBool_.Count; } + } + public bool GetRepeatedBool(int index) { + return repeatedBool_[index]; + } + + public const int RepeatedStringFieldNumber = 44; + private pbc::PopsicleList repeatedString_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringList { + get { return pbc::Lists.AsReadOnly(repeatedString_); } + } + public int RepeatedStringCount { + get { return repeatedString_.Count; } + } + public string GetRepeatedString(int index) { + return repeatedString_[index]; + } + + public const int RepeatedBytesFieldNumber = 45; + private pbc::PopsicleList repeatedBytes_ = new pbc::PopsicleList(); + public scg::IList RepeatedBytesList { + get { return pbc::Lists.AsReadOnly(repeatedBytes_); } + } + public int RepeatedBytesCount { + get { return repeatedBytes_.Count; } + } + public pb::ByteString GetRepeatedBytes(int index) { + return repeatedBytes_[index]; + } + + public const int RepeatedGroupFieldNumber = 46; + private pbc::PopsicleList repeatedGroup_ = new pbc::PopsicleList(); + public scg::IList RepeatedGroupList { + get { return repeatedGroup_; } + } + public int RepeatedGroupCount { + get { return repeatedGroup_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup GetRepeatedGroup(int index) { + return repeatedGroup_[index]; + } + + public const int RepeatedNestedMessageFieldNumber = 48; + private pbc::PopsicleList repeatedNestedMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedNestedMessageList { + get { return repeatedNestedMessage_; } + } + public int RepeatedNestedMessageCount { + get { return repeatedNestedMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage GetRepeatedNestedMessage(int index) { + return repeatedNestedMessage_[index]; + } + + public const int RepeatedForeignMessageFieldNumber = 49; + private pbc::PopsicleList repeatedForeignMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedForeignMessageList { + get { return repeatedForeignMessage_; } + } + public int RepeatedForeignMessageCount { + get { return repeatedForeignMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedForeignMessage(int index) { + return repeatedForeignMessage_[index]; + } + + public const int RepeatedImportMessageFieldNumber = 50; + private pbc::PopsicleList repeatedImportMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedImportMessageList { + get { return repeatedImportMessage_; } + } + public int RepeatedImportMessageCount { + get { return repeatedImportMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage GetRepeatedImportMessage(int index) { + return repeatedImportMessage_[index]; + } + + public const int RepeatedNestedEnumFieldNumber = 51; + private pbc::PopsicleList repeatedNestedEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedNestedEnumList { + get { return pbc::Lists.AsReadOnly(repeatedNestedEnum_); } + } + public int RepeatedNestedEnumCount { + get { return repeatedNestedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum GetRepeatedNestedEnum(int index) { + return repeatedNestedEnum_[index]; + } + + public const int RepeatedForeignEnumFieldNumber = 52; + private pbc::PopsicleList repeatedForeignEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedForeignEnumList { + get { return pbc::Lists.AsReadOnly(repeatedForeignEnum_); } + } + public int RepeatedForeignEnumCount { + get { return repeatedForeignEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedForeignEnum(int index) { + return repeatedForeignEnum_[index]; + } + + public const int RepeatedImportEnumFieldNumber = 53; + private pbc::PopsicleList repeatedImportEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedImportEnumList { + get { return pbc::Lists.AsReadOnly(repeatedImportEnum_); } + } + public int RepeatedImportEnumCount { + get { return repeatedImportEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum GetRepeatedImportEnum(int index) { + return repeatedImportEnum_[index]; + } + + public const int RepeatedStringPieceFieldNumber = 54; + private pbc::PopsicleList repeatedStringPiece_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringPieceList { + get { return pbc::Lists.AsReadOnly(repeatedStringPiece_); } + } + public int RepeatedStringPieceCount { + get { return repeatedStringPiece_.Count; } + } + public string GetRepeatedStringPiece(int index) { + return repeatedStringPiece_[index]; + } + + public const int RepeatedCordFieldNumber = 55; + private pbc::PopsicleList repeatedCord_ = new pbc::PopsicleList(); + public scg::IList RepeatedCordList { + get { return pbc::Lists.AsReadOnly(repeatedCord_); } + } + public int RepeatedCordCount { + get { return repeatedCord_.Count; } + } + public string GetRepeatedCord(int index) { + return repeatedCord_[index]; + } + + public const int DefaultInt32FieldNumber = 61; + private bool hasDefaultInt32; + private int defaultInt32_ = 41; + public bool HasDefaultInt32 { + get { return hasDefaultInt32; } + } + public int DefaultInt32 { + get { return defaultInt32_; } + } + + public const int DefaultInt64FieldNumber = 62; + private bool hasDefaultInt64; + private long defaultInt64_ = 42L; + public bool HasDefaultInt64 { + get { return hasDefaultInt64; } + } + public long DefaultInt64 { + get { return defaultInt64_; } + } + + public const int DefaultUint32FieldNumber = 63; + private bool hasDefaultUint32; + private uint defaultUint32_ = 43; + public bool HasDefaultUint32 { + get { return hasDefaultUint32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultUint32 { + get { return defaultUint32_; } + } + + public const int DefaultUint64FieldNumber = 64; + private bool hasDefaultUint64; + private ulong defaultUint64_ = 44UL; + public bool HasDefaultUint64 { + get { return hasDefaultUint64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultUint64 { + get { return defaultUint64_; } + } + + public const int DefaultSint32FieldNumber = 65; + private bool hasDefaultSint32; + private int defaultSint32_ = -45; + public bool HasDefaultSint32 { + get { return hasDefaultSint32; } + } + public int DefaultSint32 { + get { return defaultSint32_; } + } + + public const int DefaultSint64FieldNumber = 66; + private bool hasDefaultSint64; + private long defaultSint64_ = 46; + public bool HasDefaultSint64 { + get { return hasDefaultSint64; } + } + public long DefaultSint64 { + get { return defaultSint64_; } + } + + public const int DefaultFixed32FieldNumber = 67; + private bool hasDefaultFixed32; + private uint defaultFixed32_ = 47; + public bool HasDefaultFixed32 { + get { return hasDefaultFixed32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultFixed32 { + get { return defaultFixed32_; } + } + + public const int DefaultFixed64FieldNumber = 68; + private bool hasDefaultFixed64; + private ulong defaultFixed64_ = 48; + public bool HasDefaultFixed64 { + get { return hasDefaultFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultFixed64 { + get { return defaultFixed64_; } + } + + public const int DefaultSfixed32FieldNumber = 69; + private bool hasDefaultSfixed32; + private int defaultSfixed32_ = 49; + public bool HasDefaultSfixed32 { + get { return hasDefaultSfixed32; } + } + public int DefaultSfixed32 { + get { return defaultSfixed32_; } + } + + public const int DefaultSfixed64FieldNumber = 70; + private bool hasDefaultSfixed64; + private long defaultSfixed64_ = -50; + public bool HasDefaultSfixed64 { + get { return hasDefaultSfixed64; } + } + public long DefaultSfixed64 { + get { return defaultSfixed64_; } + } + + public const int DefaultFloatFieldNumber = 71; + private bool hasDefaultFloat; + private float defaultFloat_ = 51.5F; + public bool HasDefaultFloat { + get { return hasDefaultFloat; } + } + public float DefaultFloat { + get { return defaultFloat_; } + } + + public const int DefaultDoubleFieldNumber = 72; + private bool hasDefaultDouble; + private double defaultDouble_ = 52000D; + public bool HasDefaultDouble { + get { return hasDefaultDouble; } + } + public double DefaultDouble { + get { return defaultDouble_; } + } + + public const int DefaultBoolFieldNumber = 73; + private bool hasDefaultBool; + private bool defaultBool_ = true; + public bool HasDefaultBool { + get { return hasDefaultBool; } + } + public bool DefaultBool { + get { return defaultBool_; } + } + + public const int DefaultStringFieldNumber = 74; + private bool hasDefaultString; + private string defaultString_ = "hello"; + public bool HasDefaultString { + get { return hasDefaultString; } + } + public string DefaultString { + get { return defaultString_; } + } + + public const int DefaultBytesFieldNumber = 75; + private bool hasDefaultBytes; + private pb::ByteString defaultBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor.Fields[62].DefaultValue; + public bool HasDefaultBytes { + get { return hasDefaultBytes; } + } + public pb::ByteString DefaultBytes { + get { return defaultBytes_; } + } + + public const int DefaultNestedEnumFieldNumber = 81; + private bool hasDefaultNestedEnum; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.BAR; + public bool HasDefaultNestedEnum { + get { return hasDefaultNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum DefaultNestedEnum { + get { return defaultNestedEnum_; } + } + + public const int DefaultForeignEnumFieldNumber = 82; + private bool hasDefaultForeignEnum; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_BAR; + public bool HasDefaultForeignEnum { + get { return hasDefaultForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum DefaultForeignEnum { + get { return defaultForeignEnum_; } + } + + public const int DefaultImportEnumFieldNumber = 83; + private bool hasDefaultImportEnum; + private global::Google.ProtocolBuffers.TestProtos.ImportEnum defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_BAR; + public bool HasDefaultImportEnum { + get { return hasDefaultImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum DefaultImportEnum { + get { return defaultImportEnum_; } + } + + public const int DefaultStringPieceFieldNumber = 84; + private bool hasDefaultStringPiece; + private string defaultStringPiece_ = "abc"; + public bool HasDefaultStringPiece { + get { return hasDefaultStringPiece; } + } + public string DefaultStringPiece { + get { return defaultStringPiece_; } + } + + public const int DefaultCordFieldNumber = 85; + private bool hasDefaultCord; + private string defaultCord_ = "123"; + public bool HasDefaultCord { + get { return hasDefaultCord; } + } + public string DefaultCord { + get { return defaultCord_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testAllTypesFieldNames; + if (hasOptionalInt32) { + output.WriteInt32(1, field_names[31], OptionalInt32); + } + if (hasOptionalInt64) { + output.WriteInt64(2, field_names[32], OptionalInt64); + } + if (hasOptionalUint32) { + output.WriteUInt32(3, field_names[41], OptionalUint32); + } + if (hasOptionalUint64) { + output.WriteUInt64(4, field_names[42], OptionalUint64); + } + if (hasOptionalSint32) { + output.WriteSInt32(5, field_names[37], OptionalSint32); + } + if (hasOptionalSint64) { + output.WriteSInt64(6, field_names[38], OptionalSint64); + } + if (hasOptionalFixed32) { + output.WriteFixed32(7, field_names[24], OptionalFixed32); + } + if (hasOptionalFixed64) { + output.WriteFixed64(8, field_names[25], OptionalFixed64); + } + if (hasOptionalSfixed32) { + output.WriteSFixed32(9, field_names[35], OptionalSfixed32); + } + if (hasOptionalSfixed64) { + output.WriteSFixed64(10, field_names[36], OptionalSfixed64); + } + if (hasOptionalFloat) { + output.WriteFloat(11, field_names[26], OptionalFloat); + } + if (hasOptionalDouble) { + output.WriteDouble(12, field_names[23], OptionalDouble); + } + if (hasOptionalBool) { + output.WriteBool(13, field_names[20], OptionalBool); + } + if (hasOptionalString) { + output.WriteString(14, field_names[39], OptionalString); + } + if (hasOptionalBytes) { + output.WriteBytes(15, field_names[21], OptionalBytes); + } + if (hasOptionalGroup) { + output.WriteGroup(16, field_names[43], OptionalGroup); + } + if (hasOptionalNestedMessage) { + output.WriteMessage(18, field_names[34], OptionalNestedMessage); + } + if (hasOptionalForeignMessage) { + output.WriteMessage(19, field_names[28], OptionalForeignMessage); + } + if (hasOptionalImportMessage) { + output.WriteMessage(20, field_names[30], OptionalImportMessage); + } + if (hasOptionalNestedEnum) { + output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum); + } + if (hasOptionalForeignEnum) { + output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum); + } + if (hasOptionalImportEnum) { + output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum); + } + if (hasOptionalStringPiece) { + output.WriteString(24, field_names[40], OptionalStringPiece); + } + if (hasOptionalCord) { + output.WriteString(25, field_names[22], OptionalCord); + } + if (repeatedInt32_.Count > 0) { + output.WriteInt32Array(31, field_names[55], repeatedInt32_); + } + if (repeatedInt64_.Count > 0) { + output.WriteInt64Array(32, field_names[56], repeatedInt64_); + } + if (repeatedUint32_.Count > 0) { + output.WriteUInt32Array(33, field_names[65], repeatedUint32_); + } + if (repeatedUint64_.Count > 0) { + output.WriteUInt64Array(34, field_names[66], repeatedUint64_); + } + if (repeatedSint32_.Count > 0) { + output.WriteSInt32Array(35, field_names[61], repeatedSint32_); + } + if (repeatedSint64_.Count > 0) { + output.WriteSInt64Array(36, field_names[62], repeatedSint64_); + } + if (repeatedFixed32_.Count > 0) { + output.WriteFixed32Array(37, field_names[48], repeatedFixed32_); + } + if (repeatedFixed64_.Count > 0) { + output.WriteFixed64Array(38, field_names[49], repeatedFixed64_); + } + if (repeatedSfixed32_.Count > 0) { + output.WriteSFixed32Array(39, field_names[59], repeatedSfixed32_); + } + if (repeatedSfixed64_.Count > 0) { + output.WriteSFixed64Array(40, field_names[60], repeatedSfixed64_); + } + if (repeatedFloat_.Count > 0) { + output.WriteFloatArray(41, field_names[50], repeatedFloat_); + } + if (repeatedDouble_.Count > 0) { + output.WriteDoubleArray(42, field_names[47], repeatedDouble_); + } + if (repeatedBool_.Count > 0) { + output.WriteBoolArray(43, field_names[44], repeatedBool_); + } + if (repeatedString_.Count > 0) { + output.WriteStringArray(44, field_names[63], repeatedString_); + } + if (repeatedBytes_.Count > 0) { + output.WriteBytesArray(45, field_names[45], repeatedBytes_); + } + if (repeatedGroup_.Count > 0) { + output.WriteGroupArray(46, field_names[67], repeatedGroup_); + } + if (repeatedNestedMessage_.Count > 0) { + output.WriteMessageArray(48, field_names[58], repeatedNestedMessage_); + } + if (repeatedForeignMessage_.Count > 0) { + output.WriteMessageArray(49, field_names[52], repeatedForeignMessage_); + } + if (repeatedImportMessage_.Count > 0) { + output.WriteMessageArray(50, field_names[54], repeatedImportMessage_); + } + if (repeatedNestedEnum_.Count > 0) { + output.WriteEnumArray(51, field_names[57], repeatedNestedEnum_); + } + if (repeatedForeignEnum_.Count > 0) { + output.WriteEnumArray(52, field_names[51], repeatedForeignEnum_); + } + if (repeatedImportEnum_.Count > 0) { + output.WriteEnumArray(53, field_names[53], repeatedImportEnum_); + } + if (repeatedStringPiece_.Count > 0) { + output.WriteStringArray(54, field_names[64], repeatedStringPiece_); + } + if (repeatedCord_.Count > 0) { + output.WriteStringArray(55, field_names[46], repeatedCord_); + } + if (hasDefaultInt32) { + output.WriteInt32(61, field_names[9], DefaultInt32); + } + if (hasDefaultInt64) { + output.WriteInt64(62, field_names[10], DefaultInt64); + } + if (hasDefaultUint32) { + output.WriteUInt32(63, field_names[18], DefaultUint32); + } + if (hasDefaultUint64) { + output.WriteUInt64(64, field_names[19], DefaultUint64); + } + if (hasDefaultSint32) { + output.WriteSInt32(65, field_names[14], DefaultSint32); + } + if (hasDefaultSint64) { + output.WriteSInt64(66, field_names[15], DefaultSint64); + } + if (hasDefaultFixed32) { + output.WriteFixed32(67, field_names[4], DefaultFixed32); + } + if (hasDefaultFixed64) { + output.WriteFixed64(68, field_names[5], DefaultFixed64); + } + if (hasDefaultSfixed32) { + output.WriteSFixed32(69, field_names[12], DefaultSfixed32); + } + if (hasDefaultSfixed64) { + output.WriteSFixed64(70, field_names[13], DefaultSfixed64); + } + if (hasDefaultFloat) { + output.WriteFloat(71, field_names[6], DefaultFloat); + } + if (hasDefaultDouble) { + output.WriteDouble(72, field_names[3], DefaultDouble); + } + if (hasDefaultBool) { + output.WriteBool(73, field_names[0], DefaultBool); + } + if (hasDefaultString) { + output.WriteString(74, field_names[16], DefaultString); + } + if (hasDefaultBytes) { + output.WriteBytes(75, field_names[1], DefaultBytes); + } + if (hasDefaultNestedEnum) { + output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum); + } + if (hasDefaultForeignEnum) { + output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum); + } + if (hasDefaultImportEnum) { + output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum); + } + if (hasDefaultStringPiece) { + output.WriteString(84, field_names[17], DefaultStringPiece); + } + if (hasDefaultCord) { + output.WriteString(85, field_names[2], DefaultCord); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(1, OptionalInt32); + } + if (hasOptionalInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(2, OptionalInt64); + } + if (hasOptionalUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(3, OptionalUint32); + } + if (hasOptionalUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(4, OptionalUint64); + } + if (hasOptionalSint32) { + size += pb::CodedOutputStream.ComputeSInt32Size(5, OptionalSint32); + } + if (hasOptionalSint64) { + size += pb::CodedOutputStream.ComputeSInt64Size(6, OptionalSint64); + } + if (hasOptionalFixed32) { + size += pb::CodedOutputStream.ComputeFixed32Size(7, OptionalFixed32); + } + if (hasOptionalFixed64) { + size += pb::CodedOutputStream.ComputeFixed64Size(8, OptionalFixed64); + } + if (hasOptionalSfixed32) { + size += pb::CodedOutputStream.ComputeSFixed32Size(9, OptionalSfixed32); + } + if (hasOptionalSfixed64) { + size += pb::CodedOutputStream.ComputeSFixed64Size(10, OptionalSfixed64); + } + if (hasOptionalFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(11, OptionalFloat); + } + if (hasOptionalDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(12, OptionalDouble); + } + if (hasOptionalBool) { + size += pb::CodedOutputStream.ComputeBoolSize(13, OptionalBool); + } + if (hasOptionalString) { + size += pb::CodedOutputStream.ComputeStringSize(14, OptionalString); + } + if (hasOptionalBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(15, OptionalBytes); + } + if (hasOptionalGroup) { + size += pb::CodedOutputStream.ComputeGroupSize(16, OptionalGroup); + } + if (hasOptionalNestedMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(18, OptionalNestedMessage); + } + if (hasOptionalForeignMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(19, OptionalForeignMessage); + } + if (hasOptionalImportMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(20, OptionalImportMessage); + } + if (hasOptionalNestedEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(21, (int) OptionalNestedEnum); + } + if (hasOptionalForeignEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(22, (int) OptionalForeignEnum); + } + if (hasOptionalImportEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(23, (int) OptionalImportEnum); + } + if (hasOptionalStringPiece) { + size += pb::CodedOutputStream.ComputeStringSize(24, OptionalStringPiece); + } + if (hasOptionalCord) { + size += pb::CodedOutputStream.ComputeStringSize(25, OptionalCord); + } + { + int dataSize = 0; + foreach (int element in RepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt32_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt64_.Count; + } + { + int dataSize = 0; + foreach (uint element in RepeatedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedUint32_.Count; + } + { + int dataSize = 0; + foreach (ulong element in RepeatedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedUint64_.Count; + } + { + int dataSize = 0; + foreach (int element in RepeatedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedSint32_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedSint64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFixed32_.Count; + size += dataSize; + size += 2 * repeatedFixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedFixed64_.Count; + size += dataSize; + size += 2 * repeatedFixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedSfixed32_.Count; + size += dataSize; + size += 2 * repeatedSfixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedSfixed64_.Count; + size += dataSize; + size += 2 * repeatedSfixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFloat_.Count; + size += dataSize; + size += 2 * repeatedFloat_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedDouble_.Count; + size += dataSize; + size += 2 * repeatedDouble_.Count; + } + { + int dataSize = 0; + dataSize = 1 * repeatedBool_.Count; + size += dataSize; + size += 2 * repeatedBool_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedStringList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedString_.Count; + } + { + int dataSize = 0; + foreach (pb::ByteString element in RepeatedBytesList) { + dataSize += pb::CodedOutputStream.ComputeBytesSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedBytes_.Count; + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup element in RepeatedGroupList) { + size += pb::CodedOutputStream.ComputeGroupSize(46, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage element in RepeatedNestedMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(48, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessage element in RepeatedForeignMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(49, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.ImportMessage element in RepeatedImportMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(50, element); + } + { + int dataSize = 0; + if (repeatedNestedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum element in repeatedNestedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedNestedEnum_.Count; + } + } + { + int dataSize = 0; + if (repeatedForeignEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in repeatedForeignEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedForeignEnum_.Count; + } + } + { + int dataSize = 0; + if (repeatedImportEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ImportEnum element in repeatedImportEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedImportEnum_.Count; + } + } + { + int dataSize = 0; + foreach (string element in RepeatedStringPieceList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedStringPiece_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedCordList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedCord_.Count; + } + if (hasDefaultInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(61, DefaultInt32); + } + if (hasDefaultInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(62, DefaultInt64); + } + if (hasDefaultUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(63, DefaultUint32); + } + if (hasDefaultUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(64, DefaultUint64); + } + if (hasDefaultSint32) { + size += pb::CodedOutputStream.ComputeSInt32Size(65, DefaultSint32); + } + if (hasDefaultSint64) { + size += pb::CodedOutputStream.ComputeSInt64Size(66, DefaultSint64); + } + if (hasDefaultFixed32) { + size += pb::CodedOutputStream.ComputeFixed32Size(67, DefaultFixed32); + } + if (hasDefaultFixed64) { + size += pb::CodedOutputStream.ComputeFixed64Size(68, DefaultFixed64); + } + if (hasDefaultSfixed32) { + size += pb::CodedOutputStream.ComputeSFixed32Size(69, DefaultSfixed32); + } + if (hasDefaultSfixed64) { + size += pb::CodedOutputStream.ComputeSFixed64Size(70, DefaultSfixed64); + } + if (hasDefaultFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(71, DefaultFloat); + } + if (hasDefaultDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(72, DefaultDouble); + } + if (hasDefaultBool) { + size += pb::CodedOutputStream.ComputeBoolSize(73, DefaultBool); + } + if (hasDefaultString) { + size += pb::CodedOutputStream.ComputeStringSize(74, DefaultString); + } + if (hasDefaultBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(75, DefaultBytes); + } + if (hasDefaultNestedEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(81, (int) DefaultNestedEnum); + } + if (hasDefaultForeignEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(82, (int) DefaultForeignEnum); + } + if (hasDefaultImportEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(83, (int) DefaultImportEnum); + } + if (hasDefaultStringPiece) { + size += pb::CodedOutputStream.ComputeStringSize(84, DefaultStringPiece); + } + if (hasDefaultCord) { + size += pb::CodedOutputStream.ComputeStringSize(85, DefaultCord); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestAllTypes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllTypes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllTypes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllTypes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllTypes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllTypes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestAllTypes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestAllTypes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestAllTypes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestAllTypes MakeReadOnly() { + repeatedInt32_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedUint32_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + repeatedSint32_.MakeReadOnly(); + repeatedSint64_.MakeReadOnly(); + repeatedFixed32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedSfixed32_.MakeReadOnly(); + repeatedSfixed64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedDouble_.MakeReadOnly(); + repeatedBool_.MakeReadOnly(); + repeatedString_.MakeReadOnly(); + repeatedBytes_.MakeReadOnly(); + repeatedGroup_.MakeReadOnly(); + repeatedNestedMessage_.MakeReadOnly(); + repeatedForeignMessage_.MakeReadOnly(); + repeatedImportMessage_.MakeReadOnly(); + repeatedNestedEnum_.MakeReadOnly(); + repeatedForeignEnum_.MakeReadOnly(); + repeatedImportEnum_.MakeReadOnly(); + repeatedStringPiece_.MakeReadOnly(); + repeatedCord_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestAllTypes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestAllTypes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestAllTypes result; + + private TestAllTypes PrepareBuilder() { + if (resultIsReadOnly) { + TestAllTypes original = result; + result = new TestAllTypes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestAllTypes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor; } + } + + public override TestAllTypes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance; } + } + + public override TestAllTypes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestAllTypes) { + return MergeFrom((TestAllTypes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestAllTypes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalInt32) { + OptionalInt32 = other.OptionalInt32; + } + if (other.HasOptionalInt64) { + OptionalInt64 = other.OptionalInt64; + } + if (other.HasOptionalUint32) { + OptionalUint32 = other.OptionalUint32; + } + if (other.HasOptionalUint64) { + OptionalUint64 = other.OptionalUint64; + } + if (other.HasOptionalSint32) { + OptionalSint32 = other.OptionalSint32; + } + if (other.HasOptionalSint64) { + OptionalSint64 = other.OptionalSint64; + } + if (other.HasOptionalFixed32) { + OptionalFixed32 = other.OptionalFixed32; + } + if (other.HasOptionalFixed64) { + OptionalFixed64 = other.OptionalFixed64; + } + if (other.HasOptionalSfixed32) { + OptionalSfixed32 = other.OptionalSfixed32; + } + if (other.HasOptionalSfixed64) { + OptionalSfixed64 = other.OptionalSfixed64; + } + if (other.HasOptionalFloat) { + OptionalFloat = other.OptionalFloat; + } + if (other.HasOptionalDouble) { + OptionalDouble = other.OptionalDouble; + } + if (other.HasOptionalBool) { + OptionalBool = other.OptionalBool; + } + if (other.HasOptionalString) { + OptionalString = other.OptionalString; + } + if (other.HasOptionalBytes) { + OptionalBytes = other.OptionalBytes; + } + if (other.HasOptionalGroup) { + MergeOptionalGroup(other.OptionalGroup); + } + if (other.HasOptionalNestedMessage) { + MergeOptionalNestedMessage(other.OptionalNestedMessage); + } + if (other.HasOptionalForeignMessage) { + MergeOptionalForeignMessage(other.OptionalForeignMessage); + } + if (other.HasOptionalImportMessage) { + MergeOptionalImportMessage(other.OptionalImportMessage); + } + if (other.HasOptionalNestedEnum) { + OptionalNestedEnum = other.OptionalNestedEnum; + } + if (other.HasOptionalForeignEnum) { + OptionalForeignEnum = other.OptionalForeignEnum; + } + if (other.HasOptionalImportEnum) { + OptionalImportEnum = other.OptionalImportEnum; + } + if (other.HasOptionalStringPiece) { + OptionalStringPiece = other.OptionalStringPiece; + } + if (other.HasOptionalCord) { + OptionalCord = other.OptionalCord; + } + if (other.repeatedInt32_.Count != 0) { + result.repeatedInt32_.Add(other.repeatedInt32_); + } + if (other.repeatedInt64_.Count != 0) { + result.repeatedInt64_.Add(other.repeatedInt64_); + } + if (other.repeatedUint32_.Count != 0) { + result.repeatedUint32_.Add(other.repeatedUint32_); + } + if (other.repeatedUint64_.Count != 0) { + result.repeatedUint64_.Add(other.repeatedUint64_); + } + if (other.repeatedSint32_.Count != 0) { + result.repeatedSint32_.Add(other.repeatedSint32_); + } + if (other.repeatedSint64_.Count != 0) { + result.repeatedSint64_.Add(other.repeatedSint64_); + } + if (other.repeatedFixed32_.Count != 0) { + result.repeatedFixed32_.Add(other.repeatedFixed32_); + } + if (other.repeatedFixed64_.Count != 0) { + result.repeatedFixed64_.Add(other.repeatedFixed64_); + } + if (other.repeatedSfixed32_.Count != 0) { + result.repeatedSfixed32_.Add(other.repeatedSfixed32_); + } + if (other.repeatedSfixed64_.Count != 0) { + result.repeatedSfixed64_.Add(other.repeatedSfixed64_); + } + if (other.repeatedFloat_.Count != 0) { + result.repeatedFloat_.Add(other.repeatedFloat_); + } + if (other.repeatedDouble_.Count != 0) { + result.repeatedDouble_.Add(other.repeatedDouble_); + } + if (other.repeatedBool_.Count != 0) { + result.repeatedBool_.Add(other.repeatedBool_); + } + if (other.repeatedString_.Count != 0) { + result.repeatedString_.Add(other.repeatedString_); + } + if (other.repeatedBytes_.Count != 0) { + result.repeatedBytes_.Add(other.repeatedBytes_); + } + if (other.repeatedGroup_.Count != 0) { + result.repeatedGroup_.Add(other.repeatedGroup_); + } + if (other.repeatedNestedMessage_.Count != 0) { + result.repeatedNestedMessage_.Add(other.repeatedNestedMessage_); + } + if (other.repeatedForeignMessage_.Count != 0) { + result.repeatedForeignMessage_.Add(other.repeatedForeignMessage_); + } + if (other.repeatedImportMessage_.Count != 0) { + result.repeatedImportMessage_.Add(other.repeatedImportMessage_); + } + if (other.repeatedNestedEnum_.Count != 0) { + result.repeatedNestedEnum_.Add(other.repeatedNestedEnum_); + } + if (other.repeatedForeignEnum_.Count != 0) { + result.repeatedForeignEnum_.Add(other.repeatedForeignEnum_); + } + if (other.repeatedImportEnum_.Count != 0) { + result.repeatedImportEnum_.Add(other.repeatedImportEnum_); + } + if (other.repeatedStringPiece_.Count != 0) { + result.repeatedStringPiece_.Add(other.repeatedStringPiece_); + } + if (other.repeatedCord_.Count != 0) { + result.repeatedCord_.Add(other.repeatedCord_); + } + if (other.HasDefaultInt32) { + DefaultInt32 = other.DefaultInt32; + } + if (other.HasDefaultInt64) { + DefaultInt64 = other.DefaultInt64; + } + if (other.HasDefaultUint32) { + DefaultUint32 = other.DefaultUint32; + } + if (other.HasDefaultUint64) { + DefaultUint64 = other.DefaultUint64; + } + if (other.HasDefaultSint32) { + DefaultSint32 = other.DefaultSint32; + } + if (other.HasDefaultSint64) { + DefaultSint64 = other.DefaultSint64; + } + if (other.HasDefaultFixed32) { + DefaultFixed32 = other.DefaultFixed32; + } + if (other.HasDefaultFixed64) { + DefaultFixed64 = other.DefaultFixed64; + } + if (other.HasDefaultSfixed32) { + DefaultSfixed32 = other.DefaultSfixed32; + } + if (other.HasDefaultSfixed64) { + DefaultSfixed64 = other.DefaultSfixed64; + } + if (other.HasDefaultFloat) { + DefaultFloat = other.DefaultFloat; + } + if (other.HasDefaultDouble) { + DefaultDouble = other.DefaultDouble; + } + if (other.HasDefaultBool) { + DefaultBool = other.DefaultBool; + } + if (other.HasDefaultString) { + DefaultString = other.DefaultString; + } + if (other.HasDefaultBytes) { + DefaultBytes = other.DefaultBytes; + } + if (other.HasDefaultNestedEnum) { + DefaultNestedEnum = other.DefaultNestedEnum; + } + if (other.HasDefaultForeignEnum) { + DefaultForeignEnum = other.DefaultForeignEnum; + } + if (other.HasDefaultImportEnum) { + DefaultImportEnum = other.DefaultImportEnum; + } + if (other.HasDefaultStringPiece) { + DefaultStringPiece = other.DefaultStringPiece; + } + if (other.HasDefaultCord) { + DefaultCord = other.DefaultCord; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testAllTypesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testAllTypesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasOptionalInt32 = input.ReadInt32(ref result.optionalInt32_); + break; + } + case 16: { + result.hasOptionalInt64 = input.ReadInt64(ref result.optionalInt64_); + break; + } + case 24: { + result.hasOptionalUint32 = input.ReadUInt32(ref result.optionalUint32_); + break; + } + case 32: { + result.hasOptionalUint64 = input.ReadUInt64(ref result.optionalUint64_); + break; + } + case 40: { + result.hasOptionalSint32 = input.ReadSInt32(ref result.optionalSint32_); + break; + } + case 48: { + result.hasOptionalSint64 = input.ReadSInt64(ref result.optionalSint64_); + break; + } + case 61: { + result.hasOptionalFixed32 = input.ReadFixed32(ref result.optionalFixed32_); + break; + } + case 65: { + result.hasOptionalFixed64 = input.ReadFixed64(ref result.optionalFixed64_); + break; + } + case 77: { + result.hasOptionalSfixed32 = input.ReadSFixed32(ref result.optionalSfixed32_); + break; + } + case 81: { + result.hasOptionalSfixed64 = input.ReadSFixed64(ref result.optionalSfixed64_); + break; + } + case 93: { + result.hasOptionalFloat = input.ReadFloat(ref result.optionalFloat_); + break; + } + case 97: { + result.hasOptionalDouble = input.ReadDouble(ref result.optionalDouble_); + break; + } + case 104: { + result.hasOptionalBool = input.ReadBool(ref result.optionalBool_); + break; + } + case 114: { + result.hasOptionalString = input.ReadString(ref result.optionalString_); + break; + } + case 122: { + result.hasOptionalBytes = input.ReadBytes(ref result.optionalBytes_); + break; + } + case 131: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.CreateBuilder(); + if (result.hasOptionalGroup) { + subBuilder.MergeFrom(OptionalGroup); + } + input.ReadGroup(16, subBuilder, extensionRegistry); + OptionalGroup = subBuilder.BuildPartial(); + break; + } + case 146: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(); + if (result.hasOptionalNestedMessage) { + subBuilder.MergeFrom(OptionalNestedMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalNestedMessage = subBuilder.BuildPartial(); + break; + } + case 154: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(); + if (result.hasOptionalForeignMessage) { + subBuilder.MergeFrom(OptionalForeignMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalForeignMessage = subBuilder.BuildPartial(); + break; + } + case 162: { + global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder(); + if (result.hasOptionalImportMessage) { + subBuilder.MergeFrom(OptionalImportMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalImportMessage = subBuilder.BuildPartial(); + break; + } + case 168: { + object unknown; + if(input.ReadEnum(ref result.optionalNestedEnum_, out unknown)) { + result.hasOptionalNestedEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(21, (ulong)(int)unknown); + } + break; + } + case 176: { + object unknown; + if(input.ReadEnum(ref result.optionalForeignEnum_, out unknown)) { + result.hasOptionalForeignEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(22, (ulong)(int)unknown); + } + break; + } + case 184: { + object unknown; + if(input.ReadEnum(ref result.optionalImportEnum_, out unknown)) { + result.hasOptionalImportEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(23, (ulong)(int)unknown); + } + break; + } + case 194: { + result.hasOptionalStringPiece = input.ReadString(ref result.optionalStringPiece_); + break; + } + case 202: { + result.hasOptionalCord = input.ReadString(ref result.optionalCord_); + break; + } + case 250: + case 248: { + input.ReadInt32Array(tag, field_name, result.repeatedInt32_); + break; + } + case 258: + case 256: { + input.ReadInt64Array(tag, field_name, result.repeatedInt64_); + break; + } + case 266: + case 264: { + input.ReadUInt32Array(tag, field_name, result.repeatedUint32_); + break; + } + case 274: + case 272: { + input.ReadUInt64Array(tag, field_name, result.repeatedUint64_); + break; + } + case 282: + case 280: { + input.ReadSInt32Array(tag, field_name, result.repeatedSint32_); + break; + } + case 290: + case 288: { + input.ReadSInt64Array(tag, field_name, result.repeatedSint64_); + break; + } + case 298: + case 301: { + input.ReadFixed32Array(tag, field_name, result.repeatedFixed32_); + break; + } + case 306: + case 305: { + input.ReadFixed64Array(tag, field_name, result.repeatedFixed64_); + break; + } + case 314: + case 317: { + input.ReadSFixed32Array(tag, field_name, result.repeatedSfixed32_); + break; + } + case 322: + case 321: { + input.ReadSFixed64Array(tag, field_name, result.repeatedSfixed64_); + break; + } + case 330: + case 333: { + input.ReadFloatArray(tag, field_name, result.repeatedFloat_); + break; + } + case 338: + case 337: { + input.ReadDoubleArray(tag, field_name, result.repeatedDouble_); + break; + } + case 346: + case 344: { + input.ReadBoolArray(tag, field_name, result.repeatedBool_); + break; + } + case 354: { + input.ReadStringArray(tag, field_name, result.repeatedString_); + break; + } + case 362: { + input.ReadBytesArray(tag, field_name, result.repeatedBytes_); + break; + } + case 371: { + input.ReadGroupArray(tag, field_name, result.repeatedGroup_, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance, extensionRegistry); + break; + } + case 386: { + input.ReadMessageArray(tag, field_name, result.repeatedNestedMessage_, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance, extensionRegistry); + break; + } + case 394: { + input.ReadMessageArray(tag, field_name, result.repeatedForeignMessage_, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance, extensionRegistry); + break; + } + case 402: { + input.ReadMessageArray(tag, field_name, result.repeatedImportMessage_, global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance, extensionRegistry); + break; + } + case 410: + case 408: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedNestedEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(51, (ulong)(int)rawValue); + } + break; + } + case 418: + case 416: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedForeignEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(52, (ulong)(int)rawValue); + } + break; + } + case 426: + case 424: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedImportEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(53, (ulong)(int)rawValue); + } + break; + } + case 434: { + input.ReadStringArray(tag, field_name, result.repeatedStringPiece_); + break; + } + case 442: { + input.ReadStringArray(tag, field_name, result.repeatedCord_); + break; + } + case 488: { + result.hasDefaultInt32 = input.ReadInt32(ref result.defaultInt32_); + break; + } + case 496: { + result.hasDefaultInt64 = input.ReadInt64(ref result.defaultInt64_); + break; + } + case 504: { + result.hasDefaultUint32 = input.ReadUInt32(ref result.defaultUint32_); + break; + } + case 512: { + result.hasDefaultUint64 = input.ReadUInt64(ref result.defaultUint64_); + break; + } + case 520: { + result.hasDefaultSint32 = input.ReadSInt32(ref result.defaultSint32_); + break; + } + case 528: { + result.hasDefaultSint64 = input.ReadSInt64(ref result.defaultSint64_); + break; + } + case 541: { + result.hasDefaultFixed32 = input.ReadFixed32(ref result.defaultFixed32_); + break; + } + case 545: { + result.hasDefaultFixed64 = input.ReadFixed64(ref result.defaultFixed64_); + break; + } + case 557: { + result.hasDefaultSfixed32 = input.ReadSFixed32(ref result.defaultSfixed32_); + break; + } + case 561: { + result.hasDefaultSfixed64 = input.ReadSFixed64(ref result.defaultSfixed64_); + break; + } + case 573: { + result.hasDefaultFloat = input.ReadFloat(ref result.defaultFloat_); + break; + } + case 577: { + result.hasDefaultDouble = input.ReadDouble(ref result.defaultDouble_); + break; + } + case 584: { + result.hasDefaultBool = input.ReadBool(ref result.defaultBool_); + break; + } + case 594: { + result.hasDefaultString = input.ReadString(ref result.defaultString_); + break; + } + case 602: { + result.hasDefaultBytes = input.ReadBytes(ref result.defaultBytes_); + break; + } + case 648: { + object unknown; + if(input.ReadEnum(ref result.defaultNestedEnum_, out unknown)) { + result.hasDefaultNestedEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(81, (ulong)(int)unknown); + } + break; + } + case 656: { + object unknown; + if(input.ReadEnum(ref result.defaultForeignEnum_, out unknown)) { + result.hasDefaultForeignEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(82, (ulong)(int)unknown); + } + break; + } + case 664: { + object unknown; + if(input.ReadEnum(ref result.defaultImportEnum_, out unknown)) { + result.hasDefaultImportEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(83, (ulong)(int)unknown); + } + break; + } + case 674: { + result.hasDefaultStringPiece = input.ReadString(ref result.defaultStringPiece_); + break; + } + case 682: { + result.hasDefaultCord = input.ReadString(ref result.defaultCord_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalInt32 { + get { return result.hasOptionalInt32; } + } + public int OptionalInt32 { + get { return result.OptionalInt32; } + set { SetOptionalInt32(value); } + } + public Builder SetOptionalInt32(int value) { + PrepareBuilder(); + result.hasOptionalInt32 = true; + result.optionalInt32_ = value; + return this; + } + public Builder ClearOptionalInt32() { + PrepareBuilder(); + result.hasOptionalInt32 = false; + result.optionalInt32_ = 0; + return this; + } + + public bool HasOptionalInt64 { + get { return result.hasOptionalInt64; } + } + public long OptionalInt64 { + get { return result.OptionalInt64; } + set { SetOptionalInt64(value); } + } + public Builder SetOptionalInt64(long value) { + PrepareBuilder(); + result.hasOptionalInt64 = true; + result.optionalInt64_ = value; + return this; + } + public Builder ClearOptionalInt64() { + PrepareBuilder(); + result.hasOptionalInt64 = false; + result.optionalInt64_ = 0L; + return this; + } + + public bool HasOptionalUint32 { + get { return result.hasOptionalUint32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalUint32 { + get { return result.OptionalUint32; } + set { SetOptionalUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalUint32(uint value) { + PrepareBuilder(); + result.hasOptionalUint32 = true; + result.optionalUint32_ = value; + return this; + } + public Builder ClearOptionalUint32() { + PrepareBuilder(); + result.hasOptionalUint32 = false; + result.optionalUint32_ = 0; + return this; + } + + public bool HasOptionalUint64 { + get { return result.hasOptionalUint64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalUint64 { + get { return result.OptionalUint64; } + set { SetOptionalUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalUint64(ulong value) { + PrepareBuilder(); + result.hasOptionalUint64 = true; + result.optionalUint64_ = value; + return this; + } + public Builder ClearOptionalUint64() { + PrepareBuilder(); + result.hasOptionalUint64 = false; + result.optionalUint64_ = 0UL; + return this; + } + + public bool HasOptionalSint32 { + get { return result.hasOptionalSint32; } + } + public int OptionalSint32 { + get { return result.OptionalSint32; } + set { SetOptionalSint32(value); } + } + public Builder SetOptionalSint32(int value) { + PrepareBuilder(); + result.hasOptionalSint32 = true; + result.optionalSint32_ = value; + return this; + } + public Builder ClearOptionalSint32() { + PrepareBuilder(); + result.hasOptionalSint32 = false; + result.optionalSint32_ = 0; + return this; + } + + public bool HasOptionalSint64 { + get { return result.hasOptionalSint64; } + } + public long OptionalSint64 { + get { return result.OptionalSint64; } + set { SetOptionalSint64(value); } + } + public Builder SetOptionalSint64(long value) { + PrepareBuilder(); + result.hasOptionalSint64 = true; + result.optionalSint64_ = value; + return this; + } + public Builder ClearOptionalSint64() { + PrepareBuilder(); + result.hasOptionalSint64 = false; + result.optionalSint64_ = 0; + return this; + } + + public bool HasOptionalFixed32 { + get { return result.hasOptionalFixed32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalFixed32 { + get { return result.OptionalFixed32; } + set { SetOptionalFixed32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalFixed32(uint value) { + PrepareBuilder(); + result.hasOptionalFixed32 = true; + result.optionalFixed32_ = value; + return this; + } + public Builder ClearOptionalFixed32() { + PrepareBuilder(); + result.hasOptionalFixed32 = false; + result.optionalFixed32_ = 0; + return this; + } + + public bool HasOptionalFixed64 { + get { return result.hasOptionalFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalFixed64 { + get { return result.OptionalFixed64; } + set { SetOptionalFixed64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalFixed64(ulong value) { + PrepareBuilder(); + result.hasOptionalFixed64 = true; + result.optionalFixed64_ = value; + return this; + } + public Builder ClearOptionalFixed64() { + PrepareBuilder(); + result.hasOptionalFixed64 = false; + result.optionalFixed64_ = 0; + return this; + } + + public bool HasOptionalSfixed32 { + get { return result.hasOptionalSfixed32; } + } + public int OptionalSfixed32 { + get { return result.OptionalSfixed32; } + set { SetOptionalSfixed32(value); } + } + public Builder SetOptionalSfixed32(int value) { + PrepareBuilder(); + result.hasOptionalSfixed32 = true; + result.optionalSfixed32_ = value; + return this; + } + public Builder ClearOptionalSfixed32() { + PrepareBuilder(); + result.hasOptionalSfixed32 = false; + result.optionalSfixed32_ = 0; + return this; + } + + public bool HasOptionalSfixed64 { + get { return result.hasOptionalSfixed64; } + } + public long OptionalSfixed64 { + get { return result.OptionalSfixed64; } + set { SetOptionalSfixed64(value); } + } + public Builder SetOptionalSfixed64(long value) { + PrepareBuilder(); + result.hasOptionalSfixed64 = true; + result.optionalSfixed64_ = value; + return this; + } + public Builder ClearOptionalSfixed64() { + PrepareBuilder(); + result.hasOptionalSfixed64 = false; + result.optionalSfixed64_ = 0; + return this; + } + + public bool HasOptionalFloat { + get { return result.hasOptionalFloat; } + } + public float OptionalFloat { + get { return result.OptionalFloat; } + set { SetOptionalFloat(value); } + } + public Builder SetOptionalFloat(float value) { + PrepareBuilder(); + result.hasOptionalFloat = true; + result.optionalFloat_ = value; + return this; + } + public Builder ClearOptionalFloat() { + PrepareBuilder(); + result.hasOptionalFloat = false; + result.optionalFloat_ = 0F; + return this; + } + + public bool HasOptionalDouble { + get { return result.hasOptionalDouble; } + } + public double OptionalDouble { + get { return result.OptionalDouble; } + set { SetOptionalDouble(value); } + } + public Builder SetOptionalDouble(double value) { + PrepareBuilder(); + result.hasOptionalDouble = true; + result.optionalDouble_ = value; + return this; + } + public Builder ClearOptionalDouble() { + PrepareBuilder(); + result.hasOptionalDouble = false; + result.optionalDouble_ = 0D; + return this; + } + + public bool HasOptionalBool { + get { return result.hasOptionalBool; } + } + public bool OptionalBool { + get { return result.OptionalBool; } + set { SetOptionalBool(value); } + } + public Builder SetOptionalBool(bool value) { + PrepareBuilder(); + result.hasOptionalBool = true; + result.optionalBool_ = value; + return this; + } + public Builder ClearOptionalBool() { + PrepareBuilder(); + result.hasOptionalBool = false; + result.optionalBool_ = false; + return this; + } + + public bool HasOptionalString { + get { return result.hasOptionalString; } + } + public string OptionalString { + get { return result.OptionalString; } + set { SetOptionalString(value); } + } + public Builder SetOptionalString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalString = true; + result.optionalString_ = value; + return this; + } + public Builder ClearOptionalString() { + PrepareBuilder(); + result.hasOptionalString = false; + result.optionalString_ = ""; + return this; + } + + public bool HasOptionalBytes { + get { return result.hasOptionalBytes; } + } + public pb::ByteString OptionalBytes { + get { return result.OptionalBytes; } + set { SetOptionalBytes(value); } + } + public Builder SetOptionalBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalBytes = true; + result.optionalBytes_ = value; + return this; + } + public Builder ClearOptionalBytes() { + PrepareBuilder(); + result.hasOptionalBytes = false; + result.optionalBytes_ = pb::ByteString.Empty; + return this; + } + + public bool HasOptionalGroup { + get { return result.hasOptionalGroup; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup OptionalGroup { + get { return result.OptionalGroup; } + set { SetOptionalGroup(value); } + } + public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalGroup = true; + result.optionalGroup_ = value; + return this; + } + public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalGroup = true; + result.optionalGroup_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalGroup && + result.optionalGroup_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) { + result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.CreateBuilder(result.optionalGroup_).MergeFrom(value).BuildPartial(); + } else { + result.optionalGroup_ = value; + } + result.hasOptionalGroup = true; + return this; + } + public Builder ClearOptionalGroup() { + PrepareBuilder(); + result.hasOptionalGroup = false; + result.optionalGroup_ = null; + return this; + } + + public bool HasOptionalNestedMessage { + get { return result.hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage OptionalNestedMessage { + get { return result.OptionalNestedMessage; } + set { SetOptionalNestedMessage(value); } + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = value; + return this; + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalNestedMessage && + result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { + result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalNestedMessage_ = value; + } + result.hasOptionalNestedMessage = true; + return this; + } + public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); + result.hasOptionalNestedMessage = false; + result.optionalNestedMessage_ = null; + return this; + } + + public bool HasOptionalForeignMessage { + get { return result.hasOptionalForeignMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage OptionalForeignMessage { + get { return result.OptionalForeignMessage; } + set { SetOptionalForeignMessage(value); } + } + public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalForeignMessage = true; + result.optionalForeignMessage_ = value; + return this; + } + public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalForeignMessage = true; + result.optionalForeignMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalForeignMessage && + result.optionalForeignMessage_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.optionalForeignMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalForeignMessage_ = value; + } + result.hasOptionalForeignMessage = true; + return this; + } + public Builder ClearOptionalForeignMessage() { + PrepareBuilder(); + result.hasOptionalForeignMessage = false; + result.optionalForeignMessage_ = null; + return this; + } + + public bool HasOptionalImportMessage { + get { return result.hasOptionalImportMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage OptionalImportMessage { + get { return result.OptionalImportMessage; } + set { SetOptionalImportMessage(value); } + } + public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalImportMessage = true; + result.optionalImportMessage_ = value; + return this; + } + public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalImportMessage = true; + result.optionalImportMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalImportMessage && + result.optionalImportMessage_ != global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) { + result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder(result.optionalImportMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalImportMessage_ = value; + } + result.hasOptionalImportMessage = true; + return this; + } + public Builder ClearOptionalImportMessage() { + PrepareBuilder(); + result.hasOptionalImportMessage = false; + result.optionalImportMessage_ = null; + return this; + } + + public bool HasOptionalNestedEnum { + get { return result.hasOptionalNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum OptionalNestedEnum { + get { return result.OptionalNestedEnum; } + set { SetOptionalNestedEnum(value); } + } + public Builder SetOptionalNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.hasOptionalNestedEnum = true; + result.optionalNestedEnum_ = value; + return this; + } + public Builder ClearOptionalNestedEnum() { + PrepareBuilder(); + result.hasOptionalNestedEnum = false; + result.optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.FOO; + return this; + } + + public bool HasOptionalForeignEnum { + get { return result.hasOptionalForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum OptionalForeignEnum { + get { return result.OptionalForeignEnum; } + set { SetOptionalForeignEnum(value); } + } + public Builder SetOptionalForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasOptionalForeignEnum = true; + result.optionalForeignEnum_ = value; + return this; + } + public Builder ClearOptionalForeignEnum() { + PrepareBuilder(); + result.hasOptionalForeignEnum = false; + result.optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + return this; + } + + public bool HasOptionalImportEnum { + get { return result.hasOptionalImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum OptionalImportEnum { + get { return result.OptionalImportEnum; } + set { SetOptionalImportEnum(value); } + } + public Builder SetOptionalImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.hasOptionalImportEnum = true; + result.optionalImportEnum_ = value; + return this; + } + public Builder ClearOptionalImportEnum() { + PrepareBuilder(); + result.hasOptionalImportEnum = false; + result.optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_FOO; + return this; + } + + public bool HasOptionalStringPiece { + get { return result.hasOptionalStringPiece; } + } + public string OptionalStringPiece { + get { return result.OptionalStringPiece; } + set { SetOptionalStringPiece(value); } + } + public Builder SetOptionalStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalStringPiece = true; + result.optionalStringPiece_ = value; + return this; + } + public Builder ClearOptionalStringPiece() { + PrepareBuilder(); + result.hasOptionalStringPiece = false; + result.optionalStringPiece_ = ""; + return this; + } + + public bool HasOptionalCord { + get { return result.hasOptionalCord; } + } + public string OptionalCord { + get { return result.OptionalCord; } + set { SetOptionalCord(value); } + } + public Builder SetOptionalCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalCord = true; + result.optionalCord_ = value; + return this; + } + public Builder ClearOptionalCord() { + PrepareBuilder(); + result.hasOptionalCord = false; + result.optionalCord_ = ""; + return this; + } + + public pbc::IPopsicleList RepeatedInt32List { + get { return PrepareBuilder().repeatedInt32_; } + } + public int RepeatedInt32Count { + get { return result.RepeatedInt32Count; } + } + public int GetRepeatedInt32(int index) { + return result.GetRepeatedInt32(index); + } + public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.repeatedInt32_[index] = value; + return this; + } + public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); + result.repeatedInt32_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt32_.Add(values); + return this; + } + public Builder ClearRepeatedInt32() { + PrepareBuilder(); + result.repeatedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt64List { + get { return PrepareBuilder().repeatedInt64_; } + } + public int RepeatedInt64Count { + get { return result.RepeatedInt64Count; } + } + public long GetRepeatedInt64(int index) { + return result.GetRepeatedInt64(index); + } + public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); + result.repeatedInt64_[index] = value; + return this; + } + public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); + result.repeatedInt64_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt64_.Add(values); + return this; + } + public Builder ClearRepeatedInt64() { + PrepareBuilder(); + result.repeatedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint32List { + get { return PrepareBuilder().repeatedUint32_; } + } + public int RepeatedUint32Count { + get { return result.RepeatedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedUint32(int index) { + return result.GetRepeatedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint32(int index, uint value) { + PrepareBuilder(); + result.repeatedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint32(uint value) { + PrepareBuilder(); + result.repeatedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint32_.Add(values); + return this; + } + public Builder ClearRepeatedUint32() { + PrepareBuilder(); + result.repeatedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint64List { + get { return PrepareBuilder().repeatedUint64_; } + } + public int RepeatedUint64Count { + get { return result.RepeatedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return result.GetRepeatedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); + result.repeatedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); + result.repeatedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint64_.Add(values); + return this; + } + public Builder ClearRepeatedUint64() { + PrepareBuilder(); + result.repeatedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSint32List { + get { return PrepareBuilder().repeatedSint32_; } + } + public int RepeatedSint32Count { + get { return result.RepeatedSint32Count; } + } + public int GetRepeatedSint32(int index) { + return result.GetRepeatedSint32(index); + } + public Builder SetRepeatedSint32(int index, int value) { + PrepareBuilder(); + result.repeatedSint32_[index] = value; + return this; + } + public Builder AddRepeatedSint32(int value) { + PrepareBuilder(); + result.repeatedSint32_.Add(value); + return this; + } + public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSint32_.Add(values); + return this; + } + public Builder ClearRepeatedSint32() { + PrepareBuilder(); + result.repeatedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSint64List { + get { return PrepareBuilder().repeatedSint64_; } + } + public int RepeatedSint64Count { + get { return result.RepeatedSint64Count; } + } + public long GetRepeatedSint64(int index) { + return result.GetRepeatedSint64(index); + } + public Builder SetRepeatedSint64(int index, long value) { + PrepareBuilder(); + result.repeatedSint64_[index] = value; + return this; + } + public Builder AddRepeatedSint64(long value) { + PrepareBuilder(); + result.repeatedSint64_.Add(value); + return this; + } + public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSint64_.Add(values); + return this; + } + public Builder ClearRepeatedSint64() { + PrepareBuilder(); + result.repeatedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed32List { + get { return PrepareBuilder().repeatedFixed32_; } + } + public int RepeatedFixed32Count { + get { return result.RepeatedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return result.GetRepeatedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); + result.repeatedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); + result.repeatedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed32_.Add(values); + return this; + } + public Builder ClearRepeatedFixed32() { + PrepareBuilder(); + result.repeatedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed64List { + get { return PrepareBuilder().repeatedFixed64_; } + } + public int RepeatedFixed64Count { + get { return result.RepeatedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return result.GetRepeatedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); + result.repeatedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); + result.repeatedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed64_.Add(values); + return this; + } + public Builder ClearRepeatedFixed64() { + PrepareBuilder(); + result.repeatedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSfixed32List { + get { return PrepareBuilder().repeatedSfixed32_; } + } + public int RepeatedSfixed32Count { + get { return result.RepeatedSfixed32Count; } + } + public int GetRepeatedSfixed32(int index) { + return result.GetRepeatedSfixed32(index); + } + public Builder SetRepeatedSfixed32(int index, int value) { + PrepareBuilder(); + result.repeatedSfixed32_[index] = value; + return this; + } + public Builder AddRepeatedSfixed32(int value) { + PrepareBuilder(); + result.repeatedSfixed32_.Add(value); + return this; + } + public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSfixed32_.Add(values); + return this; + } + public Builder ClearRepeatedSfixed32() { + PrepareBuilder(); + result.repeatedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSfixed64List { + get { return PrepareBuilder().repeatedSfixed64_; } + } + public int RepeatedSfixed64Count { + get { return result.RepeatedSfixed64Count; } + } + public long GetRepeatedSfixed64(int index) { + return result.GetRepeatedSfixed64(index); + } + public Builder SetRepeatedSfixed64(int index, long value) { + PrepareBuilder(); + result.repeatedSfixed64_[index] = value; + return this; + } + public Builder AddRepeatedSfixed64(long value) { + PrepareBuilder(); + result.repeatedSfixed64_.Add(value); + return this; + } + public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSfixed64_.Add(values); + return this; + } + public Builder ClearRepeatedSfixed64() { + PrepareBuilder(); + result.repeatedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedFloatList { + get { return PrepareBuilder().repeatedFloat_; } + } + public int RepeatedFloatCount { + get { return result.RepeatedFloatCount; } + } + public float GetRepeatedFloat(int index) { + return result.GetRepeatedFloat(index); + } + public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); + result.repeatedFloat_[index] = value; + return this; + } + public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); + result.repeatedFloat_.Add(value); + return this; + } + public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFloat_.Add(values); + return this; + } + public Builder ClearRepeatedFloat() { + PrepareBuilder(); + result.repeatedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedDoubleList { + get { return PrepareBuilder().repeatedDouble_; } + } + public int RepeatedDoubleCount { + get { return result.RepeatedDoubleCount; } + } + public double GetRepeatedDouble(int index) { + return result.GetRepeatedDouble(index); + } + public Builder SetRepeatedDouble(int index, double value) { + PrepareBuilder(); + result.repeatedDouble_[index] = value; + return this; + } + public Builder AddRepeatedDouble(double value) { + PrepareBuilder(); + result.repeatedDouble_.Add(value); + return this; + } + public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedDouble_.Add(values); + return this; + } + public Builder ClearRepeatedDouble() { + PrepareBuilder(); + result.repeatedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedBoolList { + get { return PrepareBuilder().repeatedBool_; } + } + public int RepeatedBoolCount { + get { return result.RepeatedBoolCount; } + } + public bool GetRepeatedBool(int index) { + return result.GetRepeatedBool(index); + } + public Builder SetRepeatedBool(int index, bool value) { + PrepareBuilder(); + result.repeatedBool_[index] = value; + return this; + } + public Builder AddRepeatedBool(bool value) { + PrepareBuilder(); + result.repeatedBool_.Add(value); + return this; + } + public Builder AddRangeRepeatedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedBool_.Add(values); + return this; + } + public Builder ClearRepeatedBool() { + PrepareBuilder(); + result.repeatedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringList { + get { return PrepareBuilder().repeatedString_; } + } + public int RepeatedStringCount { + get { return result.RepeatedStringCount; } + } + public string GetRepeatedString(int index) { + return result.GetRepeatedString(index); + } + public Builder SetRepeatedString(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedString_[index] = value; + return this; + } + public Builder AddRepeatedString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedString_.Add(value); + return this; + } + public Builder AddRangeRepeatedString(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedString_.Add(values); + return this; + } + public Builder ClearRepeatedString() { + PrepareBuilder(); + result.repeatedString_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedBytesList { + get { return PrepareBuilder().repeatedBytes_; } + } + public int RepeatedBytesCount { + get { return result.RepeatedBytesCount; } + } + public pb::ByteString GetRepeatedBytes(int index) { + return result.GetRepeatedBytes(index); + } + public Builder SetRepeatedBytes(int index, pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedBytes_[index] = value; + return this; + } + public Builder AddRepeatedBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedBytes_.Add(value); + return this; + } + public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedBytes_.Add(values); + return this; + } + public Builder ClearRepeatedBytes() { + PrepareBuilder(); + result.repeatedBytes_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedGroupList { + get { return PrepareBuilder().repeatedGroup_; } + } + public int RepeatedGroupCount { + get { return result.RepeatedGroupCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup GetRepeatedGroup(int index) { + return result.GetRepeatedGroup(index); + } + public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedGroup_[index] = value; + return this; + } + public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedGroup_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedGroup_.Add(value); + return this; + } + public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedGroup_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedGroup_.Add(values); + return this; + } + public Builder ClearRepeatedGroup() { + PrepareBuilder(); + result.repeatedGroup_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedNestedMessageList { + get { return PrepareBuilder().repeatedNestedMessage_; } + } + public int RepeatedNestedMessageCount { + get { return result.RepeatedNestedMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage GetRepeatedNestedMessage(int index) { + return result.GetRepeatedNestedMessage(index); + } + public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedNestedMessage_[index] = value; + return this; + } + public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedNestedMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedNestedMessage_.Add(value); + return this; + } + public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedNestedMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedNestedMessage_.Add(values); + return this; + } + public Builder ClearRepeatedNestedMessage() { + PrepareBuilder(); + result.repeatedNestedMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedForeignMessageList { + get { return PrepareBuilder().repeatedForeignMessage_; } + } + public int RepeatedForeignMessageCount { + get { return result.RepeatedForeignMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedForeignMessage(int index) { + return result.GetRepeatedForeignMessage(index); + } + public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedForeignMessage_[index] = value; + return this; + } + public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedForeignMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedForeignMessage_.Add(value); + return this; + } + public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedForeignMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedForeignMessage_.Add(values); + return this; + } + public Builder ClearRepeatedForeignMessage() { + PrepareBuilder(); + result.repeatedForeignMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedImportMessageList { + get { return PrepareBuilder().repeatedImportMessage_; } + } + public int RepeatedImportMessageCount { + get { return result.RepeatedImportMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage GetRepeatedImportMessage(int index) { + return result.GetRepeatedImportMessage(index); + } + public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedImportMessage_[index] = value; + return this; + } + public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedImportMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedImportMessage_.Add(value); + return this; + } + public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedImportMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedImportMessage_.Add(values); + return this; + } + public Builder ClearRepeatedImportMessage() { + PrepareBuilder(); + result.repeatedImportMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedNestedEnumList { + get { return PrepareBuilder().repeatedNestedEnum_; } + } + public int RepeatedNestedEnumCount { + get { return result.RepeatedNestedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum GetRepeatedNestedEnum(int index) { + return result.GetRepeatedNestedEnum(index); + } + public Builder SetRepeatedNestedEnum(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.repeatedNestedEnum_[index] = value; + return this; + } + public Builder AddRepeatedNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.repeatedNestedEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedNestedEnum_.Add(values); + return this; + } + public Builder ClearRepeatedNestedEnum() { + PrepareBuilder(); + result.repeatedNestedEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedForeignEnumList { + get { return PrepareBuilder().repeatedForeignEnum_; } + } + public int RepeatedForeignEnumCount { + get { return result.RepeatedForeignEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedForeignEnum(int index) { + return result.GetRepeatedForeignEnum(index); + } + public Builder SetRepeatedForeignEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedForeignEnum_[index] = value; + return this; + } + public Builder AddRepeatedForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedForeignEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedForeignEnum_.Add(values); + return this; + } + public Builder ClearRepeatedForeignEnum() { + PrepareBuilder(); + result.repeatedForeignEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedImportEnumList { + get { return PrepareBuilder().repeatedImportEnum_; } + } + public int RepeatedImportEnumCount { + get { return result.RepeatedImportEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum GetRepeatedImportEnum(int index) { + return result.GetRepeatedImportEnum(index); + } + public Builder SetRepeatedImportEnum(int index, global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.repeatedImportEnum_[index] = value; + return this; + } + public Builder AddRepeatedImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.repeatedImportEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedImportEnum_.Add(values); + return this; + } + public Builder ClearRepeatedImportEnum() { + PrepareBuilder(); + result.repeatedImportEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringPieceList { + get { return PrepareBuilder().repeatedStringPiece_; } + } + public int RepeatedStringPieceCount { + get { return result.RepeatedStringPieceCount; } + } + public string GetRepeatedStringPiece(int index) { + return result.GetRepeatedStringPiece(index); + } + public Builder SetRepeatedStringPiece(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPiece_[index] = value; + return this; + } + public Builder AddRepeatedStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPiece_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringPiece_.Add(values); + return this; + } + public Builder ClearRepeatedStringPiece() { + PrepareBuilder(); + result.repeatedStringPiece_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedCordList { + get { return PrepareBuilder().repeatedCord_; } + } + public int RepeatedCordCount { + get { return result.RepeatedCordCount; } + } + public string GetRepeatedCord(int index) { + return result.GetRepeatedCord(index); + } + public Builder SetRepeatedCord(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCord_[index] = value; + return this; + } + public Builder AddRepeatedCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCord_.Add(value); + return this; + } + public Builder AddRangeRepeatedCord(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedCord_.Add(values); + return this; + } + public Builder ClearRepeatedCord() { + PrepareBuilder(); + result.repeatedCord_.Clear(); + return this; + } + + public bool HasDefaultInt32 { + get { return result.hasDefaultInt32; } + } + public int DefaultInt32 { + get { return result.DefaultInt32; } + set { SetDefaultInt32(value); } + } + public Builder SetDefaultInt32(int value) { + PrepareBuilder(); + result.hasDefaultInt32 = true; + result.defaultInt32_ = value; + return this; + } + public Builder ClearDefaultInt32() { + PrepareBuilder(); + result.hasDefaultInt32 = false; + result.defaultInt32_ = 41; + return this; + } + + public bool HasDefaultInt64 { + get { return result.hasDefaultInt64; } + } + public long DefaultInt64 { + get { return result.DefaultInt64; } + set { SetDefaultInt64(value); } + } + public Builder SetDefaultInt64(long value) { + PrepareBuilder(); + result.hasDefaultInt64 = true; + result.defaultInt64_ = value; + return this; + } + public Builder ClearDefaultInt64() { + PrepareBuilder(); + result.hasDefaultInt64 = false; + result.defaultInt64_ = 42L; + return this; + } + + public bool HasDefaultUint32 { + get { return result.hasDefaultUint32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultUint32 { + get { return result.DefaultUint32; } + set { SetDefaultUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultUint32(uint value) { + PrepareBuilder(); + result.hasDefaultUint32 = true; + result.defaultUint32_ = value; + return this; + } + public Builder ClearDefaultUint32() { + PrepareBuilder(); + result.hasDefaultUint32 = false; + result.defaultUint32_ = 43; + return this; + } + + public bool HasDefaultUint64 { + get { return result.hasDefaultUint64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultUint64 { + get { return result.DefaultUint64; } + set { SetDefaultUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultUint64(ulong value) { + PrepareBuilder(); + result.hasDefaultUint64 = true; + result.defaultUint64_ = value; + return this; + } + public Builder ClearDefaultUint64() { + PrepareBuilder(); + result.hasDefaultUint64 = false; + result.defaultUint64_ = 44UL; + return this; + } + + public bool HasDefaultSint32 { + get { return result.hasDefaultSint32; } + } + public int DefaultSint32 { + get { return result.DefaultSint32; } + set { SetDefaultSint32(value); } + } + public Builder SetDefaultSint32(int value) { + PrepareBuilder(); + result.hasDefaultSint32 = true; + result.defaultSint32_ = value; + return this; + } + public Builder ClearDefaultSint32() { + PrepareBuilder(); + result.hasDefaultSint32 = false; + result.defaultSint32_ = -45; + return this; + } + + public bool HasDefaultSint64 { + get { return result.hasDefaultSint64; } + } + public long DefaultSint64 { + get { return result.DefaultSint64; } + set { SetDefaultSint64(value); } + } + public Builder SetDefaultSint64(long value) { + PrepareBuilder(); + result.hasDefaultSint64 = true; + result.defaultSint64_ = value; + return this; + } + public Builder ClearDefaultSint64() { + PrepareBuilder(); + result.hasDefaultSint64 = false; + result.defaultSint64_ = 46; + return this; + } + + public bool HasDefaultFixed32 { + get { return result.hasDefaultFixed32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultFixed32 { + get { return result.DefaultFixed32; } + set { SetDefaultFixed32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultFixed32(uint value) { + PrepareBuilder(); + result.hasDefaultFixed32 = true; + result.defaultFixed32_ = value; + return this; + } + public Builder ClearDefaultFixed32() { + PrepareBuilder(); + result.hasDefaultFixed32 = false; + result.defaultFixed32_ = 47; + return this; + } + + public bool HasDefaultFixed64 { + get { return result.hasDefaultFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultFixed64 { + get { return result.DefaultFixed64; } + set { SetDefaultFixed64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultFixed64(ulong value) { + PrepareBuilder(); + result.hasDefaultFixed64 = true; + result.defaultFixed64_ = value; + return this; + } + public Builder ClearDefaultFixed64() { + PrepareBuilder(); + result.hasDefaultFixed64 = false; + result.defaultFixed64_ = 48; + return this; + } + + public bool HasDefaultSfixed32 { + get { return result.hasDefaultSfixed32; } + } + public int DefaultSfixed32 { + get { return result.DefaultSfixed32; } + set { SetDefaultSfixed32(value); } + } + public Builder SetDefaultSfixed32(int value) { + PrepareBuilder(); + result.hasDefaultSfixed32 = true; + result.defaultSfixed32_ = value; + return this; + } + public Builder ClearDefaultSfixed32() { + PrepareBuilder(); + result.hasDefaultSfixed32 = false; + result.defaultSfixed32_ = 49; + return this; + } + + public bool HasDefaultSfixed64 { + get { return result.hasDefaultSfixed64; } + } + public long DefaultSfixed64 { + get { return result.DefaultSfixed64; } + set { SetDefaultSfixed64(value); } + } + public Builder SetDefaultSfixed64(long value) { + PrepareBuilder(); + result.hasDefaultSfixed64 = true; + result.defaultSfixed64_ = value; + return this; + } + public Builder ClearDefaultSfixed64() { + PrepareBuilder(); + result.hasDefaultSfixed64 = false; + result.defaultSfixed64_ = -50; + return this; + } + + public bool HasDefaultFloat { + get { return result.hasDefaultFloat; } + } + public float DefaultFloat { + get { return result.DefaultFloat; } + set { SetDefaultFloat(value); } + } + public Builder SetDefaultFloat(float value) { + PrepareBuilder(); + result.hasDefaultFloat = true; + result.defaultFloat_ = value; + return this; + } + public Builder ClearDefaultFloat() { + PrepareBuilder(); + result.hasDefaultFloat = false; + result.defaultFloat_ = 51.5F; + return this; + } + + public bool HasDefaultDouble { + get { return result.hasDefaultDouble; } + } + public double DefaultDouble { + get { return result.DefaultDouble; } + set { SetDefaultDouble(value); } + } + public Builder SetDefaultDouble(double value) { + PrepareBuilder(); + result.hasDefaultDouble = true; + result.defaultDouble_ = value; + return this; + } + public Builder ClearDefaultDouble() { + PrepareBuilder(); + result.hasDefaultDouble = false; + result.defaultDouble_ = 52000D; + return this; + } + + public bool HasDefaultBool { + get { return result.hasDefaultBool; } + } + public bool DefaultBool { + get { return result.DefaultBool; } + set { SetDefaultBool(value); } + } + public Builder SetDefaultBool(bool value) { + PrepareBuilder(); + result.hasDefaultBool = true; + result.defaultBool_ = value; + return this; + } + public Builder ClearDefaultBool() { + PrepareBuilder(); + result.hasDefaultBool = false; + result.defaultBool_ = true; + return this; + } + + public bool HasDefaultString { + get { return result.hasDefaultString; } + } + public string DefaultString { + get { return result.DefaultString; } + set { SetDefaultString(value); } + } + public Builder SetDefaultString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultString = true; + result.defaultString_ = value; + return this; + } + public Builder ClearDefaultString() { + PrepareBuilder(); + result.hasDefaultString = false; + result.defaultString_ = "hello"; + return this; + } + + public bool HasDefaultBytes { + get { return result.hasDefaultBytes; } + } + public pb::ByteString DefaultBytes { + get { return result.DefaultBytes; } + set { SetDefaultBytes(value); } + } + public Builder SetDefaultBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultBytes = true; + result.defaultBytes_ = value; + return this; + } + public Builder ClearDefaultBytes() { + PrepareBuilder(); + result.hasDefaultBytes = false; + result.defaultBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor.Fields[62].DefaultValue; + return this; + } + + public bool HasDefaultNestedEnum { + get { return result.hasDefaultNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum DefaultNestedEnum { + get { return result.DefaultNestedEnum; } + set { SetDefaultNestedEnum(value); } + } + public Builder SetDefaultNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.hasDefaultNestedEnum = true; + result.defaultNestedEnum_ = value; + return this; + } + public Builder ClearDefaultNestedEnum() { + PrepareBuilder(); + result.hasDefaultNestedEnum = false; + result.defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.BAR; + return this; + } + + public bool HasDefaultForeignEnum { + get { return result.hasDefaultForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum DefaultForeignEnum { + get { return result.DefaultForeignEnum; } + set { SetDefaultForeignEnum(value); } + } + public Builder SetDefaultForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasDefaultForeignEnum = true; + result.defaultForeignEnum_ = value; + return this; + } + public Builder ClearDefaultForeignEnum() { + PrepareBuilder(); + result.hasDefaultForeignEnum = false; + result.defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_BAR; + return this; + } + + public bool HasDefaultImportEnum { + get { return result.hasDefaultImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum DefaultImportEnum { + get { return result.DefaultImportEnum; } + set { SetDefaultImportEnum(value); } + } + public Builder SetDefaultImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.hasDefaultImportEnum = true; + result.defaultImportEnum_ = value; + return this; + } + public Builder ClearDefaultImportEnum() { + PrepareBuilder(); + result.hasDefaultImportEnum = false; + result.defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_BAR; + return this; + } + + public bool HasDefaultStringPiece { + get { return result.hasDefaultStringPiece; } + } + public string DefaultStringPiece { + get { return result.DefaultStringPiece; } + set { SetDefaultStringPiece(value); } + } + public Builder SetDefaultStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultStringPiece = true; + result.defaultStringPiece_ = value; + return this; + } + public Builder ClearDefaultStringPiece() { + PrepareBuilder(); + result.hasDefaultStringPiece = false; + result.defaultStringPiece_ = "abc"; + return this; + } + + public bool HasDefaultCord { + get { return result.hasDefaultCord; } + } + public string DefaultCord { + get { return result.DefaultCord; } + set { SetDefaultCord(value); } + } + public Builder SetDefaultCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultCord = true; + result.defaultCord_ = value; + return this; + } + public Builder ClearDefaultCord() { + PrepareBuilder(); + result.hasDefaultCord = false; + result.defaultCord_ = "123"; + return this; + } + } + static TestAllTypes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { + private TestDeprecatedFields() { } + private static readonly TestDeprecatedFields defaultInstance = new TestDeprecatedFields().MakeReadOnly(); + private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; + private static readonly uint[] _testDeprecatedFieldsFieldTags = new uint[] { 8 }; + public static TestDeprecatedFields DefaultInstance { + get { return defaultInstance; } + } + + public override TestDeprecatedFields DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDeprecatedFields ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable; } + } + + public const int DeprecatedInt32FieldNumber = 1; + private bool hasDeprecatedInt32; + private int deprecatedInt32_; + [global::System.ObsoleteAttribute()] + public bool HasDeprecatedInt32 { + get { return hasDeprecatedInt32; } + } + [global::System.ObsoleteAttribute()] + public int DeprecatedInt32 { + get { return deprecatedInt32_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDeprecatedFieldsFieldNames; + if (hasDeprecatedInt32) { + output.WriteInt32(1, field_names[0], DeprecatedInt32); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasDeprecatedInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(1, DeprecatedInt32); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestDeprecatedFields ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedFields ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDeprecatedFields ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDeprecatedFields MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDeprecatedFields prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDeprecatedFields cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDeprecatedFields result; + + private TestDeprecatedFields PrepareBuilder() { + if (resultIsReadOnly) { + TestDeprecatedFields original = result; + result = new TestDeprecatedFields(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDeprecatedFields MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.Descriptor; } + } + + public override TestDeprecatedFields DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.DefaultInstance; } + } + + public override TestDeprecatedFields BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestDeprecatedFields) { + return MergeFrom((TestDeprecatedFields) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDeprecatedFields other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasDeprecatedInt32) { + DeprecatedInt32 = other.DeprecatedInt32; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDeprecatedFieldsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDeprecatedFieldsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasDeprecatedInt32 = input.ReadInt32(ref result.deprecatedInt32_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + [global::System.ObsoleteAttribute()] + public bool HasDeprecatedInt32 { + get { return result.hasDeprecatedInt32; } + } + [global::System.ObsoleteAttribute()] + public int DeprecatedInt32 { + get { return result.DeprecatedInt32; } + set { SetDeprecatedInt32(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetDeprecatedInt32(int value) { + PrepareBuilder(); + result.hasDeprecatedInt32 = true; + result.deprecatedInt32_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearDeprecatedInt32() { + PrepareBuilder(); + result.hasDeprecatedInt32 = false; + result.deprecatedInt32_ = 0; + return this; + } + } + static TestDeprecatedFields() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ForeignMessage : pb::GeneratedMessage { + private ForeignMessage() { } + private static readonly ForeignMessage defaultInstance = new ForeignMessage().MakeReadOnly(); + private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; + private static readonly uint[] _foreignMessageFieldTags = new uint[] { 8 }; + public static ForeignMessage DefaultInstance { + get { return defaultInstance; } + } + + public override ForeignMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ForeignMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_ForeignMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable; } + } + + public const int CFieldNumber = 1; + private bool hasC; + private int c_; + public bool HasC { + get { return hasC; } + } + public int C { + get { return c_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _foreignMessageFieldNames; + if (hasC) { + output.WriteInt32(1, field_names[0], C); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasC) { + size += pb::CodedOutputStream.ComputeInt32Size(1, C); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ForeignMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ForeignMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ForeignMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ForeignMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ForeignMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ForeignMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ForeignMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ForeignMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ForeignMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ForeignMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ForeignMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ForeignMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ForeignMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ForeignMessage result; + + private ForeignMessage PrepareBuilder() { + if (resultIsReadOnly) { + ForeignMessage original = result; + result = new ForeignMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ForeignMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Descriptor; } + } + + public override ForeignMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public override ForeignMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ForeignMessage) { + return MergeFrom((ForeignMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ForeignMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasC) { + C = other.C; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_foreignMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _foreignMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasC = input.ReadInt32(ref result.c_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasC { + get { return result.hasC; } + } + public int C { + get { return result.C; } + set { SetC(value); } + } + public Builder SetC(int value) { + PrepareBuilder(); + result.hasC = true; + result.c_ = value; + return this; + } + public Builder ClearC() { + PrepareBuilder(); + result.hasC = false; + result.c_ = 0; + return this; + } + } + static ForeignMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestAllExtensions : pb::ExtendableMessage { + private TestAllExtensions() { } + private static readonly TestAllExtensions defaultInstance = new TestAllExtensions().MakeReadOnly(); + private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testAllExtensionsFieldTags = new uint[] { }; + public static TestAllExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestAllExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestAllExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testAllExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestAllExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestAllExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestAllExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestAllExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestAllExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestAllExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestAllExtensions result; + + private TestAllExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestAllExtensions original = result; + result = new TestAllExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestAllExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.Descriptor; } + } + + public override TestAllExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.DefaultInstance; } + } + + public override TestAllExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestAllExtensions) { + return MergeFrom((TestAllExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestAllExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testAllExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testAllExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestAllExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { + private OptionalGroup_extension() { } + private static readonly OptionalGroup_extension defaultInstance = new OptionalGroup_extension().MakeReadOnly(); + private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; + private static readonly uint[] _optionalGroupExtensionFieldTags = new uint[] { 136 }; + public static OptionalGroup_extension DefaultInstance { + get { return defaultInstance; } + } + + public override OptionalGroup_extension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OptionalGroup_extension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OptionalGroup_extension__FieldAccessorTable; } + } + + public const int AFieldNumber = 17; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _optionalGroupExtensionFieldNames; + if (hasA) { + output.WriteInt32(17, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(17, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OptionalGroup_extension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OptionalGroup_extension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OptionalGroup_extension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OptionalGroup_extension prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OptionalGroup_extension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OptionalGroup_extension result; + + private OptionalGroup_extension PrepareBuilder() { + if (resultIsReadOnly) { + OptionalGroup_extension original = result; + result = new OptionalGroup_extension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OptionalGroup_extension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.Descriptor; } + } + + public override OptionalGroup_extension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.DefaultInstance; } + } + + public override OptionalGroup_extension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OptionalGroup_extension) { + return MergeFrom((OptionalGroup_extension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OptionalGroup_extension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_optionalGroupExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _optionalGroupExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 136: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static OptionalGroup_extension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { + private RepeatedGroup_extension() { } + private static readonly RepeatedGroup_extension defaultInstance = new RepeatedGroup_extension().MakeReadOnly(); + private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; + private static readonly uint[] _repeatedGroupExtensionFieldTags = new uint[] { 376 }; + public static RepeatedGroup_extension DefaultInstance { + get { return defaultInstance; } + } + + public override RepeatedGroup_extension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RepeatedGroup_extension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_RepeatedGroup_extension__FieldAccessorTable; } + } + + public const int AFieldNumber = 47; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _repeatedGroupExtensionFieldNames; + if (hasA) { + output.WriteInt32(47, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(47, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static RepeatedGroup_extension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RepeatedGroup_extension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RepeatedGroup_extension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RepeatedGroup_extension prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RepeatedGroup_extension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RepeatedGroup_extension result; + + private RepeatedGroup_extension PrepareBuilder() { + if (resultIsReadOnly) { + RepeatedGroup_extension original = result; + result = new RepeatedGroup_extension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RepeatedGroup_extension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.Descriptor; } + } + + public override RepeatedGroup_extension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.DefaultInstance; } + } + + public override RepeatedGroup_extension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is RepeatedGroup_extension) { + return MergeFrom((RepeatedGroup_extension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RepeatedGroup_extension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_repeatedGroupExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _repeatedGroupExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 376: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static RepeatedGroup_extension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestNestedExtension : pb::GeneratedMessage { + private TestNestedExtension() { } + private static readonly TestNestedExtension defaultInstance = new TestNestedExtension().MakeReadOnly(); + private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; + private static readonly uint[] _testNestedExtensionFieldTags = new uint[] { }; + public static TestNestedExtension DefaultInstance { + get { return defaultInstance; } + } + + public override TestNestedExtension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestNestedExtension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedExtension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedExtension__FieldAccessorTable; } + } + + public const int TestFieldNumber = 1002; + public static pb::GeneratedExtensionBase Test; + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testNestedExtensionFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestNestedExtension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestNestedExtension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestNestedExtension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestNestedExtension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestNestedExtension prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestNestedExtension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestNestedExtension result; + + private TestNestedExtension PrepareBuilder() { + if (resultIsReadOnly) { + TestNestedExtension original = result; + result = new TestNestedExtension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestNestedExtension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Descriptor; } + } + + public override TestNestedExtension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.DefaultInstance; } + } + + public override TestNestedExtension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestNestedExtension) { + return MergeFrom((TestNestedExtension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestNestedExtension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testNestedExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testNestedExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestNestedExtension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRequired : pb::GeneratedMessage { + private TestRequired() { } + private static readonly TestRequired defaultInstance = new TestRequired().MakeReadOnly(); + private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; + private static readonly uint[] _testRequiredFieldTags = new uint[] { 8, 24, 264, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 16, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 32, 40, 48, 56, 64, 72 }; + public static TestRequired DefaultInstance { + get { return defaultInstance; } + } + + public override TestRequired DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRequired ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequired__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequired__FieldAccessorTable; } + } + + public const int SingleFieldNumber = 1000; + public static pb::GeneratedExtensionBase Single; + public const int MultiFieldNumber = 1001; + public static pb::GeneratedExtensionBase> Multi; + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public const int Dummy2FieldNumber = 2; + private bool hasDummy2; + private int dummy2_; + public bool HasDummy2 { + get { return hasDummy2; } + } + public int Dummy2 { + get { return dummy2_; } + } + + public const int BFieldNumber = 3; + private bool hasB; + private int b_; + public bool HasB { + get { return hasB; } + } + public int B { + get { return b_; } + } + + public const int Dummy4FieldNumber = 4; + private bool hasDummy4; + private int dummy4_; + public bool HasDummy4 { + get { return hasDummy4; } + } + public int Dummy4 { + get { return dummy4_; } + } + + public const int Dummy5FieldNumber = 5; + private bool hasDummy5; + private int dummy5_; + public bool HasDummy5 { + get { return hasDummy5; } + } + public int Dummy5 { + get { return dummy5_; } + } + + public const int Dummy6FieldNumber = 6; + private bool hasDummy6; + private int dummy6_; + public bool HasDummy6 { + get { return hasDummy6; } + } + public int Dummy6 { + get { return dummy6_; } + } + + public const int Dummy7FieldNumber = 7; + private bool hasDummy7; + private int dummy7_; + public bool HasDummy7 { + get { return hasDummy7; } + } + public int Dummy7 { + get { return dummy7_; } + } + + public const int Dummy8FieldNumber = 8; + private bool hasDummy8; + private int dummy8_; + public bool HasDummy8 { + get { return hasDummy8; } + } + public int Dummy8 { + get { return dummy8_; } + } + + public const int Dummy9FieldNumber = 9; + private bool hasDummy9; + private int dummy9_; + public bool HasDummy9 { + get { return hasDummy9; } + } + public int Dummy9 { + get { return dummy9_; } + } + + public const int Dummy10FieldNumber = 10; + private bool hasDummy10; + private int dummy10_; + public bool HasDummy10 { + get { return hasDummy10; } + } + public int Dummy10 { + get { return dummy10_; } + } + + public const int Dummy11FieldNumber = 11; + private bool hasDummy11; + private int dummy11_; + public bool HasDummy11 { + get { return hasDummy11; } + } + public int Dummy11 { + get { return dummy11_; } + } + + public const int Dummy12FieldNumber = 12; + private bool hasDummy12; + private int dummy12_; + public bool HasDummy12 { + get { return hasDummy12; } + } + public int Dummy12 { + get { return dummy12_; } + } + + public const int Dummy13FieldNumber = 13; + private bool hasDummy13; + private int dummy13_; + public bool HasDummy13 { + get { return hasDummy13; } + } + public int Dummy13 { + get { return dummy13_; } + } + + public const int Dummy14FieldNumber = 14; + private bool hasDummy14; + private int dummy14_; + public bool HasDummy14 { + get { return hasDummy14; } + } + public int Dummy14 { + get { return dummy14_; } + } + + public const int Dummy15FieldNumber = 15; + private bool hasDummy15; + private int dummy15_; + public bool HasDummy15 { + get { return hasDummy15; } + } + public int Dummy15 { + get { return dummy15_; } + } + + public const int Dummy16FieldNumber = 16; + private bool hasDummy16; + private int dummy16_; + public bool HasDummy16 { + get { return hasDummy16; } + } + public int Dummy16 { + get { return dummy16_; } + } + + public const int Dummy17FieldNumber = 17; + private bool hasDummy17; + private int dummy17_; + public bool HasDummy17 { + get { return hasDummy17; } + } + public int Dummy17 { + get { return dummy17_; } + } + + public const int Dummy18FieldNumber = 18; + private bool hasDummy18; + private int dummy18_; + public bool HasDummy18 { + get { return hasDummy18; } + } + public int Dummy18 { + get { return dummy18_; } + } + + public const int Dummy19FieldNumber = 19; + private bool hasDummy19; + private int dummy19_; + public bool HasDummy19 { + get { return hasDummy19; } + } + public int Dummy19 { + get { return dummy19_; } + } + + public const int Dummy20FieldNumber = 20; + private bool hasDummy20; + private int dummy20_; + public bool HasDummy20 { + get { return hasDummy20; } + } + public int Dummy20 { + get { return dummy20_; } + } + + public const int Dummy21FieldNumber = 21; + private bool hasDummy21; + private int dummy21_; + public bool HasDummy21 { + get { return hasDummy21; } + } + public int Dummy21 { + get { return dummy21_; } + } + + public const int Dummy22FieldNumber = 22; + private bool hasDummy22; + private int dummy22_; + public bool HasDummy22 { + get { return hasDummy22; } + } + public int Dummy22 { + get { return dummy22_; } + } + + public const int Dummy23FieldNumber = 23; + private bool hasDummy23; + private int dummy23_; + public bool HasDummy23 { + get { return hasDummy23; } + } + public int Dummy23 { + get { return dummy23_; } + } + + public const int Dummy24FieldNumber = 24; + private bool hasDummy24; + private int dummy24_; + public bool HasDummy24 { + get { return hasDummy24; } + } + public int Dummy24 { + get { return dummy24_; } + } + + public const int Dummy25FieldNumber = 25; + private bool hasDummy25; + private int dummy25_; + public bool HasDummy25 { + get { return hasDummy25; } + } + public int Dummy25 { + get { return dummy25_; } + } + + public const int Dummy26FieldNumber = 26; + private bool hasDummy26; + private int dummy26_; + public bool HasDummy26 { + get { return hasDummy26; } + } + public int Dummy26 { + get { return dummy26_; } + } + + public const int Dummy27FieldNumber = 27; + private bool hasDummy27; + private int dummy27_; + public bool HasDummy27 { + get { return hasDummy27; } + } + public int Dummy27 { + get { return dummy27_; } + } + + public const int Dummy28FieldNumber = 28; + private bool hasDummy28; + private int dummy28_; + public bool HasDummy28 { + get { return hasDummy28; } + } + public int Dummy28 { + get { return dummy28_; } + } + + public const int Dummy29FieldNumber = 29; + private bool hasDummy29; + private int dummy29_; + public bool HasDummy29 { + get { return hasDummy29; } + } + public int Dummy29 { + get { return dummy29_; } + } + + public const int Dummy30FieldNumber = 30; + private bool hasDummy30; + private int dummy30_; + public bool HasDummy30 { + get { return hasDummy30; } + } + public int Dummy30 { + get { return dummy30_; } + } + + public const int Dummy31FieldNumber = 31; + private bool hasDummy31; + private int dummy31_; + public bool HasDummy31 { + get { return hasDummy31; } + } + public int Dummy31 { + get { return dummy31_; } + } + + public const int Dummy32FieldNumber = 32; + private bool hasDummy32; + private int dummy32_; + public bool HasDummy32 { + get { return hasDummy32; } + } + public int Dummy32 { + get { return dummy32_; } + } + + public const int CFieldNumber = 33; + private bool hasC; + private int c_; + public bool HasC { + get { return hasC; } + } + public int C { + get { return c_; } + } + + public override bool IsInitialized { + get { + if (!hasA) return false; + if (!hasB) return false; + if (!hasC) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRequiredFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + if (hasDummy2) { + output.WriteInt32(2, field_names[13], Dummy2); + } + if (hasB) { + output.WriteInt32(3, field_names[1], B); + } + if (hasDummy4) { + output.WriteInt32(4, field_names[27], Dummy4); + } + if (hasDummy5) { + output.WriteInt32(5, field_names[28], Dummy5); + } + if (hasDummy6) { + output.WriteInt32(6, field_names[29], Dummy6); + } + if (hasDummy7) { + output.WriteInt32(7, field_names[30], Dummy7); + } + if (hasDummy8) { + output.WriteInt32(8, field_names[31], Dummy8); + } + if (hasDummy9) { + output.WriteInt32(9, field_names[32], Dummy9); + } + if (hasDummy10) { + output.WriteInt32(10, field_names[3], Dummy10); + } + if (hasDummy11) { + output.WriteInt32(11, field_names[4], Dummy11); + } + if (hasDummy12) { + output.WriteInt32(12, field_names[5], Dummy12); + } + if (hasDummy13) { + output.WriteInt32(13, field_names[6], Dummy13); + } + if (hasDummy14) { + output.WriteInt32(14, field_names[7], Dummy14); + } + if (hasDummy15) { + output.WriteInt32(15, field_names[8], Dummy15); + } + if (hasDummy16) { + output.WriteInt32(16, field_names[9], Dummy16); + } + if (hasDummy17) { + output.WriteInt32(17, field_names[10], Dummy17); + } + if (hasDummy18) { + output.WriteInt32(18, field_names[11], Dummy18); + } + if (hasDummy19) { + output.WriteInt32(19, field_names[12], Dummy19); + } + if (hasDummy20) { + output.WriteInt32(20, field_names[14], Dummy20); + } + if (hasDummy21) { + output.WriteInt32(21, field_names[15], Dummy21); + } + if (hasDummy22) { + output.WriteInt32(22, field_names[16], Dummy22); + } + if (hasDummy23) { + output.WriteInt32(23, field_names[17], Dummy23); + } + if (hasDummy24) { + output.WriteInt32(24, field_names[18], Dummy24); + } + if (hasDummy25) { + output.WriteInt32(25, field_names[19], Dummy25); + } + if (hasDummy26) { + output.WriteInt32(26, field_names[20], Dummy26); + } + if (hasDummy27) { + output.WriteInt32(27, field_names[21], Dummy27); + } + if (hasDummy28) { + output.WriteInt32(28, field_names[22], Dummy28); + } + if (hasDummy29) { + output.WriteInt32(29, field_names[23], Dummy29); + } + if (hasDummy30) { + output.WriteInt32(30, field_names[24], Dummy30); + } + if (hasDummy31) { + output.WriteInt32(31, field_names[25], Dummy31); + } + if (hasDummy32) { + output.WriteInt32(32, field_names[26], Dummy32); + } + if (hasC) { + output.WriteInt32(33, field_names[2], C); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + if (hasDummy2) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Dummy2); + } + if (hasB) { + size += pb::CodedOutputStream.ComputeInt32Size(3, B); + } + if (hasDummy4) { + size += pb::CodedOutputStream.ComputeInt32Size(4, Dummy4); + } + if (hasDummy5) { + size += pb::CodedOutputStream.ComputeInt32Size(5, Dummy5); + } + if (hasDummy6) { + size += pb::CodedOutputStream.ComputeInt32Size(6, Dummy6); + } + if (hasDummy7) { + size += pb::CodedOutputStream.ComputeInt32Size(7, Dummy7); + } + if (hasDummy8) { + size += pb::CodedOutputStream.ComputeInt32Size(8, Dummy8); + } + if (hasDummy9) { + size += pb::CodedOutputStream.ComputeInt32Size(9, Dummy9); + } + if (hasDummy10) { + size += pb::CodedOutputStream.ComputeInt32Size(10, Dummy10); + } + if (hasDummy11) { + size += pb::CodedOutputStream.ComputeInt32Size(11, Dummy11); + } + if (hasDummy12) { + size += pb::CodedOutputStream.ComputeInt32Size(12, Dummy12); + } + if (hasDummy13) { + size += pb::CodedOutputStream.ComputeInt32Size(13, Dummy13); + } + if (hasDummy14) { + size += pb::CodedOutputStream.ComputeInt32Size(14, Dummy14); + } + if (hasDummy15) { + size += pb::CodedOutputStream.ComputeInt32Size(15, Dummy15); + } + if (hasDummy16) { + size += pb::CodedOutputStream.ComputeInt32Size(16, Dummy16); + } + if (hasDummy17) { + size += pb::CodedOutputStream.ComputeInt32Size(17, Dummy17); + } + if (hasDummy18) { + size += pb::CodedOutputStream.ComputeInt32Size(18, Dummy18); + } + if (hasDummy19) { + size += pb::CodedOutputStream.ComputeInt32Size(19, Dummy19); + } + if (hasDummy20) { + size += pb::CodedOutputStream.ComputeInt32Size(20, Dummy20); + } + if (hasDummy21) { + size += pb::CodedOutputStream.ComputeInt32Size(21, Dummy21); + } + if (hasDummy22) { + size += pb::CodedOutputStream.ComputeInt32Size(22, Dummy22); + } + if (hasDummy23) { + size += pb::CodedOutputStream.ComputeInt32Size(23, Dummy23); + } + if (hasDummy24) { + size += pb::CodedOutputStream.ComputeInt32Size(24, Dummy24); + } + if (hasDummy25) { + size += pb::CodedOutputStream.ComputeInt32Size(25, Dummy25); + } + if (hasDummy26) { + size += pb::CodedOutputStream.ComputeInt32Size(26, Dummy26); + } + if (hasDummy27) { + size += pb::CodedOutputStream.ComputeInt32Size(27, Dummy27); + } + if (hasDummy28) { + size += pb::CodedOutputStream.ComputeInt32Size(28, Dummy28); + } + if (hasDummy29) { + size += pb::CodedOutputStream.ComputeInt32Size(29, Dummy29); + } + if (hasDummy30) { + size += pb::CodedOutputStream.ComputeInt32Size(30, Dummy30); + } + if (hasDummy31) { + size += pb::CodedOutputStream.ComputeInt32Size(31, Dummy31); + } + if (hasDummy32) { + size += pb::CodedOutputStream.ComputeInt32Size(32, Dummy32); + } + if (hasC) { + size += pb::CodedOutputStream.ComputeInt32Size(33, C); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRequired ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequired ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequired ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequired ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequired ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequired ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRequired ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRequired ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRequired ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequired ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRequired MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRequired prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRequired cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRequired result; + + private TestRequired PrepareBuilder() { + if (resultIsReadOnly) { + TestRequired original = result; + result = new TestRequired(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRequired MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequired.Descriptor; } + } + + public override TestRequired DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; } + } + + public override TestRequired BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRequired) { + return MergeFrom((TestRequired) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRequired other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + if (other.HasDummy2) { + Dummy2 = other.Dummy2; + } + if (other.HasB) { + B = other.B; + } + if (other.HasDummy4) { + Dummy4 = other.Dummy4; + } + if (other.HasDummy5) { + Dummy5 = other.Dummy5; + } + if (other.HasDummy6) { + Dummy6 = other.Dummy6; + } + if (other.HasDummy7) { + Dummy7 = other.Dummy7; + } + if (other.HasDummy8) { + Dummy8 = other.Dummy8; + } + if (other.HasDummy9) { + Dummy9 = other.Dummy9; + } + if (other.HasDummy10) { + Dummy10 = other.Dummy10; + } + if (other.HasDummy11) { + Dummy11 = other.Dummy11; + } + if (other.HasDummy12) { + Dummy12 = other.Dummy12; + } + if (other.HasDummy13) { + Dummy13 = other.Dummy13; + } + if (other.HasDummy14) { + Dummy14 = other.Dummy14; + } + if (other.HasDummy15) { + Dummy15 = other.Dummy15; + } + if (other.HasDummy16) { + Dummy16 = other.Dummy16; + } + if (other.HasDummy17) { + Dummy17 = other.Dummy17; + } + if (other.HasDummy18) { + Dummy18 = other.Dummy18; + } + if (other.HasDummy19) { + Dummy19 = other.Dummy19; + } + if (other.HasDummy20) { + Dummy20 = other.Dummy20; + } + if (other.HasDummy21) { + Dummy21 = other.Dummy21; + } + if (other.HasDummy22) { + Dummy22 = other.Dummy22; + } + if (other.HasDummy23) { + Dummy23 = other.Dummy23; + } + if (other.HasDummy24) { + Dummy24 = other.Dummy24; + } + if (other.HasDummy25) { + Dummy25 = other.Dummy25; + } + if (other.HasDummy26) { + Dummy26 = other.Dummy26; + } + if (other.HasDummy27) { + Dummy27 = other.Dummy27; + } + if (other.HasDummy28) { + Dummy28 = other.Dummy28; + } + if (other.HasDummy29) { + Dummy29 = other.Dummy29; + } + if (other.HasDummy30) { + Dummy30 = other.Dummy30; + } + if (other.HasDummy31) { + Dummy31 = other.Dummy31; + } + if (other.HasDummy32) { + Dummy32 = other.Dummy32; + } + if (other.HasC) { + C = other.C; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRequiredFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRequiredFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + case 16: { + result.hasDummy2 = input.ReadInt32(ref result.dummy2_); + break; + } + case 24: { + result.hasB = input.ReadInt32(ref result.b_); + break; + } + case 32: { + result.hasDummy4 = input.ReadInt32(ref result.dummy4_); + break; + } + case 40: { + result.hasDummy5 = input.ReadInt32(ref result.dummy5_); + break; + } + case 48: { + result.hasDummy6 = input.ReadInt32(ref result.dummy6_); + break; + } + case 56: { + result.hasDummy7 = input.ReadInt32(ref result.dummy7_); + break; + } + case 64: { + result.hasDummy8 = input.ReadInt32(ref result.dummy8_); + break; + } + case 72: { + result.hasDummy9 = input.ReadInt32(ref result.dummy9_); + break; + } + case 80: { + result.hasDummy10 = input.ReadInt32(ref result.dummy10_); + break; + } + case 88: { + result.hasDummy11 = input.ReadInt32(ref result.dummy11_); + break; + } + case 96: { + result.hasDummy12 = input.ReadInt32(ref result.dummy12_); + break; + } + case 104: { + result.hasDummy13 = input.ReadInt32(ref result.dummy13_); + break; + } + case 112: { + result.hasDummy14 = input.ReadInt32(ref result.dummy14_); + break; + } + case 120: { + result.hasDummy15 = input.ReadInt32(ref result.dummy15_); + break; + } + case 128: { + result.hasDummy16 = input.ReadInt32(ref result.dummy16_); + break; + } + case 136: { + result.hasDummy17 = input.ReadInt32(ref result.dummy17_); + break; + } + case 144: { + result.hasDummy18 = input.ReadInt32(ref result.dummy18_); + break; + } + case 152: { + result.hasDummy19 = input.ReadInt32(ref result.dummy19_); + break; + } + case 160: { + result.hasDummy20 = input.ReadInt32(ref result.dummy20_); + break; + } + case 168: { + result.hasDummy21 = input.ReadInt32(ref result.dummy21_); + break; + } + case 176: { + result.hasDummy22 = input.ReadInt32(ref result.dummy22_); + break; + } + case 184: { + result.hasDummy23 = input.ReadInt32(ref result.dummy23_); + break; + } + case 192: { + result.hasDummy24 = input.ReadInt32(ref result.dummy24_); + break; + } + case 200: { + result.hasDummy25 = input.ReadInt32(ref result.dummy25_); + break; + } + case 208: { + result.hasDummy26 = input.ReadInt32(ref result.dummy26_); + break; + } + case 216: { + result.hasDummy27 = input.ReadInt32(ref result.dummy27_); + break; + } + case 224: { + result.hasDummy28 = input.ReadInt32(ref result.dummy28_); + break; + } + case 232: { + result.hasDummy29 = input.ReadInt32(ref result.dummy29_); + break; + } + case 240: { + result.hasDummy30 = input.ReadInt32(ref result.dummy30_); + break; + } + case 248: { + result.hasDummy31 = input.ReadInt32(ref result.dummy31_); + break; + } + case 256: { + result.hasDummy32 = input.ReadInt32(ref result.dummy32_); + break; + } + case 264: { + result.hasC = input.ReadInt32(ref result.c_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + + public bool HasDummy2 { + get { return result.hasDummy2; } + } + public int Dummy2 { + get { return result.Dummy2; } + set { SetDummy2(value); } + } + public Builder SetDummy2(int value) { + PrepareBuilder(); + result.hasDummy2 = true; + result.dummy2_ = value; + return this; + } + public Builder ClearDummy2() { + PrepareBuilder(); + result.hasDummy2 = false; + result.dummy2_ = 0; + return this; + } + + public bool HasB { + get { return result.hasB; } + } + public int B { + get { return result.B; } + set { SetB(value); } + } + public Builder SetB(int value) { + PrepareBuilder(); + result.hasB = true; + result.b_ = value; + return this; + } + public Builder ClearB() { + PrepareBuilder(); + result.hasB = false; + result.b_ = 0; + return this; + } + + public bool HasDummy4 { + get { return result.hasDummy4; } + } + public int Dummy4 { + get { return result.Dummy4; } + set { SetDummy4(value); } + } + public Builder SetDummy4(int value) { + PrepareBuilder(); + result.hasDummy4 = true; + result.dummy4_ = value; + return this; + } + public Builder ClearDummy4() { + PrepareBuilder(); + result.hasDummy4 = false; + result.dummy4_ = 0; + return this; + } + + public bool HasDummy5 { + get { return result.hasDummy5; } + } + public int Dummy5 { + get { return result.Dummy5; } + set { SetDummy5(value); } + } + public Builder SetDummy5(int value) { + PrepareBuilder(); + result.hasDummy5 = true; + result.dummy5_ = value; + return this; + } + public Builder ClearDummy5() { + PrepareBuilder(); + result.hasDummy5 = false; + result.dummy5_ = 0; + return this; + } + + public bool HasDummy6 { + get { return result.hasDummy6; } + } + public int Dummy6 { + get { return result.Dummy6; } + set { SetDummy6(value); } + } + public Builder SetDummy6(int value) { + PrepareBuilder(); + result.hasDummy6 = true; + result.dummy6_ = value; + return this; + } + public Builder ClearDummy6() { + PrepareBuilder(); + result.hasDummy6 = false; + result.dummy6_ = 0; + return this; + } + + public bool HasDummy7 { + get { return result.hasDummy7; } + } + public int Dummy7 { + get { return result.Dummy7; } + set { SetDummy7(value); } + } + public Builder SetDummy7(int value) { + PrepareBuilder(); + result.hasDummy7 = true; + result.dummy7_ = value; + return this; + } + public Builder ClearDummy7() { + PrepareBuilder(); + result.hasDummy7 = false; + result.dummy7_ = 0; + return this; + } + + public bool HasDummy8 { + get { return result.hasDummy8; } + } + public int Dummy8 { + get { return result.Dummy8; } + set { SetDummy8(value); } + } + public Builder SetDummy8(int value) { + PrepareBuilder(); + result.hasDummy8 = true; + result.dummy8_ = value; + return this; + } + public Builder ClearDummy8() { + PrepareBuilder(); + result.hasDummy8 = false; + result.dummy8_ = 0; + return this; + } + + public bool HasDummy9 { + get { return result.hasDummy9; } + } + public int Dummy9 { + get { return result.Dummy9; } + set { SetDummy9(value); } + } + public Builder SetDummy9(int value) { + PrepareBuilder(); + result.hasDummy9 = true; + result.dummy9_ = value; + return this; + } + public Builder ClearDummy9() { + PrepareBuilder(); + result.hasDummy9 = false; + result.dummy9_ = 0; + return this; + } + + public bool HasDummy10 { + get { return result.hasDummy10; } + } + public int Dummy10 { + get { return result.Dummy10; } + set { SetDummy10(value); } + } + public Builder SetDummy10(int value) { + PrepareBuilder(); + result.hasDummy10 = true; + result.dummy10_ = value; + return this; + } + public Builder ClearDummy10() { + PrepareBuilder(); + result.hasDummy10 = false; + result.dummy10_ = 0; + return this; + } + + public bool HasDummy11 { + get { return result.hasDummy11; } + } + public int Dummy11 { + get { return result.Dummy11; } + set { SetDummy11(value); } + } + public Builder SetDummy11(int value) { + PrepareBuilder(); + result.hasDummy11 = true; + result.dummy11_ = value; + return this; + } + public Builder ClearDummy11() { + PrepareBuilder(); + result.hasDummy11 = false; + result.dummy11_ = 0; + return this; + } + + public bool HasDummy12 { + get { return result.hasDummy12; } + } + public int Dummy12 { + get { return result.Dummy12; } + set { SetDummy12(value); } + } + public Builder SetDummy12(int value) { + PrepareBuilder(); + result.hasDummy12 = true; + result.dummy12_ = value; + return this; + } + public Builder ClearDummy12() { + PrepareBuilder(); + result.hasDummy12 = false; + result.dummy12_ = 0; + return this; + } + + public bool HasDummy13 { + get { return result.hasDummy13; } + } + public int Dummy13 { + get { return result.Dummy13; } + set { SetDummy13(value); } + } + public Builder SetDummy13(int value) { + PrepareBuilder(); + result.hasDummy13 = true; + result.dummy13_ = value; + return this; + } + public Builder ClearDummy13() { + PrepareBuilder(); + result.hasDummy13 = false; + result.dummy13_ = 0; + return this; + } + + public bool HasDummy14 { + get { return result.hasDummy14; } + } + public int Dummy14 { + get { return result.Dummy14; } + set { SetDummy14(value); } + } + public Builder SetDummy14(int value) { + PrepareBuilder(); + result.hasDummy14 = true; + result.dummy14_ = value; + return this; + } + public Builder ClearDummy14() { + PrepareBuilder(); + result.hasDummy14 = false; + result.dummy14_ = 0; + return this; + } + + public bool HasDummy15 { + get { return result.hasDummy15; } + } + public int Dummy15 { + get { return result.Dummy15; } + set { SetDummy15(value); } + } + public Builder SetDummy15(int value) { + PrepareBuilder(); + result.hasDummy15 = true; + result.dummy15_ = value; + return this; + } + public Builder ClearDummy15() { + PrepareBuilder(); + result.hasDummy15 = false; + result.dummy15_ = 0; + return this; + } + + public bool HasDummy16 { + get { return result.hasDummy16; } + } + public int Dummy16 { + get { return result.Dummy16; } + set { SetDummy16(value); } + } + public Builder SetDummy16(int value) { + PrepareBuilder(); + result.hasDummy16 = true; + result.dummy16_ = value; + return this; + } + public Builder ClearDummy16() { + PrepareBuilder(); + result.hasDummy16 = false; + result.dummy16_ = 0; + return this; + } + + public bool HasDummy17 { + get { return result.hasDummy17; } + } + public int Dummy17 { + get { return result.Dummy17; } + set { SetDummy17(value); } + } + public Builder SetDummy17(int value) { + PrepareBuilder(); + result.hasDummy17 = true; + result.dummy17_ = value; + return this; + } + public Builder ClearDummy17() { + PrepareBuilder(); + result.hasDummy17 = false; + result.dummy17_ = 0; + return this; + } + + public bool HasDummy18 { + get { return result.hasDummy18; } + } + public int Dummy18 { + get { return result.Dummy18; } + set { SetDummy18(value); } + } + public Builder SetDummy18(int value) { + PrepareBuilder(); + result.hasDummy18 = true; + result.dummy18_ = value; + return this; + } + public Builder ClearDummy18() { + PrepareBuilder(); + result.hasDummy18 = false; + result.dummy18_ = 0; + return this; + } + + public bool HasDummy19 { + get { return result.hasDummy19; } + } + public int Dummy19 { + get { return result.Dummy19; } + set { SetDummy19(value); } + } + public Builder SetDummy19(int value) { + PrepareBuilder(); + result.hasDummy19 = true; + result.dummy19_ = value; + return this; + } + public Builder ClearDummy19() { + PrepareBuilder(); + result.hasDummy19 = false; + result.dummy19_ = 0; + return this; + } + + public bool HasDummy20 { + get { return result.hasDummy20; } + } + public int Dummy20 { + get { return result.Dummy20; } + set { SetDummy20(value); } + } + public Builder SetDummy20(int value) { + PrepareBuilder(); + result.hasDummy20 = true; + result.dummy20_ = value; + return this; + } + public Builder ClearDummy20() { + PrepareBuilder(); + result.hasDummy20 = false; + result.dummy20_ = 0; + return this; + } + + public bool HasDummy21 { + get { return result.hasDummy21; } + } + public int Dummy21 { + get { return result.Dummy21; } + set { SetDummy21(value); } + } + public Builder SetDummy21(int value) { + PrepareBuilder(); + result.hasDummy21 = true; + result.dummy21_ = value; + return this; + } + public Builder ClearDummy21() { + PrepareBuilder(); + result.hasDummy21 = false; + result.dummy21_ = 0; + return this; + } + + public bool HasDummy22 { + get { return result.hasDummy22; } + } + public int Dummy22 { + get { return result.Dummy22; } + set { SetDummy22(value); } + } + public Builder SetDummy22(int value) { + PrepareBuilder(); + result.hasDummy22 = true; + result.dummy22_ = value; + return this; + } + public Builder ClearDummy22() { + PrepareBuilder(); + result.hasDummy22 = false; + result.dummy22_ = 0; + return this; + } + + public bool HasDummy23 { + get { return result.hasDummy23; } + } + public int Dummy23 { + get { return result.Dummy23; } + set { SetDummy23(value); } + } + public Builder SetDummy23(int value) { + PrepareBuilder(); + result.hasDummy23 = true; + result.dummy23_ = value; + return this; + } + public Builder ClearDummy23() { + PrepareBuilder(); + result.hasDummy23 = false; + result.dummy23_ = 0; + return this; + } + + public bool HasDummy24 { + get { return result.hasDummy24; } + } + public int Dummy24 { + get { return result.Dummy24; } + set { SetDummy24(value); } + } + public Builder SetDummy24(int value) { + PrepareBuilder(); + result.hasDummy24 = true; + result.dummy24_ = value; + return this; + } + public Builder ClearDummy24() { + PrepareBuilder(); + result.hasDummy24 = false; + result.dummy24_ = 0; + return this; + } + + public bool HasDummy25 { + get { return result.hasDummy25; } + } + public int Dummy25 { + get { return result.Dummy25; } + set { SetDummy25(value); } + } + public Builder SetDummy25(int value) { + PrepareBuilder(); + result.hasDummy25 = true; + result.dummy25_ = value; + return this; + } + public Builder ClearDummy25() { + PrepareBuilder(); + result.hasDummy25 = false; + result.dummy25_ = 0; + return this; + } + + public bool HasDummy26 { + get { return result.hasDummy26; } + } + public int Dummy26 { + get { return result.Dummy26; } + set { SetDummy26(value); } + } + public Builder SetDummy26(int value) { + PrepareBuilder(); + result.hasDummy26 = true; + result.dummy26_ = value; + return this; + } + public Builder ClearDummy26() { + PrepareBuilder(); + result.hasDummy26 = false; + result.dummy26_ = 0; + return this; + } + + public bool HasDummy27 { + get { return result.hasDummy27; } + } + public int Dummy27 { + get { return result.Dummy27; } + set { SetDummy27(value); } + } + public Builder SetDummy27(int value) { + PrepareBuilder(); + result.hasDummy27 = true; + result.dummy27_ = value; + return this; + } + public Builder ClearDummy27() { + PrepareBuilder(); + result.hasDummy27 = false; + result.dummy27_ = 0; + return this; + } + + public bool HasDummy28 { + get { return result.hasDummy28; } + } + public int Dummy28 { + get { return result.Dummy28; } + set { SetDummy28(value); } + } + public Builder SetDummy28(int value) { + PrepareBuilder(); + result.hasDummy28 = true; + result.dummy28_ = value; + return this; + } + public Builder ClearDummy28() { + PrepareBuilder(); + result.hasDummy28 = false; + result.dummy28_ = 0; + return this; + } + + public bool HasDummy29 { + get { return result.hasDummy29; } + } + public int Dummy29 { + get { return result.Dummy29; } + set { SetDummy29(value); } + } + public Builder SetDummy29(int value) { + PrepareBuilder(); + result.hasDummy29 = true; + result.dummy29_ = value; + return this; + } + public Builder ClearDummy29() { + PrepareBuilder(); + result.hasDummy29 = false; + result.dummy29_ = 0; + return this; + } + + public bool HasDummy30 { + get { return result.hasDummy30; } + } + public int Dummy30 { + get { return result.Dummy30; } + set { SetDummy30(value); } + } + public Builder SetDummy30(int value) { + PrepareBuilder(); + result.hasDummy30 = true; + result.dummy30_ = value; + return this; + } + public Builder ClearDummy30() { + PrepareBuilder(); + result.hasDummy30 = false; + result.dummy30_ = 0; + return this; + } + + public bool HasDummy31 { + get { return result.hasDummy31; } + } + public int Dummy31 { + get { return result.Dummy31; } + set { SetDummy31(value); } + } + public Builder SetDummy31(int value) { + PrepareBuilder(); + result.hasDummy31 = true; + result.dummy31_ = value; + return this; + } + public Builder ClearDummy31() { + PrepareBuilder(); + result.hasDummy31 = false; + result.dummy31_ = 0; + return this; + } + + public bool HasDummy32 { + get { return result.hasDummy32; } + } + public int Dummy32 { + get { return result.Dummy32; } + set { SetDummy32(value); } + } + public Builder SetDummy32(int value) { + PrepareBuilder(); + result.hasDummy32 = true; + result.dummy32_ = value; + return this; + } + public Builder ClearDummy32() { + PrepareBuilder(); + result.hasDummy32 = false; + result.dummy32_ = 0; + return this; + } + + public bool HasC { + get { return result.hasC; } + } + public int C { + get { return result.C; } + set { SetC(value); } + } + public Builder SetC(int value) { + PrepareBuilder(); + result.hasC = true; + result.c_ = value; + return this; + } + public Builder ClearC() { + PrepareBuilder(); + result.hasC = false; + result.c_ = 0; + return this; + } + } + static TestRequired() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRequiredForeign : pb::GeneratedMessage { + private TestRequiredForeign() { } + private static readonly TestRequiredForeign defaultInstance = new TestRequiredForeign().MakeReadOnly(); + private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; + private static readonly uint[] _testRequiredForeignFieldTags = new uint[] { 24, 10, 18 }; + public static TestRequiredForeign DefaultInstance { + get { return defaultInstance; } + } + + public override TestRequiredForeign DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRequiredForeign ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequiredForeign__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequiredForeign__FieldAccessorTable; } + } + + public const int OptionalMessageFieldNumber = 1; + private bool hasOptionalMessage; + private global::Google.ProtocolBuffers.TestProtos.TestRequired optionalMessage_; + public bool HasOptionalMessage { + get { return hasOptionalMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired OptionalMessage { + get { return optionalMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; } + } + + public const int RepeatedMessageFieldNumber = 2; + private pbc::PopsicleList repeatedMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedMessageList { + get { return repeatedMessage_; } + } + public int RepeatedMessageCount { + get { return repeatedMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired GetRepeatedMessage(int index) { + return repeatedMessage_[index]; + } + + public const int DummyFieldNumber = 3; + private bool hasDummy; + private int dummy_; + public bool HasDummy { + get { return hasDummy; } + } + public int Dummy { + get { return dummy_; } + } + + public override bool IsInitialized { + get { + if (HasOptionalMessage) { + if (!OptionalMessage.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestRequired element in RepeatedMessageList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRequiredForeignFieldNames; + if (hasOptionalMessage) { + output.WriteMessage(1, field_names[1], OptionalMessage); + } + if (repeatedMessage_.Count > 0) { + output.WriteMessageArray(2, field_names[2], repeatedMessage_); + } + if (hasDummy) { + output.WriteInt32(3, field_names[0], Dummy); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalMessage); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestRequired element in RepeatedMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + if (hasDummy) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Dummy); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRequiredForeign ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRequiredForeign ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRequiredForeign ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRequiredForeign MakeReadOnly() { + repeatedMessage_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRequiredForeign prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRequiredForeign cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRequiredForeign result; + + private TestRequiredForeign PrepareBuilder() { + if (resultIsReadOnly) { + TestRequiredForeign original = result; + result = new TestRequiredForeign(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRequiredForeign MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.Descriptor; } + } + + public override TestRequiredForeign DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.DefaultInstance; } + } + + public override TestRequiredForeign BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRequiredForeign) { + return MergeFrom((TestRequiredForeign) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRequiredForeign other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalMessage) { + MergeOptionalMessage(other.OptionalMessage); + } + if (other.repeatedMessage_.Count != 0) { + result.repeatedMessage_.Add(other.repeatedMessage_); + } + if (other.HasDummy) { + Dummy = other.Dummy; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRequiredForeignFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRequiredForeignFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestRequired.CreateBuilder(); + if (result.hasOptionalMessage) { + subBuilder.MergeFrom(OptionalMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalMessage = subBuilder.BuildPartial(); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.repeatedMessage_, global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance, extensionRegistry); + break; + } + case 24: { + result.hasDummy = input.ReadInt32(ref result.dummy_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalMessage { + get { return result.hasOptionalMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired OptionalMessage { + get { return result.OptionalMessage; } + set { SetOptionalMessage(value); } + } + public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalMessage = true; + result.optionalMessage_ = value; + return this; + } + public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalMessage = true; + result.optionalMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalMessage && + result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) { + result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalMessage_ = value; + } + result.hasOptionalMessage = true; + return this; + } + public Builder ClearOptionalMessage() { + PrepareBuilder(); + result.hasOptionalMessage = false; + result.optionalMessage_ = null; + return this; + } + + public pbc::IPopsicleList RepeatedMessageList { + get { return PrepareBuilder().repeatedMessage_; } + } + public int RepeatedMessageCount { + get { return result.RepeatedMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired GetRepeatedMessage(int index) { + return result.GetRepeatedMessage(index); + } + public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessage_[index] = value; + return this; + } + public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessage_.Add(value); + return this; + } + public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedMessage_.Add(values); + return this; + } + public Builder ClearRepeatedMessage() { + PrepareBuilder(); + result.repeatedMessage_.Clear(); + return this; + } + + public bool HasDummy { + get { return result.hasDummy; } + } + public int Dummy { + get { return result.Dummy; } + set { SetDummy(value); } + } + public Builder SetDummy(int value) { + PrepareBuilder(); + result.hasDummy = true; + result.dummy_ = value; + return this; + } + public Builder ClearDummy() { + PrepareBuilder(); + result.hasDummy = false; + result.dummy_ = 0; + return this; + } + } + static TestRequiredForeign() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestForeignNested : pb::GeneratedMessage { + private TestForeignNested() { } + private static readonly TestForeignNested defaultInstance = new TestForeignNested().MakeReadOnly(); + private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; + private static readonly uint[] _testForeignNestedFieldTags = new uint[] { 10 }; + public static TestForeignNested DefaultInstance { + get { return defaultInstance; } + } + + public override TestForeignNested DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestForeignNested ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestForeignNested__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable; } + } + + public const int ForeignNestedFieldNumber = 1; + private bool hasForeignNested; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_; + public bool HasForeignNested { + get { return hasForeignNested; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { + get { return foreignNested_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testForeignNestedFieldNames; + if (hasForeignNested) { + output.WriteMessage(1, field_names[0], ForeignNested); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasForeignNested) { + size += pb::CodedOutputStream.ComputeMessageSize(1, ForeignNested); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestForeignNested ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestForeignNested ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestForeignNested ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestForeignNested ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestForeignNested ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestForeignNested ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestForeignNested ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestForeignNested ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestForeignNested ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestForeignNested ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestForeignNested MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestForeignNested prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestForeignNested cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestForeignNested result; + + private TestForeignNested PrepareBuilder() { + if (resultIsReadOnly) { + TestForeignNested original = result; + result = new TestForeignNested(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestForeignNested MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestForeignNested.Descriptor; } + } + + public override TestForeignNested DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestForeignNested.DefaultInstance; } + } + + public override TestForeignNested BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestForeignNested) { + return MergeFrom((TestForeignNested) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestForeignNested other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestForeignNested.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasForeignNested) { + MergeForeignNested(other.ForeignNested); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testForeignNestedFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testForeignNestedFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(); + if (result.hasForeignNested) { + subBuilder.MergeFrom(ForeignNested); + } + input.ReadMessage(subBuilder, extensionRegistry); + ForeignNested = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasForeignNested { + get { return result.hasForeignNested; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { + get { return result.ForeignNested; } + set { SetForeignNested(value); } + } + public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasForeignNested = true; + result.foreignNested_ = value; + return this; + } + public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasForeignNested = true; + result.foreignNested_ = builderForValue.Build(); + return this; + } + public Builder MergeForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasForeignNested && + result.foreignNested_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { + result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.foreignNested_).MergeFrom(value).BuildPartial(); + } else { + result.foreignNested_ = value; + } + result.hasForeignNested = true; + return this; + } + public Builder ClearForeignNested() { + PrepareBuilder(); + result.hasForeignNested = false; + result.foreignNested_ = null; + return this; + } + } + static TestForeignNested() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestEmptyMessage : pb::GeneratedMessage { + private TestEmptyMessage() { } + private static readonly TestEmptyMessage defaultInstance = new TestEmptyMessage().MakeReadOnly(); + private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; + private static readonly uint[] _testEmptyMessageFieldTags = new uint[] { }; + public static TestEmptyMessage DefaultInstance { + get { return defaultInstance; } + } + + public override TestEmptyMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestEmptyMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessage__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testEmptyMessageFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestEmptyMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestEmptyMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestEmptyMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestEmptyMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestEmptyMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestEmptyMessage result; + + private TestEmptyMessage PrepareBuilder() { + if (resultIsReadOnly) { + TestEmptyMessage original = result; + result = new TestEmptyMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestEmptyMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.Descriptor; } + } + + public override TestEmptyMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.DefaultInstance; } + } + + public override TestEmptyMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestEmptyMessage) { + return MergeFrom((TestEmptyMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestEmptyMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testEmptyMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testEmptyMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestEmptyMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { + private TestEmptyMessageWithExtensions() { } + private static readonly TestEmptyMessageWithExtensions defaultInstance = new TestEmptyMessageWithExtensions().MakeReadOnly(); + private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testEmptyMessageWithExtensionsFieldTags = new uint[] { }; + public static TestEmptyMessageWithExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestEmptyMessageWithExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestEmptyMessageWithExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testEmptyMessageWithExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestEmptyMessageWithExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestEmptyMessageWithExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestEmptyMessageWithExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestEmptyMessageWithExtensions result; + + private TestEmptyMessageWithExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestEmptyMessageWithExtensions original = result; + result = new TestEmptyMessageWithExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestEmptyMessageWithExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.Descriptor; } + } + + public override TestEmptyMessageWithExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.DefaultInstance; } + } + + public override TestEmptyMessageWithExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestEmptyMessageWithExtensions) { + return MergeFrom((TestEmptyMessageWithExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestEmptyMessageWithExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testEmptyMessageWithExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testEmptyMessageWithExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestEmptyMessageWithExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { + private TestMultipleExtensionRanges() { } + private static readonly TestMultipleExtensionRanges defaultInstance = new TestMultipleExtensionRanges().MakeReadOnly(); + private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; + private static readonly uint[] _testMultipleExtensionRangesFieldTags = new uint[] { }; + public static TestMultipleExtensionRanges DefaultInstance { + get { return defaultInstance; } + } + + public override TestMultipleExtensionRanges DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMultipleExtensionRanges ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMultipleExtensionRanges__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMultipleExtensionRangesFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(43, output); + extensionWriter.WriteUntil(4244, output); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMultipleExtensionRanges ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMultipleExtensionRanges MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMultipleExtensionRanges prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMultipleExtensionRanges cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMultipleExtensionRanges result; + + private TestMultipleExtensionRanges PrepareBuilder() { + if (resultIsReadOnly) { + TestMultipleExtensionRanges original = result; + result = new TestMultipleExtensionRanges(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMultipleExtensionRanges MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.Descriptor; } + } + + public override TestMultipleExtensionRanges DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.DefaultInstance; } + } + + public override TestMultipleExtensionRanges BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMultipleExtensionRanges) { + return MergeFrom((TestMultipleExtensionRanges) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMultipleExtensionRanges other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMultipleExtensionRangesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMultipleExtensionRangesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestMultipleExtensionRanges() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { + private TestReallyLargeTagNumber() { } + private static readonly TestReallyLargeTagNumber defaultInstance = new TestReallyLargeTagNumber().MakeReadOnly(); + private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; + private static readonly uint[] _testReallyLargeTagNumberFieldTags = new uint[] { 8, 2147483640 }; + public static TestReallyLargeTagNumber DefaultInstance { + get { return defaultInstance; } + } + + public override TestReallyLargeTagNumber DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestReallyLargeTagNumber ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public const int BbFieldNumber = 268435455; + private bool hasBb; + private int bb_; + public bool HasBb { + get { return hasBb; } + } + public int Bb { + get { return bb_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testReallyLargeTagNumberFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + if (hasBb) { + output.WriteInt32(268435455, field_names[1], Bb); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + if (hasBb) { + size += pb::CodedOutputStream.ComputeInt32Size(268435455, Bb); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestReallyLargeTagNumber ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestReallyLargeTagNumber MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestReallyLargeTagNumber prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestReallyLargeTagNumber cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestReallyLargeTagNumber result; + + private TestReallyLargeTagNumber PrepareBuilder() { + if (resultIsReadOnly) { + TestReallyLargeTagNumber original = result; + result = new TestReallyLargeTagNumber(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestReallyLargeTagNumber MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.Descriptor; } + } + + public override TestReallyLargeTagNumber DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.DefaultInstance; } + } + + public override TestReallyLargeTagNumber BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestReallyLargeTagNumber) { + return MergeFrom((TestReallyLargeTagNumber) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestReallyLargeTagNumber other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + if (other.HasBb) { + Bb = other.Bb; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testReallyLargeTagNumberFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testReallyLargeTagNumberFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + case 2147483640: { + result.hasBb = input.ReadInt32(ref result.bb_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + + public bool HasBb { + get { return result.hasBb; } + } + public int Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(int value) { + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = 0; + return this; + } + } + static TestReallyLargeTagNumber() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { + private TestRecursiveMessage() { } + private static readonly TestRecursiveMessage defaultInstance = new TestRecursiveMessage().MakeReadOnly(); + private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; + private static readonly uint[] _testRecursiveMessageFieldTags = new uint[] { 10, 16 }; + public static TestRecursiveMessage DefaultInstance { + get { return defaultInstance; } + } + + public override TestRecursiveMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRecursiveMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage a_; + public bool HasA { + get { return hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage A { + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; } + } + + public const int IFieldNumber = 2; + private bool hasI; + private int i_; + public bool HasI { + get { return hasI; } + } + public int I { + get { return i_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRecursiveMessageFieldNames; + if (hasA) { + output.WriteMessage(1, field_names[0], A); + } + if (hasI) { + output.WriteInt32(2, field_names[1], I); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeMessageSize(1, A); + } + if (hasI) { + size += pb::CodedOutputStream.ComputeInt32Size(2, I); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRecursiveMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRecursiveMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRecursiveMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRecursiveMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRecursiveMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRecursiveMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRecursiveMessage result; + + private TestRecursiveMessage PrepareBuilder() { + if (resultIsReadOnly) { + TestRecursiveMessage original = result; + result = new TestRecursiveMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRecursiveMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Descriptor; } + } + + public override TestRecursiveMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; } + } + + public override TestRecursiveMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRecursiveMessage) { + return MergeFrom((TestRecursiveMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRecursiveMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + MergeA(other.A); + } + if (other.HasI) { + I = other.I; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRecursiveMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRecursiveMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.CreateBuilder(); + if (result.hasA) { + subBuilder.MergeFrom(A); + } + input.ReadMessage(subBuilder, extensionRegistry); + A = subBuilder.BuildPartial(); + break; + } + case 16: { + result.hasI = input.ReadInt32(ref result.i_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasA = true; + result.a_ = builderForValue.Build(); + return this; + } + public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasA && + result.a_ != global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) { + result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); + } else { + result.a_ = value; + } + result.hasA = true; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = null; + return this; + } + + public bool HasI { + get { return result.hasI; } + } + public int I { + get { return result.I; } + set { SetI(value); } + } + public Builder SetI(int value) { + PrepareBuilder(); + result.hasI = true; + result.i_ = value; + return this; + } + public Builder ClearI() { + PrepareBuilder(); + result.hasI = false; + result.i_ = 0; + return this; + } + } + static TestRecursiveMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { + private TestMutualRecursionA() { } + private static readonly TestMutualRecursionA defaultInstance = new TestMutualRecursionA().MakeReadOnly(); + private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; + private static readonly uint[] _testMutualRecursionAFieldTags = new uint[] { 10 }; + public static TestMutualRecursionA DefaultInstance { + get { return defaultInstance; } + } + + public override TestMutualRecursionA DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMutualRecursionA ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable; } + } + + public const int BbFieldNumber = 1; + private bool hasBb; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB bb_; + public bool HasBb { + get { return hasBb; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB Bb { + get { return bb_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMutualRecursionAFieldNames; + if (hasBb) { + output.WriteMessage(1, field_names[0], Bb); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasBb) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Bb); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMutualRecursionA ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionA ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMutualRecursionA ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMutualRecursionA MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMutualRecursionA prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMutualRecursionA cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMutualRecursionA result; + + private TestMutualRecursionA PrepareBuilder() { + if (resultIsReadOnly) { + TestMutualRecursionA original = result; + result = new TestMutualRecursionA(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMutualRecursionA MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Descriptor; } + } + + public override TestMutualRecursionA DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; } + } + + public override TestMutualRecursionA BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMutualRecursionA) { + return MergeFrom((TestMutualRecursionA) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMutualRecursionA other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasBb) { + MergeBb(other.Bb); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMutualRecursionAFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMutualRecursionAFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.CreateBuilder(); + if (result.hasBb) { + subBuilder.MergeFrom(Bb); + } + input.ReadMessage(subBuilder, extensionRegistry); + Bb = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasBb { + get { return result.hasBb; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasBb = true; + result.bb_ = builderForValue.Build(); + return this; + } + public Builder MergeBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasBb && + result.bb_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) { + result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.CreateBuilder(result.bb_).MergeFrom(value).BuildPartial(); + } else { + result.bb_ = value; + } + result.hasBb = true; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = null; + return this; + } + } + static TestMutualRecursionA() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { + private TestMutualRecursionB() { } + private static readonly TestMutualRecursionB defaultInstance = new TestMutualRecursionB().MakeReadOnly(); + private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; + private static readonly uint[] _testMutualRecursionBFieldTags = new uint[] { 10, 16 }; + public static TestMutualRecursionB DefaultInstance { + get { return defaultInstance; } + } + + public override TestMutualRecursionB DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMutualRecursionB ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA a_; + public bool HasA { + get { return hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA A { + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; } + } + + public const int OptionalInt32FieldNumber = 2; + private bool hasOptionalInt32; + private int optionalInt32_; + public bool HasOptionalInt32 { + get { return hasOptionalInt32; } + } + public int OptionalInt32 { + get { return optionalInt32_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMutualRecursionBFieldNames; + if (hasA) { + output.WriteMessage(1, field_names[0], A); + } + if (hasOptionalInt32) { + output.WriteInt32(2, field_names[1], OptionalInt32); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeMessageSize(1, A); + } + if (hasOptionalInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(2, OptionalInt32); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMutualRecursionB ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionB ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMutualRecursionB ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMutualRecursionB MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMutualRecursionB prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMutualRecursionB cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMutualRecursionB result; + + private TestMutualRecursionB PrepareBuilder() { + if (resultIsReadOnly) { + TestMutualRecursionB original = result; + result = new TestMutualRecursionB(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMutualRecursionB MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Descriptor; } + } + + public override TestMutualRecursionB DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; } + } + + public override TestMutualRecursionB BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMutualRecursionB) { + return MergeFrom((TestMutualRecursionB) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMutualRecursionB other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + MergeA(other.A); + } + if (other.HasOptionalInt32) { + OptionalInt32 = other.OptionalInt32; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMutualRecursionBFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMutualRecursionBFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.CreateBuilder(); + if (result.hasA) { + subBuilder.MergeFrom(A); + } + input.ReadMessage(subBuilder, extensionRegistry); + A = subBuilder.BuildPartial(); + break; + } + case 16: { + result.hasOptionalInt32 = input.ReadInt32(ref result.optionalInt32_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasA = true; + result.a_ = builderForValue.Build(); + return this; + } + public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasA && + result.a_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) { + result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); + } else { + result.a_ = value; + } + result.hasA = true; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = null; + return this; + } + + public bool HasOptionalInt32 { + get { return result.hasOptionalInt32; } + } + public int OptionalInt32 { + get { return result.OptionalInt32; } + set { SetOptionalInt32(value); } + } + public Builder SetOptionalInt32(int value) { + PrepareBuilder(); + result.hasOptionalInt32 = true; + result.optionalInt32_ = value; + return this; + } + public Builder ClearOptionalInt32() { + PrepareBuilder(); + result.hasOptionalInt32 = false; + result.optionalInt32_ = 0; + return this; + } + } + static TestMutualRecursionB() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { + private TestDupFieldNumber() { } + private static readonly TestDupFieldNumber defaultInstance = new TestDupFieldNumber().MakeReadOnly(); + private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; + private static readonly uint[] _testDupFieldNumberFieldTags = new uint[] { 8, 27, 19 }; + public static TestDupFieldNumber DefaultInstance { + get { return defaultInstance; } + } + + public override TestDupFieldNumber DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDupFieldNumber ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Foo : pb::GeneratedMessage { + private Foo() { } + private static readonly Foo defaultInstance = new Foo().MakeReadOnly(); + private static readonly string[] _fooFieldNames = new string[] { "a" }; + private static readonly uint[] _fooFieldTags = new uint[] { 8 }; + public static Foo DefaultInstance { + get { return defaultInstance; } + } + + public override Foo DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Foo ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Foo__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fooFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Foo ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Foo ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Foo ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Foo ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Foo ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Foo ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Foo ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Foo ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Foo ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Foo ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Foo MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Foo prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Foo cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Foo result; + + private Foo PrepareBuilder() { + if (resultIsReadOnly) { + Foo original = result; + result = new Foo(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Foo MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Descriptor; } + } + + public override Foo DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; } + } + + public override Foo BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Foo) { + return MergeFrom((Foo) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Foo other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fooFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fooFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static Foo() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Bar : pb::GeneratedMessage { + private Bar() { } + private static readonly Bar defaultInstance = new Bar().MakeReadOnly(); + private static readonly string[] _barFieldNames = new string[] { "a" }; + private static readonly uint[] _barFieldTags = new uint[] { 8 }; + public static Bar DefaultInstance { + get { return defaultInstance; } + } + + public override Bar DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Bar ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Bar__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _barFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Bar ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Bar ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Bar ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Bar ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Bar ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Bar ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Bar ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Bar ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Bar ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Bar ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Bar MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Bar prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Bar cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Bar result; + + private Bar PrepareBuilder() { + if (resultIsReadOnly) { + Bar original = result; + result = new Bar(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Bar MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Descriptor; } + } + + public override Bar DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; } + } + + public override Bar BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Bar) { + return MergeFrom((Bar) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Bar other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_barFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _barFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static Bar() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public const int FooFieldNumber = 2; + private bool hasFoo; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo foo_; + public bool HasFoo { + get { return hasFoo; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo Foo { + get { return foo_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; } + } + + public const int BarFieldNumber = 3; + private bool hasBar; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar bar_; + public bool HasBar { + get { return hasBar; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar Bar { + get { return bar_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDupFieldNumberFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + if (hasFoo) { + output.WriteGroup(2, field_names[2], Foo); + } + if (hasBar) { + output.WriteGroup(3, field_names[1], Bar); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + if (hasFoo) { + size += pb::CodedOutputStream.ComputeGroupSize(2, Foo); + } + if (hasBar) { + size += pb::CodedOutputStream.ComputeGroupSize(3, Bar); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestDupFieldNumber ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDupFieldNumber ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDupFieldNumber ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDupFieldNumber MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDupFieldNumber prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDupFieldNumber cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDupFieldNumber result; + + private TestDupFieldNumber PrepareBuilder() { + if (resultIsReadOnly) { + TestDupFieldNumber original = result; + result = new TestDupFieldNumber(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDupFieldNumber MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Descriptor; } + } + + public override TestDupFieldNumber DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.DefaultInstance; } + } + + public override TestDupFieldNumber BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestDupFieldNumber) { + return MergeFrom((TestDupFieldNumber) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDupFieldNumber other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + if (other.HasFoo) { + MergeFoo(other.Foo); + } + if (other.HasBar) { + MergeBar(other.Bar); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDupFieldNumberFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDupFieldNumberFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + case 19: { + global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.CreateBuilder(); + if (result.hasFoo) { + subBuilder.MergeFrom(Foo); + } + input.ReadGroup(2, subBuilder, extensionRegistry); + Foo = subBuilder.BuildPartial(); + break; + } + case 27: { + global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.CreateBuilder(); + if (result.hasBar) { + subBuilder.MergeFrom(Bar); + } + input.ReadGroup(3, subBuilder, extensionRegistry); + Bar = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + + public bool HasFoo { + get { return result.hasFoo; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo Foo { + get { return result.Foo; } + set { SetFoo(value); } + } + public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasFoo = true; + result.foo_ = value; + return this; + } + public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasFoo = true; + result.foo_ = builderForValue.Build(); + return this; + } + public Builder MergeFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasFoo && + result.foo_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) { + result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.CreateBuilder(result.foo_).MergeFrom(value).BuildPartial(); + } else { + result.foo_ = value; + } + result.hasFoo = true; + return this; + } + public Builder ClearFoo() { + PrepareBuilder(); + result.hasFoo = false; + result.foo_ = null; + return this; + } + + public bool HasBar { + get { return result.hasBar; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar Bar { + get { return result.Bar; } + set { SetBar(value); } + } + public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBar = true; + result.bar_ = value; + return this; + } + public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasBar = true; + result.bar_ = builderForValue.Build(); + return this; + } + public Builder MergeBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasBar && + result.bar_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) { + result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.CreateBuilder(result.bar_).MergeFrom(value).BuildPartial(); + } else { + result.bar_ = value; + } + result.hasBar = true; + return this; + } + public Builder ClearBar() { + PrepareBuilder(); + result.hasBar = false; + result.bar_ = null; + return this; + } + } + static TestDupFieldNumber() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { + private TestNestedMessageHasBits() { } + private static readonly TestNestedMessageHasBits defaultInstance = new TestNestedMessageHasBits().MakeReadOnly(); + private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; + private static readonly uint[] _testNestedMessageHasBitsFieldTags = new uint[] { 10 }; + public static TestNestedMessageHasBits DefaultInstance { + get { return defaultInstance; } + } + + public override TestNestedMessageHasBits DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestNestedMessageHasBits ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); + private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; + private static readonly uint[] _nestedMessageFieldTags = new uint[] { 18, 8 }; + public static NestedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override NestedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NestedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__FieldAccessorTable; } + } + + public const int NestedmessageRepeatedInt32FieldNumber = 1; + private pbc::PopsicleList nestedmessageRepeatedInt32_ = new pbc::PopsicleList(); + public scg::IList NestedmessageRepeatedInt32List { + get { return pbc::Lists.AsReadOnly(nestedmessageRepeatedInt32_); } + } + public int NestedmessageRepeatedInt32Count { + get { return nestedmessageRepeatedInt32_.Count; } + } + public int GetNestedmessageRepeatedInt32(int index) { + return nestedmessageRepeatedInt32_[index]; + } + + public const int NestedmessageRepeatedForeignmessageFieldNumber = 2; + private pbc::PopsicleList nestedmessageRepeatedForeignmessage_ = new pbc::PopsicleList(); + public scg::IList NestedmessageRepeatedForeignmessageList { + get { return nestedmessageRepeatedForeignmessage_; } + } + public int NestedmessageRepeatedForeignmessageCount { + get { return nestedmessageRepeatedForeignmessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetNestedmessageRepeatedForeignmessage(int index) { + return nestedmessageRepeatedForeignmessage_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _nestedMessageFieldNames; + if (nestedmessageRepeatedInt32_.Count > 0) { + output.WriteInt32Array(1, field_names[1], nestedmessageRepeatedInt32_); + } + if (nestedmessageRepeatedForeignmessage_.Count > 0) { + output.WriteMessageArray(2, field_names[0], nestedmessageRepeatedForeignmessage_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in NestedmessageRepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * nestedmessageRepeatedInt32_.Count; + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessage element in NestedmessageRepeatedForeignmessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static NestedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NestedMessage MakeReadOnly() { + nestedmessageRepeatedInt32_.MakeReadOnly(); + nestedmessageRepeatedForeignmessage_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NestedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (resultIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NestedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Descriptor; } + } + + public override NestedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; } + } + + public override NestedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NestedMessage) { + return MergeFrom((NestedMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NestedMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.nestedmessageRepeatedInt32_.Count != 0) { + result.nestedmessageRepeatedInt32_.Add(other.nestedmessageRepeatedInt32_); + } + if (other.nestedmessageRepeatedForeignmessage_.Count != 0) { + result.nestedmessageRepeatedForeignmessage_.Add(other.nestedmessageRepeatedForeignmessage_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_nestedMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _nestedMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: + case 8: { + input.ReadInt32Array(tag, field_name, result.nestedmessageRepeatedInt32_); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.nestedmessageRepeatedForeignmessage_, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList NestedmessageRepeatedInt32List { + get { return PrepareBuilder().nestedmessageRepeatedInt32_; } + } + public int NestedmessageRepeatedInt32Count { + get { return result.NestedmessageRepeatedInt32Count; } + } + public int GetNestedmessageRepeatedInt32(int index) { + return result.GetNestedmessageRepeatedInt32(index); + } + public Builder SetNestedmessageRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_[index] = value; + return this; + } + public Builder AddNestedmessageRepeatedInt32(int value) { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_.Add(value); + return this; + } + public Builder AddRangeNestedmessageRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_.Add(values); + return this; + } + public Builder ClearNestedmessageRepeatedInt32() { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList NestedmessageRepeatedForeignmessageList { + get { return PrepareBuilder().nestedmessageRepeatedForeignmessage_; } + } + public int NestedmessageRepeatedForeignmessageCount { + get { return result.NestedmessageRepeatedForeignmessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetNestedmessageRepeatedForeignmessage(int index) { + return result.GetNestedmessageRepeatedForeignmessage(index); + } + public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_[index] = value; + return this; + } + public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Add(value); + return this; + } + public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeNestedmessageRepeatedForeignmessage(scg::IEnumerable values) { + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Add(values); + return this; + } + public Builder ClearNestedmessageRepeatedForeignmessage() { + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Clear(); + return this; + } + } + static NestedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int OptionalNestedMessageFieldNumber = 1; + private bool hasOptionalNestedMessage; + private global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage optionalNestedMessage_; + public bool HasOptionalNestedMessage { + get { return hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage OptionalNestedMessage { + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testNestedMessageHasBitsFieldNames; + if (hasOptionalNestedMessage) { + output.WriteMessage(1, field_names[0], OptionalNestedMessage); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalNestedMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalNestedMessage); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestNestedMessageHasBits ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestNestedMessageHasBits ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestNestedMessageHasBits MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestNestedMessageHasBits prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestNestedMessageHasBits cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestNestedMessageHasBits result; + + private TestNestedMessageHasBits PrepareBuilder() { + if (resultIsReadOnly) { + TestNestedMessageHasBits original = result; + result = new TestNestedMessageHasBits(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestNestedMessageHasBits MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Descriptor; } + } + + public override TestNestedMessageHasBits DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.DefaultInstance; } + } + + public override TestNestedMessageHasBits BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestNestedMessageHasBits) { + return MergeFrom((TestNestedMessageHasBits) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestNestedMessageHasBits other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalNestedMessage) { + MergeOptionalNestedMessage(other.OptionalNestedMessage); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testNestedMessageHasBitsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testNestedMessageHasBitsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.CreateBuilder(); + if (result.hasOptionalNestedMessage) { + subBuilder.MergeFrom(OptionalNestedMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalNestedMessage = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalNestedMessage { + get { return result.hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage OptionalNestedMessage { + get { return result.OptionalNestedMessage; } + set { SetOptionalNestedMessage(value); } + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = value; + return this; + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalNestedMessage && + result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) { + result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalNestedMessage_ = value; + } + result.hasOptionalNestedMessage = true; + return this; + } + public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); + result.hasOptionalNestedMessage = false; + result.optionalNestedMessage_ = null; + return this; + } + } + static TestNestedMessageHasBits() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { + private TestCamelCaseFieldNames() { } + private static readonly TestCamelCaseFieldNames defaultInstance = new TestCamelCaseFieldNames().MakeReadOnly(); + private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; + private static readonly uint[] _testCamelCaseFieldNamesFieldTags = new uint[] { 50, 24, 34, 8, 98, 72, 82, 56, 66, 90, 18, 42 }; + public static TestCamelCaseFieldNames DefaultInstance { + get { return defaultInstance; } + } + + public override TestCamelCaseFieldNames DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestCamelCaseFieldNames ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable; } + } + + public const int PrimitiveFieldFieldNumber = 1; + private bool hasPrimitiveField; + private int primitiveField_; + public bool HasPrimitiveField { + get { return hasPrimitiveField; } + } + public int PrimitiveField { + get { return primitiveField_; } + } + + public const int StringFieldFieldNumber = 2; + private bool hasStringField; + private string stringField_ = ""; + public bool HasStringField { + get { return hasStringField; } + } + public string StringField { + get { return stringField_; } + } + + public const int EnumFieldFieldNumber = 3; + private bool hasEnumField; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum enumField_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + public bool HasEnumField { + get { return hasEnumField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumField { + get { return enumField_; } + } + + public const int MessageFieldFieldNumber = 4; + private bool hasMessageField; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageField_; + public bool HasMessageField { + get { return hasMessageField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageField { + get { return messageField_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public const int StringPieceFieldFieldNumber = 5; + private bool hasStringPieceField; + private string stringPieceField_ = ""; + public bool HasStringPieceField { + get { return hasStringPieceField; } + } + public string StringPieceField { + get { return stringPieceField_; } + } + + public const int CordFieldFieldNumber = 6; + private bool hasCordField; + private string cordField_ = ""; + public bool HasCordField { + get { return hasCordField; } + } + public string CordField { + get { return cordField_; } + } + + public const int RepeatedPrimitiveFieldFieldNumber = 7; + private pbc::PopsicleList repeatedPrimitiveField_ = new pbc::PopsicleList(); + public scg::IList RepeatedPrimitiveFieldList { + get { return pbc::Lists.AsReadOnly(repeatedPrimitiveField_); } + } + public int RepeatedPrimitiveFieldCount { + get { return repeatedPrimitiveField_.Count; } + } + public int GetRepeatedPrimitiveField(int index) { + return repeatedPrimitiveField_[index]; + } + + public const int RepeatedStringFieldFieldNumber = 8; + private pbc::PopsicleList repeatedStringField_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringFieldList { + get { return pbc::Lists.AsReadOnly(repeatedStringField_); } + } + public int RepeatedStringFieldCount { + get { return repeatedStringField_.Count; } + } + public string GetRepeatedStringField(int index) { + return repeatedStringField_[index]; + } + + public const int RepeatedEnumFieldFieldNumber = 9; + private pbc::PopsicleList repeatedEnumField_ = new pbc::PopsicleList(); + public scg::IList RepeatedEnumFieldList { + get { return pbc::Lists.AsReadOnly(repeatedEnumField_); } + } + public int RepeatedEnumFieldCount { + get { return repeatedEnumField_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedEnumField(int index) { + return repeatedEnumField_[index]; + } + + public const int RepeatedMessageFieldFieldNumber = 10; + private pbc::PopsicleList repeatedMessageField_ = new pbc::PopsicleList(); + public scg::IList RepeatedMessageFieldList { + get { return repeatedMessageField_; } + } + public int RepeatedMessageFieldCount { + get { return repeatedMessageField_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedMessageField(int index) { + return repeatedMessageField_[index]; + } + + public const int RepeatedStringPieceFieldFieldNumber = 11; + private pbc::PopsicleList repeatedStringPieceField_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringPieceFieldList { + get { return pbc::Lists.AsReadOnly(repeatedStringPieceField_); } + } + public int RepeatedStringPieceFieldCount { + get { return repeatedStringPieceField_.Count; } + } + public string GetRepeatedStringPieceField(int index) { + return repeatedStringPieceField_[index]; + } + + public const int RepeatedCordFieldFieldNumber = 12; + private pbc::PopsicleList repeatedCordField_ = new pbc::PopsicleList(); + public scg::IList RepeatedCordFieldList { + get { return pbc::Lists.AsReadOnly(repeatedCordField_); } + } + public int RepeatedCordFieldCount { + get { return repeatedCordField_.Count; } + } + public string GetRepeatedCordField(int index) { + return repeatedCordField_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testCamelCaseFieldNamesFieldNames; + if (hasPrimitiveField) { + output.WriteInt32(1, field_names[3], PrimitiveField); + } + if (hasStringField) { + output.WriteString(2, field_names[10], StringField); + } + if (hasEnumField) { + output.WriteEnum(3, field_names[1], (int) EnumField, EnumField); + } + if (hasMessageField) { + output.WriteMessage(4, field_names[2], MessageField); + } + if (hasStringPieceField) { + output.WriteString(5, field_names[11], StringPieceField); + } + if (hasCordField) { + output.WriteString(6, field_names[0], CordField); + } + if (repeatedPrimitiveField_.Count > 0) { + output.WriteInt32Array(7, field_names[7], repeatedPrimitiveField_); + } + if (repeatedStringField_.Count > 0) { + output.WriteStringArray(8, field_names[8], repeatedStringField_); + } + if (repeatedEnumField_.Count > 0) { + output.WriteEnumArray(9, field_names[5], repeatedEnumField_); + } + if (repeatedMessageField_.Count > 0) { + output.WriteMessageArray(10, field_names[6], repeatedMessageField_); + } + if (repeatedStringPieceField_.Count > 0) { + output.WriteStringArray(11, field_names[9], repeatedStringPieceField_); + } + if (repeatedCordField_.Count > 0) { + output.WriteStringArray(12, field_names[4], repeatedCordField_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPrimitiveField) { + size += pb::CodedOutputStream.ComputeInt32Size(1, PrimitiveField); + } + if (hasStringField) { + size += pb::CodedOutputStream.ComputeStringSize(2, StringField); + } + if (hasEnumField) { + size += pb::CodedOutputStream.ComputeEnumSize(3, (int) EnumField); + } + if (hasMessageField) { + size += pb::CodedOutputStream.ComputeMessageSize(4, MessageField); + } + if (hasStringPieceField) { + size += pb::CodedOutputStream.ComputeStringSize(5, StringPieceField); + } + if (hasCordField) { + size += pb::CodedOutputStream.ComputeStringSize(6, CordField); + } + { + int dataSize = 0; + foreach (int element in RepeatedPrimitiveFieldList) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedPrimitiveField_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedStringFieldList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedStringField_.Count; + } + { + int dataSize = 0; + if (repeatedEnumField_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in repeatedEnumField_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1 * repeatedEnumField_.Count; + } + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessage element in RepeatedMessageFieldList) { + size += pb::CodedOutputStream.ComputeMessageSize(10, element); + } + { + int dataSize = 0; + foreach (string element in RepeatedStringPieceFieldList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedStringPieceField_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedCordFieldList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedCordField_.Count; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestCamelCaseFieldNames ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestCamelCaseFieldNames MakeReadOnly() { + repeatedPrimitiveField_.MakeReadOnly(); + repeatedStringField_.MakeReadOnly(); + repeatedEnumField_.MakeReadOnly(); + repeatedMessageField_.MakeReadOnly(); + repeatedStringPieceField_.MakeReadOnly(); + repeatedCordField_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestCamelCaseFieldNames prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestCamelCaseFieldNames cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestCamelCaseFieldNames result; + + private TestCamelCaseFieldNames PrepareBuilder() { + if (resultIsReadOnly) { + TestCamelCaseFieldNames original = result; + result = new TestCamelCaseFieldNames(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestCamelCaseFieldNames MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.Descriptor; } + } + + public override TestCamelCaseFieldNames DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.DefaultInstance; } + } + + public override TestCamelCaseFieldNames BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestCamelCaseFieldNames) { + return MergeFrom((TestCamelCaseFieldNames) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestCamelCaseFieldNames other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasPrimitiveField) { + PrimitiveField = other.PrimitiveField; + } + if (other.HasStringField) { + StringField = other.StringField; + } + if (other.HasEnumField) { + EnumField = other.EnumField; + } + if (other.HasMessageField) { + MergeMessageField(other.MessageField); + } + if (other.HasStringPieceField) { + StringPieceField = other.StringPieceField; + } + if (other.HasCordField) { + CordField = other.CordField; + } + if (other.repeatedPrimitiveField_.Count != 0) { + result.repeatedPrimitiveField_.Add(other.repeatedPrimitiveField_); + } + if (other.repeatedStringField_.Count != 0) { + result.repeatedStringField_.Add(other.repeatedStringField_); + } + if (other.repeatedEnumField_.Count != 0) { + result.repeatedEnumField_.Add(other.repeatedEnumField_); + } + if (other.repeatedMessageField_.Count != 0) { + result.repeatedMessageField_.Add(other.repeatedMessageField_); + } + if (other.repeatedStringPieceField_.Count != 0) { + result.repeatedStringPieceField_.Add(other.repeatedStringPieceField_); + } + if (other.repeatedCordField_.Count != 0) { + result.repeatedCordField_.Add(other.repeatedCordField_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testCamelCaseFieldNamesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testCamelCaseFieldNamesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasPrimitiveField = input.ReadInt32(ref result.primitiveField_); + break; + } + case 18: { + result.hasStringField = input.ReadString(ref result.stringField_); + break; + } + case 24: { + object unknown; + if(input.ReadEnum(ref result.enumField_, out unknown)) { + result.hasEnumField = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(3, (ulong)(int)unknown); + } + break; + } + case 34: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(); + if (result.hasMessageField) { + subBuilder.MergeFrom(MessageField); + } + input.ReadMessage(subBuilder, extensionRegistry); + MessageField = subBuilder.BuildPartial(); + break; + } + case 42: { + result.hasStringPieceField = input.ReadString(ref result.stringPieceField_); + break; + } + case 50: { + result.hasCordField = input.ReadString(ref result.cordField_); + break; + } + case 58: + case 56: { + input.ReadInt32Array(tag, field_name, result.repeatedPrimitiveField_); + break; + } + case 66: { + input.ReadStringArray(tag, field_name, result.repeatedStringField_); + break; + } + case 74: + case 72: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedEnumField_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(9, (ulong)(int)rawValue); + } + break; + } + case 82: { + input.ReadMessageArray(tag, field_name, result.repeatedMessageField_, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance, extensionRegistry); + break; + } + case 90: { + input.ReadStringArray(tag, field_name, result.repeatedStringPieceField_); + break; + } + case 98: { + input.ReadStringArray(tag, field_name, result.repeatedCordField_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasPrimitiveField { + get { return result.hasPrimitiveField; } + } + public int PrimitiveField { + get { return result.PrimitiveField; } + set { SetPrimitiveField(value); } + } + public Builder SetPrimitiveField(int value) { + PrepareBuilder(); + result.hasPrimitiveField = true; + result.primitiveField_ = value; + return this; + } + public Builder ClearPrimitiveField() { + PrepareBuilder(); + result.hasPrimitiveField = false; + result.primitiveField_ = 0; + return this; + } + + public bool HasStringField { + get { return result.hasStringField; } + } + public string StringField { + get { return result.StringField; } + set { SetStringField(value); } + } + public Builder SetStringField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasStringField = true; + result.stringField_ = value; + return this; + } + public Builder ClearStringField() { + PrepareBuilder(); + result.hasStringField = false; + result.stringField_ = ""; + return this; + } + + public bool HasEnumField { + get { return result.hasEnumField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumField { + get { return result.EnumField; } + set { SetEnumField(value); } + } + public Builder SetEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasEnumField = true; + result.enumField_ = value; + return this; + } + public Builder ClearEnumField() { + PrepareBuilder(); + result.hasEnumField = false; + result.enumField_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + return this; + } + + public bool HasMessageField { + get { return result.hasMessageField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageField { + get { return result.MessageField; } + set { SetMessageField(value); } + } + public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessageField = true; + result.messageField_ = value; + return this; + } + public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMessageField = true; + result.messageField_ = builderForValue.Build(); + return this; + } + public Builder MergeMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMessageField && + result.messageField_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageField_).MergeFrom(value).BuildPartial(); + } else { + result.messageField_ = value; + } + result.hasMessageField = true; + return this; + } + public Builder ClearMessageField() { + PrepareBuilder(); + result.hasMessageField = false; + result.messageField_ = null; + return this; + } + + public bool HasStringPieceField { + get { return result.hasStringPieceField; } + } + public string StringPieceField { + get { return result.StringPieceField; } + set { SetStringPieceField(value); } + } + public Builder SetStringPieceField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasStringPieceField = true; + result.stringPieceField_ = value; + return this; + } + public Builder ClearStringPieceField() { + PrepareBuilder(); + result.hasStringPieceField = false; + result.stringPieceField_ = ""; + return this; + } + + public bool HasCordField { + get { return result.hasCordField; } + } + public string CordField { + get { return result.CordField; } + set { SetCordField(value); } + } + public Builder SetCordField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasCordField = true; + result.cordField_ = value; + return this; + } + public Builder ClearCordField() { + PrepareBuilder(); + result.hasCordField = false; + result.cordField_ = ""; + return this; + } + + public pbc::IPopsicleList RepeatedPrimitiveFieldList { + get { return PrepareBuilder().repeatedPrimitiveField_; } + } + public int RepeatedPrimitiveFieldCount { + get { return result.RepeatedPrimitiveFieldCount; } + } + public int GetRepeatedPrimitiveField(int index) { + return result.GetRepeatedPrimitiveField(index); + } + public Builder SetRepeatedPrimitiveField(int index, int value) { + PrepareBuilder(); + result.repeatedPrimitiveField_[index] = value; + return this; + } + public Builder AddRepeatedPrimitiveField(int value) { + PrepareBuilder(); + result.repeatedPrimitiveField_.Add(value); + return this; + } + public Builder AddRangeRepeatedPrimitiveField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedPrimitiveField_.Add(values); + return this; + } + public Builder ClearRepeatedPrimitiveField() { + PrepareBuilder(); + result.repeatedPrimitiveField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringFieldList { + get { return PrepareBuilder().repeatedStringField_; } + } + public int RepeatedStringFieldCount { + get { return result.RepeatedStringFieldCount; } + } + public string GetRepeatedStringField(int index) { + return result.GetRepeatedStringField(index); + } + public Builder SetRepeatedStringField(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringField_[index] = value; + return this; + } + public Builder AddRepeatedStringField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringField_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringField_.Add(values); + return this; + } + public Builder ClearRepeatedStringField() { + PrepareBuilder(); + result.repeatedStringField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedEnumFieldList { + get { return PrepareBuilder().repeatedEnumField_; } + } + public int RepeatedEnumFieldCount { + get { return result.RepeatedEnumFieldCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedEnumField(int index) { + return result.GetRepeatedEnumField(index); + } + public Builder SetRepeatedEnumField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedEnumField_[index] = value; + return this; + } + public Builder AddRepeatedEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedEnumField_.Add(value); + return this; + } + public Builder AddRangeRepeatedEnumField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedEnumField_.Add(values); + return this; + } + public Builder ClearRepeatedEnumField() { + PrepareBuilder(); + result.repeatedEnumField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedMessageFieldList { + get { return PrepareBuilder().repeatedMessageField_; } + } + public int RepeatedMessageFieldCount { + get { return result.RepeatedMessageFieldCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedMessageField(int index) { + return result.GetRepeatedMessageField(index); + } + public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessageField_[index] = value; + return this; + } + public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessageField_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessageField_.Add(value); + return this; + } + public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessageField_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedMessageField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedMessageField_.Add(values); + return this; + } + public Builder ClearRepeatedMessageField() { + PrepareBuilder(); + result.repeatedMessageField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringPieceFieldList { + get { return PrepareBuilder().repeatedStringPieceField_; } + } + public int RepeatedStringPieceFieldCount { + get { return result.RepeatedStringPieceFieldCount; } + } + public string GetRepeatedStringPieceField(int index) { + return result.GetRepeatedStringPieceField(index); + } + public Builder SetRepeatedStringPieceField(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPieceField_[index] = value; + return this; + } + public Builder AddRepeatedStringPieceField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPieceField_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringPieceField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringPieceField_.Add(values); + return this; + } + public Builder ClearRepeatedStringPieceField() { + PrepareBuilder(); + result.repeatedStringPieceField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedCordFieldList { + get { return PrepareBuilder().repeatedCordField_; } + } + public int RepeatedCordFieldCount { + get { return result.RepeatedCordFieldCount; } + } + public string GetRepeatedCordField(int index) { + return result.GetRepeatedCordField(index); + } + public Builder SetRepeatedCordField(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCordField_[index] = value; + return this; + } + public Builder AddRepeatedCordField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCordField_.Add(value); + return this; + } + public Builder AddRangeRepeatedCordField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedCordField_.Add(values); + return this; + } + public Builder ClearRepeatedCordField() { + PrepareBuilder(); + result.repeatedCordField_.Clear(); + return this; + } + } + static TestCamelCaseFieldNames() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestFieldOrderings : pb::ExtendableMessage { + private TestFieldOrderings() { } + private static readonly TestFieldOrderings defaultInstance = new TestFieldOrderings().MakeReadOnly(); + private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; + private static readonly uint[] _testFieldOrderingsFieldTags = new uint[] { 813, 8, 90 }; + public static TestFieldOrderings DefaultInstance { + get { return defaultInstance; } + } + + public override TestFieldOrderings DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestFieldOrderings ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestFieldOrderings__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable; } + } + + public const int MyStringFieldNumber = 11; + private bool hasMyString; + private string myString_ = ""; + public bool HasMyString { + get { return hasMyString; } + } + public string MyString { + get { return myString_; } + } + + public const int MyIntFieldNumber = 1; + private bool hasMyInt; + private long myInt_; + public bool HasMyInt { + get { return hasMyInt; } + } + public long MyInt { + get { return myInt_; } + } + + public const int MyFloatFieldNumber = 101; + private bool hasMyFloat; + private float myFloat_; + public bool HasMyFloat { + get { return hasMyFloat; } + } + public float MyFloat { + get { return myFloat_; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testFieldOrderingsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasMyInt) { + output.WriteInt64(1, field_names[1], MyInt); + } + extensionWriter.WriteUntil(11, output); + if (hasMyString) { + output.WriteString(11, field_names[2], MyString); + } + extensionWriter.WriteUntil(101, output); + if (hasMyFloat) { + output.WriteFloat(101, field_names[0], MyFloat); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasMyString) { + size += pb::CodedOutputStream.ComputeStringSize(11, MyString); + } + if (hasMyInt) { + size += pb::CodedOutputStream.ComputeInt64Size(1, MyInt); + } + if (hasMyFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(101, MyFloat); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestFieldOrderings ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestFieldOrderings ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestFieldOrderings ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestFieldOrderings MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestFieldOrderings prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestFieldOrderings cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestFieldOrderings result; + + private TestFieldOrderings PrepareBuilder() { + if (resultIsReadOnly) { + TestFieldOrderings original = result; + result = new TestFieldOrderings(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestFieldOrderings MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.Descriptor; } + } + + public override TestFieldOrderings DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.DefaultInstance; } + } + + public override TestFieldOrderings BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestFieldOrderings) { + return MergeFrom((TestFieldOrderings) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestFieldOrderings other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasMyString) { + MyString = other.MyString; + } + if (other.HasMyInt) { + MyInt = other.MyInt; + } + if (other.HasMyFloat) { + MyFloat = other.MyFloat; + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testFieldOrderingsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testFieldOrderingsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasMyInt = input.ReadInt64(ref result.myInt_); + break; + } + case 90: { + result.hasMyString = input.ReadString(ref result.myString_); + break; + } + case 813: { + result.hasMyFloat = input.ReadFloat(ref result.myFloat_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasMyString { + get { return result.hasMyString; } + } + public string MyString { + get { return result.MyString; } + set { SetMyString(value); } + } + public Builder SetMyString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMyString = true; + result.myString_ = value; + return this; + } + public Builder ClearMyString() { + PrepareBuilder(); + result.hasMyString = false; + result.myString_ = ""; + return this; + } + + public bool HasMyInt { + get { return result.hasMyInt; } + } + public long MyInt { + get { return result.MyInt; } + set { SetMyInt(value); } + } + public Builder SetMyInt(long value) { + PrepareBuilder(); + result.hasMyInt = true; + result.myInt_ = value; + return this; + } + public Builder ClearMyInt() { + PrepareBuilder(); + result.hasMyInt = false; + result.myInt_ = 0L; + return this; + } + + public bool HasMyFloat { + get { return result.hasMyFloat; } + } + public float MyFloat { + get { return result.MyFloat; } + set { SetMyFloat(value); } + } + public Builder SetMyFloat(float value) { + PrepareBuilder(); + result.hasMyFloat = true; + result.myFloat_ = value; + return this; + } + public Builder ClearMyFloat() { + PrepareBuilder(); + result.hasMyFloat = false; + result.myFloat_ = 0F; + return this; + } + } + static TestFieldOrderings() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { + private TestExtremeDefaultValues() { } + private static readonly TestExtremeDefaultValues defaultInstance = new TestExtremeDefaultValues().MakeReadOnly(); + private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "cpp_trigraph", "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; + private static readonly uint[] _testExtremeDefaultValuesFieldTags = new uint[] { 162, 10, 113, 141, 101, 16, 24, 129, 157, 121, 149, 93, 85, 69, 77, 32, 40, 109, 50, 61 }; + public static TestExtremeDefaultValues DefaultInstance { + get { return defaultInstance; } + } + + public override TestExtremeDefaultValues DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestExtremeDefaultValues ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestExtremeDefaultValues__FieldAccessorTable; } + } + + public const int EscapedBytesFieldNumber = 1; + private bool hasEscapedBytes; + private pb::ByteString escapedBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[0].DefaultValue; + public bool HasEscapedBytes { + get { return hasEscapedBytes; } + } + public pb::ByteString EscapedBytes { + get { return escapedBytes_; } + } + + public const int LargeUint32FieldNumber = 2; + private bool hasLargeUint32; + private uint largeUint32_ = 4294967295; + public bool HasLargeUint32 { + get { return hasLargeUint32; } + } + [global::System.CLSCompliant(false)] + public uint LargeUint32 { + get { return largeUint32_; } + } + + public const int LargeUint64FieldNumber = 3; + private bool hasLargeUint64; + private ulong largeUint64_ = 18446744073709551615UL; + public bool HasLargeUint64 { + get { return hasLargeUint64; } + } + [global::System.CLSCompliant(false)] + public ulong LargeUint64 { + get { return largeUint64_; } + } + + public const int SmallInt32FieldNumber = 4; + private bool hasSmallInt32; + private int smallInt32_ = -2147483647; + public bool HasSmallInt32 { + get { return hasSmallInt32; } + } + public int SmallInt32 { + get { return smallInt32_; } + } + + public const int SmallInt64FieldNumber = 5; + private bool hasSmallInt64; + private long smallInt64_ = -9223372036854775807L; + public bool HasSmallInt64 { + get { return hasSmallInt64; } + } + public long SmallInt64 { + get { return smallInt64_; } + } + + public const int Utf8StringFieldNumber = 6; + private bool hasUtf8String; + private string utf8String_ = (string) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[5].DefaultValue; + public bool HasUtf8String { + get { return hasUtf8String; } + } + public string Utf8String { + get { return utf8String_; } + } + + public const int ZeroFloatFieldNumber = 7; + private bool hasZeroFloat; + private float zeroFloat_; + public bool HasZeroFloat { + get { return hasZeroFloat; } + } + public float ZeroFloat { + get { return zeroFloat_; } + } + + public const int OneFloatFieldNumber = 8; + private bool hasOneFloat; + private float oneFloat_ = 1F; + public bool HasOneFloat { + get { return hasOneFloat; } + } + public float OneFloat { + get { return oneFloat_; } + } + + public const int SmallFloatFieldNumber = 9; + private bool hasSmallFloat; + private float smallFloat_ = 1.5F; + public bool HasSmallFloat { + get { return hasSmallFloat; } + } + public float SmallFloat { + get { return smallFloat_; } + } + + public const int NegativeOneFloatFieldNumber = 10; + private bool hasNegativeOneFloat; + private float negativeOneFloat_ = -1F; + public bool HasNegativeOneFloat { + get { return hasNegativeOneFloat; } + } + public float NegativeOneFloat { + get { return negativeOneFloat_; } + } + + public const int NegativeFloatFieldNumber = 11; + private bool hasNegativeFloat; + private float negativeFloat_ = -1.5F; + public bool HasNegativeFloat { + get { return hasNegativeFloat; } + } + public float NegativeFloat { + get { return negativeFloat_; } + } + + public const int LargeFloatFieldNumber = 12; + private bool hasLargeFloat; + private float largeFloat_ = 2E+08F; + public bool HasLargeFloat { + get { return hasLargeFloat; } + } + public float LargeFloat { + get { return largeFloat_; } + } + + public const int SmallNegativeFloatFieldNumber = 13; + private bool hasSmallNegativeFloat; + private float smallNegativeFloat_ = -8E-28F; + public bool HasSmallNegativeFloat { + get { return hasSmallNegativeFloat; } + } + public float SmallNegativeFloat { + get { return smallNegativeFloat_; } + } + + public const int InfDoubleFieldNumber = 14; + private bool hasInfDouble; + private double infDouble_ = double.PositiveInfinity; + public bool HasInfDouble { + get { return hasInfDouble; } + } + public double InfDouble { + get { return infDouble_; } + } + + public const int NegInfDoubleFieldNumber = 15; + private bool hasNegInfDouble; + private double negInfDouble_ = double.NegativeInfinity; + public bool HasNegInfDouble { + get { return hasNegInfDouble; } + } + public double NegInfDouble { + get { return negInfDouble_; } + } + + public const int NanDoubleFieldNumber = 16; + private bool hasNanDouble; + private double nanDouble_ = double.NaN; + public bool HasNanDouble { + get { return hasNanDouble; } + } + public double NanDouble { + get { return nanDouble_; } + } + + public const int InfFloatFieldNumber = 17; + private bool hasInfFloat; + private float infFloat_ = float.PositiveInfinity; + public bool HasInfFloat { + get { return hasInfFloat; } + } + public float InfFloat { + get { return infFloat_; } + } + + public const int NegInfFloatFieldNumber = 18; + private bool hasNegInfFloat; + private float negInfFloat_ = float.NegativeInfinity; + public bool HasNegInfFloat { + get { return hasNegInfFloat; } + } + public float NegInfFloat { + get { return negInfFloat_; } + } + + public const int NanFloatFieldNumber = 19; + private bool hasNanFloat; + private float nanFloat_ = float.NaN; + public bool HasNanFloat { + get { return hasNanFloat; } + } + public float NanFloat { + get { return nanFloat_; } + } + + public const int CppTrigraphFieldNumber = 20; + private bool hasCppTrigraph; + private string cppTrigraph_ = "? ? ?? ?? ??? ??/ ??-"; + public bool HasCppTrigraph { + get { return hasCppTrigraph; } + } + public string CppTrigraph { + get { return cppTrigraph_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testExtremeDefaultValuesFieldNames; + if (hasEscapedBytes) { + output.WriteBytes(1, field_names[1], EscapedBytes); + } + if (hasLargeUint32) { + output.WriteUInt32(2, field_names[5], LargeUint32); + } + if (hasLargeUint64) { + output.WriteUInt64(3, field_names[6], LargeUint64); + } + if (hasSmallInt32) { + output.WriteInt32(4, field_names[15], SmallInt32); + } + if (hasSmallInt64) { + output.WriteInt64(5, field_names[16], SmallInt64); + } + if (hasUtf8String) { + output.WriteString(6, field_names[18], Utf8String); + } + if (hasZeroFloat) { + output.WriteFloat(7, field_names[19], ZeroFloat); + } + if (hasOneFloat) { + output.WriteFloat(8, field_names[13], OneFloat); + } + if (hasSmallFloat) { + output.WriteFloat(9, field_names[14], SmallFloat); + } + if (hasNegativeOneFloat) { + output.WriteFloat(10, field_names[12], NegativeOneFloat); + } + if (hasNegativeFloat) { + output.WriteFloat(11, field_names[11], NegativeFloat); + } + if (hasLargeFloat) { + output.WriteFloat(12, field_names[4], LargeFloat); + } + if (hasSmallNegativeFloat) { + output.WriteFloat(13, field_names[17], SmallNegativeFloat); + } + if (hasInfDouble) { + output.WriteDouble(14, field_names[2], InfDouble); + } + if (hasNegInfDouble) { + output.WriteDouble(15, field_names[9], NegInfDouble); + } + if (hasNanDouble) { + output.WriteDouble(16, field_names[7], NanDouble); + } + if (hasInfFloat) { + output.WriteFloat(17, field_names[3], InfFloat); + } + if (hasNegInfFloat) { + output.WriteFloat(18, field_names[10], NegInfFloat); + } + if (hasNanFloat) { + output.WriteFloat(19, field_names[8], NanFloat); + } + if (hasCppTrigraph) { + output.WriteString(20, field_names[0], CppTrigraph); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasEscapedBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(1, EscapedBytes); + } + if (hasLargeUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(2, LargeUint32); + } + if (hasLargeUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(3, LargeUint64); + } + if (hasSmallInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(4, SmallInt32); + } + if (hasSmallInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(5, SmallInt64); + } + if (hasUtf8String) { + size += pb::CodedOutputStream.ComputeStringSize(6, Utf8String); + } + if (hasZeroFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(7, ZeroFloat); + } + if (hasOneFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(8, OneFloat); + } + if (hasSmallFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(9, SmallFloat); + } + if (hasNegativeOneFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(10, NegativeOneFloat); + } + if (hasNegativeFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(11, NegativeFloat); + } + if (hasLargeFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(12, LargeFloat); + } + if (hasSmallNegativeFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(13, SmallNegativeFloat); + } + if (hasInfDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(14, InfDouble); + } + if (hasNegInfDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(15, NegInfDouble); + } + if (hasNanDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(16, NanDouble); + } + if (hasInfFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(17, InfFloat); + } + if (hasNegInfFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(18, NegInfFloat); + } + if (hasNanFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(19, NanFloat); + } + if (hasCppTrigraph) { + size += pb::CodedOutputStream.ComputeStringSize(20, CppTrigraph); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestExtremeDefaultValues ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestExtremeDefaultValues ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestExtremeDefaultValues MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestExtremeDefaultValues prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestExtremeDefaultValues cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestExtremeDefaultValues result; + + private TestExtremeDefaultValues PrepareBuilder() { + if (resultIsReadOnly) { + TestExtremeDefaultValues original = result; + result = new TestExtremeDefaultValues(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestExtremeDefaultValues MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor; } + } + + public override TestExtremeDefaultValues DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.DefaultInstance; } + } + + public override TestExtremeDefaultValues BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestExtremeDefaultValues) { + return MergeFrom((TestExtremeDefaultValues) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestExtremeDefaultValues other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasEscapedBytes) { + EscapedBytes = other.EscapedBytes; + } + if (other.HasLargeUint32) { + LargeUint32 = other.LargeUint32; + } + if (other.HasLargeUint64) { + LargeUint64 = other.LargeUint64; + } + if (other.HasSmallInt32) { + SmallInt32 = other.SmallInt32; + } + if (other.HasSmallInt64) { + SmallInt64 = other.SmallInt64; + } + if (other.HasUtf8String) { + Utf8String = other.Utf8String; + } + if (other.HasZeroFloat) { + ZeroFloat = other.ZeroFloat; + } + if (other.HasOneFloat) { + OneFloat = other.OneFloat; + } + if (other.HasSmallFloat) { + SmallFloat = other.SmallFloat; + } + if (other.HasNegativeOneFloat) { + NegativeOneFloat = other.NegativeOneFloat; + } + if (other.HasNegativeFloat) { + NegativeFloat = other.NegativeFloat; + } + if (other.HasLargeFloat) { + LargeFloat = other.LargeFloat; + } + if (other.HasSmallNegativeFloat) { + SmallNegativeFloat = other.SmallNegativeFloat; + } + if (other.HasInfDouble) { + InfDouble = other.InfDouble; + } + if (other.HasNegInfDouble) { + NegInfDouble = other.NegInfDouble; + } + if (other.HasNanDouble) { + NanDouble = other.NanDouble; + } + if (other.HasInfFloat) { + InfFloat = other.InfFloat; + } + if (other.HasNegInfFloat) { + NegInfFloat = other.NegInfFloat; + } + if (other.HasNanFloat) { + NanFloat = other.NanFloat; + } + if (other.HasCppTrigraph) { + CppTrigraph = other.CppTrigraph; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testExtremeDefaultValuesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testExtremeDefaultValuesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasEscapedBytes = input.ReadBytes(ref result.escapedBytes_); + break; + } + case 16: { + result.hasLargeUint32 = input.ReadUInt32(ref result.largeUint32_); + break; + } + case 24: { + result.hasLargeUint64 = input.ReadUInt64(ref result.largeUint64_); + break; + } + case 32: { + result.hasSmallInt32 = input.ReadInt32(ref result.smallInt32_); + break; + } + case 40: { + result.hasSmallInt64 = input.ReadInt64(ref result.smallInt64_); + break; + } + case 50: { + result.hasUtf8String = input.ReadString(ref result.utf8String_); + break; + } + case 61: { + result.hasZeroFloat = input.ReadFloat(ref result.zeroFloat_); + break; + } + case 69: { + result.hasOneFloat = input.ReadFloat(ref result.oneFloat_); + break; + } + case 77: { + result.hasSmallFloat = input.ReadFloat(ref result.smallFloat_); + break; + } + case 85: { + result.hasNegativeOneFloat = input.ReadFloat(ref result.negativeOneFloat_); + break; + } + case 93: { + result.hasNegativeFloat = input.ReadFloat(ref result.negativeFloat_); + break; + } + case 101: { + result.hasLargeFloat = input.ReadFloat(ref result.largeFloat_); + break; + } + case 109: { + result.hasSmallNegativeFloat = input.ReadFloat(ref result.smallNegativeFloat_); + break; + } + case 113: { + result.hasInfDouble = input.ReadDouble(ref result.infDouble_); + break; + } + case 121: { + result.hasNegInfDouble = input.ReadDouble(ref result.negInfDouble_); + break; + } + case 129: { + result.hasNanDouble = input.ReadDouble(ref result.nanDouble_); + break; + } + case 141: { + result.hasInfFloat = input.ReadFloat(ref result.infFloat_); + break; + } + case 149: { + result.hasNegInfFloat = input.ReadFloat(ref result.negInfFloat_); + break; + } + case 157: { + result.hasNanFloat = input.ReadFloat(ref result.nanFloat_); + break; + } + case 162: { + result.hasCppTrigraph = input.ReadString(ref result.cppTrigraph_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasEscapedBytes { + get { return result.hasEscapedBytes; } + } + public pb::ByteString EscapedBytes { + get { return result.EscapedBytes; } + set { SetEscapedBytes(value); } + } + public Builder SetEscapedBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasEscapedBytes = true; + result.escapedBytes_ = value; + return this; + } + public Builder ClearEscapedBytes() { + PrepareBuilder(); + result.hasEscapedBytes = false; + result.escapedBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[0].DefaultValue; + return this; + } + + public bool HasLargeUint32 { + get { return result.hasLargeUint32; } + } + [global::System.CLSCompliant(false)] + public uint LargeUint32 { + get { return result.LargeUint32; } + set { SetLargeUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetLargeUint32(uint value) { + PrepareBuilder(); + result.hasLargeUint32 = true; + result.largeUint32_ = value; + return this; + } + public Builder ClearLargeUint32() { + PrepareBuilder(); + result.hasLargeUint32 = false; + result.largeUint32_ = 4294967295; + return this; + } + + public bool HasLargeUint64 { + get { return result.hasLargeUint64; } + } + [global::System.CLSCompliant(false)] + public ulong LargeUint64 { + get { return result.LargeUint64; } + set { SetLargeUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetLargeUint64(ulong value) { + PrepareBuilder(); + result.hasLargeUint64 = true; + result.largeUint64_ = value; + return this; + } + public Builder ClearLargeUint64() { + PrepareBuilder(); + result.hasLargeUint64 = false; + result.largeUint64_ = 18446744073709551615UL; + return this; + } + + public bool HasSmallInt32 { + get { return result.hasSmallInt32; } + } + public int SmallInt32 { + get { return result.SmallInt32; } + set { SetSmallInt32(value); } + } + public Builder SetSmallInt32(int value) { + PrepareBuilder(); + result.hasSmallInt32 = true; + result.smallInt32_ = value; + return this; + } + public Builder ClearSmallInt32() { + PrepareBuilder(); + result.hasSmallInt32 = false; + result.smallInt32_ = -2147483647; + return this; + } + + public bool HasSmallInt64 { + get { return result.hasSmallInt64; } + } + public long SmallInt64 { + get { return result.SmallInt64; } + set { SetSmallInt64(value); } + } + public Builder SetSmallInt64(long value) { + PrepareBuilder(); + result.hasSmallInt64 = true; + result.smallInt64_ = value; + return this; + } + public Builder ClearSmallInt64() { + PrepareBuilder(); + result.hasSmallInt64 = false; + result.smallInt64_ = -9223372036854775807L; + return this; + } + + public bool HasUtf8String { + get { return result.hasUtf8String; } + } + public string Utf8String { + get { return result.Utf8String; } + set { SetUtf8String(value); } + } + public Builder SetUtf8String(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasUtf8String = true; + result.utf8String_ = value; + return this; + } + public Builder ClearUtf8String() { + PrepareBuilder(); + result.hasUtf8String = false; + result.utf8String_ = (string) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[5].DefaultValue; + return this; + } + + public bool HasZeroFloat { + get { return result.hasZeroFloat; } + } + public float ZeroFloat { + get { return result.ZeroFloat; } + set { SetZeroFloat(value); } + } + public Builder SetZeroFloat(float value) { + PrepareBuilder(); + result.hasZeroFloat = true; + result.zeroFloat_ = value; + return this; + } + public Builder ClearZeroFloat() { + PrepareBuilder(); + result.hasZeroFloat = false; + result.zeroFloat_ = 0F; + return this; + } + + public bool HasOneFloat { + get { return result.hasOneFloat; } + } + public float OneFloat { + get { return result.OneFloat; } + set { SetOneFloat(value); } + } + public Builder SetOneFloat(float value) { + PrepareBuilder(); + result.hasOneFloat = true; + result.oneFloat_ = value; + return this; + } + public Builder ClearOneFloat() { + PrepareBuilder(); + result.hasOneFloat = false; + result.oneFloat_ = 1F; + return this; + } + + public bool HasSmallFloat { + get { return result.hasSmallFloat; } + } + public float SmallFloat { + get { return result.SmallFloat; } + set { SetSmallFloat(value); } + } + public Builder SetSmallFloat(float value) { + PrepareBuilder(); + result.hasSmallFloat = true; + result.smallFloat_ = value; + return this; + } + public Builder ClearSmallFloat() { + PrepareBuilder(); + result.hasSmallFloat = false; + result.smallFloat_ = 1.5F; + return this; + } + + public bool HasNegativeOneFloat { + get { return result.hasNegativeOneFloat; } + } + public float NegativeOneFloat { + get { return result.NegativeOneFloat; } + set { SetNegativeOneFloat(value); } + } + public Builder SetNegativeOneFloat(float value) { + PrepareBuilder(); + result.hasNegativeOneFloat = true; + result.negativeOneFloat_ = value; + return this; + } + public Builder ClearNegativeOneFloat() { + PrepareBuilder(); + result.hasNegativeOneFloat = false; + result.negativeOneFloat_ = -1F; + return this; + } + + public bool HasNegativeFloat { + get { return result.hasNegativeFloat; } + } + public float NegativeFloat { + get { return result.NegativeFloat; } + set { SetNegativeFloat(value); } + } + public Builder SetNegativeFloat(float value) { + PrepareBuilder(); + result.hasNegativeFloat = true; + result.negativeFloat_ = value; + return this; + } + public Builder ClearNegativeFloat() { + PrepareBuilder(); + result.hasNegativeFloat = false; + result.negativeFloat_ = -1.5F; + return this; + } + + public bool HasLargeFloat { + get { return result.hasLargeFloat; } + } + public float LargeFloat { + get { return result.LargeFloat; } + set { SetLargeFloat(value); } + } + public Builder SetLargeFloat(float value) { + PrepareBuilder(); + result.hasLargeFloat = true; + result.largeFloat_ = value; + return this; + } + public Builder ClearLargeFloat() { + PrepareBuilder(); + result.hasLargeFloat = false; + result.largeFloat_ = 2E+08F; + return this; + } + + public bool HasSmallNegativeFloat { + get { return result.hasSmallNegativeFloat; } + } + public float SmallNegativeFloat { + get { return result.SmallNegativeFloat; } + set { SetSmallNegativeFloat(value); } + } + public Builder SetSmallNegativeFloat(float value) { + PrepareBuilder(); + result.hasSmallNegativeFloat = true; + result.smallNegativeFloat_ = value; + return this; + } + public Builder ClearSmallNegativeFloat() { + PrepareBuilder(); + result.hasSmallNegativeFloat = false; + result.smallNegativeFloat_ = -8E-28F; + return this; + } + + public bool HasInfDouble { + get { return result.hasInfDouble; } + } + public double InfDouble { + get { return result.InfDouble; } + set { SetInfDouble(value); } + } + public Builder SetInfDouble(double value) { + PrepareBuilder(); + result.hasInfDouble = true; + result.infDouble_ = value; + return this; + } + public Builder ClearInfDouble() { + PrepareBuilder(); + result.hasInfDouble = false; + result.infDouble_ = double.PositiveInfinity; + return this; + } + + public bool HasNegInfDouble { + get { return result.hasNegInfDouble; } + } + public double NegInfDouble { + get { return result.NegInfDouble; } + set { SetNegInfDouble(value); } + } + public Builder SetNegInfDouble(double value) { + PrepareBuilder(); + result.hasNegInfDouble = true; + result.negInfDouble_ = value; + return this; + } + public Builder ClearNegInfDouble() { + PrepareBuilder(); + result.hasNegInfDouble = false; + result.negInfDouble_ = double.NegativeInfinity; + return this; + } + + public bool HasNanDouble { + get { return result.hasNanDouble; } + } + public double NanDouble { + get { return result.NanDouble; } + set { SetNanDouble(value); } + } + public Builder SetNanDouble(double value) { + PrepareBuilder(); + result.hasNanDouble = true; + result.nanDouble_ = value; + return this; + } + public Builder ClearNanDouble() { + PrepareBuilder(); + result.hasNanDouble = false; + result.nanDouble_ = double.NaN; + return this; + } + + public bool HasInfFloat { + get { return result.hasInfFloat; } + } + public float InfFloat { + get { return result.InfFloat; } + set { SetInfFloat(value); } + } + public Builder SetInfFloat(float value) { + PrepareBuilder(); + result.hasInfFloat = true; + result.infFloat_ = value; + return this; + } + public Builder ClearInfFloat() { + PrepareBuilder(); + result.hasInfFloat = false; + result.infFloat_ = float.PositiveInfinity; + return this; + } + + public bool HasNegInfFloat { + get { return result.hasNegInfFloat; } + } + public float NegInfFloat { + get { return result.NegInfFloat; } + set { SetNegInfFloat(value); } + } + public Builder SetNegInfFloat(float value) { + PrepareBuilder(); + result.hasNegInfFloat = true; + result.negInfFloat_ = value; + return this; + } + public Builder ClearNegInfFloat() { + PrepareBuilder(); + result.hasNegInfFloat = false; + result.negInfFloat_ = float.NegativeInfinity; + return this; + } + + public bool HasNanFloat { + get { return result.hasNanFloat; } + } + public float NanFloat { + get { return result.NanFloat; } + set { SetNanFloat(value); } + } + public Builder SetNanFloat(float value) { + PrepareBuilder(); + result.hasNanFloat = true; + result.nanFloat_ = value; + return this; + } + public Builder ClearNanFloat() { + PrepareBuilder(); + result.hasNanFloat = false; + result.nanFloat_ = float.NaN; + return this; + } + + public bool HasCppTrigraph { + get { return result.hasCppTrigraph; } + } + public string CppTrigraph { + get { return result.CppTrigraph; } + set { SetCppTrigraph(value); } + } + public Builder SetCppTrigraph(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasCppTrigraph = true; + result.cppTrigraph_ = value; + return this; + } + public Builder ClearCppTrigraph() { + PrepareBuilder(); + result.hasCppTrigraph = false; + result.cppTrigraph_ = "? ? ?? ?? ??? ??/ ??-"; + return this; + } + } + static TestExtremeDefaultValues() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SparseEnumMessage : pb::GeneratedMessage { + private SparseEnumMessage() { } + private static readonly SparseEnumMessage defaultInstance = new SparseEnumMessage().MakeReadOnly(); + private static readonly string[] _sparseEnumMessageFieldNames = new string[] { "sparse_enum" }; + private static readonly uint[] _sparseEnumMessageFieldTags = new uint[] { 8 }; + public static SparseEnumMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SparseEnumMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SparseEnumMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_SparseEnumMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable; } + } + + public const int SparseEnumFieldNumber = 1; + private bool hasSparseEnum; + private global::Google.ProtocolBuffers.TestProtos.TestSparseEnum sparseEnum_ = global::Google.ProtocolBuffers.TestProtos.TestSparseEnum.SPARSE_A; + public bool HasSparseEnum { + get { return hasSparseEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestSparseEnum SparseEnum { + get { return sparseEnum_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _sparseEnumMessageFieldNames; + if (hasSparseEnum) { + output.WriteEnum(1, field_names[0], (int) SparseEnum, SparseEnum); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasSparseEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) SparseEnum); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SparseEnumMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SparseEnumMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SparseEnumMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SparseEnumMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SparseEnumMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SparseEnumMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SparseEnumMessage result; + + private SparseEnumMessage PrepareBuilder() { + if (resultIsReadOnly) { + SparseEnumMessage original = result; + result = new SparseEnumMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SparseEnumMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SparseEnumMessage.Descriptor; } + } + + public override SparseEnumMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SparseEnumMessage.DefaultInstance; } + } + + public override SparseEnumMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SparseEnumMessage) { + return MergeFrom((SparseEnumMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SparseEnumMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SparseEnumMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasSparseEnum) { + SparseEnum = other.SparseEnum; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_sparseEnumMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _sparseEnumMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + object unknown; + if(input.ReadEnum(ref result.sparseEnum_, out unknown)) { + result.hasSparseEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(1, (ulong)(int)unknown); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasSparseEnum { + get { return result.hasSparseEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestSparseEnum SparseEnum { + get { return result.SparseEnum; } + set { SetSparseEnum(value); } + } + public Builder SetSparseEnum(global::Google.ProtocolBuffers.TestProtos.TestSparseEnum value) { + PrepareBuilder(); + result.hasSparseEnum = true; + result.sparseEnum_ = value; + return this; + } + public Builder ClearSparseEnum() { + PrepareBuilder(); + result.hasSparseEnum = false; + result.sparseEnum_ = global::Google.ProtocolBuffers.TestProtos.TestSparseEnum.SPARSE_A; + return this; + } + } + static SparseEnumMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OneString : pb::GeneratedMessage { + private OneString() { } + private static readonly OneString defaultInstance = new OneString().MakeReadOnly(); + private static readonly string[] _oneStringFieldNames = new string[] { "data" }; + private static readonly uint[] _oneStringFieldTags = new uint[] { 10 }; + public static OneString DefaultInstance { + get { return defaultInstance; } + } + + public override OneString DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OneString ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneString__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneString__FieldAccessorTable; } + } + + public const int DataFieldNumber = 1; + private bool hasData; + private string data_ = ""; + public bool HasData { + get { return hasData; } + } + public string Data { + get { return data_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _oneStringFieldNames; + if (hasData) { + output.WriteString(1, field_names[0], Data); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasData) { + size += pb::CodedOutputStream.ComputeStringSize(1, Data); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OneString ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneString ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneString ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneString ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneString ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneString ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OneString ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OneString ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OneString ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneString ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OneString MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OneString prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OneString cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OneString result; + + private OneString PrepareBuilder() { + if (resultIsReadOnly) { + OneString original = result; + result = new OneString(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OneString MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneString.Descriptor; } + } + + public override OneString DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneString.DefaultInstance; } + } + + public override OneString BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OneString) { + return MergeFrom((OneString) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OneString other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OneString.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasData) { + Data = other.Data; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_oneStringFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _oneStringFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasData = input.ReadString(ref result.data_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasData { + get { return result.hasData; } + } + public string Data { + get { return result.Data; } + set { SetData(value); } + } + public Builder SetData(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasData = true; + result.data_ = value; + return this; + } + public Builder ClearData() { + PrepareBuilder(); + result.hasData = false; + result.data_ = ""; + return this; + } + } + static OneString() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OneBytes : pb::GeneratedMessage { + private OneBytes() { } + private static readonly OneBytes defaultInstance = new OneBytes().MakeReadOnly(); + private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; + private static readonly uint[] _oneBytesFieldTags = new uint[] { 10 }; + public static OneBytes DefaultInstance { + get { return defaultInstance; } + } + + public override OneBytes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OneBytes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneBytes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneBytes__FieldAccessorTable; } + } + + public const int DataFieldNumber = 1; + private bool hasData; + private pb::ByteString data_ = pb::ByteString.Empty; + public bool HasData { + get { return hasData; } + } + public pb::ByteString Data { + get { return data_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _oneBytesFieldNames; + if (hasData) { + output.WriteBytes(1, field_names[0], Data); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasData) { + size += pb::CodedOutputStream.ComputeBytesSize(1, Data); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OneBytes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneBytes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneBytes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneBytes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneBytes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneBytes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OneBytes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OneBytes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OneBytes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneBytes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OneBytes MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OneBytes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OneBytes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OneBytes result; + + private OneBytes PrepareBuilder() { + if (resultIsReadOnly) { + OneBytes original = result; + result = new OneBytes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OneBytes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneBytes.Descriptor; } + } + + public override OneBytes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneBytes.DefaultInstance; } + } + + public override OneBytes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OneBytes) { + return MergeFrom((OneBytes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OneBytes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OneBytes.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasData) { + Data = other.Data; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_oneBytesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _oneBytesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasData = input.ReadBytes(ref result.data_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasData { + get { return result.hasData; } + } + public pb::ByteString Data { + get { return result.Data; } + set { SetData(value); } + } + public Builder SetData(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasData = true; + result.data_ = value; + return this; + } + public Builder ClearData() { + PrepareBuilder(); + result.hasData = false; + result.data_ = pb::ByteString.Empty; + return this; + } + } + static OneBytes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestPackedTypes : pb::GeneratedMessage { + private TestPackedTypes() { } + private static readonly TestPackedTypes defaultInstance = new TestPackedTypes().MakeReadOnly(); + private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; + private static readonly uint[] _testPackedTypesFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; + public static TestPackedTypes DefaultInstance { + get { return defaultInstance; } + } + + public override TestPackedTypes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestPackedTypes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedTypes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable; } + } + + public const int PackedInt32FieldNumber = 90; + private int packedInt32MemoizedSerializedSize; + private pbc::PopsicleList packedInt32_ = new pbc::PopsicleList(); + public scg::IList PackedInt32List { + get { return pbc::Lists.AsReadOnly(packedInt32_); } + } + public int PackedInt32Count { + get { return packedInt32_.Count; } + } + public int GetPackedInt32(int index) { + return packedInt32_[index]; + } + + public const int PackedInt64FieldNumber = 91; + private int packedInt64MemoizedSerializedSize; + private pbc::PopsicleList packedInt64_ = new pbc::PopsicleList(); + public scg::IList PackedInt64List { + get { return pbc::Lists.AsReadOnly(packedInt64_); } + } + public int PackedInt64Count { + get { return packedInt64_.Count; } + } + public long GetPackedInt64(int index) { + return packedInt64_[index]; + } + + public const int PackedUint32FieldNumber = 92; + private int packedUint32MemoizedSerializedSize; + private pbc::PopsicleList packedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedUint32List { + get { return pbc::Lists.AsReadOnly(packedUint32_); } + } + public int PackedUint32Count { + get { return packedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedUint32(int index) { + return packedUint32_[index]; + } + + public const int PackedUint64FieldNumber = 93; + private int packedUint64MemoizedSerializedSize; + private pbc::PopsicleList packedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedUint64List { + get { return pbc::Lists.AsReadOnly(packedUint64_); } + } + public int PackedUint64Count { + get { return packedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedUint64(int index) { + return packedUint64_[index]; + } + + public const int PackedSint32FieldNumber = 94; + private int packedSint32MemoizedSerializedSize; + private pbc::PopsicleList packedSint32_ = new pbc::PopsicleList(); + public scg::IList PackedSint32List { + get { return pbc::Lists.AsReadOnly(packedSint32_); } + } + public int PackedSint32Count { + get { return packedSint32_.Count; } + } + public int GetPackedSint32(int index) { + return packedSint32_[index]; + } + + public const int PackedSint64FieldNumber = 95; + private int packedSint64MemoizedSerializedSize; + private pbc::PopsicleList packedSint64_ = new pbc::PopsicleList(); + public scg::IList PackedSint64List { + get { return pbc::Lists.AsReadOnly(packedSint64_); } + } + public int PackedSint64Count { + get { return packedSint64_.Count; } + } + public long GetPackedSint64(int index) { + return packedSint64_[index]; + } + + public const int PackedFixed32FieldNumber = 96; + private int packedFixed32MemoizedSerializedSize; + private pbc::PopsicleList packedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedFixed32List { + get { return pbc::Lists.AsReadOnly(packedFixed32_); } + } + public int PackedFixed32Count { + get { return packedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedFixed32(int index) { + return packedFixed32_[index]; + } + + public const int PackedFixed64FieldNumber = 97; + private int packedFixed64MemoizedSerializedSize; + private pbc::PopsicleList packedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedFixed64List { + get { return pbc::Lists.AsReadOnly(packedFixed64_); } + } + public int PackedFixed64Count { + get { return packedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedFixed64(int index) { + return packedFixed64_[index]; + } + + public const int PackedSfixed32FieldNumber = 98; + private int packedSfixed32MemoizedSerializedSize; + private pbc::PopsicleList packedSfixed32_ = new pbc::PopsicleList(); + public scg::IList PackedSfixed32List { + get { return pbc::Lists.AsReadOnly(packedSfixed32_); } + } + public int PackedSfixed32Count { + get { return packedSfixed32_.Count; } + } + public int GetPackedSfixed32(int index) { + return packedSfixed32_[index]; + } + + public const int PackedSfixed64FieldNumber = 99; + private int packedSfixed64MemoizedSerializedSize; + private pbc::PopsicleList packedSfixed64_ = new pbc::PopsicleList(); + public scg::IList PackedSfixed64List { + get { return pbc::Lists.AsReadOnly(packedSfixed64_); } + } + public int PackedSfixed64Count { + get { return packedSfixed64_.Count; } + } + public long GetPackedSfixed64(int index) { + return packedSfixed64_[index]; + } + + public const int PackedFloatFieldNumber = 100; + private int packedFloatMemoizedSerializedSize; + private pbc::PopsicleList packedFloat_ = new pbc::PopsicleList(); + public scg::IList PackedFloatList { + get { return pbc::Lists.AsReadOnly(packedFloat_); } + } + public int PackedFloatCount { + get { return packedFloat_.Count; } + } + public float GetPackedFloat(int index) { + return packedFloat_[index]; + } + + public const int PackedDoubleFieldNumber = 101; + private int packedDoubleMemoizedSerializedSize; + private pbc::PopsicleList packedDouble_ = new pbc::PopsicleList(); + public scg::IList PackedDoubleList { + get { return pbc::Lists.AsReadOnly(packedDouble_); } + } + public int PackedDoubleCount { + get { return packedDouble_.Count; } + } + public double GetPackedDouble(int index) { + return packedDouble_[index]; + } + + public const int PackedBoolFieldNumber = 102; + private int packedBoolMemoizedSerializedSize; + private pbc::PopsicleList packedBool_ = new pbc::PopsicleList(); + public scg::IList PackedBoolList { + get { return pbc::Lists.AsReadOnly(packedBool_); } + } + public int PackedBoolCount { + get { return packedBool_.Count; } + } + public bool GetPackedBool(int index) { + return packedBool_[index]; + } + + public const int PackedEnumFieldNumber = 103; + private int packedEnumMemoizedSerializedSize; + private pbc::PopsicleList packedEnum_ = new pbc::PopsicleList(); + public scg::IList PackedEnumList { + get { return pbc::Lists.AsReadOnly(packedEnum_); } + } + public int PackedEnumCount { + get { return packedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetPackedEnum(int index) { + return packedEnum_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testPackedTypesFieldNames; + if (packedInt32_.Count > 0) { + output.WritePackedInt32Array(90, field_names[6], packedInt32MemoizedSerializedSize, packedInt32_); + } + if (packedInt64_.Count > 0) { + output.WritePackedInt64Array(91, field_names[7], packedInt64MemoizedSerializedSize, packedInt64_); + } + if (packedUint32_.Count > 0) { + output.WritePackedUInt32Array(92, field_names[12], packedUint32MemoizedSerializedSize, packedUint32_); + } + if (packedUint64_.Count > 0) { + output.WritePackedUInt64Array(93, field_names[13], packedUint64MemoizedSerializedSize, packedUint64_); + } + if (packedSint32_.Count > 0) { + output.WritePackedSInt32Array(94, field_names[10], packedSint32MemoizedSerializedSize, packedSint32_); + } + if (packedSint64_.Count > 0) { + output.WritePackedSInt64Array(95, field_names[11], packedSint64MemoizedSerializedSize, packedSint64_); + } + if (packedFixed32_.Count > 0) { + output.WritePackedFixed32Array(96, field_names[3], packedFixed32MemoizedSerializedSize, packedFixed32_); + } + if (packedFixed64_.Count > 0) { + output.WritePackedFixed64Array(97, field_names[4], packedFixed64MemoizedSerializedSize, packedFixed64_); + } + if (packedSfixed32_.Count > 0) { + output.WritePackedSFixed32Array(98, field_names[8], packedSfixed32MemoizedSerializedSize, packedSfixed32_); + } + if (packedSfixed64_.Count > 0) { + output.WritePackedSFixed64Array(99, field_names[9], packedSfixed64MemoizedSerializedSize, packedSfixed64_); + } + if (packedFloat_.Count > 0) { + output.WritePackedFloatArray(100, field_names[5], packedFloatMemoizedSerializedSize, packedFloat_); + } + if (packedDouble_.Count > 0) { + output.WritePackedDoubleArray(101, field_names[1], packedDoubleMemoizedSerializedSize, packedDouble_); + } + if (packedBool_.Count > 0) { + output.WritePackedBoolArray(102, field_names[0], packedBoolMemoizedSerializedSize, packedBool_); + } + if (packedEnum_.Count > 0) { + output.WritePackedEnumArray(103, field_names[2], packedEnumMemoizedSerializedSize, packedEnum_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in PackedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + if (packedInt32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedInt32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (long element in PackedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + if (packedInt64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedInt64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (uint element in PackedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + if (packedUint32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedUint32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (ulong element in PackedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + if (packedUint64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedUint64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (int element in PackedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + if (packedSint32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSint32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (long element in PackedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + if (packedSint64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSint64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedFixed32_.Count; + size += dataSize; + if (packedFixed32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFixed32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedFixed64_.Count; + size += dataSize; + if (packedFixed64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFixed64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedSfixed32_.Count; + size += dataSize; + if (packedSfixed32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSfixed32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedSfixed64_.Count; + size += dataSize; + if (packedSfixed64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSfixed64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedFloat_.Count; + size += dataSize; + if (packedFloat_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFloatMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedDouble_.Count; + size += dataSize; + if (packedDouble_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedDoubleMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 1 * packedBool_.Count; + size += dataSize; + if (packedBool_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedBoolMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + if (packedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in packedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + packedEnumMemoizedSerializedSize = dataSize; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestPackedTypes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestPackedTypes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestPackedTypes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestPackedTypes MakeReadOnly() { + packedInt32_.MakeReadOnly(); + packedInt64_.MakeReadOnly(); + packedUint32_.MakeReadOnly(); + packedUint64_.MakeReadOnly(); + packedSint32_.MakeReadOnly(); + packedSint64_.MakeReadOnly(); + packedFixed32_.MakeReadOnly(); + packedFixed64_.MakeReadOnly(); + packedSfixed32_.MakeReadOnly(); + packedSfixed64_.MakeReadOnly(); + packedFloat_.MakeReadOnly(); + packedDouble_.MakeReadOnly(); + packedBool_.MakeReadOnly(); + packedEnum_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestPackedTypes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestPackedTypes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestPackedTypes result; + + private TestPackedTypes PrepareBuilder() { + if (resultIsReadOnly) { + TestPackedTypes original = result; + result = new TestPackedTypes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestPackedTypes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.Descriptor; } + } + + public override TestPackedTypes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance; } + } + + public override TestPackedTypes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestPackedTypes) { + return MergeFrom((TestPackedTypes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestPackedTypes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance) return this; + PrepareBuilder(); + if (other.packedInt32_.Count != 0) { + result.packedInt32_.Add(other.packedInt32_); + } + if (other.packedInt64_.Count != 0) { + result.packedInt64_.Add(other.packedInt64_); + } + if (other.packedUint32_.Count != 0) { + result.packedUint32_.Add(other.packedUint32_); + } + if (other.packedUint64_.Count != 0) { + result.packedUint64_.Add(other.packedUint64_); + } + if (other.packedSint32_.Count != 0) { + result.packedSint32_.Add(other.packedSint32_); + } + if (other.packedSint64_.Count != 0) { + result.packedSint64_.Add(other.packedSint64_); + } + if (other.packedFixed32_.Count != 0) { + result.packedFixed32_.Add(other.packedFixed32_); + } + if (other.packedFixed64_.Count != 0) { + result.packedFixed64_.Add(other.packedFixed64_); + } + if (other.packedSfixed32_.Count != 0) { + result.packedSfixed32_.Add(other.packedSfixed32_); + } + if (other.packedSfixed64_.Count != 0) { + result.packedSfixed64_.Add(other.packedSfixed64_); + } + if (other.packedFloat_.Count != 0) { + result.packedFloat_.Add(other.packedFloat_); + } + if (other.packedDouble_.Count != 0) { + result.packedDouble_.Add(other.packedDouble_); + } + if (other.packedBool_.Count != 0) { + result.packedBool_.Add(other.packedBool_); + } + if (other.packedEnum_.Count != 0) { + result.packedEnum_.Add(other.packedEnum_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testPackedTypesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testPackedTypesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 722: + case 720: { + input.ReadInt32Array(tag, field_name, result.packedInt32_); + break; + } + case 730: + case 728: { + input.ReadInt64Array(tag, field_name, result.packedInt64_); + break; + } + case 738: + case 736: { + input.ReadUInt32Array(tag, field_name, result.packedUint32_); + break; + } + case 746: + case 744: { + input.ReadUInt64Array(tag, field_name, result.packedUint64_); + break; + } + case 754: + case 752: { + input.ReadSInt32Array(tag, field_name, result.packedSint32_); + break; + } + case 762: + case 760: { + input.ReadSInt64Array(tag, field_name, result.packedSint64_); + break; + } + case 770: + case 773: { + input.ReadFixed32Array(tag, field_name, result.packedFixed32_); + break; + } + case 778: + case 777: { + input.ReadFixed64Array(tag, field_name, result.packedFixed64_); + break; + } + case 786: + case 789: { + input.ReadSFixed32Array(tag, field_name, result.packedSfixed32_); + break; + } + case 794: + case 793: { + input.ReadSFixed64Array(tag, field_name, result.packedSfixed64_); + break; + } + case 802: + case 805: { + input.ReadFloatArray(tag, field_name, result.packedFloat_); + break; + } + case 810: + case 809: { + input.ReadDoubleArray(tag, field_name, result.packedDouble_); + break; + } + case 818: + case 816: { + input.ReadBoolArray(tag, field_name, result.packedBool_); + break; + } + case 826: + case 824: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.packedEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(103, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList PackedInt32List { + get { return PrepareBuilder().packedInt32_; } + } + public int PackedInt32Count { + get { return result.PackedInt32Count; } + } + public int GetPackedInt32(int index) { + return result.GetPackedInt32(index); + } + public Builder SetPackedInt32(int index, int value) { + PrepareBuilder(); + result.packedInt32_[index] = value; + return this; + } + public Builder AddPackedInt32(int value) { + PrepareBuilder(); + result.packedInt32_.Add(value); + return this; + } + public Builder AddRangePackedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedInt32_.Add(values); + return this; + } + public Builder ClearPackedInt32() { + PrepareBuilder(); + result.packedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedInt64List { + get { return PrepareBuilder().packedInt64_; } + } + public int PackedInt64Count { + get { return result.PackedInt64Count; } + } + public long GetPackedInt64(int index) { + return result.GetPackedInt64(index); + } + public Builder SetPackedInt64(int index, long value) { + PrepareBuilder(); + result.packedInt64_[index] = value; + return this; + } + public Builder AddPackedInt64(long value) { + PrepareBuilder(); + result.packedInt64_.Add(value); + return this; + } + public Builder AddRangePackedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedInt64_.Add(values); + return this; + } + public Builder ClearPackedInt64() { + PrepareBuilder(); + result.packedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedUint32List { + get { return PrepareBuilder().packedUint32_; } + } + public int PackedUint32Count { + get { return result.PackedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedUint32(int index) { + return result.GetPackedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedUint32(int index, uint value) { + PrepareBuilder(); + result.packedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedUint32(uint value) { + PrepareBuilder(); + result.packedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedUint32_.Add(values); + return this; + } + public Builder ClearPackedUint32() { + PrepareBuilder(); + result.packedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedUint64List { + get { return PrepareBuilder().packedUint64_; } + } + public int PackedUint64Count { + get { return result.PackedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedUint64(int index) { + return result.GetPackedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedUint64(int index, ulong value) { + PrepareBuilder(); + result.packedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedUint64(ulong value) { + PrepareBuilder(); + result.packedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedUint64_.Add(values); + return this; + } + public Builder ClearPackedUint64() { + PrepareBuilder(); + result.packedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSint32List { + get { return PrepareBuilder().packedSint32_; } + } + public int PackedSint32Count { + get { return result.PackedSint32Count; } + } + public int GetPackedSint32(int index) { + return result.GetPackedSint32(index); + } + public Builder SetPackedSint32(int index, int value) { + PrepareBuilder(); + result.packedSint32_[index] = value; + return this; + } + public Builder AddPackedSint32(int value) { + PrepareBuilder(); + result.packedSint32_.Add(value); + return this; + } + public Builder AddRangePackedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSint32_.Add(values); + return this; + } + public Builder ClearPackedSint32() { + PrepareBuilder(); + result.packedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSint64List { + get { return PrepareBuilder().packedSint64_; } + } + public int PackedSint64Count { + get { return result.PackedSint64Count; } + } + public long GetPackedSint64(int index) { + return result.GetPackedSint64(index); + } + public Builder SetPackedSint64(int index, long value) { + PrepareBuilder(); + result.packedSint64_[index] = value; + return this; + } + public Builder AddPackedSint64(long value) { + PrepareBuilder(); + result.packedSint64_.Add(value); + return this; + } + public Builder AddRangePackedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSint64_.Add(values); + return this; + } + public Builder ClearPackedSint64() { + PrepareBuilder(); + result.packedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedFixed32List { + get { return PrepareBuilder().packedFixed32_; } + } + public int PackedFixed32Count { + get { return result.PackedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedFixed32(int index) { + return result.GetPackedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedFixed32(int index, uint value) { + PrepareBuilder(); + result.packedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedFixed32(uint value) { + PrepareBuilder(); + result.packedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFixed32_.Add(values); + return this; + } + public Builder ClearPackedFixed32() { + PrepareBuilder(); + result.packedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedFixed64List { + get { return PrepareBuilder().packedFixed64_; } + } + public int PackedFixed64Count { + get { return result.PackedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedFixed64(int index) { + return result.GetPackedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedFixed64(int index, ulong value) { + PrepareBuilder(); + result.packedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedFixed64(ulong value) { + PrepareBuilder(); + result.packedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFixed64_.Add(values); + return this; + } + public Builder ClearPackedFixed64() { + PrepareBuilder(); + result.packedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSfixed32List { + get { return PrepareBuilder().packedSfixed32_; } + } + public int PackedSfixed32Count { + get { return result.PackedSfixed32Count; } + } + public int GetPackedSfixed32(int index) { + return result.GetPackedSfixed32(index); + } + public Builder SetPackedSfixed32(int index, int value) { + PrepareBuilder(); + result.packedSfixed32_[index] = value; + return this; + } + public Builder AddPackedSfixed32(int value) { + PrepareBuilder(); + result.packedSfixed32_.Add(value); + return this; + } + public Builder AddRangePackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSfixed32_.Add(values); + return this; + } + public Builder ClearPackedSfixed32() { + PrepareBuilder(); + result.packedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSfixed64List { + get { return PrepareBuilder().packedSfixed64_; } + } + public int PackedSfixed64Count { + get { return result.PackedSfixed64Count; } + } + public long GetPackedSfixed64(int index) { + return result.GetPackedSfixed64(index); + } + public Builder SetPackedSfixed64(int index, long value) { + PrepareBuilder(); + result.packedSfixed64_[index] = value; + return this; + } + public Builder AddPackedSfixed64(long value) { + PrepareBuilder(); + result.packedSfixed64_.Add(value); + return this; + } + public Builder AddRangePackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSfixed64_.Add(values); + return this; + } + public Builder ClearPackedSfixed64() { + PrepareBuilder(); + result.packedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedFloatList { + get { return PrepareBuilder().packedFloat_; } + } + public int PackedFloatCount { + get { return result.PackedFloatCount; } + } + public float GetPackedFloat(int index) { + return result.GetPackedFloat(index); + } + public Builder SetPackedFloat(int index, float value) { + PrepareBuilder(); + result.packedFloat_[index] = value; + return this; + } + public Builder AddPackedFloat(float value) { + PrepareBuilder(); + result.packedFloat_.Add(value); + return this; + } + public Builder AddRangePackedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFloat_.Add(values); + return this; + } + public Builder ClearPackedFloat() { + PrepareBuilder(); + result.packedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedDoubleList { + get { return PrepareBuilder().packedDouble_; } + } + public int PackedDoubleCount { + get { return result.PackedDoubleCount; } + } + public double GetPackedDouble(int index) { + return result.GetPackedDouble(index); + } + public Builder SetPackedDouble(int index, double value) { + PrepareBuilder(); + result.packedDouble_[index] = value; + return this; + } + public Builder AddPackedDouble(double value) { + PrepareBuilder(); + result.packedDouble_.Add(value); + return this; + } + public Builder AddRangePackedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.packedDouble_.Add(values); + return this; + } + public Builder ClearPackedDouble() { + PrepareBuilder(); + result.packedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedBoolList { + get { return PrepareBuilder().packedBool_; } + } + public int PackedBoolCount { + get { return result.PackedBoolCount; } + } + public bool GetPackedBool(int index) { + return result.GetPackedBool(index); + } + public Builder SetPackedBool(int index, bool value) { + PrepareBuilder(); + result.packedBool_[index] = value; + return this; + } + public Builder AddPackedBool(bool value) { + PrepareBuilder(); + result.packedBool_.Add(value); + return this; + } + public Builder AddRangePackedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.packedBool_.Add(values); + return this; + } + public Builder ClearPackedBool() { + PrepareBuilder(); + result.packedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedEnumList { + get { return PrepareBuilder().packedEnum_; } + } + public int PackedEnumCount { + get { return result.PackedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetPackedEnum(int index) { + return result.GetPackedEnum(index); + } + public Builder SetPackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.packedEnum_[index] = value; + return this; + } + public Builder AddPackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.packedEnum_.Add(value); + return this; + } + public Builder AddRangePackedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.packedEnum_.Add(values); + return this; + } + public Builder ClearPackedEnum() { + PrepareBuilder(); + result.packedEnum_.Clear(); + return this; + } + } + static TestPackedTypes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { + private TestUnpackedTypes() { } + private static readonly TestUnpackedTypes defaultInstance = new TestUnpackedTypes().MakeReadOnly(); + private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; + private static readonly uint[] _testUnpackedTypesFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; + public static TestUnpackedTypes DefaultInstance { + get { return defaultInstance; } + } + + public override TestUnpackedTypes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestUnpackedTypes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable; } + } + + public const int UnpackedInt32FieldNumber = 90; + private pbc::PopsicleList unpackedInt32_ = new pbc::PopsicleList(); + public scg::IList UnpackedInt32List { + get { return pbc::Lists.AsReadOnly(unpackedInt32_); } + } + public int UnpackedInt32Count { + get { return unpackedInt32_.Count; } + } + public int GetUnpackedInt32(int index) { + return unpackedInt32_[index]; + } + + public const int UnpackedInt64FieldNumber = 91; + private pbc::PopsicleList unpackedInt64_ = new pbc::PopsicleList(); + public scg::IList UnpackedInt64List { + get { return pbc::Lists.AsReadOnly(unpackedInt64_); } + } + public int UnpackedInt64Count { + get { return unpackedInt64_.Count; } + } + public long GetUnpackedInt64(int index) { + return unpackedInt64_[index]; + } + + public const int UnpackedUint32FieldNumber = 92; + private pbc::PopsicleList unpackedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedUint32List { + get { return pbc::Lists.AsReadOnly(unpackedUint32_); } + } + public int UnpackedUint32Count { + get { return unpackedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedUint32(int index) { + return unpackedUint32_[index]; + } + + public const int UnpackedUint64FieldNumber = 93; + private pbc::PopsicleList unpackedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedUint64List { + get { return pbc::Lists.AsReadOnly(unpackedUint64_); } + } + public int UnpackedUint64Count { + get { return unpackedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedUint64(int index) { + return unpackedUint64_[index]; + } + + public const int UnpackedSint32FieldNumber = 94; + private pbc::PopsicleList unpackedSint32_ = new pbc::PopsicleList(); + public scg::IList UnpackedSint32List { + get { return pbc::Lists.AsReadOnly(unpackedSint32_); } + } + public int UnpackedSint32Count { + get { return unpackedSint32_.Count; } + } + public int GetUnpackedSint32(int index) { + return unpackedSint32_[index]; + } + + public const int UnpackedSint64FieldNumber = 95; + private pbc::PopsicleList unpackedSint64_ = new pbc::PopsicleList(); + public scg::IList UnpackedSint64List { + get { return pbc::Lists.AsReadOnly(unpackedSint64_); } + } + public int UnpackedSint64Count { + get { return unpackedSint64_.Count; } + } + public long GetUnpackedSint64(int index) { + return unpackedSint64_[index]; + } + + public const int UnpackedFixed32FieldNumber = 96; + private pbc::PopsicleList unpackedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedFixed32List { + get { return pbc::Lists.AsReadOnly(unpackedFixed32_); } + } + public int UnpackedFixed32Count { + get { return unpackedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedFixed32(int index) { + return unpackedFixed32_[index]; + } + + public const int UnpackedFixed64FieldNumber = 97; + private pbc::PopsicleList unpackedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedFixed64List { + get { return pbc::Lists.AsReadOnly(unpackedFixed64_); } + } + public int UnpackedFixed64Count { + get { return unpackedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedFixed64(int index) { + return unpackedFixed64_[index]; + } + + public const int UnpackedSfixed32FieldNumber = 98; + private pbc::PopsicleList unpackedSfixed32_ = new pbc::PopsicleList(); + public scg::IList UnpackedSfixed32List { + get { return pbc::Lists.AsReadOnly(unpackedSfixed32_); } + } + public int UnpackedSfixed32Count { + get { return unpackedSfixed32_.Count; } + } + public int GetUnpackedSfixed32(int index) { + return unpackedSfixed32_[index]; + } + + public const int UnpackedSfixed64FieldNumber = 99; + private pbc::PopsicleList unpackedSfixed64_ = new pbc::PopsicleList(); + public scg::IList UnpackedSfixed64List { + get { return pbc::Lists.AsReadOnly(unpackedSfixed64_); } + } + public int UnpackedSfixed64Count { + get { return unpackedSfixed64_.Count; } + } + public long GetUnpackedSfixed64(int index) { + return unpackedSfixed64_[index]; + } + + public const int UnpackedFloatFieldNumber = 100; + private pbc::PopsicleList unpackedFloat_ = new pbc::PopsicleList(); + public scg::IList UnpackedFloatList { + get { return pbc::Lists.AsReadOnly(unpackedFloat_); } + } + public int UnpackedFloatCount { + get { return unpackedFloat_.Count; } + } + public float GetUnpackedFloat(int index) { + return unpackedFloat_[index]; + } + + public const int UnpackedDoubleFieldNumber = 101; + private pbc::PopsicleList unpackedDouble_ = new pbc::PopsicleList(); + public scg::IList UnpackedDoubleList { + get { return pbc::Lists.AsReadOnly(unpackedDouble_); } + } + public int UnpackedDoubleCount { + get { return unpackedDouble_.Count; } + } + public double GetUnpackedDouble(int index) { + return unpackedDouble_[index]; + } + + public const int UnpackedBoolFieldNumber = 102; + private pbc::PopsicleList unpackedBool_ = new pbc::PopsicleList(); + public scg::IList UnpackedBoolList { + get { return pbc::Lists.AsReadOnly(unpackedBool_); } + } + public int UnpackedBoolCount { + get { return unpackedBool_.Count; } + } + public bool GetUnpackedBool(int index) { + return unpackedBool_[index]; + } + + public const int UnpackedEnumFieldNumber = 103; + private pbc::PopsicleList unpackedEnum_ = new pbc::PopsicleList(); + public scg::IList UnpackedEnumList { + get { return pbc::Lists.AsReadOnly(unpackedEnum_); } + } + public int UnpackedEnumCount { + get { return unpackedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetUnpackedEnum(int index) { + return unpackedEnum_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testUnpackedTypesFieldNames; + if (unpackedInt32_.Count > 0) { + output.WriteInt32Array(90, field_names[6], unpackedInt32_); + } + if (unpackedInt64_.Count > 0) { + output.WriteInt64Array(91, field_names[7], unpackedInt64_); + } + if (unpackedUint32_.Count > 0) { + output.WriteUInt32Array(92, field_names[12], unpackedUint32_); + } + if (unpackedUint64_.Count > 0) { + output.WriteUInt64Array(93, field_names[13], unpackedUint64_); + } + if (unpackedSint32_.Count > 0) { + output.WriteSInt32Array(94, field_names[10], unpackedSint32_); + } + if (unpackedSint64_.Count > 0) { + output.WriteSInt64Array(95, field_names[11], unpackedSint64_); + } + if (unpackedFixed32_.Count > 0) { + output.WriteFixed32Array(96, field_names[3], unpackedFixed32_); + } + if (unpackedFixed64_.Count > 0) { + output.WriteFixed64Array(97, field_names[4], unpackedFixed64_); + } + if (unpackedSfixed32_.Count > 0) { + output.WriteSFixed32Array(98, field_names[8], unpackedSfixed32_); + } + if (unpackedSfixed64_.Count > 0) { + output.WriteSFixed64Array(99, field_names[9], unpackedSfixed64_); + } + if (unpackedFloat_.Count > 0) { + output.WriteFloatArray(100, field_names[5], unpackedFloat_); + } + if (unpackedDouble_.Count > 0) { + output.WriteDoubleArray(101, field_names[1], unpackedDouble_); + } + if (unpackedBool_.Count > 0) { + output.WriteBoolArray(102, field_names[0], unpackedBool_); + } + if (unpackedEnum_.Count > 0) { + output.WriteEnumArray(103, field_names[2], unpackedEnum_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in UnpackedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedInt32_.Count; + } + { + int dataSize = 0; + foreach (long element in UnpackedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedInt64_.Count; + } + { + int dataSize = 0; + foreach (uint element in UnpackedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedUint32_.Count; + } + { + int dataSize = 0; + foreach (ulong element in UnpackedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedUint64_.Count; + } + { + int dataSize = 0; + foreach (int element in UnpackedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedSint32_.Count; + } + { + int dataSize = 0; + foreach (long element in UnpackedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedSint64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedFixed32_.Count; + size += dataSize; + size += 2 * unpackedFixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedFixed64_.Count; + size += dataSize; + size += 2 * unpackedFixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedSfixed32_.Count; + size += dataSize; + size += 2 * unpackedSfixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedSfixed64_.Count; + size += dataSize; + size += 2 * unpackedSfixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedFloat_.Count; + size += dataSize; + size += 2 * unpackedFloat_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedDouble_.Count; + size += dataSize; + size += 2 * unpackedDouble_.Count; + } + { + int dataSize = 0; + dataSize = 1 * unpackedBool_.Count; + size += dataSize; + size += 2 * unpackedBool_.Count; + } + { + int dataSize = 0; + if (unpackedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in unpackedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * unpackedEnum_.Count; + } + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestUnpackedTypes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestUnpackedTypes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestUnpackedTypes MakeReadOnly() { + unpackedInt32_.MakeReadOnly(); + unpackedInt64_.MakeReadOnly(); + unpackedUint32_.MakeReadOnly(); + unpackedUint64_.MakeReadOnly(); + unpackedSint32_.MakeReadOnly(); + unpackedSint64_.MakeReadOnly(); + unpackedFixed32_.MakeReadOnly(); + unpackedFixed64_.MakeReadOnly(); + unpackedSfixed32_.MakeReadOnly(); + unpackedSfixed64_.MakeReadOnly(); + unpackedFloat_.MakeReadOnly(); + unpackedDouble_.MakeReadOnly(); + unpackedBool_.MakeReadOnly(); + unpackedEnum_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestUnpackedTypes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestUnpackedTypes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestUnpackedTypes result; + + private TestUnpackedTypes PrepareBuilder() { + if (resultIsReadOnly) { + TestUnpackedTypes original = result; + result = new TestUnpackedTypes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestUnpackedTypes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.Descriptor; } + } + + public override TestUnpackedTypes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance; } + } + + public override TestUnpackedTypes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestUnpackedTypes) { + return MergeFrom((TestUnpackedTypes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestUnpackedTypes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance) return this; + PrepareBuilder(); + if (other.unpackedInt32_.Count != 0) { + result.unpackedInt32_.Add(other.unpackedInt32_); + } + if (other.unpackedInt64_.Count != 0) { + result.unpackedInt64_.Add(other.unpackedInt64_); + } + if (other.unpackedUint32_.Count != 0) { + result.unpackedUint32_.Add(other.unpackedUint32_); + } + if (other.unpackedUint64_.Count != 0) { + result.unpackedUint64_.Add(other.unpackedUint64_); + } + if (other.unpackedSint32_.Count != 0) { + result.unpackedSint32_.Add(other.unpackedSint32_); + } + if (other.unpackedSint64_.Count != 0) { + result.unpackedSint64_.Add(other.unpackedSint64_); + } + if (other.unpackedFixed32_.Count != 0) { + result.unpackedFixed32_.Add(other.unpackedFixed32_); + } + if (other.unpackedFixed64_.Count != 0) { + result.unpackedFixed64_.Add(other.unpackedFixed64_); + } + if (other.unpackedSfixed32_.Count != 0) { + result.unpackedSfixed32_.Add(other.unpackedSfixed32_); + } + if (other.unpackedSfixed64_.Count != 0) { + result.unpackedSfixed64_.Add(other.unpackedSfixed64_); + } + if (other.unpackedFloat_.Count != 0) { + result.unpackedFloat_.Add(other.unpackedFloat_); + } + if (other.unpackedDouble_.Count != 0) { + result.unpackedDouble_.Add(other.unpackedDouble_); + } + if (other.unpackedBool_.Count != 0) { + result.unpackedBool_.Add(other.unpackedBool_); + } + if (other.unpackedEnum_.Count != 0) { + result.unpackedEnum_.Add(other.unpackedEnum_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testUnpackedTypesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testUnpackedTypesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 722: + case 720: { + input.ReadInt32Array(tag, field_name, result.unpackedInt32_); + break; + } + case 730: + case 728: { + input.ReadInt64Array(tag, field_name, result.unpackedInt64_); + break; + } + case 738: + case 736: { + input.ReadUInt32Array(tag, field_name, result.unpackedUint32_); + break; + } + case 746: + case 744: { + input.ReadUInt64Array(tag, field_name, result.unpackedUint64_); + break; + } + case 754: + case 752: { + input.ReadSInt32Array(tag, field_name, result.unpackedSint32_); + break; + } + case 762: + case 760: { + input.ReadSInt64Array(tag, field_name, result.unpackedSint64_); + break; + } + case 770: + case 773: { + input.ReadFixed32Array(tag, field_name, result.unpackedFixed32_); + break; + } + case 778: + case 777: { + input.ReadFixed64Array(tag, field_name, result.unpackedFixed64_); + break; + } + case 786: + case 789: { + input.ReadSFixed32Array(tag, field_name, result.unpackedSfixed32_); + break; + } + case 794: + case 793: { + input.ReadSFixed64Array(tag, field_name, result.unpackedSfixed64_); + break; + } + case 802: + case 805: { + input.ReadFloatArray(tag, field_name, result.unpackedFloat_); + break; + } + case 810: + case 809: { + input.ReadDoubleArray(tag, field_name, result.unpackedDouble_); + break; + } + case 818: + case 816: { + input.ReadBoolArray(tag, field_name, result.unpackedBool_); + break; + } + case 826: + case 824: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.unpackedEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(103, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList UnpackedInt32List { + get { return PrepareBuilder().unpackedInt32_; } + } + public int UnpackedInt32Count { + get { return result.UnpackedInt32Count; } + } + public int GetUnpackedInt32(int index) { + return result.GetUnpackedInt32(index); + } + public Builder SetUnpackedInt32(int index, int value) { + PrepareBuilder(); + result.unpackedInt32_[index] = value; + return this; + } + public Builder AddUnpackedInt32(int value) { + PrepareBuilder(); + result.unpackedInt32_.Add(value); + return this; + } + public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedInt32_.Add(values); + return this; + } + public Builder ClearUnpackedInt32() { + PrepareBuilder(); + result.unpackedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedInt64List { + get { return PrepareBuilder().unpackedInt64_; } + } + public int UnpackedInt64Count { + get { return result.UnpackedInt64Count; } + } + public long GetUnpackedInt64(int index) { + return result.GetUnpackedInt64(index); + } + public Builder SetUnpackedInt64(int index, long value) { + PrepareBuilder(); + result.unpackedInt64_[index] = value; + return this; + } + public Builder AddUnpackedInt64(long value) { + PrepareBuilder(); + result.unpackedInt64_.Add(value); + return this; + } + public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedInt64_.Add(values); + return this; + } + public Builder ClearUnpackedInt64() { + PrepareBuilder(); + result.unpackedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedUint32List { + get { return PrepareBuilder().unpackedUint32_; } + } + public int UnpackedUint32Count { + get { return result.UnpackedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedUint32(int index) { + return result.GetUnpackedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedUint32(int index, uint value) { + PrepareBuilder(); + result.unpackedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedUint32(uint value) { + PrepareBuilder(); + result.unpackedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedUint32_.Add(values); + return this; + } + public Builder ClearUnpackedUint32() { + PrepareBuilder(); + result.unpackedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedUint64List { + get { return PrepareBuilder().unpackedUint64_; } + } + public int UnpackedUint64Count { + get { return result.UnpackedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedUint64(int index) { + return result.GetUnpackedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedUint64(int index, ulong value) { + PrepareBuilder(); + result.unpackedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedUint64(ulong value) { + PrepareBuilder(); + result.unpackedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedUint64_.Add(values); + return this; + } + public Builder ClearUnpackedUint64() { + PrepareBuilder(); + result.unpackedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSint32List { + get { return PrepareBuilder().unpackedSint32_; } + } + public int UnpackedSint32Count { + get { return result.UnpackedSint32Count; } + } + public int GetUnpackedSint32(int index) { + return result.GetUnpackedSint32(index); + } + public Builder SetUnpackedSint32(int index, int value) { + PrepareBuilder(); + result.unpackedSint32_[index] = value; + return this; + } + public Builder AddUnpackedSint32(int value) { + PrepareBuilder(); + result.unpackedSint32_.Add(value); + return this; + } + public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSint32_.Add(values); + return this; + } + public Builder ClearUnpackedSint32() { + PrepareBuilder(); + result.unpackedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSint64List { + get { return PrepareBuilder().unpackedSint64_; } + } + public int UnpackedSint64Count { + get { return result.UnpackedSint64Count; } + } + public long GetUnpackedSint64(int index) { + return result.GetUnpackedSint64(index); + } + public Builder SetUnpackedSint64(int index, long value) { + PrepareBuilder(); + result.unpackedSint64_[index] = value; + return this; + } + public Builder AddUnpackedSint64(long value) { + PrepareBuilder(); + result.unpackedSint64_.Add(value); + return this; + } + public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSint64_.Add(values); + return this; + } + public Builder ClearUnpackedSint64() { + PrepareBuilder(); + result.unpackedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedFixed32List { + get { return PrepareBuilder().unpackedFixed32_; } + } + public int UnpackedFixed32Count { + get { return result.UnpackedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedFixed32(int index) { + return result.GetUnpackedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedFixed32(int index, uint value) { + PrepareBuilder(); + result.unpackedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedFixed32(uint value) { + PrepareBuilder(); + result.unpackedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFixed32_.Add(values); + return this; + } + public Builder ClearUnpackedFixed32() { + PrepareBuilder(); + result.unpackedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedFixed64List { + get { return PrepareBuilder().unpackedFixed64_; } + } + public int UnpackedFixed64Count { + get { return result.UnpackedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedFixed64(int index) { + return result.GetUnpackedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedFixed64(int index, ulong value) { + PrepareBuilder(); + result.unpackedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedFixed64(ulong value) { + PrepareBuilder(); + result.unpackedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFixed64_.Add(values); + return this; + } + public Builder ClearUnpackedFixed64() { + PrepareBuilder(); + result.unpackedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSfixed32List { + get { return PrepareBuilder().unpackedSfixed32_; } + } + public int UnpackedSfixed32Count { + get { return result.UnpackedSfixed32Count; } + } + public int GetUnpackedSfixed32(int index) { + return result.GetUnpackedSfixed32(index); + } + public Builder SetUnpackedSfixed32(int index, int value) { + PrepareBuilder(); + result.unpackedSfixed32_[index] = value; + return this; + } + public Builder AddUnpackedSfixed32(int value) { + PrepareBuilder(); + result.unpackedSfixed32_.Add(value); + return this; + } + public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSfixed32_.Add(values); + return this; + } + public Builder ClearUnpackedSfixed32() { + PrepareBuilder(); + result.unpackedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSfixed64List { + get { return PrepareBuilder().unpackedSfixed64_; } + } + public int UnpackedSfixed64Count { + get { return result.UnpackedSfixed64Count; } + } + public long GetUnpackedSfixed64(int index) { + return result.GetUnpackedSfixed64(index); + } + public Builder SetUnpackedSfixed64(int index, long value) { + PrepareBuilder(); + result.unpackedSfixed64_[index] = value; + return this; + } + public Builder AddUnpackedSfixed64(long value) { + PrepareBuilder(); + result.unpackedSfixed64_.Add(value); + return this; + } + public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSfixed64_.Add(values); + return this; + } + public Builder ClearUnpackedSfixed64() { + PrepareBuilder(); + result.unpackedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedFloatList { + get { return PrepareBuilder().unpackedFloat_; } + } + public int UnpackedFloatCount { + get { return result.UnpackedFloatCount; } + } + public float GetUnpackedFloat(int index) { + return result.GetUnpackedFloat(index); + } + public Builder SetUnpackedFloat(int index, float value) { + PrepareBuilder(); + result.unpackedFloat_[index] = value; + return this; + } + public Builder AddUnpackedFloat(float value) { + PrepareBuilder(); + result.unpackedFloat_.Add(value); + return this; + } + public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFloat_.Add(values); + return this; + } + public Builder ClearUnpackedFloat() { + PrepareBuilder(); + result.unpackedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedDoubleList { + get { return PrepareBuilder().unpackedDouble_; } + } + public int UnpackedDoubleCount { + get { return result.UnpackedDoubleCount; } + } + public double GetUnpackedDouble(int index) { + return result.GetUnpackedDouble(index); + } + public Builder SetUnpackedDouble(int index, double value) { + PrepareBuilder(); + result.unpackedDouble_[index] = value; + return this; + } + public Builder AddUnpackedDouble(double value) { + PrepareBuilder(); + result.unpackedDouble_.Add(value); + return this; + } + public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedDouble_.Add(values); + return this; + } + public Builder ClearUnpackedDouble() { + PrepareBuilder(); + result.unpackedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedBoolList { + get { return PrepareBuilder().unpackedBool_; } + } + public int UnpackedBoolCount { + get { return result.UnpackedBoolCount; } + } + public bool GetUnpackedBool(int index) { + return result.GetUnpackedBool(index); + } + public Builder SetUnpackedBool(int index, bool value) { + PrepareBuilder(); + result.unpackedBool_[index] = value; + return this; + } + public Builder AddUnpackedBool(bool value) { + PrepareBuilder(); + result.unpackedBool_.Add(value); + return this; + } + public Builder AddRangeUnpackedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedBool_.Add(values); + return this; + } + public Builder ClearUnpackedBool() { + PrepareBuilder(); + result.unpackedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedEnumList { + get { return PrepareBuilder().unpackedEnum_; } + } + public int UnpackedEnumCount { + get { return result.UnpackedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetUnpackedEnum(int index) { + return result.GetUnpackedEnum(index); + } + public Builder SetUnpackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.unpackedEnum_[index] = value; + return this; + } + public Builder AddUnpackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.unpackedEnum_.Add(value); + return this; + } + public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedEnum_.Add(values); + return this; + } + public Builder ClearUnpackedEnum() { + PrepareBuilder(); + result.unpackedEnum_.Clear(); + return this; + } + } + static TestUnpackedTypes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestPackedExtensions : pb::ExtendableMessage { + private TestPackedExtensions() { } + private static readonly TestPackedExtensions defaultInstance = new TestPackedExtensions().MakeReadOnly(); + private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testPackedExtensionsFieldTags = new uint[] { }; + public static TestPackedExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestPackedExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestPackedExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testPackedExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestPackedExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestPackedExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestPackedExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestPackedExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestPackedExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestPackedExtensions result; + + private TestPackedExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestPackedExtensions original = result; + result = new TestPackedExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestPackedExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.Descriptor; } + } + + public override TestPackedExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.DefaultInstance; } + } + + public override TestPackedExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestPackedExtensions) { + return MergeFrom((TestPackedExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestPackedExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testPackedExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testPackedExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestPackedExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { + private TestDynamicExtensions() { } + private static readonly TestDynamicExtensions defaultInstance = new TestDynamicExtensions().MakeReadOnly(); + private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; + private static readonly uint[] _testDynamicExtensionsFieldTags = new uint[] { 16016, 16034, 16008, 16026, 16050, 16042, 16005 }; + public static TestDynamicExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestDynamicExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDynamicExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum DynamicEnumType { + DYNAMIC_FOO = 2200, + DYNAMIC_BAR = 2201, + DYNAMIC_BAZ = 2202, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class DynamicMessageType : pb::GeneratedMessage { + private DynamicMessageType() { } + private static readonly DynamicMessageType defaultInstance = new DynamicMessageType().MakeReadOnly(); + private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; + private static readonly uint[] _dynamicMessageTypeFieldTags = new uint[] { 16800 }; + public static DynamicMessageType DefaultInstance { + get { return defaultInstance; } + } + + public override DynamicMessageType DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override DynamicMessageType ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__FieldAccessorTable; } + } + + public const int DynamicFieldFieldNumber = 2100; + private bool hasDynamicField; + private int dynamicField_; + public bool HasDynamicField { + get { return hasDynamicField; } + } + public int DynamicField { + get { return dynamicField_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _dynamicMessageTypeFieldNames; + if (hasDynamicField) { + output.WriteInt32(2100, field_names[0], DynamicField); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasDynamicField) { + size += pb::CodedOutputStream.ComputeInt32Size(2100, DynamicField); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static DynamicMessageType ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DynamicMessageType ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DynamicMessageType ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DynamicMessageType ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private DynamicMessageType MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DynamicMessageType prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(DynamicMessageType cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private DynamicMessageType result; + + private DynamicMessageType PrepareBuilder() { + if (resultIsReadOnly) { + DynamicMessageType original = result; + result = new DynamicMessageType(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override DynamicMessageType MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Descriptor; } + } + + public override DynamicMessageType DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; } + } + + public override DynamicMessageType BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DynamicMessageType) { + return MergeFrom((DynamicMessageType) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DynamicMessageType other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasDynamicField) { + DynamicField = other.DynamicField; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_dynamicMessageTypeFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _dynamicMessageTypeFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 16800: { + result.hasDynamicField = input.ReadInt32(ref result.dynamicField_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasDynamicField { + get { return result.hasDynamicField; } + } + public int DynamicField { + get { return result.DynamicField; } + set { SetDynamicField(value); } + } + public Builder SetDynamicField(int value) { + PrepareBuilder(); + result.hasDynamicField = true; + result.dynamicField_ = value; + return this; + } + public Builder ClearDynamicField() { + PrepareBuilder(); + result.hasDynamicField = false; + result.dynamicField_ = 0; + return this; + } + } + static DynamicMessageType() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int ScalarExtensionFieldNumber = 2000; + private bool hasScalarExtension; + private uint scalarExtension_; + public bool HasScalarExtension { + get { return hasScalarExtension; } + } + [global::System.CLSCompliant(false)] + public uint ScalarExtension { + get { return scalarExtension_; } + } + + public const int EnumExtensionFieldNumber = 2001; + private bool hasEnumExtension; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum enumExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + public bool HasEnumExtension { + get { return hasEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumExtension { + get { return enumExtension_; } + } + + public const int DynamicEnumExtensionFieldNumber = 2002; + private bool hasDynamicEnumExtension; + private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType dynamicEnumExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType.DYNAMIC_FOO; + public bool HasDynamicEnumExtension { + get { return hasDynamicEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType DynamicEnumExtension { + get { return dynamicEnumExtension_; } + } + + public const int MessageExtensionFieldNumber = 2003; + private bool hasMessageExtension; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageExtension_; + public bool HasMessageExtension { + get { return hasMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageExtension { + get { return messageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public const int DynamicMessageExtensionFieldNumber = 2004; + private bool hasDynamicMessageExtension; + private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType dynamicMessageExtension_; + public bool HasDynamicMessageExtension { + get { return hasDynamicMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType DynamicMessageExtension { + get { return dynamicMessageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; } + } + + public const int RepeatedExtensionFieldNumber = 2005; + private pbc::PopsicleList repeatedExtension_ = new pbc::PopsicleList(); + public scg::IList RepeatedExtensionList { + get { return pbc::Lists.AsReadOnly(repeatedExtension_); } + } + public int RepeatedExtensionCount { + get { return repeatedExtension_.Count; } + } + public string GetRepeatedExtension(int index) { + return repeatedExtension_[index]; + } + + public const int PackedExtensionFieldNumber = 2006; + private int packedExtensionMemoizedSerializedSize; + private pbc::PopsicleList packedExtension_ = new pbc::PopsicleList(); + public scg::IList PackedExtensionList { + get { return pbc::Lists.AsReadOnly(packedExtension_); } + } + public int PackedExtensionCount { + get { return packedExtension_.Count; } + } + public int GetPackedExtension(int index) { + return packedExtension_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDynamicExtensionsFieldNames; + if (hasScalarExtension) { + output.WriteFixed32(2000, field_names[6], ScalarExtension); + } + if (hasEnumExtension) { + output.WriteEnum(2001, field_names[2], (int) EnumExtension, EnumExtension); + } + if (hasDynamicEnumExtension) { + output.WriteEnum(2002, field_names[0], (int) DynamicEnumExtension, DynamicEnumExtension); + } + if (hasMessageExtension) { + output.WriteMessage(2003, field_names[3], MessageExtension); + } + if (hasDynamicMessageExtension) { + output.WriteMessage(2004, field_names[1], DynamicMessageExtension); + } + if (repeatedExtension_.Count > 0) { + output.WriteStringArray(2005, field_names[5], repeatedExtension_); + } + if (packedExtension_.Count > 0) { + output.WritePackedSInt32Array(2006, field_names[4], packedExtensionMemoizedSerializedSize, packedExtension_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasScalarExtension) { + size += pb::CodedOutputStream.ComputeFixed32Size(2000, ScalarExtension); + } + if (hasEnumExtension) { + size += pb::CodedOutputStream.ComputeEnumSize(2001, (int) EnumExtension); + } + if (hasDynamicEnumExtension) { + size += pb::CodedOutputStream.ComputeEnumSize(2002, (int) DynamicEnumExtension); + } + if (hasMessageExtension) { + size += pb::CodedOutputStream.ComputeMessageSize(2003, MessageExtension); + } + if (hasDynamicMessageExtension) { + size += pb::CodedOutputStream.ComputeMessageSize(2004, DynamicMessageExtension); + } + { + int dataSize = 0; + foreach (string element in RepeatedExtensionList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedExtension_.Count; + } + { + int dataSize = 0; + foreach (int element in PackedExtensionList) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + if (packedExtension_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedExtensionMemoizedSerializedSize = dataSize; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestDynamicExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDynamicExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDynamicExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDynamicExtensions MakeReadOnly() { + repeatedExtension_.MakeReadOnly(); + packedExtension_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDynamicExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDynamicExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDynamicExtensions result; + + private TestDynamicExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestDynamicExtensions original = result; + result = new TestDynamicExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDynamicExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Descriptor; } + } + + public override TestDynamicExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.DefaultInstance; } + } + + public override TestDynamicExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestDynamicExtensions) { + return MergeFrom((TestDynamicExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDynamicExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasScalarExtension) { + ScalarExtension = other.ScalarExtension; + } + if (other.HasEnumExtension) { + EnumExtension = other.EnumExtension; + } + if (other.HasDynamicEnumExtension) { + DynamicEnumExtension = other.DynamicEnumExtension; + } + if (other.HasMessageExtension) { + MergeMessageExtension(other.MessageExtension); + } + if (other.HasDynamicMessageExtension) { + MergeDynamicMessageExtension(other.DynamicMessageExtension); + } + if (other.repeatedExtension_.Count != 0) { + result.repeatedExtension_.Add(other.repeatedExtension_); + } + if (other.packedExtension_.Count != 0) { + result.packedExtension_.Add(other.packedExtension_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDynamicExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDynamicExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 16005: { + result.hasScalarExtension = input.ReadFixed32(ref result.scalarExtension_); + break; + } + case 16008: { + object unknown; + if(input.ReadEnum(ref result.enumExtension_, out unknown)) { + result.hasEnumExtension = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(2001, (ulong)(int)unknown); + } + break; + } + case 16016: { + object unknown; + if(input.ReadEnum(ref result.dynamicEnumExtension_, out unknown)) { + result.hasDynamicEnumExtension = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(2002, (ulong)(int)unknown); + } + break; + } + case 16026: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(); + if (result.hasMessageExtension) { + subBuilder.MergeFrom(MessageExtension); + } + input.ReadMessage(subBuilder, extensionRegistry); + MessageExtension = subBuilder.BuildPartial(); + break; + } + case 16034: { + global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.CreateBuilder(); + if (result.hasDynamicMessageExtension) { + subBuilder.MergeFrom(DynamicMessageExtension); + } + input.ReadMessage(subBuilder, extensionRegistry); + DynamicMessageExtension = subBuilder.BuildPartial(); + break; + } + case 16042: { + input.ReadStringArray(tag, field_name, result.repeatedExtension_); + break; + } + case 16050: + case 16048: { + input.ReadSInt32Array(tag, field_name, result.packedExtension_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasScalarExtension { + get { return result.hasScalarExtension; } + } + [global::System.CLSCompliant(false)] + public uint ScalarExtension { + get { return result.ScalarExtension; } + set { SetScalarExtension(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetScalarExtension(uint value) { + PrepareBuilder(); + result.hasScalarExtension = true; + result.scalarExtension_ = value; + return this; + } + public Builder ClearScalarExtension() { + PrepareBuilder(); + result.hasScalarExtension = false; + result.scalarExtension_ = 0; + return this; + } + + public bool HasEnumExtension { + get { return result.hasEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumExtension { + get { return result.EnumExtension; } + set { SetEnumExtension(value); } + } + public Builder SetEnumExtension(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasEnumExtension = true; + result.enumExtension_ = value; + return this; + } + public Builder ClearEnumExtension() { + PrepareBuilder(); + result.hasEnumExtension = false; + result.enumExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + return this; + } + + public bool HasDynamicEnumExtension { + get { return result.hasDynamicEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType DynamicEnumExtension { + get { return result.DynamicEnumExtension; } + set { SetDynamicEnumExtension(value); } + } + public Builder SetDynamicEnumExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType value) { + PrepareBuilder(); + result.hasDynamicEnumExtension = true; + result.dynamicEnumExtension_ = value; + return this; + } + public Builder ClearDynamicEnumExtension() { + PrepareBuilder(); + result.hasDynamicEnumExtension = false; + result.dynamicEnumExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType.DYNAMIC_FOO; + return this; + } + + public bool HasMessageExtension { + get { return result.hasMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageExtension { + get { return result.MessageExtension; } + set { SetMessageExtension(value); } + } + public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessageExtension = true; + result.messageExtension_ = value; + return this; + } + public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMessageExtension = true; + result.messageExtension_ = builderForValue.Build(); + return this; + } + public Builder MergeMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMessageExtension && + result.messageExtension_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageExtension_).MergeFrom(value).BuildPartial(); + } else { + result.messageExtension_ = value; + } + result.hasMessageExtension = true; + return this; + } + public Builder ClearMessageExtension() { + PrepareBuilder(); + result.hasMessageExtension = false; + result.messageExtension_ = null; + return this; + } + + public bool HasDynamicMessageExtension { + get { return result.hasDynamicMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType DynamicMessageExtension { + get { return result.DynamicMessageExtension; } + set { SetDynamicMessageExtension(value); } + } + public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDynamicMessageExtension = true; + result.dynamicMessageExtension_ = value; + return this; + } + public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasDynamicMessageExtension = true; + result.dynamicMessageExtension_ = builderForValue.Build(); + return this; + } + public Builder MergeDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasDynamicMessageExtension && + result.dynamicMessageExtension_ != global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) { + result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.CreateBuilder(result.dynamicMessageExtension_).MergeFrom(value).BuildPartial(); + } else { + result.dynamicMessageExtension_ = value; + } + result.hasDynamicMessageExtension = true; + return this; + } + public Builder ClearDynamicMessageExtension() { + PrepareBuilder(); + result.hasDynamicMessageExtension = false; + result.dynamicMessageExtension_ = null; + return this; + } + + public pbc::IPopsicleList RepeatedExtensionList { + get { return PrepareBuilder().repeatedExtension_; } + } + public int RepeatedExtensionCount { + get { return result.RepeatedExtensionCount; } + } + public string GetRepeatedExtension(int index) { + return result.GetRepeatedExtension(index); + } + public Builder SetRepeatedExtension(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedExtension_[index] = value; + return this; + } + public Builder AddRepeatedExtension(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedExtension_.Add(value); + return this; + } + public Builder AddRangeRepeatedExtension(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedExtension_.Add(values); + return this; + } + public Builder ClearRepeatedExtension() { + PrepareBuilder(); + result.repeatedExtension_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedExtensionList { + get { return PrepareBuilder().packedExtension_; } + } + public int PackedExtensionCount { + get { return result.PackedExtensionCount; } + } + public int GetPackedExtension(int index) { + return result.GetPackedExtension(index); + } + public Builder SetPackedExtension(int index, int value) { + PrepareBuilder(); + result.packedExtension_[index] = value; + return this; + } + public Builder AddPackedExtension(int value) { + PrepareBuilder(); + result.packedExtension_.Add(value); + return this; + } + public Builder AddRangePackedExtension(scg::IEnumerable values) { + PrepareBuilder(); + result.packedExtension_.Add(values); + return this; + } + public Builder ClearPackedExtension() { + PrepareBuilder(); + result.packedExtension_.Clear(); + return this; + } + } + static TestDynamicExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { + private TestRepeatedScalarDifferentTagSizes() { } + private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new TestRepeatedScalarDifferentTagSizes().MakeReadOnly(); + private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; + private static readonly uint[] _testRepeatedScalarDifferentTagSizesFieldTags = new uint[] { 101, 16369, 2097141, 104, 16376, 2097144 }; + public static TestRepeatedScalarDifferentTagSizes DefaultInstance { + get { return defaultInstance; } + } + + public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRepeatedScalarDifferentTagSizes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable; } + } + + public const int RepeatedFixed32FieldNumber = 12; + private pbc::PopsicleList repeatedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed32List { + get { return pbc::Lists.AsReadOnly(repeatedFixed32_); } + } + public int RepeatedFixed32Count { + get { return repeatedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return repeatedFixed32_[index]; + } + + public const int RepeatedInt32FieldNumber = 13; + private pbc::PopsicleList repeatedInt32_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt32List { + get { return pbc::Lists.AsReadOnly(repeatedInt32_); } + } + public int RepeatedInt32Count { + get { return repeatedInt32_.Count; } + } + public int GetRepeatedInt32(int index) { + return repeatedInt32_[index]; + } + + public const int RepeatedFixed64FieldNumber = 2046; + private pbc::PopsicleList repeatedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed64List { + get { return pbc::Lists.AsReadOnly(repeatedFixed64_); } + } + public int RepeatedFixed64Count { + get { return repeatedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return repeatedFixed64_[index]; + } + + public const int RepeatedInt64FieldNumber = 2047; + private pbc::PopsicleList repeatedInt64_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt64List { + get { return pbc::Lists.AsReadOnly(repeatedInt64_); } + } + public int RepeatedInt64Count { + get { return repeatedInt64_.Count; } + } + public long GetRepeatedInt64(int index) { + return repeatedInt64_[index]; + } + + public const int RepeatedFloatFieldNumber = 262142; + private pbc::PopsicleList repeatedFloat_ = new pbc::PopsicleList(); + public scg::IList RepeatedFloatList { + get { return pbc::Lists.AsReadOnly(repeatedFloat_); } + } + public int RepeatedFloatCount { + get { return repeatedFloat_.Count; } + } + public float GetRepeatedFloat(int index) { + return repeatedFloat_[index]; + } + + public const int RepeatedUint64FieldNumber = 262143; + private pbc::PopsicleList repeatedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint64List { + get { return pbc::Lists.AsReadOnly(repeatedUint64_); } + } + public int RepeatedUint64Count { + get { return repeatedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return repeatedUint64_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRepeatedScalarDifferentTagSizesFieldNames; + if (repeatedFixed32_.Count > 0) { + output.WriteFixed32Array(12, field_names[0], repeatedFixed32_); + } + if (repeatedInt32_.Count > 0) { + output.WriteInt32Array(13, field_names[3], repeatedInt32_); + } + if (repeatedFixed64_.Count > 0) { + output.WriteFixed64Array(2046, field_names[1], repeatedFixed64_); + } + if (repeatedInt64_.Count > 0) { + output.WriteInt64Array(2047, field_names[4], repeatedInt64_); + } + if (repeatedFloat_.Count > 0) { + output.WriteFloatArray(262142, field_names[2], repeatedFloat_); + } + if (repeatedUint64_.Count > 0) { + output.WriteUInt64Array(262143, field_names[5], repeatedUint64_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + dataSize = 4 * repeatedFixed32_.Count; + size += dataSize; + size += 1 * repeatedFixed32_.Count; + } + { + int dataSize = 0; + foreach (int element in RepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedInt32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedFixed64_.Count; + size += dataSize; + size += 2 * repeatedFixed64_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFloat_.Count; + size += dataSize; + size += 3 * repeatedFloat_.Count; + } + { + int dataSize = 0; + foreach (ulong element in RepeatedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 3 * repeatedUint64_.Count; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRepeatedScalarDifferentTagSizes MakeReadOnly() { + repeatedFixed32_.MakeReadOnly(); + repeatedInt32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRepeatedScalarDifferentTagSizes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRepeatedScalarDifferentTagSizes result; + + private TestRepeatedScalarDifferentTagSizes PrepareBuilder() { + if (resultIsReadOnly) { + TestRepeatedScalarDifferentTagSizes original = result; + result = new TestRepeatedScalarDifferentTagSizes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRepeatedScalarDifferentTagSizes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.Descriptor; } + } + + public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance; } + } + + public override TestRepeatedScalarDifferentTagSizes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRepeatedScalarDifferentTagSizes) { + return MergeFrom((TestRepeatedScalarDifferentTagSizes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRepeatedScalarDifferentTagSizes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance) return this; + PrepareBuilder(); + if (other.repeatedFixed32_.Count != 0) { + result.repeatedFixed32_.Add(other.repeatedFixed32_); + } + if (other.repeatedInt32_.Count != 0) { + result.repeatedInt32_.Add(other.repeatedInt32_); + } + if (other.repeatedFixed64_.Count != 0) { + result.repeatedFixed64_.Add(other.repeatedFixed64_); + } + if (other.repeatedInt64_.Count != 0) { + result.repeatedInt64_.Add(other.repeatedInt64_); + } + if (other.repeatedFloat_.Count != 0) { + result.repeatedFloat_.Add(other.repeatedFloat_); + } + if (other.repeatedUint64_.Count != 0) { + result.repeatedUint64_.Add(other.repeatedUint64_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRepeatedScalarDifferentTagSizesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRepeatedScalarDifferentTagSizesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 98: + case 101: { + input.ReadFixed32Array(tag, field_name, result.repeatedFixed32_); + break; + } + case 106: + case 104: { + input.ReadInt32Array(tag, field_name, result.repeatedInt32_); + break; + } + case 16370: + case 16369: { + input.ReadFixed64Array(tag, field_name, result.repeatedFixed64_); + break; + } + case 16378: + case 16376: { + input.ReadInt64Array(tag, field_name, result.repeatedInt64_); + break; + } + case 2097138: + case 2097141: { + input.ReadFloatArray(tag, field_name, result.repeatedFloat_); + break; + } + case 2097146: + case 2097144: { + input.ReadUInt64Array(tag, field_name, result.repeatedUint64_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed32List { + get { return PrepareBuilder().repeatedFixed32_; } + } + public int RepeatedFixed32Count { + get { return result.RepeatedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return result.GetRepeatedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); + result.repeatedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); + result.repeatedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed32_.Add(values); + return this; + } + public Builder ClearRepeatedFixed32() { + PrepareBuilder(); + result.repeatedFixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt32List { + get { return PrepareBuilder().repeatedInt32_; } + } + public int RepeatedInt32Count { + get { return result.RepeatedInt32Count; } + } + public int GetRepeatedInt32(int index) { + return result.GetRepeatedInt32(index); + } + public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.repeatedInt32_[index] = value; + return this; + } + public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); + result.repeatedInt32_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt32_.Add(values); + return this; + } + public Builder ClearRepeatedInt32() { + PrepareBuilder(); + result.repeatedInt32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed64List { + get { return PrepareBuilder().repeatedFixed64_; } + } + public int RepeatedFixed64Count { + get { return result.RepeatedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return result.GetRepeatedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); + result.repeatedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); + result.repeatedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed64_.Add(values); + return this; + } + public Builder ClearRepeatedFixed64() { + PrepareBuilder(); + result.repeatedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt64List { + get { return PrepareBuilder().repeatedInt64_; } + } + public int RepeatedInt64Count { + get { return result.RepeatedInt64Count; } + } + public long GetRepeatedInt64(int index) { + return result.GetRepeatedInt64(index); + } + public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); + result.repeatedInt64_[index] = value; + return this; + } + public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); + result.repeatedInt64_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt64_.Add(values); + return this; + } + public Builder ClearRepeatedInt64() { + PrepareBuilder(); + result.repeatedInt64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedFloatList { + get { return PrepareBuilder().repeatedFloat_; } + } + public int RepeatedFloatCount { + get { return result.RepeatedFloatCount; } + } + public float GetRepeatedFloat(int index) { + return result.GetRepeatedFloat(index); + } + public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); + result.repeatedFloat_[index] = value; + return this; + } + public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); + result.repeatedFloat_.Add(value); + return this; + } + public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFloat_.Add(values); + return this; + } + public Builder ClearRepeatedFloat() { + PrepareBuilder(); + result.repeatedFloat_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint64List { + get { return PrepareBuilder().repeatedUint64_; } + } + public int RepeatedUint64Count { + get { return result.RepeatedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return result.GetRepeatedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); + result.repeatedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); + result.repeatedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint64_.Add(values); + return this; + } + public Builder ClearRepeatedUint64() { + PrepareBuilder(); + result.repeatedUint64_.Clear(); + return this; + } + } + static TestRepeatedScalarDifferentTagSizes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FooRequest : pb::GeneratedMessage { + private FooRequest() { } + private static readonly FooRequest defaultInstance = new FooRequest().MakeReadOnly(); + private static readonly string[] _fooRequestFieldNames = new string[] { }; + private static readonly uint[] _fooRequestFieldTags = new uint[] { }; + public static FooRequest DefaultInstance { + get { return defaultInstance; } + } + + public override FooRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FooRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooRequest__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fooRequestFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FooRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FooRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FooRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FooRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FooRequest MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FooRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FooRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FooRequest result; + + private FooRequest PrepareBuilder() { + if (resultIsReadOnly) { + FooRequest original = result; + result = new FooRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FooRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooRequest.Descriptor; } + } + + public override FooRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance; } + } + + public override FooRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FooRequest) { + return MergeFrom((FooRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FooRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fooRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fooRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static FooRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FooResponse : pb::GeneratedMessage { + private FooResponse() { } + private static readonly FooResponse defaultInstance = new FooResponse().MakeReadOnly(); + private static readonly string[] _fooResponseFieldNames = new string[] { }; + private static readonly uint[] _fooResponseFieldTags = new uint[] { }; + public static FooResponse DefaultInstance { + get { return defaultInstance; } + } + + public override FooResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FooResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooResponse__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fooResponseFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FooResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FooResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FooResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FooResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FooResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FooResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FooResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FooResponse result; + + private FooResponse PrepareBuilder() { + if (resultIsReadOnly) { + FooResponse original = result; + result = new FooResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FooResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooResponse.Descriptor; } + } + + public override FooResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance; } + } + + public override FooResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FooResponse) { + return MergeFrom((FooResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FooResponse other) { + if (other == global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fooResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fooResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static FooResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class BarRequest : pb::GeneratedMessage { + private BarRequest() { } + private static readonly BarRequest defaultInstance = new BarRequest().MakeReadOnly(); + private static readonly string[] _barRequestFieldNames = new string[] { }; + private static readonly uint[] _barRequestFieldTags = new uint[] { }; + public static BarRequest DefaultInstance { + get { return defaultInstance; } + } + + public override BarRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override BarRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarRequest__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _barRequestFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static BarRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static BarRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static BarRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static BarRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private BarRequest MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(BarRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(BarRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private BarRequest result; + + private BarRequest PrepareBuilder() { + if (resultIsReadOnly) { + BarRequest original = result; + result = new BarRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override BarRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarRequest.Descriptor; } + } + + public override BarRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance; } + } + + public override BarRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is BarRequest) { + return MergeFrom((BarRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(BarRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_barRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _barRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static BarRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class BarResponse : pb::GeneratedMessage { + private BarResponse() { } + private static readonly BarResponse defaultInstance = new BarResponse().MakeReadOnly(); + private static readonly string[] _barResponseFieldNames = new string[] { }; + private static readonly uint[] _barResponseFieldTags = new uint[] { }; + public static BarResponse DefaultInstance { + get { return defaultInstance; } + } + + public override BarResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override BarResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarResponse__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _barResponseFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static BarResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static BarResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static BarResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static BarResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private BarResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(BarResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(BarResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private BarResponse result; + + private BarResponse PrepareBuilder() { + if (resultIsReadOnly) { + BarResponse original = result; + result = new BarResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override BarResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarResponse.Descriptor; } + } + + public override BarResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance; } + } + + public override BarResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is BarResponse) { + return MergeFrom((BarResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(BarResponse other) { + if (other == global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_barResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _barResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static BarResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + #endregion + + #region Services + /* + * Service generation is now disabled by default, use the following option to enable: + * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + */ + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtoBench/google_message1.dat b/csharp/src/ProtoBench/google_message1.dat new file mode 100644 index 00000000..bc0f064c Binary files /dev/null and b/csharp/src/ProtoBench/google_message1.dat differ diff --git a/csharp/src/ProtoBench/google_message2.dat b/csharp/src/ProtoBench/google_message2.dat new file mode 100644 index 00000000..06c09441 Binary files /dev/null and b/csharp/src/ProtoBench/google_message2.dat differ diff --git a/csharp/src/ProtoDump/Program.cs b/csharp/src/ProtoDump/Program.cs new file mode 100644 index 00000000..a935e780 --- /dev/null +++ b/csharp/src/ProtoDump/Program.cs @@ -0,0 +1,88 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers.ProtoDump +{ + /// + /// Small utility to load a binary message and dump it in text form + /// + internal class Program + { + private static int Main(string[] args) + { + if (args.Length != 2) + { + Console.Error.WriteLine("Usage: ProtoDump "); + Console.Error.WriteLine("The descriptor type name is the fully-qualified message name,"); + Console.Error.WriteLine("including assembly e.g. ProjectNamespace.Message,Company.Project"); + return 1; + } + IMessage defaultMessage; + try + { + defaultMessage = MessageUtil.GetDefaultMessage(args[0]); + } + catch (ArgumentException e) + { + Console.Error.WriteLine(e.Message); + return 1; + } + try + { + IBuilder builder = defaultMessage.WeakCreateBuilderForType(); + if (builder == null) + { + Console.Error.WriteLine("Unable to create builder"); + return 1; + } + byte[] inputData = File.ReadAllBytes(args[1]); + builder.WeakMergeFrom(ByteString.CopyFrom(inputData)); + Console.WriteLine(TextFormat.PrintToString(builder.WeakBuild())); + return 0; + } + catch (Exception e) + { + Console.Error.WriteLine("Error: {0}", e.Message); + Console.Error.WriteLine(); + Console.Error.WriteLine("Detailed exception information: {0}", e); + return 1; + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoDump/Properties/AssemblyInfo.cs b/csharp/src/ProtoDump/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..a8ce8eae --- /dev/null +++ b/csharp/src/ProtoDump/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("ProtoDump")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtoDump")] +[assembly: AssemblyCopyright("Copyright © 2009")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.4.1.555")] + +[assembly: AssemblyVersion("2.4.1.555")] +[assembly: AssemblyFileVersion("2.4.1.555")] \ No newline at end of file diff --git a/csharp/src/ProtoDump/ProtoDump.csproj b/csharp/src/ProtoDump/ProtoDump.csproj new file mode 100644 index 00000000..f040d950 --- /dev/null +++ b/csharp/src/ProtoDump/ProtoDump.csproj @@ -0,0 +1,65 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {D7282E99-2DC3-405B-946F-177DB2FD2AE2} + Exe + Properties + Google.ProtocolBuffers.ProtoDump + ProtoDump + v3.5 + 512 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE + prompt + 4 + true + true + Off + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + \ No newline at end of file diff --git a/csharp/src/ProtoGen.Test/DependencyResolutionTest.cs b/csharp/src/ProtoGen.Test/DependencyResolutionTest.cs new file mode 100644 index 00000000..47c6f1a1 --- /dev/null +++ b/csharp/src/ProtoGen.Test/DependencyResolutionTest.cs @@ -0,0 +1,150 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; +using NUnit.Framework; + +namespace Google.ProtocolBuffers.ProtoGen +{ + /// + /// Tests for the dependency resolution in Generator. + /// + [TestFixture] + public class DependencyResolutionTest + { + [Test] + public void TwoDistinctFiles() + { + FileDescriptorProto first = new FileDescriptorProto.Builder {Name = "First"}.Build(); + FileDescriptorProto second = new FileDescriptorProto.Builder {Name = "Second"}.Build(); + var set = new List { first, second }; + + IList converted = Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); + Assert.AreEqual(2, converted.Count); + Assert.AreEqual("First", converted[0].Name); + Assert.AreEqual(0, converted[0].Dependencies.Count); + Assert.AreEqual("Second", converted[1].Name); + Assert.AreEqual(0, converted[1].Dependencies.Count); + } + + [Test] + public void FirstDependsOnSecond() + { + FileDescriptorProto first = + new FileDescriptorProto.Builder {Name = "First", DependencyList = {"Second"}}.Build(); + FileDescriptorProto second = new FileDescriptorProto.Builder {Name = "Second"}.Build(); + var set = new List { first, second }; + IList converted = Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); + Assert.AreEqual(2, converted.Count); + Assert.AreEqual("First", converted[0].Name); + Assert.AreEqual(1, converted[0].Dependencies.Count); + Assert.AreEqual(converted[1], converted[0].Dependencies[0]); + Assert.AreEqual("Second", converted[1].Name); + Assert.AreEqual(0, converted[1].Dependencies.Count); + } + + [Test] + public void SecondDependsOnFirst() + { + FileDescriptorProto first = new FileDescriptorProto.Builder {Name = "First"}.Build(); + FileDescriptorProto second = + new FileDescriptorProto.Builder {Name = "Second", DependencyList = {"First"}}.Build(); + var set = new List { first, second }; + IList converted = Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); + Assert.AreEqual(2, converted.Count); + Assert.AreEqual("First", converted[0].Name); + Assert.AreEqual(0, converted[0].Dependencies.Count); + Assert.AreEqual("Second", converted[1].Name); + Assert.AreEqual(1, converted[1].Dependencies.Count); + Assert.AreEqual(converted[0], converted[1].Dependencies[0]); + } + + [Test] + public void CircularDependency() + { + FileDescriptorProto first = + new FileDescriptorProto.Builder {Name = "First", DependencyList = {"Second"}}.Build(); + FileDescriptorProto second = + new FileDescriptorProto.Builder {Name = "Second", DependencyList = {"First"}}.Build(); + var set = new List { first, second }; + try + { + Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); + Assert.Fail("Expected exception"); + } + catch (DependencyResolutionException) + { + // Expected + } + } + + [Test] + public void MissingDependency() + { + FileDescriptorProto first = + new FileDescriptorProto.Builder {Name = "First", DependencyList = {"Second"}}.Build(); + var set = new List { first }; + try + { + Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); + Assert.Fail("Expected exception"); + } + catch (DependencyResolutionException) + { + // Expected + } + } + + [Test] + public void SelfDependency() + { + FileDescriptorProto first = + new FileDescriptorProto.Builder {Name = "First", DependencyList = {"First"}}.Build(); + var set = new List { first }; + try + { + Generator.ConvertDescriptors(CSharpFileOptions.DefaultInstance, set); + Assert.Fail("Expected exception"); + } + catch (DependencyResolutionException) + { + // Expected + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen.Test/Properties/AssemblyInfo.cs b/csharp/src/ProtoGen.Test/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0b632bce --- /dev/null +++ b/csharp/src/ProtoGen.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("ProtoGen.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtoGen.Test")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.4.1.555")] + +[assembly: AssemblyVersion("2.4.1.555")] +[assembly: AssemblyFileVersion("2.4.1.555")] \ No newline at end of file diff --git a/csharp/src/ProtoGen.Test/ProtoGen.Test.csproj b/csharp/src/ProtoGen.Test/ProtoGen.Test.csproj new file mode 100644 index 00000000..81f84796 --- /dev/null +++ b/csharp/src/ProtoGen.Test/ProtoGen.Test.csproj @@ -0,0 +1,99 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {C268DA4C-4004-47DA-AF23-44C983281A68} + Library + Properties + Google.ProtocolBuffers.ProtoGen + Google.ProtocolBuffers.ProtoGen.Test + v3.5 + 512 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + {250ADE34-82FD-4BAE-86D5-985FBE589C4A} + ProtoGen + + + + + protoc.exe + PreserveNewest + + + + + google\protobuf\csharp_options.proto + PreserveNewest + + + google\protobuf\descriptor.proto + PreserveNewest + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtoGen.Test/ProtocGenCsUnittests.cs b/csharp/src/ProtoGen.Test/ProtocGenCsUnittests.cs new file mode 100644 index 00000000..8ee56de5 --- /dev/null +++ b/csharp/src/ProtoGen.Test/ProtocGenCsUnittests.cs @@ -0,0 +1,683 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Reflection; +using System.Text; + +namespace Google.ProtocolBuffers.ProtoGen +{ + /// + /// Tests protoc-gen-cs plugin. + /// + [TestFixture] + [Category("Preprocessor")] + public partial class ProtocGenCsUnittests + { + private static readonly string TempPath = Path.Combine(Path.GetTempPath(), "protoc-gen-cs.Test"); + + private const string DefaultProto = + @" +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +}"; + + #region TestFixture SetUp/TearDown + + private static readonly string OriginalWorkingDirectory = Environment.CurrentDirectory; + + private StringBuilder buffer = new StringBuilder(); + + [TestFixtureSetUp] + public virtual void Setup() + { + Teardown(); + Directory.CreateDirectory(TempPath); + Environment.CurrentDirectory = TempPath; + this.buffer.Length = 0; + } + + [TestFixtureTearDown] + public virtual void Teardown() + { + Environment.CurrentDirectory = OriginalWorkingDirectory; + if (Directory.Exists(TempPath)) + { + Directory.Delete(TempPath, true); + } + } + + #endregion + + #region Helper Methods RunProtoGen / RunCsc + + private void RunProtoc(int expect, string protoFile, params string[] args) + { + string protoPath = string.Format("-I. -I\"{0}\"", OriginalWorkingDirectory); + string plugin = string.Format("--plugin=\"{0}\"", Path.Combine(OriginalWorkingDirectory, "protoc-gen-cs.exe")); + string csOut = args.Length == 0 ? "--cs_out=." : string.Format("--cs_out=\"{0}:.\"", string.Join(" ", args)); + // Start the child process. + Process p = new Process(); + // Redirect the output stream of the child process. + p.StartInfo.CreateNoWindow = true; + p.StartInfo.UseShellExecute = false; + p.StartInfo.RedirectStandardError = true; + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.WorkingDirectory = TempPath; + p.StartInfo.FileName = Path.Combine(OriginalWorkingDirectory, "protoc.exe"); + p.StartInfo.Arguments = string.Join(" ", new string[] { plugin, csOut, protoPath, protoFile }); + p.Start(); + // Read the output stream first and then wait. + buffer.AppendLine(string.Format("{0}> \"{1}\" {2}", p.StartInfo.WorkingDirectory, p.StartInfo.FileName, p.StartInfo.Arguments)); + buffer.AppendLine(p.StandardError.ReadToEnd()); + buffer.AppendLine(p.StandardOutput.ReadToEnd()); + p.WaitForExit(); + Assert.AreEqual(expect, p.ExitCode, this.buffer.ToString()); + } + + private Assembly RunCsc(int expect, params string[] sources) + { + using (TempFile tempDll = new TempFile(String.Empty)) + { + tempDll.ChangeExtension(".dll"); + List args = new List(); + args.Add("/nologo"); + args.Add("/target:library"); + args.Add("/debug-"); + args.Add(String.Format(@"""/out:{0}""", tempDll.TempPath)); + args.Add("/r:System.dll"); + args.Add(String.Format(@"""/r:{0}""", + typeof(Google.ProtocolBuffers.DescriptorProtos.DescriptorProto).Assembly. + Location)); + args.AddRange(sources); + + string exe = Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), + "csc.exe"); + ProcessStartInfo psi = new ProcessStartInfo(exe); + psi.WorkingDirectory = TempPath; + psi.CreateNoWindow = true; + psi.UseShellExecute = false; + psi.RedirectStandardOutput = true; + psi.RedirectStandardError = true; + psi.Arguments = string.Join(" ", args.ToArray()); + Process p = Process.Start(psi); + buffer.AppendLine(string.Format("{0}> \"{1}\" {2}", p.StartInfo.WorkingDirectory, p.StartInfo.FileName, p.StartInfo.Arguments)); + buffer.AppendLine(p.StandardError.ReadToEnd()); + buffer.AppendLine(p.StandardOutput.ReadToEnd()); + p.WaitForExit(); + Assert.AreEqual(expect, p.ExitCode, this.buffer.ToString()); + + Assembly asm = null; + if (p.ExitCode == 0) + { + byte[] allbytes = File.ReadAllBytes(tempDll.TempPath); + asm = Assembly.Load(allbytes); + + foreach (Type t in asm.GetTypes()) + { + Debug.WriteLine(t.FullName, asm.FullName); + } + } + return asm; + } + } + + #endregion + + // ******************************************************************* + // The following tests excercise options for protogen.exe + // ******************************************************************* + + [Test] + public void TestProtoFile() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoc(0, proto.TempPath); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithConflictingType() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +package nunit.simple; +// Test a very simple message. +message " + + test + @" { + optional string name = 1; +} ")) + { + RunProtoc(0, proto.TempPath); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple." + test, true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.Proto." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithNamespace() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoc(0, proto.TempPath, "-namespace=MyNewNamespace"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("MyNewNamespace.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("MyNewNamespace." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithUmbrellaClassName() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach("MyUmbrellaClassname.cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoc(0, proto.TempPath, "/umbrella_classname=MyUmbrellaClassname"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.MyUmbrellaClassname", true, true); + } + } + + [Test] + public void TestProtoFileWithNestedClass() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoc(0, proto.TempPath, "-nest_classes=true"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple." + test + "+MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithExpandedNsDirectories() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(@"nunit\simple\" + test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoc(0, proto.TempPath, "-expand_namespace_directories=true"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithNewExtension() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".Generated.cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoc(0, proto.TempPath, "-file_extension=.Generated.cs"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithUmbrellaNamespace() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoc(0, proto.TempPath, "-umbrella_namespace=MyUmbrella.Namespace"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.MyUmbrella.Namespace." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithIgnoredUmbrellaNamespaceDueToNesting() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoc(0, proto.TempPath, "-nest_classes=true", "-umbrella_namespace=MyUmbrella.Namespace"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple." + test + "+MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithExplicitEmptyUmbrellaNamespace() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +package nunit.simple; +// Test a very simple message. +message " + + test + @" { + optional string name = 1; +} ")) + { + //Forces the umbrella class to not use a namespace even if a collision with a type is detected. + RunProtoc(0, proto.TempPath, "-umbrella_namespace="); + //error CS0441: 'nunit.simple.TestProtoFileWithExplicitEmptyUmbrellaNamespace': a class cannot be both static and sealed + RunCsc(1, source.TempPath); + } + } + + [Test] + public void TestProtoFileWithNewOutputFolder() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(@"generated-code\" + test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoc(1, proto.TempPath, "-output_directory=generated-code"); + Directory.CreateDirectory("generated-code"); + RunProtoc(0, proto.TempPath, "-output_directory=generated-code"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileAndIgnoreGoogleProtobuf() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).namespace = ""MyNewNamespace""; +" + + DefaultProto)) + { + string google = Path.Combine(TempPath, "google\\protobuf"); + Directory.CreateDirectory(google); + foreach (string file in Directory.GetFiles(Path.Combine(OriginalWorkingDirectory, "google\\protobuf"))) + { + File.Copy(file, Path.Combine(google, Path.GetFileName(file))); + } + + Assert.AreEqual(0, Directory.GetFiles(TempPath, "*.cs").Length); + RunProtoc(0, proto.TempPath); + Assert.AreEqual(1, Directory.GetFiles(TempPath, "*.cs").Length); + + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("MyNewNamespace.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("MyNewNamespace." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithoutIgnoreGoogleProtobuf() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).namespace = ""MyNewNamespace""; +" + + DefaultProto)) + { + string google = Path.Combine(TempPath, "google\\protobuf"); + Directory.CreateDirectory(google); + foreach (string file in Directory.GetFiles(Path.Combine(OriginalWorkingDirectory, "google\\protobuf"))) + { + File.Copy(file, Path.Combine(google, Path.GetFileName(file))); + } + + Assert.AreEqual(0, Directory.GetFiles(TempPath, "*.cs").Length); + //Without the option this fails due to being unable to resolve google/protobuf descriptors + RunProtoc(0, proto.TempPath); + } + } + + // ******************************************************************* + // The following tests excercise options for protoc.exe + // ******************************************************************* + + [Test] + public void TestProtoFileWithIncludeImports() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).namespace = ""MyNewNamespace""; + +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +} ") + ) + { + string google = Path.Combine(TempPath, "google\\protobuf"); + Directory.CreateDirectory(google); + foreach (string file in Directory.GetFiles(Path.Combine(OriginalWorkingDirectory, "google\\protobuf"))) + { + File.Copy(file, Path.Combine(google, Path.GetFileName(file))); + } + + Assert.AreEqual(0, Directory.GetFiles(TempPath, "*.cs").Length); + //if you specify the protoc option --include_imports this should build three source files + RunProtoc(0, proto.TempPath); + Assert.AreEqual(1, Directory.GetFiles(TempPath, "*.cs").Length); + + //you can (and should) simply omit the inclusion of the extra source files in your project + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("MyNewNamespace.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("MyNewNamespace." + test, true, true); + } + } + + //Seems the --proto_path or -I option is non-functional for me. Maybe others have luck? + [Test] + public void TestProtoFileInDifferentDirectory() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + Environment.CurrentDirectory = OriginalWorkingDirectory; + RunProtoc(0, proto.TempPath); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + // ******************************************************************* + // Handling of mutliple input files + // ******************************************************************* + + [Test] + public void TestMultipleProtoFiles() + { + Setup(); + using (TempFile source1 = TempFile.Attach("MyMessage.cs")) + using ( + ProtoFile proto1 = new ProtoFile("MyMessage.proto", + @" +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +}") + ) + using (TempFile source2 = TempFile.Attach("MyMessageList.cs")) + using ( + ProtoFile proto2 = new ProtoFile("MyMessageList.proto", + @" +package nunit.simple; +import ""MyMessage.proto""; +// Test a very simple message. +message MyMessageList { + repeated MyMessage messages = 1; +}") + ) + { + RunProtoc(0, proto1.TempPath); + RunProtoc(0, proto2.TempPath); + Assembly a = RunCsc(0, source1.TempPath, source2.TempPath); + //assert that the message type is in the expected namespace + Type t1 = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t1), "Expect an IMessage"); + //assert that the message type is in the expected namespace + Type t2 = a.GetType("nunit.simple.MyMessageList", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t2), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.Proto.MyMessage", true, true); + a.GetType("nunit.simple.Proto.MyMessageList", true, true); + } + } + + [Test] + public void TestOneProtoFileWithBufferFile() + { + Setup(); + using (TempFile source1 = TempFile.Attach("MyMessage.cs")) + using ( + ProtoFile proto1 = new ProtoFile("MyMessage.proto", + @" +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +}") + ) + using (TempFile source2 = TempFile.Attach("MyMessageList.cs")) + using ( + ProtoFile proto2 = new ProtoFile("MyMessageList.proto", + @" +package nunit.simple; +import ""MyMessage.proto""; +// Test a very simple message. +message MyMessageList { + repeated MyMessage messages = 1; +}") + ) + { + //build the proto buffer for MyMessage + RunProtoc(0, proto1.TempPath); + //build the MyMessageList proto-buffer and generate code by including MyMessage.pb + RunProtoc(0, proto2.TempPath); + Assembly a = RunCsc(0, source1.TempPath, source2.TempPath); + //assert that the message type is in the expected namespace + Type t1 = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t1), "Expect an IMessage"); + //assert that the message type is in the expected namespace + Type t2 = a.GetType("nunit.simple.MyMessageList", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t2), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.Proto.MyMessage", true, true); + a.GetType("nunit.simple.Proto.MyMessageList", true, true); + } + } + + [Test] + public void TestProtoFileWithService() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", +@" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +} +// test a very simple service. +service TestService { + rpc Execute (MyMessage) returns (MyMessage); +}")) + { + CopyInGoogleProtoFiles(); + + RunProtoc(0, proto.TempPath, "-nest_classes=false"); + Assert.AreEqual(1, Directory.GetFiles(TempPath, "*.cs").Length); + + Assembly a = RunCsc(0, source.TempPath); + //assert that the service type is in the expected namespace + Type t1 = a.GetType("nunit.simple.TestService", true, true); + Assert.IsTrue(typeof(IService).IsAssignableFrom(t1), "Expect an IService"); + Assert.IsTrue(t1.IsAbstract, "Expect abstract class"); + //assert that the Stub subclass type is in the expected namespace + Type t2 = a.GetType("nunit.simple.TestService+Stub", true, true); + Assert.IsTrue(t1.IsAssignableFrom(t2), "Expect a sub of TestService"); + Assert.IsFalse(t2.IsAbstract, "Expect concrete class"); + } + } + + [Test] + public void TestProtoFileWithServiceInternal() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", +@" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +} +// test a very simple service. +service TestService { + rpc Execute (MyMessage) returns (MyMessage); +}")) + { + CopyInGoogleProtoFiles(); + + RunProtoc(0, proto.TempPath, "-nest_classes=false", "-public_classes=false"); + Assert.AreEqual(1, Directory.GetFiles(TempPath, "*.cs").Length); + + Assembly a = RunCsc(0, source.TempPath); + //assert that the service type is in the expected namespace + Type t1 = a.GetType("nunit.simple.TestService", true, true); + Assert.IsTrue(typeof(IService).IsAssignableFrom(t1), "Expect an IService"); + Assert.IsTrue(t1.IsAbstract, "Expect abstract class"); + //assert that the Stub subclass type is in the expected namespace + Type t2 = a.GetType("nunit.simple.TestService+Stub", true, true); + Assert.IsTrue(t1.IsAssignableFrom(t2), "Expect a sub of TestService"); + Assert.IsFalse(t2.IsAbstract, "Expect concrete class"); + } + } + + private static void CopyInGoogleProtoFiles() + { + string google = Path.Combine(TempPath, "google\\protobuf"); + Directory.CreateDirectory(google); + foreach (string file in Directory.GetFiles(Path.Combine(OriginalWorkingDirectory, "google\\protobuf"))) + { + File.Copy(file, Path.Combine(google, Path.GetFileName(file))); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen.Test/TempFile.cs b/csharp/src/ProtoGen.Test/TempFile.cs new file mode 100644 index 00000000..74a183f5 --- /dev/null +++ b/csharp/src/ProtoGen.Test/TempFile.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class ProtoFile : TempFile + { + public ProtoFile(string filename, string contents) + : base(filename, contents) + { + } + } + + internal class TempFile : IDisposable + { + private string tempFile; + + public static TempFile Attach(string path) + { + return new TempFile(path, null); + } + + protected TempFile(string filename, string contents) + { + tempFile = filename; + if (contents != null) + { + File.WriteAllText(tempFile, contents, new UTF8Encoding(false)); + } + } + + public TempFile(string contents) + : this(Path.GetTempFileName(), contents) + { + } + + public string TempPath + { + get { return tempFile; } + } + + public void ChangeExtension(string ext) + { + string newFile = Path.ChangeExtension(tempFile, ext); + File.Move(tempFile, newFile); + tempFile = newFile; + } + + public void Dispose() + { + if (File.Exists(tempFile)) + { + File.Delete(tempFile); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen.Test/TestPreprocessing.cs b/csharp/src/ProtoGen.Test/TestPreprocessing.cs new file mode 100644 index 00000000..8b3b0663 --- /dev/null +++ b/csharp/src/ProtoGen.Test/TestPreprocessing.cs @@ -0,0 +1,733 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Diagnostics; +using System.IO; +using System.Reflection; +using NUnit.Framework; + +namespace Google.ProtocolBuffers.ProtoGen +{ + [TestFixture] + [Category("Preprocessor")] + public partial class TestPreprocessing + { + private static readonly string TempPath = Path.Combine(Path.GetTempPath(), "proto-gen-test"); + + private const string DefaultProto = + @" +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +}"; + + #region TestFixture SetUp/TearDown + + private static readonly string OriginalWorkingDirectory = Environment.CurrentDirectory; + + [TestFixtureSetUp] + public virtual void Setup() + { + Teardown(); + Directory.CreateDirectory(TempPath); + Environment.CurrentDirectory = TempPath; + } + + [TestFixtureTearDown] + public virtual void Teardown() + { + Environment.CurrentDirectory = OriginalWorkingDirectory; + if (Directory.Exists(TempPath)) + { + Directory.Delete(TempPath, true); + } + } + + #endregion + + #region Helper Methods RunProtoGen / RunCsc + + private void RunProtoGen(int expect, params string[] args) + { + TextWriter tout = Console.Out, terr = Console.Error; + StringWriter temp = new StringWriter(); + Console.SetOut(temp); + Console.SetError(temp); + try + { + Assert.AreEqual(expect, ProgramPreprocess.Run(args), "ProtoGen Failed: {0}", temp); + } + finally + { + Console.SetOut(tout); + Console.SetError(terr); + } + } + + private Assembly RunCsc(int expect, params string[] sources) + { + using (TempFile tempDll = new TempFile(String.Empty)) + { + tempDll.ChangeExtension(".dll"); + List args = new List(); + args.Add("/nologo"); + args.Add("/target:library"); + args.Add("/debug-"); + args.Add(String.Format(@"""/out:{0}""", tempDll.TempPath)); + args.Add("/r:System.dll"); + args.Add(String.Format(@"""/r:{0}""", + typeof(Google.ProtocolBuffers.DescriptorProtos.DescriptorProto).Assembly. + Location)); + args.AddRange(sources); + + string exe = Path.Combine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(), + "csc.exe"); + ProcessStartInfo psi = new ProcessStartInfo(exe); + psi.CreateNoWindow = true; + psi.UseShellExecute = false; + psi.RedirectStandardOutput = true; + psi.RedirectStandardError = true; + psi.Arguments = string.Join(" ", args.ToArray()); + Process p = Process.Start(psi); + p.WaitForExit(); + string errorText = p.StandardOutput.ReadToEnd() + p.StandardError.ReadToEnd(); + Assert.AreEqual(expect, p.ExitCode, "CSC.exe Failed: {0}", errorText); + + Assembly asm = null; + if (p.ExitCode == 0) + { + byte[] allbytes = File.ReadAllBytes(tempDll.TempPath); + asm = Assembly.Load(allbytes); + + foreach (Type t in asm.GetTypes()) + { + Debug.WriteLine(t.FullName, asm.FullName); + } + } + return asm; + } + } + + #endregion + + // ******************************************************************* + // The following tests excercise options for protogen.exe + // ******************************************************************* + + [Test] + public void TestProtoFile() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoGen(0, proto.TempPath); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithConflictingType() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +package nunit.simple; +// Test a very simple message. +message " + + test + @" { + optional string name = 1; +} ")) + { + RunProtoGen(0, proto.TempPath); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple." + test, true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.Proto." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithNamespace() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoGen(0, proto.TempPath, "-namespace:MyNewNamespace"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("MyNewNamespace.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("MyNewNamespace." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithUmbrellaClassName() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach("MyUmbrellaClassname.cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoGen(0, proto.TempPath, "/umbrella_classname=MyUmbrellaClassname"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.MyUmbrellaClassname", true, true); + } + } + + [Test] + public void TestProtoFileWithNestedClass() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoGen(0, proto.TempPath, "-nest_classes:true"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple." + test + "+MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithExpandedNsDirectories() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(@"nunit\simple\" + test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoGen(0, proto.TempPath, "-expand_namespace_directories:true"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithNewExtension() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".Generated.cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoGen(0, proto.TempPath, "-file_extension:.Generated.cs"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithUmbrellaNamespace() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoGen(0, proto.TempPath, "-umbrella_namespace:MyUmbrella.Namespace"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.MyUmbrella.Namespace." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithIgnoredUmbrellaNamespaceDueToNesting() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoGen(0, proto.TempPath, "-nest_classes:true", "-umbrella_namespace:MyUmbrella.Namespace"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple." + test + "+MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithExplicitEmptyUmbrellaNamespace() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +package nunit.simple; +// Test a very simple message. +message " + + test + @" { + optional string name = 1; +} ")) + { + //Forces the umbrella class to not use a namespace even if a collision with a type is detected. + RunProtoGen(0, proto.TempPath, "-umbrella_namespace:"); + //error CS0441: 'nunit.simple.TestProtoFileWithExplicitEmptyUmbrellaNamespace': a class cannot be both static and sealed + RunCsc(1, source.TempPath); + } + } + + [Test] + public void TestProtoFileWithNewOutputFolder() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(@"generated-code\" + test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + RunProtoGen(1, proto.TempPath, "-output_directory:generated-code"); + Directory.CreateDirectory("generated-code"); + RunProtoGen(0, proto.TempPath, "-output_directory:generated-code"); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + [Test] + public void TestProtoFileAndIgnoreGoogleProtobuf() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).namespace = ""MyNewNamespace""; +" + + DefaultProto)) + { + string google = Path.Combine(TempPath, "google\\protobuf"); + Directory.CreateDirectory(google); + foreach (string file in Directory.GetFiles(Path.Combine(OriginalWorkingDirectory, "google\\protobuf"))) + { + File.Copy(file, Path.Combine(google, Path.GetFileName(file))); + } + + Assert.AreEqual(0, Directory.GetFiles(TempPath, "*.cs").Length); + RunProtoGen(0, proto.TempPath, "-ignore_google_protobuf:true"); + Assert.AreEqual(1, Directory.GetFiles(TempPath, "*.cs").Length); + + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("MyNewNamespace.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("MyNewNamespace." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithoutIgnoreGoogleProtobuf() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).namespace = ""MyNewNamespace""; +" + + DefaultProto)) + { + string google = Path.Combine(TempPath, "google\\protobuf"); + Directory.CreateDirectory(google); + foreach (string file in Directory.GetFiles(Path.Combine(OriginalWorkingDirectory, "google\\protobuf"))) + { + File.Copy(file, Path.Combine(google, Path.GetFileName(file))); + } + + Assert.AreEqual(0, Directory.GetFiles(TempPath, "*.cs").Length); + //Without the option this fails due to being unable to resolve google/protobuf descriptors + RunProtoGen(1, proto.TempPath, "-ignore_google_protobuf:false"); + } + } + + // ******************************************************************* + // The following tests excercise options for protoc.exe + // ******************************************************************* + + [Test] + public void TestProtoFileWithIncludeImports() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).namespace = ""MyNewNamespace""; + +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +} ") + ) + { + string google = Path.Combine(TempPath, "google\\protobuf"); + Directory.CreateDirectory(google); + foreach (string file in Directory.GetFiles(Path.Combine(OriginalWorkingDirectory, "google\\protobuf"))) + { + File.Copy(file, Path.Combine(google, Path.GetFileName(file))); + } + + Assert.AreEqual(0, Directory.GetFiles(TempPath, "*.cs").Length); + //if you specify the protoc option --include_imports this should build three source files + RunProtoGen(0, proto.TempPath, "--include_imports"); + Assert.AreEqual(3, Directory.GetFiles(TempPath, "*.cs").Length); + + //you can (and should) simply omit the inclusion of the extra source files in your project + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("MyNewNamespace.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("MyNewNamespace." + test, true, true); + } + } + + [Test] + public void TestProtoFileWithIncludeImportsAndIgnoreGoogleProtobuf() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).namespace = ""MyNewNamespace""; + +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +} ") + ) + { + string google = Path.Combine(TempPath, "google\\protobuf"); + Directory.CreateDirectory(google); + foreach (string file in Directory.GetFiles(Path.Combine(OriginalWorkingDirectory, "google\\protobuf"))) + File.Copy(file, Path.Combine(google, Path.GetFileName(file))); + + Assert.AreEqual(0, Directory.GetFiles(TempPath, "*.cs").Length); + //Even with --include_imports, if you provide -ignore_google_protobuf:true you only get the one source file + RunProtoGen(0, proto.TempPath, "-ignore_google_protobuf:true", "--include_imports"); + Assert.AreEqual(1, Directory.GetFiles(TempPath, "*.cs").Length); + + //you can (and should) simply omit the inclusion of the extra source files in your project + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("MyNewNamespace.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("MyNewNamespace." + test, true, true); + } + } + + [Test] + public void TestProtoFileKeepingTheProtoBuffer() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile protobuf = TempFile.Attach(test + ".pb")) + using (TempFile source = TempFile.Attach(test + ".cs")) + using ( + ProtoFile proto = new ProtoFile(test + ".proto", + @" +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +} ") + ) + { + RunProtoGen(0, proto.TempPath, "--descriptor_set_out=" + protobuf.TempPath); + Assert.IsTrue(File.Exists(protobuf.TempPath), "Missing: " + protobuf.TempPath); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + //Seems the --proto_path or -I option is non-functional for me. Maybe others have luck? + [Test] + public void TestProtoFileInDifferentDirectory() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", DefaultProto)) + { + Environment.CurrentDirectory = OriginalWorkingDirectory; + RunProtoGen(0, proto.TempPath, "--proto_path=" + TempPath); + Assembly a = RunCsc(0, source.TempPath); + //assert that the message type is in the expected namespace + Type t = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple." + test, true, true); + } + } + + // ******************************************************************* + // Handling of mutliple input files + // ******************************************************************* + + [Test] + public void TestMultipleProtoFiles() + { + Setup(); + using (TempFile source1 = TempFile.Attach("MyMessage.cs")) + using ( + ProtoFile proto1 = new ProtoFile("MyMessage.proto", + @" +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +}") + ) + using (TempFile source2 = TempFile.Attach("MyMessageList.cs")) + using ( + ProtoFile proto2 = new ProtoFile("MyMessageList.proto", + @" +package nunit.simple; +import ""MyMessage.proto""; +// Test a very simple message. +message MyMessageList { + repeated MyMessage messages = 1; +}") + ) + { + RunProtoGen(0, proto1.TempPath, proto2.TempPath); + Assembly a = RunCsc(0, source1.TempPath, source2.TempPath); + //assert that the message type is in the expected namespace + Type t1 = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t1), "Expect an IMessage"); + //assert that the message type is in the expected namespace + Type t2 = a.GetType("nunit.simple.MyMessageList", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t2), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.Proto.MyMessage", true, true); + a.GetType("nunit.simple.Proto.MyMessageList", true, true); + } + } + + [Test] + public void TestOneProtoFileWithBufferFile() + { + Setup(); + using (TempFile source1 = TempFile.Attach("MyMessage.cs")) + using (TempFile protobuf = TempFile.Attach("MyMessage.pb")) + using ( + ProtoFile proto1 = new ProtoFile("MyMessage.proto", + @" +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +}") + ) + using (TempFile source2 = TempFile.Attach("MyMessageList.cs")) + using ( + ProtoFile proto2 = new ProtoFile("MyMessageList.proto", + @" +package nunit.simple; +import ""MyMessage.proto""; +// Test a very simple message. +message MyMessageList { + repeated MyMessage messages = 1; +}") + ) + { + //build the proto buffer for MyMessage + RunProtoGen(0, proto1.TempPath, "--descriptor_set_out=" + protobuf.TempPath); + //build the MyMessageList proto-buffer and generate code by including MyMessage.pb + RunProtoGen(0, proto2.TempPath, protobuf.TempPath); + Assembly a = RunCsc(0, source1.TempPath, source2.TempPath); + //assert that the message type is in the expected namespace + Type t1 = a.GetType("nunit.simple.MyMessage", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t1), "Expect an IMessage"); + //assert that the message type is in the expected namespace + Type t2 = a.GetType("nunit.simple.MyMessageList", true, true); + Assert.IsTrue(typeof(IMessage).IsAssignableFrom(t2), "Expect an IMessage"); + //assert that we can find the static descriptor type + a.GetType("nunit.simple.Proto.MyMessage", true, true); + a.GetType("nunit.simple.Proto.MyMessageList", true, true); + } + } + + [Test] + public void TestProtoFileWithService() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", +@" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +} +// test a very simple service. +service TestService { + rpc Execute (MyMessage) returns (MyMessage); +}")) + { + CopyInGoogleProtoFiles(); + + RunProtoGen(0, proto.TempPath, "-ignore_google_protobuf:true", "-nest_classes=false"); + Assert.AreEqual(1, Directory.GetFiles(TempPath, "*.cs").Length); + + Assembly a = RunCsc(0, source.TempPath); + //assert that the service type is in the expected namespace + Type t1 = a.GetType("nunit.simple.TestService", true, true); + Assert.IsTrue(typeof(IService).IsAssignableFrom(t1), "Expect an IService"); + Assert.IsTrue(t1.IsAbstract, "Expect abstract class"); + //assert that the Stub subclass type is in the expected namespace + Type t2 = a.GetType("nunit.simple.TestService+Stub", true, true); + Assert.IsTrue(t1.IsAssignableFrom(t2), "Expect a sub of TestService"); + Assert.IsFalse(t2.IsAbstract, "Expect concrete class"); + } + } + + [Test] + public void TestProtoFileWithServiceInternal() + { + string test = new StackFrame(false).GetMethod().Name; + Setup(); + using (TempFile source = TempFile.Attach(test + ".cs")) + using (ProtoFile proto = new ProtoFile(test + ".proto", +@" +import ""google/protobuf/csharp_options.proto""; +option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + +package nunit.simple; +// Test a very simple message. +message MyMessage { + optional string name = 1; +} +// test a very simple service. +service TestService { + rpc Execute (MyMessage) returns (MyMessage); +}")) + { + CopyInGoogleProtoFiles(); + + RunProtoGen(0, proto.TempPath, "-ignore_google_protobuf:true", "-nest_classes=false", "-public_classes=false"); + Assert.AreEqual(1, Directory.GetFiles(TempPath, "*.cs").Length); + + Assembly a = RunCsc(0, source.TempPath); + //assert that the service type is in the expected namespace + Type t1 = a.GetType("nunit.simple.TestService", true, true); + Assert.IsTrue(typeof(IService).IsAssignableFrom(t1), "Expect an IService"); + Assert.IsTrue(t1.IsAbstract, "Expect abstract class"); + //assert that the Stub subclass type is in the expected namespace + Type t2 = a.GetType("nunit.simple.TestService+Stub", true, true); + Assert.IsTrue(t1.IsAssignableFrom(t2), "Expect a sub of TestService"); + Assert.IsFalse(t2.IsAbstract, "Expect concrete class"); + } + } + + private static void CopyInGoogleProtoFiles() + { + string google = Path.Combine(TempPath, "google\\protobuf"); + Directory.CreateDirectory(google); + foreach (string file in Directory.GetFiles(Path.Combine(OriginalWorkingDirectory, "google\\protobuf"))) + { + File.Copy(file, Path.Combine(google, Path.GetFileName(file))); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen.Test/protoc-gen-cs.Test.csproj b/csharp/src/ProtoGen.Test/protoc-gen-cs.Test.csproj new file mode 100644 index 00000000..2e816115 --- /dev/null +++ b/csharp/src/ProtoGen.Test/protoc-gen-cs.Test.csproj @@ -0,0 +1,101 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6} + Library + Properties + Google.ProtocolBuffers.ProtoGen + protoc-gen-cs.Test + v3.5 + 512 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + + + + + + + + + + {6908bdce-d925-43f3-94ac-a531e6df2591} + ProtocolBuffers + + + {250ade34-82fd-4bae-86d5-985fbe589c4b} + protoc-gen-cs + + + + + protoc.exe + PreserveNewest + + + + + google\protobuf\csharp_options.proto + PreserveNewest + + + google\protobuf\descriptor.proto + PreserveNewest + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtoGen/DependencyResolutionException.cs b/csharp/src/ProtoGen/DependencyResolutionException.cs new file mode 100644 index 00000000..aef192e0 --- /dev/null +++ b/csharp/src/ProtoGen/DependencyResolutionException.cs @@ -0,0 +1,55 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers.ProtoGen +{ + /// + /// Exception thrown when dependencies within a descriptor set can't be resolved. + /// + public sealed class DependencyResolutionException : Exception + { + public DependencyResolutionException(string message) : base(message) + { + } + + public DependencyResolutionException(string format, params object[] args) + : base(string.Format(format, args)) + { + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/DescriptorUtil.cs b/csharp/src/ProtoGen/DescriptorUtil.cs new file mode 100644 index 00000000..0666bb93 --- /dev/null +++ b/csharp/src/ProtoGen/DescriptorUtil.cs @@ -0,0 +1,106 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + /// + /// Utility class for determining namespaces etc. + /// + internal static class DescriptorUtil + { + internal static string GetFullUmbrellaClassName(IDescriptor descriptor) + { + CSharpFileOptions options = descriptor.File.CSharpOptions; + string result = options.Namespace; + if (result != "") + { + result += '.'; + } + result += GetQualifiedUmbrellaClassName(options); + return "global::" + result; + } + + /// + /// Evaluates the options and returns the qualified name of the umbrella class + /// relative to the descriptor type's namespace. Basically concatenates the + /// UmbrellaNamespace + UmbrellaClassname fields. + /// + internal static string GetQualifiedUmbrellaClassName(CSharpFileOptions options) + { + string fullName = options.UmbrellaClassname; + if (!options.NestClasses && options.UmbrellaNamespace != "") + { + fullName = String.Format("{0}.{1}", options.UmbrellaNamespace, options.UmbrellaClassname); + } + return fullName; + } + + internal static string GetMappedTypeName(MappedType type) + { + switch (type) + { + case MappedType.Int32: + return "int"; + case MappedType.Int64: + return "long"; + case MappedType.UInt32: + return "uint"; + case MappedType.UInt64: + return "ulong"; + case MappedType.Single: + return "float"; + case MappedType.Double: + return "double"; + case MappedType.Boolean: + return "bool"; + case MappedType.String: + return "string"; + case MappedType.ByteString: + return "pb::ByteString"; + case MappedType.Enum: + return null; + case MappedType.Message: + return null; + default: + throw new ArgumentOutOfRangeException("Unknown mapped type " + type); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/EnumFieldGenerator.cs b/csharp/src/ProtoGen/EnumFieldGenerator.cs new file mode 100644 index 00000000..8d70bc67 --- /dev/null +++ b/csharp/src/ProtoGen/EnumFieldGenerator.cs @@ -0,0 +1,148 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class EnumFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator + { + internal EnumFieldGenerator(FieldDescriptor descriptor, int fieldOrdinal) + : base(descriptor, fieldOrdinal) + { + } + + public void GenerateMembers(TextGenerator writer) + { + writer.WriteLine("private bool has{0};", PropertyName); + writer.WriteLine("private {0} {1}_ = {2};", TypeName, Name, DefaultValue); + AddDeprecatedFlag(writer); + writer.WriteLine("public bool Has{0} {{", PropertyName); + writer.WriteLine(" get {{ return has{0}; }}", PropertyName); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return {0}_; }}", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) + { + AddDeprecatedFlag(writer); + writer.WriteLine("public bool Has{0} {{", PropertyName); + writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return result.{0}; }}", PropertyName); + writer.WriteLine(" set {{ Set{0}(value); }}", PropertyName); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.has{0} = true;", PropertyName); + writer.WriteLine(" result.{0}_ = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.has{0} = false;", PropertyName); + writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) + { + writer.WriteLine("if (other.Has{0}) {{", PropertyName); + writer.WriteLine(" {0} = other.{0};", PropertyName); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) + { + // Nothing to do here for enum types + } + + public void GenerateParsingCode(TextGenerator writer) + { + writer.WriteLine("object unknown;"); + writer.WriteLine("if(input.ReadEnum(ref result.{0}_, out unknown)) {{", Name); + writer.WriteLine(" result.has{0} = true;", PropertyName); + writer.WriteLine("} else if(unknown is int) {"); + if (!UseLiteRuntime) + { + writer.WriteLine(" if (unknownFields == null) {"); // First unknown field - create builder now + writer.WriteLine(" unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer.WriteLine(" }"); + writer.WriteLine(" unknownFields.MergeVarintField({0}, (ulong)(int)unknown);", Number); + } + writer.WriteLine("}"); + } + + public void GenerateSerializationCode(TextGenerator writer) + { + writer.WriteLine("if (has{0}) {{", PropertyName); + writer.WriteLine(" output.WriteEnum({0}, field_names[{2}], (int) {1}, {1});", Number, PropertyName, + FieldOrdinal); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) + { + writer.WriteLine("if (has{0}) {{", PropertyName); + writer.WriteLine(" size += pb::CodedOutputStream.ComputeEnumSize({0}, (int) {1});", Number, PropertyName); + writer.WriteLine("}"); + } + + public override void WriteHash(TextGenerator writer) + { + writer.WriteLine("if (has{0}) hash ^= {1}_.GetHashCode();", PropertyName, Name); + } + + public override void WriteEquals(TextGenerator writer) + { + writer.WriteLine("if (has{0} != other.has{0} || (has{0} && !{1}_.Equals(other.{1}_))) return false;", + PropertyName, Name); + } + + public override void WriteToString(TextGenerator writer) + { + writer.WriteLine("PrintField(\"{0}\", has{1}, {2}_, writer);", Descriptor.Name, PropertyName, Name); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/EnumGenerator.cs b/csharp/src/ProtoGen/EnumGenerator.cs new file mode 100644 index 00000000..a6ed45d1 --- /dev/null +++ b/csharp/src/ProtoGen/EnumGenerator.cs @@ -0,0 +1,62 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class EnumGenerator : SourceGeneratorBase, ISourceGenerator + { + internal EnumGenerator(EnumDescriptor descriptor) : base(descriptor) + { + } + + // TODO(jonskeet): Write out enum descriptors? Can be retrieved from file... + public void Generate(TextGenerator writer) + { + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("{0} enum {1} {{", ClassAccessLevel, Descriptor.Name); + writer.Indent(); + foreach (EnumValueDescriptor value in Descriptor.Values) + { + writer.WriteLine("{0} = {1},", value.Name, value.Number); + } + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/ExtensionGenerator.cs b/csharp/src/ProtoGen/ExtensionGenerator.cs new file mode 100644 index 00000000..a862a7a0 --- /dev/null +++ b/csharp/src/ProtoGen/ExtensionGenerator.cs @@ -0,0 +1,183 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class ExtensionGenerator : FieldGeneratorBase, ISourceGenerator + { + private readonly string extends; + private readonly string scope; + private readonly string type; + private readonly string name; + + internal ExtensionGenerator(FieldDescriptor descriptor) + : base(descriptor, 0) + { + if (Descriptor.ExtensionScope != null) + { + scope = GetClassName(Descriptor.ExtensionScope); + } + else + { + scope = DescriptorUtil.GetFullUmbrellaClassName(Descriptor.File); + } + switch (Descriptor.MappedType) + { + case MappedType.Message: + type = GetClassName(Descriptor.MessageType); + break; + case MappedType.Enum: + type = GetClassName(Descriptor.EnumType); + break; + default: + type = DescriptorUtil.GetMappedTypeName(Descriptor.MappedType); + break; + } + extends = GetClassName(Descriptor.ContainingType); + name = Descriptor.CSharpOptions.PropertyName; + } + + public void Generate(TextGenerator writer) + { + if (Descriptor.File.CSharpOptions.ClsCompliance && GetFieldConstantName(Descriptor).StartsWith("_")) + { + writer.WriteLine("[global::System.CLSCompliant(false)]"); + } + + writer.WriteLine("public const int {0} = {1};", GetFieldConstantName(Descriptor), Descriptor.FieldNumber); + + if (UseLiteRuntime) + { + if (Descriptor.MappedType == MappedType.Message && Descriptor.MessageType.Options.MessageSetWireFormat) + { + throw new ArgumentException( + "option message_set_wire_format = true; is not supported in Lite runtime extensions."); + } + if (!Descriptor.IsCLSCompliant && Descriptor.File.CSharpOptions.ClsCompliance) + { + writer.WriteLine("[global::System.CLSCompliant(false)]"); + } + writer.WriteLine("{0} static pb::{4}<{1}, {2}> {3};", ClassAccessLevel, extends, type, name, + Descriptor.IsRepeated ? "GeneratedRepeatExtensionLite" : "GeneratedExtensionLite"); + } + else if (Descriptor.IsRepeated) + { + if (!Descriptor.IsCLSCompliant && Descriptor.File.CSharpOptions.ClsCompliance) + { + writer.WriteLine("[global::System.CLSCompliant(false)]"); + } + writer.WriteLine("{0} static pb::GeneratedExtensionBase> {2};", ClassAccessLevel, type, + name); + } + else + { + if (!Descriptor.IsCLSCompliant && Descriptor.File.CSharpOptions.ClsCompliance) + { + writer.WriteLine("[global::System.CLSCompliant(false)]"); + } + writer.WriteLine("{0} static pb::GeneratedExtensionBase<{1}> {2};", ClassAccessLevel, type, name); + } + } + + internal void GenerateStaticVariableInitializers(TextGenerator writer) + { + if (UseLiteRuntime) + { + writer.WriteLine("{0}.{1} = ", scope, name); + writer.Indent(); + writer.WriteLine("new pb::{0}<{1}, {2}>(", + Descriptor.IsRepeated ? "GeneratedRepeatExtensionLite" : "GeneratedExtensionLite", + extends, type); + writer.Indent(); + writer.WriteLine("\"{0}\",", Descriptor.FullName); + writer.WriteLine("{0}.DefaultInstance,", extends); + if (!Descriptor.IsRepeated) + { + writer.WriteLine("{0},", + Descriptor.HasDefaultValue + ? DefaultValue + : IsNullableType ? "null" : "default(" + type + ")"); + } + writer.WriteLine("{0},", + (Descriptor.MappedType == MappedType.Message) ? type + ".DefaultInstance" : "null"); + writer.WriteLine("{0},", + (Descriptor.MappedType == MappedType.Enum) ? "new EnumLiteMap<" + type + ">()" : "null"); + writer.WriteLine("{0}.{1}FieldNumber,", scope, name); + writer.Write("pbd::FieldType.{0}", Descriptor.FieldType); + if (Descriptor.IsRepeated) + { + writer.WriteLine(","); + writer.Write(Descriptor.IsPacked ? "true" : "false"); + } + writer.Outdent(); + writer.WriteLine(");"); + writer.Outdent(); + } + else if (Descriptor.IsRepeated) + { + writer.WriteLine( + "{0}.{1} = pb::GeneratedRepeatExtension<{2}>.CreateInstance({0}.Descriptor.Extensions[{3}]);", scope, + name, type, Descriptor.Index); + } + else + { + writer.WriteLine( + "{0}.{1} = pb::GeneratedSingleExtension<{2}>.CreateInstance({0}.Descriptor.Extensions[{3}]);", scope, + name, type, Descriptor.Index); + } + } + + internal void GenerateExtensionRegistrationCode(TextGenerator writer) + { + writer.WriteLine("registry.Add({0}.{1});", scope, name); + } + + public override void WriteHash(TextGenerator writer) + { + } + + public override void WriteEquals(TextGenerator writer) + { + } + + public override void WriteToString(TextGenerator writer) + { + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/FieldGeneratorBase.cs b/csharp/src/ProtoGen/FieldGeneratorBase.cs new file mode 100644 index 00000000..93aee6ca --- /dev/null +++ b/csharp/src/ProtoGen/FieldGeneratorBase.cs @@ -0,0 +1,389 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Globalization; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal abstract class FieldGeneratorBase : SourceGeneratorBase + { + private readonly int _fieldOrdinal; + + protected FieldGeneratorBase(FieldDescriptor descriptor, int fieldOrdinal) + : base(descriptor) + { + _fieldOrdinal = fieldOrdinal; + } + + public abstract void WriteHash(TextGenerator writer); + public abstract void WriteEquals(TextGenerator writer); + public abstract void WriteToString(TextGenerator writer); + + public int FieldOrdinal + { + get { return _fieldOrdinal; } + } + + private static bool AllPrintableAscii(string text) + { + foreach (char c in text) + { + if (c < 0x20 || c > 0x7e) + { + return false; + } + } + return true; + } + + /// + /// This returns true if the field has a non-default default value. For instance this returns + /// false for numerics with a default of zero '0', or booleans with a default of false. + /// + protected bool HasDefaultValue + { + get + { + switch (Descriptor.FieldType) + { + case FieldType.Float: + case FieldType.Double: + case FieldType.Int32: + case FieldType.Int64: + case FieldType.SInt32: + case FieldType.SInt64: + case FieldType.SFixed32: + case FieldType.SFixed64: + case FieldType.UInt32: + case FieldType.UInt64: + case FieldType.Fixed32: + case FieldType.Fixed64: + { + IConvertible value = (IConvertible) Descriptor.DefaultValue; + return value.ToString(CultureInfo.InvariantCulture) != "0"; + } + case FieldType.Bool: + return ((bool) Descriptor.DefaultValue) == true; + default: + return true; + } + } + } + + /// Copy exists in ExtensionGenerator.cs + protected string DefaultValue + { + get + { + string suffix = ""; + switch (Descriptor.FieldType) + { + case FieldType.Float: + suffix = "F"; + break; + case FieldType.Double: + suffix = "D"; + break; + case FieldType.Int64: + suffix = "L"; + break; + case FieldType.UInt64: + suffix = "UL"; + break; + } + switch (Descriptor.FieldType) + { + case FieldType.Float: + case FieldType.Double: + case FieldType.Int32: + case FieldType.Int64: + case FieldType.SInt32: + case FieldType.SInt64: + case FieldType.SFixed32: + case FieldType.SFixed64: + case FieldType.UInt32: + case FieldType.UInt64: + case FieldType.Fixed32: + case FieldType.Fixed64: + { + // The simple Object.ToString converts using the current culture. + // We want to always use the invariant culture so it's predictable. + IConvertible value = (IConvertible) Descriptor.DefaultValue; + //a few things that must be handled explicitly + if (Descriptor.FieldType == FieldType.Double && value is double) + { + if (double.IsNaN((double) value)) + { + return "double.NaN"; + } + if (double.IsPositiveInfinity((double) value)) + { + return "double.PositiveInfinity"; + } + if (double.IsNegativeInfinity((double) value)) + { + return "double.NegativeInfinity"; + } + } + else if (Descriptor.FieldType == FieldType.Float && value is float) + { + if (float.IsNaN((float) value)) + { + return "float.NaN"; + } + if (float.IsPositiveInfinity((float) value)) + { + return "float.PositiveInfinity"; + } + if (float.IsNegativeInfinity((float) value)) + { + return "float.NegativeInfinity"; + } + } + return value.ToString(CultureInfo.InvariantCulture) + suffix; + } + case FieldType.Bool: + return (bool) Descriptor.DefaultValue ? "true" : "false"; + + case FieldType.Bytes: + if (!Descriptor.HasDefaultValue) + { + return "pb::ByteString.Empty"; + } + if (UseLiteRuntime && Descriptor.DefaultValue is ByteString) + { + string temp = (((ByteString) Descriptor.DefaultValue).ToBase64()); + return String.Format("pb::ByteString.FromBase64(\"{0}\")", temp); + } + return string.Format("(pb::ByteString) {0}.Descriptor.Fields[{1}].DefaultValue", + GetClassName(Descriptor.ContainingType), Descriptor.Index); + case FieldType.String: + if (AllPrintableAscii(Descriptor.Proto.DefaultValue)) + { + // All chars are ASCII and printable. In this case we only + // need to escape quotes and backslashes. + return "\"" + Descriptor.Proto.DefaultValue + .Replace("\\", "\\\\") + .Replace("'", "\\'") + .Replace("\"", "\\\"") + + "\""; + } + if (UseLiteRuntime && Descriptor.DefaultValue is String) + { + string temp = Convert.ToBase64String( + Encoding.UTF8.GetBytes((String) Descriptor.DefaultValue)); + return String.Format("pb::ByteString.FromBase64(\"{0}\").ToStringUtf8()", temp); + } + return string.Format("(string) {0}.Descriptor.Fields[{1}].DefaultValue", + GetClassName(Descriptor.ContainingType), Descriptor.Index); + case FieldType.Enum: + return TypeName + "." + ((EnumValueDescriptor) Descriptor.DefaultValue).Name; + case FieldType.Message: + case FieldType.Group: + return TypeName + ".DefaultInstance"; + default: + throw new InvalidOperationException("Invalid field descriptor type"); + } + } + } + + protected string PropertyName + { + get { return Descriptor.CSharpOptions.PropertyName; } + } + + protected string Name + { + get { return NameHelpers.UnderscoresToCamelCase(GetFieldName(Descriptor)); } + } + + protected int Number + { + get { return Descriptor.FieldNumber; } + } + + protected void AddNullCheck(TextGenerator writer) + { + AddNullCheck(writer, "value"); + } + + protected void AddNullCheck(TextGenerator writer, string name) + { + if (IsNullableType) + { + writer.WriteLine(" pb::ThrowHelper.ThrowIfNull({0}, \"{0}\");", name); + } + } + + protected void AddPublicMemberAttributes(TextGenerator writer) + { + AddDeprecatedFlag(writer); + AddClsComplianceCheck(writer); + } + + protected void AddClsComplianceCheck(TextGenerator writer) + { + if (!Descriptor.IsCLSCompliant && Descriptor.File.CSharpOptions.ClsCompliance) + { + writer.WriteLine("[global::System.CLSCompliant(false)]"); + } + } + + protected bool IsObsolete { get { return Descriptor.Options.Deprecated; } } + + /// + /// Writes [global::System.ObsoleteAttribute()] if the member is obsolete + /// + protected void AddDeprecatedFlag(TextGenerator writer) + { + if (IsObsolete) + { + writer.WriteLine("[global::System.ObsoleteAttribute()]"); + } + } + + /// + /// For encodings with fixed sizes, returns that size in bytes. Otherwise + /// returns -1. TODO(jonskeet): Make this less ugly. + /// + protected int FixedSize + { + get + { + switch (Descriptor.FieldType) + { + case FieldType.UInt32: + case FieldType.UInt64: + case FieldType.Int32: + case FieldType.Int64: + case FieldType.SInt32: + case FieldType.SInt64: + case FieldType.Enum: + case FieldType.Bytes: + case FieldType.String: + case FieldType.Message: + case FieldType.Group: + return -1; + case FieldType.Float: + return WireFormat.FloatSize; + case FieldType.SFixed32: + return WireFormat.SFixed32Size; + case FieldType.Fixed32: + return WireFormat.Fixed32Size; + case FieldType.Double: + return WireFormat.DoubleSize; + case FieldType.SFixed64: + return WireFormat.SFixed64Size; + case FieldType.Fixed64: + return WireFormat.Fixed64Size; + case FieldType.Bool: + return WireFormat.BoolSize; + default: + throw new InvalidOperationException("Invalid field descriptor type"); + } + } + } + + protected bool IsNullableType + { + get + { + switch (Descriptor.FieldType) + { + case FieldType.Float: + case FieldType.Double: + case FieldType.Int32: + case FieldType.Int64: + case FieldType.SInt32: + case FieldType.SInt64: + case FieldType.SFixed32: + case FieldType.SFixed64: + case FieldType.UInt32: + case FieldType.UInt64: + case FieldType.Fixed32: + case FieldType.Fixed64: + case FieldType.Bool: + case FieldType.Enum: + return false; + case FieldType.Bytes: + case FieldType.String: + case FieldType.Message: + case FieldType.Group: + return true; + default: + throw new InvalidOperationException("Invalid field descriptor type"); + } + } + } + + protected string TypeName + { + get + { + switch (Descriptor.FieldType) + { + case FieldType.Enum: + return GetClassName(Descriptor.EnumType); + case FieldType.Message: + case FieldType.Group: + return GetClassName(Descriptor.MessageType); + default: + return DescriptorUtil.GetMappedTypeName(Descriptor.MappedType); + } + } + } + + protected string MessageOrGroup + { + get { return Descriptor.FieldType == FieldType.Group ? "Group" : "Message"; } + } + + /// + /// Returns the type name as used in CodedInputStream method names: SFixed32, UInt32 etc. + /// + protected string CapitalizedTypeName + { + get + { + // Our enum names match perfectly. How serendipitous. + return Descriptor.FieldType.ToString(); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/Generator.cs b/csharp/src/ProtoGen/Generator.cs new file mode 100644 index 00000000..bc481ec0 --- /dev/null +++ b/csharp/src/ProtoGen/Generator.cs @@ -0,0 +1,267 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using System.Text; +using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Compiler.PluginProto; +using Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + /// + /// Code generator for protocol buffers. Only C# is supported at the moment. + /// + public sealed class Generator + { + private readonly GeneratorOptions options; + + private Generator(GeneratorOptions options) + { + options.Validate(); + this.options = options; + } + + /// + /// Returns a generator configured with the specified options. + /// + public static Generator CreateGenerator(GeneratorOptions options) + { + return new Generator(options); + } + + public void Generate(CodeGeneratorRequest request, CodeGeneratorResponse.Builder response) + { + IList descriptors = ConvertDescriptors(options.FileOptions, request.ProtoFileList); + + // Combine with options from command line + foreach (FileDescriptor descriptor in descriptors) + { + descriptor.ConfigureWithDefaultOptions(options.FileOptions); + } + + bool duplicates = false; + Dictionary names = new Dictionary(StringComparer.OrdinalIgnoreCase); + foreach (FileDescriptor descriptor in descriptors) + { + string file = GetOutputFile(descriptor, false); + if (names.ContainsKey(file)) + { + duplicates = true; + break; + } + names.Add(file, true); + } + + //ROK - Changed to dictionary from HashSet to allow 2.0 compile + var filesToGenerate = new Dictionary(StringComparer.OrdinalIgnoreCase); + foreach (var item in request.FileToGenerateList) + { + filesToGenerate[item] = null; + } + foreach (FileDescriptor descriptor in descriptors) + { + // Optionally exclude descriptors in google.protobuf + if (descriptor.CSharpOptions.IgnoreGoogleProtobuf && descriptor.Package == "google.protobuf") + { + continue; + } + if (filesToGenerate.ContainsKey(descriptor.Name)) + { + Generate(descriptor, duplicates, response); + } + } + } + + /// + /// Generates code for a particular file. All dependencies must + /// already have been resolved. + /// + private void Generate(FileDescriptor descriptor, bool duplicates, CodeGeneratorResponse.Builder response) + { + var code = new StringBuilder(); + var ucg = new UmbrellaClassGenerator(descriptor); + using (StringWriter textWriter = new StringWriter(code)) + { + TextGenerator writer = new TextGenerator(textWriter, options.LineBreak); + ucg.Generate(writer); + } + response.AddFile(new CodeGeneratorResponse.Types.File.Builder + { + Name = GetOutputFile(descriptor, duplicates), + Content = code.ToString(), + }.Build()); + } + + private string GetOutputFile(FileDescriptor descriptor, bool duplicates) + { + CSharpFileOptions fileOptions = descriptor.CSharpOptions; + + string filename = descriptor.CSharpOptions.UmbrellaClassname + descriptor.CSharpOptions.FileExtension; + if (duplicates) + { + string namepart; + if (String.IsNullOrEmpty(descriptor.Name) || String.IsNullOrEmpty(namepart = Path.GetFileNameWithoutExtension(descriptor.Name))) + throw new ApplicationException("Duplicate UmbrellaClassname options created a file name collision."); + + filename = namepart + descriptor.CSharpOptions.FileExtension; + } + + string outputDirectory = descriptor.CSharpOptions.OutputDirectory; + if (fileOptions.ExpandNamespaceDirectories) + { + string package = fileOptions.Namespace; + if (!string.IsNullOrEmpty(package)) + { + string[] bits = package.Split('.'); + foreach (string bit in bits) + { + outputDirectory = Path.Combine(outputDirectory, bit); + } + } + } + + // As the directory can be explicitly specified in options, we need to make sure it exists + Directory.CreateDirectory(outputDirectory); + return Path.Combine(outputDirectory, filename); + } + + /// + /// Resolves any dependencies and converts FileDescriptorProtos into FileDescriptors. + /// The list returned is in the same order as the protos are listed in the descriptor set. + /// Note: this method is internal rather than private to allow testing. + /// + /// Not all dependencies could be resolved. + public static IList ConvertDescriptors(CSharpFileOptions options, + IList fileList) + { + FileDescriptor[] converted = new FileDescriptor[fileList.Count]; + + Dictionary convertedMap = new Dictionary(); + + int totalConverted = 0; + + bool madeProgress = true; + while (madeProgress && totalConverted < converted.Length) + { + madeProgress = false; + for (int i = 0; i < converted.Length; i++) + { + if (converted[i] != null) + { + // Already done this one + continue; + } + FileDescriptorProto candidate = fileList[i]; + FileDescriptor[] dependencies = new FileDescriptor[candidate.DependencyList.Count]; + + + CSharpFileOptions.Builder builder = options.ToBuilder(); + if (candidate.Options.HasExtension(CSharpOptions.CSharpFileOptions)) + { + builder.MergeFrom( + candidate.Options.GetExtension(CSharpOptions.CSharpFileOptions)); + } + CSharpFileOptions localOptions = builder.Build(); + + bool foundAllDependencies = true; + for (int j = 0; j < dependencies.Length; j++) + { + if (!convertedMap.TryGetValue(candidate.DependencyList[j], out dependencies[j])) + { + // We can auto-magically resolve these since we already have their description + // This way if the file is only referencing options it does not need to be built with the + // --include_imports definition. + if (localOptions.IgnoreGoogleProtobuf && + (candidate.DependencyList[j] == "google/protobuf/csharp_options.proto")) + { + dependencies[j] = CSharpOptions.Descriptor; + continue; + } + if (localOptions.IgnoreGoogleProtobuf && + (candidate.DependencyList[j] == "google/protobuf/descriptor.proto")) + { + dependencies[j] = DescriptorProtoFile.Descriptor; + continue; + } + foundAllDependencies = false; + break; + } + } + if (!foundAllDependencies) + { + continue; + } + madeProgress = true; + totalConverted++; + converted[i] = FileDescriptor.BuildFrom(candidate, dependencies); + convertedMap[candidate.Name] = converted[i]; + } + } + if (!madeProgress) + { + StringBuilder remaining = new StringBuilder(); + for (int i = 0; i < converted.Length; i++) + { + if (converted[i] == null) + { + if (remaining.Length != 0) + { + remaining.Append(", "); + } + FileDescriptorProto failure = fileList[i]; + remaining.Append(failure.Name); + remaining.Append(":"); + foreach (string dependency in failure.DependencyList) + { + if (!convertedMap.ContainsKey(dependency)) + { + remaining.Append(" "); + remaining.Append(dependency); + } + } + remaining.Append(";"); + } + } + throw new DependencyResolutionException("Unable to resolve all dependencies: " + remaining); + } + return Lists.AsReadOnly(converted); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/GeneratorOptions.cs b/csharp/src/ProtoGen/GeneratorOptions.cs new file mode 100644 index 00000000..ec500d82 --- /dev/null +++ b/csharp/src/ProtoGen/GeneratorOptions.cs @@ -0,0 +1,330 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using System.Text.RegularExpressions; +using Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + /// + /// All the configuration required for the generator - where to generate + /// output files, the location of input files etc. While this isn't immutable + /// in practice, the contents shouldn't be changed after being passed to + /// the generator. + /// + public sealed class GeneratorOptions + { + private static Dictionary LineBreaks = + new Dictionary(StringComparer.InvariantCultureIgnoreCase) + { + {"Windows", "\r\n"}, + {"Unix", "\n"}, + {"Default", Environment.NewLine} + }; + + public IList InputFiles { get; set; } + + public GeneratorOptions() + { + LineBreak = Environment.NewLine; + } + + /// + /// Attempts to validate the options, but doesn't throw an exception if they're invalid. + /// Instead, when this method returns false, the output variable will contain a collection + /// of reasons for the validation failure. + /// + /// Variable to receive a list of reasons in case of validation failure. + /// true if the options are valid; false otherwise + public bool TryValidate(out IList reasons) + { + List tmpReasons = new List(); + + ParseArguments(tmpReasons); + + // Output directory validation + if (string.IsNullOrEmpty(FileOptions.OutputDirectory)) + { + tmpReasons.Add("No output directory specified"); + } + else + { + if (!Directory.Exists(FileOptions.OutputDirectory)) + { + tmpReasons.Add("Specified output directory (" + FileOptions.OutputDirectory + " doesn't exist."); + } + } + + // Input file validation (just in terms of presence) + if (InputFiles == null || InputFiles.Count == 0) + { + tmpReasons.Add("No input files specified"); + } + else + { + foreach (string input in InputFiles) + { + FileInfo fi = new FileInfo(input); + if (!fi.Exists) + { + tmpReasons.Add("Input file " + input + " doesn't exist."); + } + } + } + + if (tmpReasons.Count != 0) + { + reasons = tmpReasons; + return false; + } + + reasons = null; + return true; + } + + /// + /// Validates that all the options have been set and are valid, + /// throwing an exception if they haven't. + /// + /// The options are invalid. + public void Validate() + { + IList reasons; + if (!TryValidate(out reasons)) + { + throw new InvalidOptionsException(reasons); + } + } + + // Raw arguments, used to provide defaults for proto file options + public IList Arguments { get; set; } + + [Obsolete("Please use GeneratorOptions.FileOptions.OutputDirectory instead")] + public string OutputDirectory + { + get { return FileOptions.OutputDirectory; } + set + { + CSharpFileOptions.Builder bld = FileOptions.ToBuilder(); + bld.OutputDirectory = value; + FileOptions = bld.Build(); + } + } + + private static readonly Regex ArgMatch = new Regex(@"^[-/](?[\w_]+?)[:=](?.*)$"); + private CSharpFileOptions fileOptions; + + public CSharpFileOptions FileOptions + { + get { return fileOptions ?? (fileOptions = CSharpFileOptions.DefaultInstance); } + set { fileOptions = value; } + } + + public string LineBreak { get; set; } + + private void ParseArguments(IList tmpReasons) + { + bool doHelp = Arguments.Count == 0; + + InputFiles = new List(); + CSharpFileOptions.Builder builder = FileOptions.ToBuilder(); + Dictionary fields = + new Dictionary(StringComparer.OrdinalIgnoreCase); + foreach (FieldDescriptor fld in builder.DescriptorForType.Fields) + { + fields.Add(fld.Name, fld); + } + + foreach (string argument in Arguments) + { + if (StringComparer.OrdinalIgnoreCase.Equals("-help", argument) || + StringComparer.OrdinalIgnoreCase.Equals("/help", argument) || + StringComparer.OrdinalIgnoreCase.Equals("-?", argument) || + StringComparer.OrdinalIgnoreCase.Equals("/?", argument)) + { + doHelp = true; + break; + } + + Match m = ArgMatch.Match(argument); + if (m.Success) + { + FieldDescriptor fld; + string name = m.Groups["name"].Value; + string value = m.Groups["value"].Value; + + if (fields.TryGetValue(name, out fld)) + { + object obj; + if (TryCoerceType(value, fld, out obj, tmpReasons)) + { + builder[fld] = obj; + } + } + else if (name == "line_break") + { + string tmp; + if (LineBreaks.TryGetValue(value, out tmp)) + { + LineBreak = tmp; + } + else + { + tmpReasons.Add("Invalid value for 'line_break': " + value + "."); + } + } + else if (!File.Exists(argument)) + { + doHelp = true; + tmpReasons.Add("Unknown argument '" + name + "'."); + } + else + { + InputFiles.Add(argument); + } + } + else + { + InputFiles.Add(argument); + } + } + + if (doHelp || InputFiles.Count == 0) + { + tmpReasons.Add("Arguments:"); + foreach (KeyValuePair field in fields) + { + tmpReasons.Add(String.Format("-{0}=[{1}]", field.Key, field.Value.FieldType)); + } + tmpReasons.Add("-line_break=[" + string.Join("|", new List(LineBreaks.Keys).ToArray()) + "]"); + tmpReasons.Add("followed by one or more file paths."); + } + else + { + FileOptions = builder.Build(); + } + } + + private static bool TryCoerceType(string text, FieldDescriptor field, out object value, IList tmpReasons) + { + value = null; + + switch (field.FieldType) + { + case FieldType.Int32: + case FieldType.SInt32: + case FieldType.SFixed32: + value = Int32.Parse(text); + break; + + case FieldType.Int64: + case FieldType.SInt64: + case FieldType.SFixed64: + value = Int64.Parse(text); + break; + + case FieldType.UInt32: + case FieldType.Fixed32: + value = UInt32.Parse(text); + break; + + case FieldType.UInt64: + case FieldType.Fixed64: + value = UInt64.Parse(text); + break; + + case FieldType.Float: + value = float.Parse(text); + break; + + case FieldType.Double: + value = Double.Parse(text); + break; + + case FieldType.Bool: + value = Boolean.Parse(text); + break; + + case FieldType.String: + value = text; + break; + + case FieldType.Enum: + { + EnumDescriptor enumType = field.EnumType; + + int number; + if (int.TryParse(text, out number)) + { + value = enumType.FindValueByNumber(number); + if (value == null) + { + tmpReasons.Add( + "Enum type \"" + enumType.FullName + + "\" has no value with number " + number + "."); + return false; + } + } + else + { + value = enumType.FindValueByName(text); + if (value == null) + { + tmpReasons.Add( + "Enum type \"" + enumType.FullName + + "\" has no value named \"" + text + "\"."); + return false; + } + } + + break; + } + + case FieldType.Bytes: + case FieldType.Message: + case FieldType.Group: + tmpReasons.Add("Unhandled field type " + field.FieldType.ToString() + "."); + return false; + } + + return true; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/Helpers.cs b/csharp/src/ProtoGen/Helpers.cs new file mode 100644 index 00000000..3c001150 --- /dev/null +++ b/csharp/src/ProtoGen/Helpers.cs @@ -0,0 +1,45 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers.ProtoGen +{ + /// + /// Helpers to resolve class names etc. + /// + internal static class Helpers + { + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/IFieldSourceGenerator.cs b/csharp/src/ProtoGen/IFieldSourceGenerator.cs new file mode 100644 index 00000000..f53ae5e4 --- /dev/null +++ b/csharp/src/ProtoGen/IFieldSourceGenerator.cs @@ -0,0 +1,53 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers.ProtoGen +{ + internal interface IFieldSourceGenerator + { + void GenerateMembers(TextGenerator writer); + void GenerateBuilderMembers(TextGenerator writer); + void GenerateMergingCode(TextGenerator writer); + void GenerateBuildingCode(TextGenerator writer); + void GenerateParsingCode(TextGenerator writer); + void GenerateSerializationCode(TextGenerator writer); + void GenerateSerializedSizeCode(TextGenerator writer); + + void WriteHash(TextGenerator writer); + void WriteEquals(TextGenerator writer); + void WriteToString(TextGenerator writer); + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/ISourceGenerator.cs b/csharp/src/ProtoGen/ISourceGenerator.cs new file mode 100644 index 00000000..452d854a --- /dev/null +++ b/csharp/src/ProtoGen/ISourceGenerator.cs @@ -0,0 +1,43 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers.ProtoGen +{ + internal interface ISourceGenerator + { + void Generate(TextGenerator writer); + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/InvalidOptionsException.cs b/csharp/src/ProtoGen/InvalidOptionsException.cs new file mode 100644 index 00000000..fb698495 --- /dev/null +++ b/csharp/src/ProtoGen/InvalidOptionsException.cs @@ -0,0 +1,77 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Collections; + +namespace Google.ProtocolBuffers.ProtoGen +{ + /// + /// Exception thrown to indicate that the options passed were invalid. + /// + public sealed class InvalidOptionsException : Exception + { + private readonly IList reasons; + + /// + /// An immutable list of reasons why the options were invalid. + /// + public IList Reasons + { + get { return reasons; } + } + + public InvalidOptionsException(IList reasons) + : base(BuildMessage(reasons)) + { + this.reasons = Lists.AsReadOnly(reasons); + } + + private static string BuildMessage(IEnumerable reasons) + { + StringBuilder builder = new StringBuilder("Invalid options:"); + builder.AppendLine(); + foreach (string reason in reasons) + { + builder.Append(" "); + builder.AppendLine(reason); + } + return builder.ToString(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/MessageFieldGenerator.cs b/csharp/src/ProtoGen/MessageFieldGenerator.cs new file mode 100644 index 00000000..25b58a60 --- /dev/null +++ b/csharp/src/ProtoGen/MessageFieldGenerator.cs @@ -0,0 +1,174 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class MessageFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator + { + internal MessageFieldGenerator(FieldDescriptor descriptor, int fieldOrdinal) + : base(descriptor, fieldOrdinal) + { + } + + public void GenerateMembers(TextGenerator writer) + { + writer.WriteLine("private bool has{0};", PropertyName); + writer.WriteLine("private {0} {1}_;", TypeName, Name); + AddDeprecatedFlag(writer); + writer.WriteLine("public bool Has{0} {{", PropertyName); + writer.WriteLine(" get {{ return has{0}; }}", PropertyName); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return {0}_ ?? {1}; }}", Name, DefaultValue); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) + { + AddDeprecatedFlag(writer); + writer.WriteLine("public bool Has{0} {{", PropertyName); + writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return result.{0}; }}", PropertyName); + writer.WriteLine(" set {{ Set{0}(value); }}", PropertyName); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName); + AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.has{0} = true;", PropertyName); + writer.WriteLine(" result.{0}_ = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Set{0}({1}.Builder builderForValue) {{", PropertyName, TypeName); + AddNullCheck(writer, "builderForValue"); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.has{0} = true;", PropertyName); + writer.WriteLine(" result.{0}_ = builderForValue.Build();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Merge{0}({1} value) {{", PropertyName, TypeName); + AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" if (result.has{0} &&", PropertyName); + writer.WriteLine(" result.{0}_ != {1}) {{", Name, DefaultValue); + writer.WriteLine(" result.{0}_ = {1}.CreateBuilder(result.{0}_).MergeFrom(value).BuildPartial();", Name, + TypeName); + writer.WriteLine(" } else {"); + writer.WriteLine(" result.{0}_ = value;", Name); + writer.WriteLine(" }"); + writer.WriteLine(" result.has{0} = true;", PropertyName); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.has{0} = false;", PropertyName); + writer.WriteLine(" result.{0}_ = null;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) + { + writer.WriteLine("if (other.Has{0}) {{", PropertyName); + writer.WriteLine(" Merge{0}(other.{0});", PropertyName); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) + { + // Nothing to do for singular fields + } + + public void GenerateParsingCode(TextGenerator writer) + { + writer.WriteLine("{0}.Builder subBuilder = {0}.CreateBuilder();", TypeName); + writer.WriteLine("if (result.has{0}) {{", PropertyName); + writer.WriteLine(" subBuilder.MergeFrom({0});", PropertyName); + writer.WriteLine("}"); + if (Descriptor.FieldType == FieldType.Group) + { + writer.WriteLine("input.ReadGroup({0}, subBuilder, extensionRegistry);", Number); + } + else + { + writer.WriteLine("input.ReadMessage(subBuilder, extensionRegistry);"); + } + writer.WriteLine("{0} = subBuilder.BuildPartial();", PropertyName); + } + + public void GenerateSerializationCode(TextGenerator writer) + { + writer.WriteLine("if (has{0}) {{", PropertyName); + writer.WriteLine(" output.Write{0}({1}, field_names[{3}], {2});", MessageOrGroup, Number, PropertyName, + FieldOrdinal); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) + { + writer.WriteLine("if (has{0}) {{", PropertyName); + writer.WriteLine(" size += pb::CodedOutputStream.Compute{0}Size({1}, {2});", + MessageOrGroup, Number, PropertyName); + writer.WriteLine("}"); + } + + public override void WriteHash(TextGenerator writer) + { + writer.WriteLine("if (has{0}) hash ^= {1}_.GetHashCode();", PropertyName, Name); + } + + public override void WriteEquals(TextGenerator writer) + { + writer.WriteLine("if (has{0} != other.has{0} || (has{0} && !{1}_.Equals(other.{1}_))) return false;", + PropertyName, Name); + } + + public override void WriteToString(TextGenerator writer) + { + writer.WriteLine("PrintField(\"{2}\", has{0}, {1}_, writer);", PropertyName, Name, + Descriptor.FieldType == FieldType.Group ? Descriptor.MessageType.Name : Descriptor.Name); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/MessageGenerator.cs b/csharp/src/ProtoGen/MessageGenerator.cs new file mode 100644 index 00000000..e7ed1e86 --- /dev/null +++ b/csharp/src/ProtoGen/MessageGenerator.cs @@ -0,0 +1,893 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class MessageGenerator : SourceGeneratorBase, ISourceGenerator + { + private string[] _fieldNames; + + internal MessageGenerator(MessageDescriptor descriptor) : base(descriptor) + { + } + + private string ClassName + { + get { return Descriptor.Name; } + } + + private string FullClassName + { + get { return GetClassName(Descriptor); } + } + + /// + /// Get an identifier that uniquely identifies this type within the file. + /// This is used to declare static variables related to this type at the + /// outermost file scope. + /// + private static string GetUniqueFileScopeIdentifier(IDescriptor descriptor) + { + return "static_" + descriptor.FullName.Replace(".", "_"); + } + + internal void GenerateStaticVariables(TextGenerator writer) + { + // Because descriptor.proto (Google.ProtocolBuffers.DescriptorProtos) is + // used in the construction of descriptors, we have a tricky bootstrapping + // problem. To help control static initialization order, we make sure all + // descriptors and other static data that depends on them are members of + // the proto-descriptor class. This way, they will be initialized in + // a deterministic order. + + string identifier = GetUniqueFileScopeIdentifier(Descriptor); + + if (!UseLiteRuntime) + { + // The descriptor for this type. + string access = Descriptor.File.CSharpOptions.NestClasses ? "private" : "internal"; + writer.WriteLine("{0} static pbd::MessageDescriptor internal__{1}__Descriptor;", access, identifier); + writer.WriteLine( + "{0} static pb::FieldAccess.FieldAccessorTable<{1}, {1}.Builder> internal__{2}__FieldAccessorTable;", + access, FullClassName, identifier); + } + // Generate static members for all nested types. + foreach (MessageDescriptor nestedMessage in Descriptor.NestedTypes) + { + new MessageGenerator(nestedMessage).GenerateStaticVariables(writer); + } + } + + internal void GenerateStaticVariableInitializers(TextGenerator writer) + { + string identifier = GetUniqueFileScopeIdentifier(Descriptor); + + if (!UseLiteRuntime) + { + writer.Write("internal__{0}__Descriptor = ", identifier); + if (Descriptor.ContainingType == null) + { + writer.WriteLine("Descriptor.MessageTypes[{0}];", Descriptor.Index); + } + else + { + writer.WriteLine("internal__{0}__Descriptor.NestedTypes[{1}];", + GetUniqueFileScopeIdentifier(Descriptor.ContainingType), Descriptor.Index); + } + + writer.WriteLine("internal__{0}__FieldAccessorTable = ", identifier); + writer.WriteLine( + " new pb::FieldAccess.FieldAccessorTable<{1}, {1}.Builder>(internal__{0}__Descriptor,", + identifier, FullClassName); + writer.Print(" new string[] { "); + foreach (FieldDescriptor field in Descriptor.Fields) + { + writer.Write("\"{0}\", ", field.CSharpOptions.PropertyName); + } + writer.WriteLine("});"); + } + + // Generate static member initializers for all nested types. + foreach (MessageDescriptor nestedMessage in Descriptor.NestedTypes) + { + new MessageGenerator(nestedMessage).GenerateStaticVariableInitializers(writer); + } + + foreach (FieldDescriptor extension in Descriptor.Extensions) + { + new ExtensionGenerator(extension).GenerateStaticVariableInitializers(writer); + } + } + + public string[] FieldNames + { + get + { + if (_fieldNames == null) + { + List names = new List(); + foreach (FieldDescriptor fieldDescriptor in Descriptor.Fields) + { + names.Add(fieldDescriptor.Name); + } + //if you change this, the search must also change in GenerateBuilderParsingMethods + names.Sort(StringComparer.Ordinal); + _fieldNames = names.ToArray(); + } + return _fieldNames; + } + } + + internal int FieldOrdinal(FieldDescriptor field) + { + return Array.BinarySearch(FieldNames, field.Name, StringComparer.Ordinal); + } + + private IFieldSourceGenerator CreateFieldGenerator(FieldDescriptor fieldDescriptor) + { + return SourceGenerators.CreateFieldGenerator(fieldDescriptor, FieldOrdinal(fieldDescriptor)); + } + + public void Generate(TextGenerator writer) + { + if (Descriptor.File.CSharpOptions.AddSerializable) + { + writer.WriteLine("[global::System.SerializableAttribute()]"); + } + writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("{0} sealed partial class {1} : pb::{2}Message{3}<{1}, {1}.Builder> {{", + ClassAccessLevel, ClassName, + Descriptor.Proto.ExtensionRangeCount > 0 ? "Extendable" : "Generated", + RuntimeSuffix); + writer.Indent(); + if (Descriptor.File.CSharpOptions.GeneratePrivateCtor) + { + writer.WriteLine("private {0}() {{ }}", ClassName); + } + // Must call MakeReadOnly() to make sure all lists are made read-only + writer.WriteLine("private static readonly {0} defaultInstance = new {0}().MakeReadOnly();", ClassName); + + if (OptimizeSpeed) + { + writer.WriteLine("private static readonly string[] _{0}FieldNames = new string[] {{ {2}{1}{2} }};", + NameHelpers.UnderscoresToCamelCase(ClassName), String.Join("\", \"", FieldNames), + FieldNames.Length > 0 ? "\"" : ""); + List tags = new List(); + foreach (string name in FieldNames) + { + tags.Add(WireFormat.MakeTag(Descriptor.FindFieldByName(name)).ToString()); + } + + writer.WriteLine("private static readonly uint[] _{0}FieldTags = new uint[] {{ {1} }};", + NameHelpers.UnderscoresToCamelCase(ClassName), String.Join(", ", tags.ToArray())); + } + writer.WriteLine("public static {0} DefaultInstance {{", ClassName); + writer.WriteLine(" get { return defaultInstance; }"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override {0} DefaultInstanceForType {{", ClassName); + writer.WriteLine(" get { return DefaultInstance; }"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("protected override {0} ThisMessage {{", ClassName); + writer.WriteLine(" get { return this; }"); + writer.WriteLine("}"); + writer.WriteLine(); + if (!UseLiteRuntime) + { + writer.WriteLine("public static pbd::MessageDescriptor Descriptor {"); + writer.WriteLine(" get {{ return {0}.internal__{1}__Descriptor; }}", + DescriptorUtil.GetFullUmbrellaClassName(Descriptor), + GetUniqueFileScopeIdentifier(Descriptor)); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine( + "protected override pb::FieldAccess.FieldAccessorTable<{0}, {0}.Builder> InternalFieldAccessors {{", + ClassName); + writer.WriteLine(" get {{ return {0}.internal__{1}__FieldAccessorTable; }}", + DescriptorUtil.GetFullUmbrellaClassName(Descriptor), + GetUniqueFileScopeIdentifier(Descriptor)); + writer.WriteLine("}"); + writer.WriteLine(); + } + + // Extensions don't need to go in an extra nested type + WriteChildren(writer, null, Descriptor.Extensions); + + if (Descriptor.EnumTypes.Count + Descriptor.NestedTypes.Count > 0) + { + writer.WriteLine("#region Nested types"); + writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("public static partial class Types {"); + writer.Indent(); + WriteChildren(writer, null, Descriptor.EnumTypes); + WriteChildren(writer, null, Descriptor.NestedTypes); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine("#endregion"); + writer.WriteLine(); + } + + foreach (FieldDescriptor fieldDescriptor in Descriptor.Fields) + { + if (Descriptor.File.CSharpOptions.ClsCompliance && GetFieldConstantName(fieldDescriptor).StartsWith("_")) + { + writer.WriteLine("[global::System.CLSCompliant(false)]"); + } + + // Rats: we lose the debug comment here :( + writer.WriteLine("public const int {0} = {1};", GetFieldConstantName(fieldDescriptor), + fieldDescriptor.FieldNumber); + CreateFieldGenerator(fieldDescriptor).GenerateMembers(writer); + writer.WriteLine(); + } + + if (OptimizeSpeed) + { + GenerateIsInitialized(writer); + GenerateMessageSerializationMethods(writer); + } + if (UseLiteRuntime) + { + GenerateLiteRuntimeMethods(writer); + } + + GenerateParseFromMethods(writer); + GenerateBuilder(writer); + + // Force the static initialization code for the file to run, since it may + // initialize static variables declared in this class. + writer.WriteLine("static {0}() {{", ClassName); + // We call object.ReferenceEquals() just to make it a valid statement on its own. + // Another option would be GetType(), but that causes problems in DescriptorProtoFile, + // where the bootstrapping is somewhat recursive - type initializers call + // each other, effectively. We temporarily see Descriptor as null. + writer.WriteLine(" object.ReferenceEquals({0}.Descriptor, null);", + DescriptorUtil.GetFullUmbrellaClassName(Descriptor)); + writer.WriteLine("}"); + + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + private void GenerateLiteRuntimeMethods(TextGenerator writer) + { + bool callbase = Descriptor.Proto.ExtensionRangeCount > 0; + writer.WriteLine("#region Lite runtime methods"); + writer.WriteLine("public override int GetHashCode() {"); + writer.Indent(); + writer.WriteLine("int hash = GetType().GetHashCode();"); + foreach (FieldDescriptor fieldDescriptor in Descriptor.Fields) + { + CreateFieldGenerator(fieldDescriptor).WriteHash(writer); + } + if (callbase) + { + writer.WriteLine("hash ^= base.GetHashCode();"); + } + writer.WriteLine("return hash;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine("public override bool Equals(object obj) {"); + writer.Indent(); + writer.WriteLine("{0} other = obj as {0};", ClassName); + writer.WriteLine("if (other == null) return false;"); + foreach (FieldDescriptor fieldDescriptor in Descriptor.Fields) + { + CreateFieldGenerator(fieldDescriptor).WriteEquals(writer); + } + if (callbase) + { + writer.WriteLine("if (!base.Equals(other)) return false;"); + } + writer.WriteLine("return true;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine("public override void PrintTo(global::System.IO.TextWriter writer) {"); + writer.Indent(); + List sorted = new List(Descriptor.Fields); + sorted.Sort( + new Comparison( + delegate(FieldDescriptor a, FieldDescriptor b) { return a.FieldNumber.CompareTo(b.FieldNumber); })); + foreach (FieldDescriptor fieldDescriptor in sorted) + { + CreateFieldGenerator(fieldDescriptor).WriteToString(writer); + } + if (callbase) + { + writer.WriteLine("base.PrintTo(writer);"); + } + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine("#endregion"); + writer.WriteLine(); + } + + private void GenerateMessageSerializationMethods(TextGenerator writer) + { + List sortedFields = new List(Descriptor.Fields); + sortedFields.Sort((f1, f2) => f1.FieldNumber.CompareTo(f2.FieldNumber)); + + List sortedExtensions = + new List(Descriptor.Proto.ExtensionRangeList); + sortedExtensions.Sort((r1, r2) => (r1.Start.CompareTo(r2.Start))); + + writer.WriteLine("public override void WriteTo(pb::ICodedOutputStream output) {"); + writer.Indent(); + // Make sure we've computed the serialized length, so that packed fields are generated correctly. + writer.WriteLine("CalcSerializedSize();"); + writer.WriteLine("string[] field_names = _{0}FieldNames;", NameHelpers.UnderscoresToCamelCase(ClassName)); + if (Descriptor.Proto.ExtensionRangeList.Count > 0) + { + writer.WriteLine( + "pb::ExtendableMessage{1}<{0}, {0}.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);", + ClassName, RuntimeSuffix); + } + + // Merge the fields and the extension ranges, both sorted by field number. + for (int i = 0, j = 0; i < Descriptor.Fields.Count || j < sortedExtensions.Count;) + { + if (i == Descriptor.Fields.Count) + { + GenerateSerializeOneExtensionRange(writer, sortedExtensions[j++]); + } + else if (j == sortedExtensions.Count) + { + GenerateSerializeOneField(writer, sortedFields[i++]); + } + else if (sortedFields[i].FieldNumber < sortedExtensions[j].Start) + { + GenerateSerializeOneField(writer, sortedFields[i++]); + } + else + { + GenerateSerializeOneExtensionRange(writer, sortedExtensions[j++]); + } + } + + if (!UseLiteRuntime) + { + if (Descriptor.Proto.Options.MessageSetWireFormat) + { + writer.WriteLine("UnknownFields.WriteAsMessageSetTo(output);"); + } + else + { + writer.WriteLine("UnknownFields.WriteTo(output);"); + } + } + + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("private int memoizedSerializedSize = -1;"); + writer.WriteLine("public override int SerializedSize {"); + writer.Indent(); + writer.WriteLine("get {"); + writer.Indent(); + writer.WriteLine("int size = memoizedSerializedSize;"); + writer.WriteLine("if (size != -1) return size;"); + writer.WriteLine("return CalcSerializedSize();"); + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine("private int CalcSerializedSize() {"); + writer.Indent(); + writer.WriteLine("int size = memoizedSerializedSize;"); + writer.WriteLine("if (size != -1) return size;"); + writer.WriteLine(); + writer.WriteLine("size = 0;"); + foreach (FieldDescriptor field in Descriptor.Fields) + { + CreateFieldGenerator(field).GenerateSerializedSizeCode(writer); + } + if (Descriptor.Proto.ExtensionRangeCount > 0) + { + writer.WriteLine("size += ExtensionsSerializedSize;"); + } + + if (!UseLiteRuntime) + { + if (Descriptor.Options.MessageSetWireFormat) + { + writer.WriteLine("size += UnknownFields.SerializedSizeAsMessageSet;"); + } + else + { + writer.WriteLine("size += UnknownFields.SerializedSize;"); + } + } + writer.WriteLine("memoizedSerializedSize = size;"); + writer.WriteLine("return size;"); + writer.Outdent(); + writer.WriteLine("}"); + } + + private void GenerateSerializeOneField(TextGenerator writer, FieldDescriptor fieldDescriptor) + { + CreateFieldGenerator(fieldDescriptor).GenerateSerializationCode(writer); + } + + private static void GenerateSerializeOneExtensionRange(TextGenerator writer, + DescriptorProto.Types.ExtensionRange extensionRange) + { + writer.WriteLine("extensionWriter.WriteUntil({0}, output);", extensionRange.End); + } + + private void GenerateParseFromMethods(TextGenerator writer) + { + // Note: These are separate from GenerateMessageSerializationMethods() + // because they need to be generated even for messages that are optimized + // for code size. + + writer.WriteLine("public static {0} ParseFrom(pb::ByteString data) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine( + "public static {0} ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {{", + ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(byte[] data) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {{", + ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(global::System.IO.Stream input) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine( + "public static {0} ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {{", + ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseDelimitedFrom(global::System.IO.Stream input) {{", ClassName); + writer.WriteLine(" return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine( + "public static {0} ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {{", + ClassName); + writer.WriteLine(" return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine("public static {0} ParseFrom(pb::ICodedInputStream input) {{", ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();"); + writer.WriteLine("}"); + writer.WriteLine( + "public static {0} ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {{", + ClassName); + writer.WriteLine(" return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();"); + writer.WriteLine("}"); + } + + /// + /// Returns whether or not the specified message type has any required fields. + /// If it doesn't, calls to check for initialization can be optimised. + /// TODO(jonskeet): Move this into MessageDescriptor? + /// + private static bool HasRequiredFields(MessageDescriptor descriptor, + Dictionary alreadySeen) + { + if (alreadySeen.ContainsKey(descriptor)) + { + // The type is already in cache. This means that either: + // a. The type has no required fields. + // b. We are in the midst of checking if the type has required fields, + // somewhere up the stack. In this case, we know that if the type + // has any required fields, they'll be found when we return to it, + // and the whole call to HasRequiredFields() will return true. + // Therefore, we don't have to check if this type has required fields + // here. + return false; + } + alreadySeen[descriptor] = descriptor; // Value is irrelevant + + // If the type has extensions, an extension with message type could contain + // required fields, so we have to be conservative and assume such an + // extension exists. + if (descriptor.Extensions.Count > 0) + { + return true; + } + + foreach (FieldDescriptor field in descriptor.Fields) + { + if (field.IsRequired) + { + return true; + } + // Message or group + if (field.MappedType == MappedType.Message) + { + if (HasRequiredFields(field.MessageType, alreadySeen)) + { + return true; + } + } + } + return false; + } + + private void GenerateBuilder(TextGenerator writer) + { + writer.WriteLine("private {0} MakeReadOnly() {{", ClassName); + writer.Indent(); + foreach (FieldDescriptor field in Descriptor.Fields) + { + CreateFieldGenerator(field).GenerateBuildingCode(writer); + } + writer.WriteLine("return this;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine("public static Builder CreateBuilder() { return new Builder(); }"); + writer.WriteLine("public override Builder ToBuilder() { return CreateBuilder(this); }"); + writer.WriteLine("public override Builder CreateBuilderForType() { return new Builder(); }"); + writer.WriteLine("public static Builder CreateBuilder({0} prototype) {{", ClassName); + writer.WriteLine(" return new Builder(prototype);"); + writer.WriteLine("}"); + writer.WriteLine(); + if (Descriptor.File.CSharpOptions.AddSerializable) + { + writer.WriteLine("[global::System.SerializableAttribute()]"); + } + writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("{0} sealed partial class Builder : pb::{2}Builder{3}<{1}, Builder> {{", + ClassAccessLevel, ClassName, + Descriptor.Proto.ExtensionRangeCount > 0 ? "Extendable" : "Generated", RuntimeSuffix); + writer.Indent(); + writer.WriteLine("protected override Builder ThisBuilder {"); + writer.WriteLine(" get { return this; }"); + writer.WriteLine("}"); + GenerateCommonBuilderMethods(writer); + if (OptimizeSpeed) + { + GenerateBuilderParsingMethods(writer); + } + foreach (FieldDescriptor field in Descriptor.Fields) + { + writer.WriteLine(); + // No field comment :( + CreateFieldGenerator(field).GenerateBuilderMembers(writer); + } + writer.Outdent(); + writer.WriteLine("}"); + } + + private void GenerateCommonBuilderMethods(TextGenerator writer) + { + //default constructor + writer.WriteLine("public Builder() {"); + //Durring static initialization of message, DefaultInstance is expected to return null. + writer.WriteLine(" result = DefaultInstance;"); + writer.WriteLine(" resultIsReadOnly = true;"); + writer.WriteLine("}"); + //clone constructor + writer.WriteLine("internal Builder({0} cloneFrom) {{", ClassName); + writer.WriteLine(" result = cloneFrom;"); + writer.WriteLine(" resultIsReadOnly = true;"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("private bool resultIsReadOnly;"); + writer.WriteLine("private {0} result;", ClassName); + writer.WriteLine(); + writer.WriteLine("private {0} PrepareBuilder() {{", ClassName); + writer.WriteLine(" if (resultIsReadOnly) {"); + writer.WriteLine(" {0} original = result;", ClassName); + writer.WriteLine(" result = new {0}();", ClassName); + writer.WriteLine(" resultIsReadOnly = false;"); + writer.WriteLine(" MergeFrom(original);"); + writer.WriteLine(" }"); + writer.WriteLine(" return result;"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override bool IsInitialized {"); + writer.WriteLine(" get { return result.IsInitialized; }"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("protected override {0} MessageBeingBuilt {{", ClassName); + writer.WriteLine(" get { return PrepareBuilder(); }"); + writer.WriteLine("}"); + writer.WriteLine(); + //Not actually expecting that DefaultInstance would ever be null here; however, we will ensure it does not break + writer.WriteLine("public override Builder Clear() {"); + writer.WriteLine(" result = DefaultInstance;", ClassName); + writer.WriteLine(" resultIsReadOnly = true;"); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override Builder Clone() {"); + writer.WriteLine(" if (resultIsReadOnly) {"); + writer.WriteLine(" return new Builder(result);"); + writer.WriteLine(" } else {"); + writer.WriteLine(" return new Builder().MergeFrom(result);"); + writer.WriteLine(" }"); + writer.WriteLine("}"); + writer.WriteLine(); + if (!UseLiteRuntime) + { + writer.WriteLine("public override pbd::MessageDescriptor DescriptorForType {"); + writer.WriteLine(" get {{ return {0}.Descriptor; }}", FullClassName); + writer.WriteLine("}"); + writer.WriteLine(); + } + writer.WriteLine("public override {0} DefaultInstanceForType {{", ClassName); + writer.WriteLine(" get {{ return {0}.DefaultInstance; }}", FullClassName); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine("public override {0} BuildPartial() {{", ClassName); + writer.Indent(); + writer.WriteLine("if (resultIsReadOnly) {"); + writer.WriteLine(" return result;"); + writer.WriteLine("}"); + writer.WriteLine("resultIsReadOnly = true;"); + writer.WriteLine("return result.MakeReadOnly();"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + + if (OptimizeSpeed) + { + writer.WriteLine("public override Builder MergeFrom(pb::IMessage{0} other) {{", RuntimeSuffix); + writer.WriteLine(" if (other is {0}) {{", ClassName); + writer.WriteLine(" return MergeFrom(({0}) other);", ClassName); + writer.WriteLine(" } else {"); + writer.WriteLine(" base.MergeFrom(other);"); + writer.WriteLine(" return this;"); + writer.WriteLine(" }"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("public override Builder MergeFrom({0} other) {{", ClassName); + // Optimization: If other is the default instance, we know none of its + // fields are set so we can skip the merge. + writer.Indent(); + writer.WriteLine("if (other == {0}.DefaultInstance) return this;", FullClassName); + writer.WriteLine("PrepareBuilder();"); + foreach (FieldDescriptor field in Descriptor.Fields) + { + CreateFieldGenerator(field).GenerateMergingCode(writer); + } + // if message type has extensions + if (Descriptor.Proto.ExtensionRangeCount > 0) + { + writer.WriteLine(" this.MergeExtensionFields(other);"); + } + if (!UseLiteRuntime) + { + writer.WriteLine("this.MergeUnknownFields(other.UnknownFields);"); + } + writer.WriteLine("return this;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + } + + private void GenerateBuilderParsingMethods(TextGenerator writer) + { + List sortedFields = new List(Descriptor.Fields); + sortedFields.Sort((f1, f2) => f1.FieldNumber.CompareTo(f2.FieldNumber)); + + writer.WriteLine("public override Builder MergeFrom(pb::ICodedInputStream input) {"); + writer.WriteLine(" return MergeFrom(input, pb::ExtensionRegistry.Empty);"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine( + "public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {"); + writer.Indent(); + writer.WriteLine("PrepareBuilder();"); + if (!UseLiteRuntime) + { + writer.WriteLine("pb::UnknownFieldSet.Builder unknownFields = null;"); + } + writer.WriteLine("uint tag;"); + writer.WriteLine("string field_name;"); + writer.WriteLine("while (input.ReadTag(out tag, out field_name)) {"); + writer.Indent(); + writer.WriteLine("if(tag == 0 && field_name != null) {"); + writer.Indent(); + //if you change from StringComparer.Ordinal, the array sort in FieldNames { get; } must also change + writer.WriteLine( + "int field_ordinal = global::System.Array.BinarySearch(_{0}FieldNames, field_name, global::System.StringComparer.Ordinal);", + NameHelpers.UnderscoresToCamelCase(ClassName)); + writer.WriteLine("if(field_ordinal >= 0)"); + writer.WriteLine(" tag = _{0}FieldTags[field_ordinal];", NameHelpers.UnderscoresToCamelCase(ClassName)); + writer.WriteLine("else {"); + if (!UseLiteRuntime) + { + writer.WriteLine(" if (unknownFields == null) {"); // First unknown field - create builder now + writer.WriteLine(" unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer.WriteLine(" }"); + } + writer.WriteLine(" ParseUnknownField(input, {0}extensionRegistry, tag, field_name);", + UseLiteRuntime ? "" : "unknownFields, "); + writer.WriteLine(" continue;"); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + + writer.WriteLine("switch (tag) {"); + writer.Indent(); + writer.WriteLine("case 0: {"); // 0 signals EOF / limit reached + writer.WriteLine(" throw pb::InvalidProtocolBufferException.InvalidTag();"); + writer.WriteLine("}"); + writer.WriteLine("default: {"); + writer.WriteLine(" if (pb::WireFormat.IsEndGroupTag(tag)) {"); + if (!UseLiteRuntime) + { + writer.WriteLine(" if (unknownFields != null) {"); + writer.WriteLine(" this.UnknownFields = unknownFields.Build();"); + writer.WriteLine(" }"); + } + writer.WriteLine(" return this;"); // it's an endgroup tag + writer.WriteLine(" }"); + if (!UseLiteRuntime) + { + writer.WriteLine(" if (unknownFields == null) {"); // First unknown field - create builder now + writer.WriteLine(" unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer.WriteLine(" }"); + } + writer.WriteLine(" ParseUnknownField(input, {0}extensionRegistry, tag, field_name);", + UseLiteRuntime ? "" : "unknownFields, "); + writer.WriteLine(" break;"); + writer.WriteLine("}"); + foreach (FieldDescriptor field in sortedFields) + { + WireFormat.WireType wt = WireFormat.GetWireType(field.FieldType); + uint tag = WireFormat.MakeTag(field.FieldNumber, wt); + + if (field.IsRepeated && + (wt == WireFormat.WireType.Varint || wt == WireFormat.WireType.Fixed32 || + wt == WireFormat.WireType.Fixed64)) + { + writer.WriteLine("case {0}:", + WireFormat.MakeTag(field.FieldNumber, WireFormat.WireType.LengthDelimited)); + } + + writer.WriteLine("case {0}: {{", tag); + writer.Indent(); + CreateFieldGenerator(field).GenerateParsingCode(writer); + writer.WriteLine("break;"); + writer.Outdent(); + writer.WriteLine("}"); + } + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + if (!UseLiteRuntime) + { + writer.WriteLine("if (unknownFields != null) {"); + writer.WriteLine(" this.UnknownFields = unknownFields.Build();"); + writer.WriteLine("}"); + } + writer.WriteLine("return this;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + private void GenerateIsInitialized(TextGenerator writer) + { + writer.WriteLine("public override bool IsInitialized {"); + writer.Indent(); + writer.WriteLine("get {"); + writer.Indent(); + + // Check that all required fields in this message are set. + // TODO(kenton): We can optimize this when we switch to putting all the + // "has" fields into a single bitfield. + foreach (FieldDescriptor field in Descriptor.Fields) + { + if (field.IsRequired) + { + writer.WriteLine("if (!has{0}) return false;", field.CSharpOptions.PropertyName); + } + } + + // Now check that all embedded messages are initialized. + foreach (FieldDescriptor field in Descriptor.Fields) + { + if (field.FieldType != FieldType.Message || + !HasRequiredFields(field.MessageType, new Dictionary())) + { + continue; + } + string propertyName = NameHelpers.UnderscoresToPascalCase(GetFieldName(field)); + if (field.IsRepeated) + { + writer.WriteLine("foreach ({0} element in {1}List) {{", GetClassName(field.MessageType), + propertyName); + writer.WriteLine(" if (!element.IsInitialized) return false;"); + writer.WriteLine("}"); + } + else if (field.IsOptional) + { + writer.WriteLine("if (Has{0}) {{", propertyName); + writer.WriteLine(" if (!{0}.IsInitialized) return false;", propertyName); + writer.WriteLine("}"); + } + else + { + writer.WriteLine("if (!{0}.IsInitialized) return false;", propertyName); + } + } + + if (Descriptor.Proto.ExtensionRangeCount > 0) + { + writer.WriteLine("if (!ExtensionsAreInitialized) return false;"); + } + writer.WriteLine("return true;"); + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + internal void GenerateExtensionRegistrationCode(TextGenerator writer) + { + foreach (FieldDescriptor extension in Descriptor.Extensions) + { + new ExtensionGenerator(extension).GenerateExtensionRegistrationCode(writer); + } + foreach (MessageDescriptor nestedMessage in Descriptor.NestedTypes) + { + new MessageGenerator(nestedMessage).GenerateExtensionRegistrationCode(writer); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/PluginProtoFile.cs b/csharp/src/ProtoGen/PluginProtoFile.cs new file mode 100644 index 00000000..e0fed5c3 --- /dev/null +++ b/csharp/src/ProtoGen/PluginProtoFile.cs @@ -0,0 +1,1187 @@ +// Generated by protoc-gen-cs, Version=2.4.1.521, Culture=neutral, PublicKeyToken=17b3b1f090c3ea48. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.Compiler.PluginProto { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Plugin { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_google_protobuf_compiler_CodeGeneratorRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_compiler_CodeGeneratorRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_compiler_CodeGeneratorResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_compiler_CodeGeneratorResponse__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_compiler_CodeGeneratorResponse_File__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_compiler_CodeGeneratorResponse_File__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static Plugin() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiVnb29nbGUvcHJvdG9idWYvY29tcGlsZXIvcGx1Z2luLnByb3RvEhhnb29n", + "bGUucHJvdG9idWYuY29tcGlsZXIaIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlw", + "dG9yLnByb3RvIn0KFENvZGVHZW5lcmF0b3JSZXF1ZXN0EhgKEGZpbGVfdG9f", + "Z2VuZXJhdGUYASADKAkSEQoJcGFyYW1ldGVyGAIgASgJEjgKCnByb3RvX2Zp", + "bGUYDyADKAsyJC5nb29nbGUucHJvdG9idWYuRmlsZURlc2NyaXB0b3JQcm90", + "byKqAQoVQ29kZUdlbmVyYXRvclJlc3BvbnNlEg0KBWVycm9yGAEgASgJEkIK", + "BGZpbGUYDyADKAsyNC5nb29nbGUucHJvdG9idWYuY29tcGlsZXIuQ29kZUdl", + "bmVyYXRvclJlc3BvbnNlLkZpbGUaPgoERmlsZRIMCgRuYW1lGAEgASgJEhcK", + "D2luc2VydGlvbl9wb2ludBgCIAEoCRIPCgdjb250ZW50GA8gASgJQiwKHGNv", + "bS5nb29nbGUucHJvdG9idWYuY29tcGlsZXJCDFBsdWdpblByb3Rvcw==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_google_protobuf_compiler_CodeGeneratorRequest__Descriptor = Descriptor.MessageTypes[0]; + internal__static_google_protobuf_compiler_CodeGeneratorRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_compiler_CodeGeneratorRequest__Descriptor, + new string[] { "FileToGenerate", "Parameter", "ProtoFile", }); + internal__static_google_protobuf_compiler_CodeGeneratorResponse__Descriptor = Descriptor.MessageTypes[1]; + internal__static_google_protobuf_compiler_CodeGeneratorResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_compiler_CodeGeneratorResponse__Descriptor, + new string[] { "Error", "File", }); + internal__static_google_protobuf_compiler_CodeGeneratorResponse_File__Descriptor = internal__static_google_protobuf_compiler_CodeGeneratorResponse__Descriptor.NestedTypes[0]; + internal__static_google_protobuf_compiler_CodeGeneratorResponse_File__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_compiler_CodeGeneratorResponse_File__Descriptor, + new string[] { "Name", "InsertionPoint", "Content", }); + return null; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CodeGeneratorRequest : pb::GeneratedMessage { + private CodeGeneratorRequest() { } + private static readonly CodeGeneratorRequest defaultInstance = new CodeGeneratorRequest().MakeReadOnly(); + private static readonly string[] _codeGeneratorRequestFieldNames = new string[] { "file_to_generate", "parameter", "proto_file" }; + private static readonly uint[] _codeGeneratorRequestFieldTags = new uint[] { 10, 18, 122 }; + public static CodeGeneratorRequest DefaultInstance { + get { return defaultInstance; } + } + + public override CodeGeneratorRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CodeGeneratorRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.Plugin.internal__static_google_protobuf_compiler_CodeGeneratorRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.Plugin.internal__static_google_protobuf_compiler_CodeGeneratorRequest__FieldAccessorTable; } + } + + public const int FileToGenerateFieldNumber = 1; + private pbc::PopsicleList fileToGenerate_ = new pbc::PopsicleList(); + public scg::IList FileToGenerateList { + get { return pbc::Lists.AsReadOnly(fileToGenerate_); } + } + public int FileToGenerateCount { + get { return fileToGenerate_.Count; } + } + public string GetFileToGenerate(int index) { + return fileToGenerate_[index]; + } + + public const int ParameterFieldNumber = 2; + private bool hasParameter; + private string parameter_ = ""; + public bool HasParameter { + get { return hasParameter; } + } + public string Parameter { + get { return parameter_; } + } + + public const int ProtoFileFieldNumber = 15; + private pbc::PopsicleList protoFile_ = new pbc::PopsicleList(); + public scg::IList ProtoFileList { + get { return protoFile_; } + } + public int ProtoFileCount { + get { return protoFile_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto GetProtoFile(int index) { + return protoFile_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto element in ProtoFileList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _codeGeneratorRequestFieldNames; + if (fileToGenerate_.Count > 0) { + output.WriteStringArray(1, field_names[0], fileToGenerate_); + } + if (hasParameter) { + output.WriteString(2, field_names[1], Parameter); + } + if (protoFile_.Count > 0) { + output.WriteMessageArray(15, field_names[2], protoFile_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (string element in FileToGenerateList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * fileToGenerate_.Count; + } + if (hasParameter) { + size += pb::CodedOutputStream.ComputeStringSize(2, Parameter); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto element in ProtoFileList) { + size += pb::CodedOutputStream.ComputeMessageSize(15, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static CodeGeneratorRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CodeGeneratorRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CodeGeneratorRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CodeGeneratorRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CodeGeneratorRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CodeGeneratorRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CodeGeneratorRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CodeGeneratorRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CodeGeneratorRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CodeGeneratorRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CodeGeneratorRequest MakeReadOnly() { + fileToGenerate_.MakeReadOnly(); + protoFile_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CodeGeneratorRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CodeGeneratorRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CodeGeneratorRequest result; + + private CodeGeneratorRequest PrepareBuilder() { + if (resultIsReadOnly) { + CodeGeneratorRequest original = result; + result = new CodeGeneratorRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CodeGeneratorRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorRequest.Descriptor; } + } + + public override CodeGeneratorRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorRequest.DefaultInstance; } + } + + public override CodeGeneratorRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CodeGeneratorRequest) { + return MergeFrom((CodeGeneratorRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CodeGeneratorRequest other) { + if (other == global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorRequest.DefaultInstance) return this; + PrepareBuilder(); + if (other.fileToGenerate_.Count != 0) { + result.fileToGenerate_.Add(other.fileToGenerate_); + } + if (other.HasParameter) { + Parameter = other.Parameter; + } + if (other.protoFile_.Count != 0) { + result.protoFile_.Add(other.protoFile_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_codeGeneratorRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _codeGeneratorRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadStringArray(tag, field_name, result.fileToGenerate_); + break; + } + case 18: { + result.hasParameter = input.ReadString(ref result.parameter_); + break; + } + case 122: { + input.ReadMessageArray(tag, field_name, result.protoFile_, global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList FileToGenerateList { + get { return PrepareBuilder().fileToGenerate_; } + } + public int FileToGenerateCount { + get { return result.FileToGenerateCount; } + } + public string GetFileToGenerate(int index) { + return result.GetFileToGenerate(index); + } + public Builder SetFileToGenerate(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.fileToGenerate_[index] = value; + return this; + } + public Builder AddFileToGenerate(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.fileToGenerate_.Add(value); + return this; + } + public Builder AddRangeFileToGenerate(scg::IEnumerable values) { + PrepareBuilder(); + result.fileToGenerate_.Add(values); + return this; + } + public Builder ClearFileToGenerate() { + PrepareBuilder(); + result.fileToGenerate_.Clear(); + return this; + } + + public bool HasParameter { + get { return result.hasParameter; } + } + public string Parameter { + get { return result.Parameter; } + set { SetParameter(value); } + } + public Builder SetParameter(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasParameter = true; + result.parameter_ = value; + return this; + } + public Builder ClearParameter() { + PrepareBuilder(); + result.hasParameter = false; + result.parameter_ = ""; + return this; + } + + public pbc::IPopsicleList ProtoFileList { + get { return PrepareBuilder().protoFile_; } + } + public int ProtoFileCount { + get { return result.ProtoFileCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto GetProtoFile(int index) { + return result.GetProtoFile(index); + } + public Builder SetProtoFile(int index, global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.protoFile_[index] = value; + return this; + } + public Builder SetProtoFile(int index, global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.protoFile_[index] = builderForValue.Build(); + return this; + } + public Builder AddProtoFile(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.protoFile_.Add(value); + return this; + } + public Builder AddProtoFile(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.protoFile_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeProtoFile(scg::IEnumerable values) { + PrepareBuilder(); + result.protoFile_.Add(values); + return this; + } + public Builder ClearProtoFile() { + PrepareBuilder(); + result.protoFile_.Clear(); + return this; + } + } + static CodeGeneratorRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.Compiler.PluginProto.Plugin.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CodeGeneratorResponse : pb::GeneratedMessage { + private CodeGeneratorResponse() { } + private static readonly CodeGeneratorResponse defaultInstance = new CodeGeneratorResponse().MakeReadOnly(); + private static readonly string[] _codeGeneratorResponseFieldNames = new string[] { "error", "file" }; + private static readonly uint[] _codeGeneratorResponseFieldTags = new uint[] { 10, 122 }; + public static CodeGeneratorResponse DefaultInstance { + get { return defaultInstance; } + } + + public override CodeGeneratorResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CodeGeneratorResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.Plugin.internal__static_google_protobuf_compiler_CodeGeneratorResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.Plugin.internal__static_google_protobuf_compiler_CodeGeneratorResponse__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class File : pb::GeneratedMessage { + private File() { } + private static readonly File defaultInstance = new File().MakeReadOnly(); + private static readonly string[] _fileFieldNames = new string[] { "content", "insertion_point", "name" }; + private static readonly uint[] _fileFieldTags = new uint[] { 122, 18, 10 }; + public static File DefaultInstance { + get { return defaultInstance; } + } + + public override File DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override File ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.Plugin.internal__static_google_protobuf_compiler_CodeGeneratorResponse_File__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.Plugin.internal__static_google_protobuf_compiler_CodeGeneratorResponse_File__FieldAccessorTable; } + } + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int InsertionPointFieldNumber = 2; + private bool hasInsertionPoint; + private string insertionPoint_ = ""; + public bool HasInsertionPoint { + get { return hasInsertionPoint; } + } + public string InsertionPoint { + get { return insertionPoint_; } + } + + public const int ContentFieldNumber = 15; + private bool hasContent; + private string content_ = ""; + public bool HasContent { + get { return hasContent; } + } + public string Content { + get { return content_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _fileFieldNames; + if (hasName) { + output.WriteString(1, field_names[2], Name); + } + if (hasInsertionPoint) { + output.WriteString(2, field_names[1], InsertionPoint); + } + if (hasContent) { + output.WriteString(15, field_names[0], Content); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + if (hasInsertionPoint) { + size += pb::CodedOutputStream.ComputeStringSize(2, InsertionPoint); + } + if (hasContent) { + size += pb::CodedOutputStream.ComputeStringSize(15, Content); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static File ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static File ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static File ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static File ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static File ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static File ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static File ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static File ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static File ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static File ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private File MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(File prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(File cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private File result; + + private File PrepareBuilder() { + if (resultIsReadOnly) { + File original = result; + result = new File(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override File MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File.Descriptor; } + } + + public override File DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File.DefaultInstance; } + } + + public override File BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is File) { + return MergeFrom((File) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(File other) { + if (other == global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.HasInsertionPoint) { + InsertionPoint = other.InsertionPoint; + } + if (other.HasContent) { + Content = other.Content; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fileFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fileFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 18: { + result.hasInsertionPoint = input.ReadString(ref result.insertionPoint_); + break; + } + case 122: { + result.hasContent = input.ReadString(ref result.content_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasInsertionPoint { + get { return result.hasInsertionPoint; } + } + public string InsertionPoint { + get { return result.InsertionPoint; } + set { SetInsertionPoint(value); } + } + public Builder SetInsertionPoint(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasInsertionPoint = true; + result.insertionPoint_ = value; + return this; + } + public Builder ClearInsertionPoint() { + PrepareBuilder(); + result.hasInsertionPoint = false; + result.insertionPoint_ = ""; + return this; + } + + public bool HasContent { + get { return result.hasContent; } + } + public string Content { + get { return result.Content; } + set { SetContent(value); } + } + public Builder SetContent(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasContent = true; + result.content_ = value; + return this; + } + public Builder ClearContent() { + PrepareBuilder(); + result.hasContent = false; + result.content_ = ""; + return this; + } + } + static File() { + object.ReferenceEquals(global::Google.ProtocolBuffers.Compiler.PluginProto.Plugin.Descriptor, null); + } + } + + } + #endregion + + public const int ErrorFieldNumber = 1; + private bool hasError; + private string error_ = ""; + public bool HasError { + get { return hasError; } + } + public string Error { + get { return error_; } + } + + public const int FileFieldNumber = 15; + private pbc::PopsicleList file_ = new pbc::PopsicleList(); + public scg::IList FileList { + get { return file_; } + } + public int FileCount { + get { return file_.Count; } + } + public global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File GetFile(int index) { + return file_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + int size = SerializedSize; + string[] field_names = _codeGeneratorResponseFieldNames; + if (hasError) { + output.WriteString(1, field_names[0], Error); + } + if (file_.Count > 0) { + output.WriteMessageArray(15, field_names[1], file_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasError) { + size += pb::CodedOutputStream.ComputeStringSize(1, Error); + } + foreach (global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File element in FileList) { + size += pb::CodedOutputStream.ComputeMessageSize(15, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + } + + public static CodeGeneratorResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CodeGeneratorResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CodeGeneratorResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CodeGeneratorResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CodeGeneratorResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CodeGeneratorResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CodeGeneratorResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CodeGeneratorResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CodeGeneratorResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CodeGeneratorResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CodeGeneratorResponse MakeReadOnly() { + file_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CodeGeneratorResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CodeGeneratorResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CodeGeneratorResponse result; + + private CodeGeneratorResponse PrepareBuilder() { + if (resultIsReadOnly) { + CodeGeneratorResponse original = result; + result = new CodeGeneratorResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CodeGeneratorResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Descriptor; } + } + + public override CodeGeneratorResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.DefaultInstance; } + } + + public override CodeGeneratorResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CodeGeneratorResponse) { + return MergeFrom((CodeGeneratorResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CodeGeneratorResponse other) { + if (other == global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasError) { + Error = other.Error; + } + if (other.file_.Count != 0) { + result.file_.Add(other.file_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_codeGeneratorResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _codeGeneratorResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasError = input.ReadString(ref result.error_); + break; + } + case 122: { + input.ReadMessageArray(tag, field_name, result.file_, global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasError { + get { return result.hasError; } + } + public string Error { + get { return result.Error; } + set { SetError(value); } + } + public Builder SetError(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasError = true; + result.error_ = value; + return this; + } + public Builder ClearError() { + PrepareBuilder(); + result.hasError = false; + result.error_ = ""; + return this; + } + + public pbc::IPopsicleList FileList { + get { return PrepareBuilder().file_; } + } + public int FileCount { + get { return result.FileCount; } + } + public global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File GetFile(int index) { + return result.GetFile(index); + } + public Builder SetFile(int index, global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.file_[index] = value; + return this; + } + public Builder SetFile(int index, global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.file_[index] = builderForValue.Build(); + return this; + } + public Builder AddFile(global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.file_.Add(value); + return this; + } + public Builder AddFile(global::Google.ProtocolBuffers.Compiler.PluginProto.CodeGeneratorResponse.Types.File.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.file_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeFile(scg::IEnumerable values) { + PrepareBuilder(); + result.file_.Add(values); + return this; + } + public Builder ClearFile() { + PrepareBuilder(); + result.file_.Clear(); + return this; + } + } + static CodeGeneratorResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.Compiler.PluginProto.Plugin.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtoGen/PrimitiveFieldGenerator.cs b/csharp/src/ProtoGen/PrimitiveFieldGenerator.cs new file mode 100644 index 00000000..69e0d4d9 --- /dev/null +++ b/csharp/src/ProtoGen/PrimitiveFieldGenerator.cs @@ -0,0 +1,140 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + // TODO(jonskeet): Refactor this. There's loads of common code here. + internal class PrimitiveFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator + { + internal PrimitiveFieldGenerator(FieldDescriptor descriptor, int fieldOrdinal) + : base(descriptor, fieldOrdinal) + { + } + + public void GenerateMembers(TextGenerator writer) + { + writer.WriteLine("private bool has{0};", PropertyName); + writer.WriteLine("private {0} {1}_{2};", TypeName, Name, HasDefaultValue ? " = " + DefaultValue : ""); + AddDeprecatedFlag(writer); + writer.WriteLine("public bool Has{0} {{", PropertyName); + writer.WriteLine(" get {{ return has{0}; }}", PropertyName); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return {0}_; }}", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) + { + AddDeprecatedFlag(writer); + writer.WriteLine("public bool Has{0} {{", PropertyName); + writer.WriteLine(" get {{ return result.has{0}; }}", PropertyName); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public {0} {1} {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return result.{0}; }}", PropertyName); + writer.WriteLine(" set {{ Set{0}(value); }}", PropertyName); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public Builder Set{0}({1} value) {{", PropertyName, TypeName); + AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.has{0} = true;", PropertyName); + writer.WriteLine(" result.{0}_ = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.has{0} = false;", PropertyName); + writer.WriteLine(" result.{0}_ = {1};", Name, DefaultValue); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) + { + writer.WriteLine("if (other.Has{0}) {{", PropertyName); + writer.WriteLine(" {0} = other.{0};", PropertyName); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) + { + // Nothing to do here for primitive types + } + + public void GenerateParsingCode(TextGenerator writer) + { + writer.WriteLine("result.has{0} = input.Read{1}(ref result.{2}_);", PropertyName, CapitalizedTypeName, Name); + } + + public void GenerateSerializationCode(TextGenerator writer) + { + writer.WriteLine("if (has{0}) {{", PropertyName); + writer.WriteLine(" output.Write{0}({1}, field_names[{3}], {2});", CapitalizedTypeName, Number, PropertyName, + FieldOrdinal); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) + { + writer.WriteLine("if (has{0}) {{", PropertyName); + writer.WriteLine(" size += pb::CodedOutputStream.Compute{0}Size({1}, {2});", + CapitalizedTypeName, Number, PropertyName); + writer.WriteLine("}"); + } + + public override void WriteHash(TextGenerator writer) + { + writer.WriteLine("if (has{0}) hash ^= {1}_.GetHashCode();", PropertyName, Name); + } + + public override void WriteEquals(TextGenerator writer) + { + writer.WriteLine("if (has{0} != other.has{0} || (has{0} && !{1}_.Equals(other.{1}_))) return false;", + PropertyName, Name); + } + + public override void WriteToString(TextGenerator writer) + { + writer.WriteLine("PrintField(\"{0}\", has{1}, {2}_, writer);", Descriptor.Name, PropertyName, Name); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/Program.cs b/csharp/src/ProtoGen/Program.cs new file mode 100644 index 00000000..b11d32e0 --- /dev/null +++ b/csharp/src/ProtoGen/Program.cs @@ -0,0 +1,105 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using System.Collections.Generic; +using Google.ProtocolBuffers.Compiler.PluginProto; +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.ProtoGen +{ + /// + /// Entry point for the Protocol Buffers generator. + /// + internal class Program + { + internal static int Main(string[] args) + { + try + { + // Hack to make sure everything's initialized + DescriptorProtoFile.Descriptor.ToString(); + GeneratorOptions options = new GeneratorOptions {Arguments = args}; + + IList validationFailures; + if (!options.TryValidate(out validationFailures)) + { + // We've already got the message-building logic in the exception... + InvalidOptionsException exception = new InvalidOptionsException(validationFailures); + Console.WriteLine(exception.Message); + return 1; + } + + var request = new CodeGeneratorRequest.Builder(); + foreach (string inputFile in options.InputFiles) + { + ExtensionRegistry extensionRegistry = ExtensionRegistry.CreateInstance(); + CSharpOptions.RegisterAllExtensions(extensionRegistry); + using (Stream inputStream = File.OpenRead(inputFile)) + { + var fileSet = FileDescriptorSet.ParseFrom(inputStream, extensionRegistry); + foreach (var fileProto in fileSet.FileList) + { + request.AddFileToGenerate(fileProto.Name); + request.AddProtoFile(fileProto); + } + } + } + + Generator generator = Generator.CreateGenerator(options); + var response = new CodeGeneratorResponse.Builder(); + generator.Generate(request.Build(), response); + if (response.HasError) + { + throw new Exception(response.Error); + } + foreach (var file in response.FileList) + { + File.WriteAllText(file.Name, file.Content); + } + return 0; + } + catch (Exception e) + { + Console.Error.WriteLine("Error: {0}", e.Message); + Console.Error.WriteLine(); + Console.Error.WriteLine("Detailed exception information: {0}", e); + return 1; + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/ProgramPreprocess.cs b/csharp/src/ProtoGen/ProgramPreprocess.cs new file mode 100644 index 00000000..343e1f2a --- /dev/null +++ b/csharp/src/ProtoGen/ProgramPreprocess.cs @@ -0,0 +1,276 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; + +namespace Google.ProtocolBuffers.ProtoGen +{ + /// + /// Preprocesses any input files with an extension of '.proto' by running protoc.exe. If arguments + /// are supplied with '--' prefix they are provided to protoc.exe, otherwise they are assumed to + /// be used for ProtoGen.exe which is run on the resulting output proto buffer. If the option + /// --descriptor_set_out= is specified the proto buffer file is kept, otherwise it will be removed + /// after code generation. + /// + public class ProgramPreprocess + { + private const string ProtocExecutable = "protoc.exe"; + private const string ProtocDirectoryArg = "--protoc_dir="; + + private static int Main(string[] args) + { + try + { + return Environment.ExitCode = Run(args); + } + catch (Exception ex) + { + Console.Error.WriteLine(ex); + return Environment.ExitCode = 2; + } + } + + public static int Run(params string[] args) + { + bool deleteFile = false; + string tempFile = null; + int result; + bool doHelp = args.Length == 0; + try + { + List protocArgs = new List(); + List protoGenArgs = new List(); + + string protocFile = GuessProtocFile(args); + + foreach (string arg in args) + { + doHelp |= StringComparer.OrdinalIgnoreCase.Equals(arg, "/?"); + doHelp |= StringComparer.OrdinalIgnoreCase.Equals(arg, "/help"); + doHelp |= StringComparer.OrdinalIgnoreCase.Equals(arg, "-?"); + doHelp |= StringComparer.OrdinalIgnoreCase.Equals(arg, "-help"); + + if (arg.StartsWith("--descriptor_set_out=")) + { + tempFile = arg.Substring("--descriptor_set_out=".Length); + protoGenArgs.Add(tempFile); + } + } + + if (doHelp) + { + Console.WriteLine(); + Console.WriteLine("PROTOC.exe: Use any of the following options that begin with '--':"); + Console.WriteLine(); + try + { + RunProtoc(protocFile, "--help"); + } + catch (Exception ex) + { + Console.Error.WriteLine(ex.Message); + } + Console.WriteLine(); + Console.WriteLine(); + Console.WriteLine( + "PROTOGEN.exe: The following options are used to specify defaults for code generation."); + Console.WriteLine(); + Program.Main(new string[0]); + Console.WriteLine(); + Console.WriteLine("The following option enables PROTOGEN.exe to find PROTOC.exe"); + Console.WriteLine("{0}", ProtocDirectoryArg); + return 0; + } + + string pathRoot = Environment.CurrentDirectory; + foreach(string arg in args) + { + if (arg.StartsWith("--proto_path=", StringComparison.InvariantCultureIgnoreCase)) + { + pathRoot = arg.Substring(13); + } + } + + foreach (string arg in args) + { + if (arg.StartsWith(ProtocDirectoryArg)) + { + // Handled earlier + continue; + } + if (arg.StartsWith("--")) + { + protocArgs.Add(arg); + } + else if ((File.Exists(arg) || File.Exists(Path.Combine(pathRoot, arg))) && + StringComparer.OrdinalIgnoreCase.Equals(".proto", Path.GetExtension(arg))) + { + if (tempFile == null) + { + deleteFile = true; + tempFile = Path.GetTempFileName(); + protocArgs.Add(String.Format("--descriptor_set_out={0}", tempFile)); + protoGenArgs.Add(tempFile); + } + string patharg = arg; + if (!File.Exists(patharg)) + { + patharg = Path.Combine(pathRoot, arg); + } + + protocArgs.Add(patharg); + } + else + { + protoGenArgs.Add(arg); + } + } + + if (tempFile != null) + { + result = RunProtoc(protocFile, protocArgs.ToArray()); + if (result != 0) + { + return result; + } + } + + result = Program.Main(protoGenArgs.ToArray()); + } + finally + { + if (deleteFile && tempFile != null && File.Exists(tempFile)) + { + File.Delete(tempFile); + } + } + return result; + } + + /// + /// Tries to work out where protoc is based on command line arguments, the current + /// directory, the directory containing protogen, and the path. + /// + /// The path to protoc.exe, or null if it can't be found. + private static string GuessProtocFile(params string[] args) + { + // Why oh why is this not in System.IO.Path or Environment...? + List searchPath = new List(); + foreach (string arg in args) + { + if (arg.StartsWith("--protoc_dir=")) + { + searchPath.Add(arg.Substring(ProtocDirectoryArg.Length)); + } + } + searchPath.Add(Environment.CurrentDirectory); + searchPath.Add(AppDomain.CurrentDomain.BaseDirectory); + searchPath.AddRange((Environment.GetEnvironmentVariable("PATH") ?? String.Empty).Split(Path.PathSeparator)); + + foreach (string path in searchPath) + { + string exeFile = Path.Combine(path, ProtocExecutable); + if (File.Exists(exeFile)) + { + return exeFile; + } + } + return null; + } + + private static int RunProtoc(string exeFile, params string[] args) + { + if (exeFile == null) + { + throw new FileNotFoundException( + "Unable to locate " + ProtocExecutable + + " make sure it is in the PATH, cwd, or exe dir, or use --protoc_dir=..."); + } + + ProcessStartInfo psi = new ProcessStartInfo(exeFile); + psi.Arguments = EscapeArguments(args); + psi.RedirectStandardError = true; + psi.RedirectStandardInput = false; + psi.RedirectStandardOutput = true; + psi.ErrorDialog = false; + psi.CreateNoWindow = true; + psi.UseShellExecute = false; + psi.WorkingDirectory = Environment.CurrentDirectory; + + Process process = Process.Start(psi); + if (process == null) + { + return 1; + } + + process.WaitForExit(); + + string tmp = process.StandardOutput.ReadToEnd(); + if (tmp.Trim().Length > 0) + { + Console.Out.WriteLine(tmp); + } + tmp = process.StandardError.ReadToEnd(); + if (tmp.Trim().Length > 0) + { + // Replace protoc output with something more amenable to Visual Studio. + var regexMsvs = new Regex(@"(.*)\((\d+)\).* column=(\d+)\s*:\s*(.*)"); + tmp = regexMsvs.Replace(tmp, "$1($2,$3): error CS9999: $4"); + var regexGcc = new Regex(@"(.*):(\d+):(\d+):\s*(.*)"); + tmp = regexGcc.Replace(tmp, "$1($2,$3): error CS9999: $4"); + Console.Error.WriteLine(tmp); + } + return process.ExitCode; + } + + /// + /// Quotes all arguments that contain whitespace, or begin with a quote and returns a single + /// argument string for use with Process.Start(). + /// + /// http://csharptest.net/?p=529 + /// A list of strings for arguments, may not contain null, '\0', '\r', or '\n' + /// The combined list of escaped/quoted strings + /// Raised when one of the arguments is null + /// Raised if an argument contains '\0', '\r', or '\n' + public static string EscapeArguments(params string[] args) + { + StringBuilder arguments = new StringBuilder(); + Regex invalidChar = new Regex("[\x00\x0a\x0d]");// these can not be escaped + Regex needsQuotes = new Regex(@"\s|""");// contains whitespace or two quote characters + Regex escapeQuote = new Regex(@"(\\*)(""|$)");// one or more '\' followed with a quote or end of string + for (int carg = 0; args != null && carg < args.Length; carg++) + { + if (args[carg] == null) + { + throw new ArgumentNullException("args[" + carg + "]"); + } + if (invalidChar.IsMatch(args[carg])) + { + throw new ArgumentOutOfRangeException("args[" + carg + "]"); + } + if (args[carg] == String.Empty) + { + arguments.Append("\"\""); + } + else if (!needsQuotes.IsMatch(args[carg])) { arguments.Append(args[carg]); } + else + { + arguments.Append('"'); + arguments.Append(escapeQuote.Replace(args[carg], + m => + m.Groups[1].Value + m.Groups[1].Value + + (m.Groups[2].Value == "\"" ? "\\\"" : "") + )); + arguments.Append('"'); + } + if (carg + 1 < args.Length) + { + arguments.Append(' '); + } + } + return arguments.ToString(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/Properties/AssemblyInfo.cs b/csharp/src/ProtoGen/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..565894f2 --- /dev/null +++ b/csharp/src/ProtoGen/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("ProtoGen")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtoGen")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.4.1.555")] + +[assembly: AssemblyVersion("2.4.1.555")] +[assembly: AssemblyFileVersion("2.4.1.555")] \ No newline at end of file diff --git a/csharp/src/ProtoGen/ProtoGen.csproj b/csharp/src/ProtoGen/ProtoGen.csproj new file mode 100644 index 00000000..2de44aec --- /dev/null +++ b/csharp/src/ProtoGen/ProtoGen.csproj @@ -0,0 +1,98 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {250ADE34-82FD-4BAE-86D5-985FBE589C4A} + Exe + Properties + Google.ProtocolBuffers.ProtoGen + ProtoGen + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + Google.ProtocolBuffers.ProtoGen.ProgramPreprocess + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE + prompt + 4 + true + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtoGen/ProtocGenCs.cs b/csharp/src/ProtoGen/ProtocGenCs.cs new file mode 100644 index 00000000..29264200 --- /dev/null +++ b/csharp/src/ProtoGen/ProtocGenCs.cs @@ -0,0 +1,76 @@ +using Google.ProtocolBuffers.Compiler.PluginProto; +using Google.ProtocolBuffers.DescriptorProtos; +using System; +using System.Collections.Generic; + +// Usage example: +// protoc.exe +// --plugin=path\to\protoc-gen-cs.exe +// --cs_out="-generated_code_attributes=true umbrella_namespace=TutorialProto :." +// --proto_path=.\protos\ +// protos\tutorial\addressbook.proto + +namespace Google.ProtocolBuffers.ProtoGen +{ + public static class ProtocGenCs + { + internal static void Run(CodeGeneratorRequest request, CodeGeneratorResponse.Builder response) + { + var arguments = new List(); + foreach (var arg in request.Parameter.Split(' ')) + { + var timmedArg = (arg ?? "").Trim(); + if (!string.IsNullOrEmpty(timmedArg)) + { + arguments.Add(timmedArg); + } + } + // Adding fake input file to make TryValidate happy. + arguments.Add(System.Reflection.Assembly.GetExecutingAssembly().Location); + + GeneratorOptions options = new GeneratorOptions + { + Arguments = arguments + }; + IList validationFailures; + if (!options.TryValidate(out validationFailures)) + { + response.Error += new InvalidOptionsException(validationFailures).Message; + return; + } + + Generator generator = Generator.CreateGenerator(options); + generator.Generate(request, response); + } + + public static int Main(string[] args) + { + // Hack to make sure everything's initialized + DescriptorProtoFile.Descriptor.ToString(); + ExtensionRegistry extensionRegistry = ExtensionRegistry.CreateInstance(); + CSharpOptions.RegisterAllExtensions(extensionRegistry); + + CodeGeneratorRequest request; + var response = new CodeGeneratorResponse.Builder(); + try + { + using (var input = Console.OpenStandardInput()) + { + request = CodeGeneratorRequest.ParseFrom(input, extensionRegistry); + } + Run(request, response); + } + catch (Exception e) + { + response.Error += e.ToString(); + } + + using (var output = Console.OpenStandardOutput()) + { + response.Build().WriteTo(output); + output.Flush(); + } + return 0; + } + } +} diff --git a/csharp/src/ProtoGen/RepeatedEnumFieldGenerator.cs b/csharp/src/ProtoGen/RepeatedEnumFieldGenerator.cs new file mode 100644 index 00000000..8c9f17b8 --- /dev/null +++ b/csharp/src/ProtoGen/RepeatedEnumFieldGenerator.cs @@ -0,0 +1,212 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class RepeatedEnumFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator + { + internal RepeatedEnumFieldGenerator(FieldDescriptor descriptor, int fieldOrdinal) + : base(descriptor, fieldOrdinal) + { + } + + public void GenerateMembers(TextGenerator writer) + { + if (Descriptor.IsPacked && OptimizeSpeed) + { + writer.WriteLine("private int {0}MemoizedSerializedSize;", Name); + } + writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name); + AddDeprecatedFlag(writer); + writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return pbc::Lists.AsReadOnly({0}_); }}", Name); + writer.WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); + writer.WriteLine("public int {0}Count {{", PropertyName); + writer.WriteLine(" get {{ return {0}_.Count; }}", Name); + writer.WriteLine("}"); + + AddDeprecatedFlag(writer); + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); + writer.WriteLine(" return {0}_[index];", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) + { + // Note: We can return the original list here, because we make it unmodifiable when we build + // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddDeprecatedFlag(writer); + writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return PrepareBuilder().{0}_; }}", Name); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public int {0}Count {{", PropertyName); + writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); + writer.WriteLine(" return result.Get{0}(index);", PropertyName); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_[index] = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Add(values);", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Clear();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) + { + writer.WriteLine("if (other.{0}_.Count != 0) {{", Name); + writer.WriteLine(" result.{0}_.Add(other.{0}_);", Name); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) + { + writer.WriteLine("{0}_.MakeReadOnly();", Name); + } + + public void GenerateParsingCode(TextGenerator writer) + { + writer.WriteLine("scg::ICollection unknownItems;"); + writer.WriteLine("input.ReadEnumArray<{0}>(tag, field_name, result.{1}_, out unknownItems);", TypeName, Name); + if (!UseLiteRuntime) + { + writer.WriteLine("if (unknownItems != null) {"); + writer.WriteLine(" if (unknownFields == null) {"); + writer.WriteLine(" unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer.WriteLine(" }"); + writer.WriteLine(" foreach (object rawValue in unknownItems)"); + writer.WriteLine(" if (rawValue is int)"); + writer.WriteLine(" unknownFields.MergeVarintField({0}, (ulong)(int)rawValue);", Number); + writer.WriteLine("}"); + } + } + + public void GenerateSerializationCode(TextGenerator writer) + { + writer.WriteLine("if ({0}_.Count > 0) {{", Name); + writer.Indent(); + if (Descriptor.IsPacked) + { + writer.WriteLine( + "output.WritePackedEnumArray({0}, field_names[{2}], {1}MemoizedSerializedSize, {1}_);", Number, Name, + FieldOrdinal, Descriptor.FieldType); + } + else + { + writer.WriteLine("output.WriteEnumArray({0}, field_names[{2}], {1}_);", Number, Name, FieldOrdinal, + Descriptor.FieldType); + } + writer.Outdent(); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) + { + writer.WriteLine("{"); + writer.Indent(); + writer.WriteLine("int dataSize = 0;"); + writer.WriteLine("if ({0}_.Count > 0) {{", Name); + writer.Indent(); + writer.WriteLine("foreach ({0} element in {1}_) {{", TypeName, Name); + writer.WriteLine(" dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);"); + writer.WriteLine("}"); + writer.WriteLine("size += dataSize;"); + int tagSize = CodedOutputStream.ComputeTagSize(Descriptor.FieldNumber); + if (Descriptor.IsPacked) + { + writer.WriteLine("size += {0};", tagSize); + writer.WriteLine("size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize);"); + } + else + { + writer.WriteLine("size += {0} * {1}_.Count;", tagSize, Name); + } + writer.Outdent(); + writer.WriteLine("}"); + // cache the data size for packed fields. + if (Descriptor.IsPacked) + { + writer.WriteLine("{0}MemoizedSerializedSize = dataSize;", Name); + } + writer.Outdent(); + writer.WriteLine("}"); + } + + public override void WriteHash(TextGenerator writer) + { + writer.WriteLine("foreach({0} i in {1}_)", TypeName, Name); + writer.WriteLine(" hash ^= i.GetHashCode();"); + } + + public override void WriteEquals(TextGenerator writer) + { + writer.WriteLine("if({0}_.Count != other.{0}_.Count) return false;", Name); + writer.WriteLine("for(int ix=0; ix < {0}_.Count; ix++)", Name); + writer.WriteLine(" if(!{0}_[ix].Equals(other.{0}_[ix])) return false;", Name); + } + + public override void WriteToString(TextGenerator writer) + { + writer.WriteLine("PrintField(\"{0}\", {1}_, writer);", Descriptor.Name, Name); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/RepeatedMessageFieldGenerator.cs b/csharp/src/ProtoGen/RepeatedMessageFieldGenerator.cs new file mode 100644 index 00000000..a9a0143c --- /dev/null +++ b/csharp/src/ProtoGen/RepeatedMessageFieldGenerator.cs @@ -0,0 +1,184 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class RepeatedMessageFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator + { + internal RepeatedMessageFieldGenerator(FieldDescriptor descriptor, int fieldOrdinal) + : base(descriptor, fieldOrdinal) + { + } + + public void GenerateMembers(TextGenerator writer) + { + writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name); + AddDeprecatedFlag(writer); + writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return {0}_; }}", Name); + writer.WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); + writer.WriteLine("public int {0}Count {{", PropertyName); + writer.WriteLine(" get {{ return {0}_.Count; }}", Name); + writer.WriteLine("}"); + + AddDeprecatedFlag(writer); + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); + writer.WriteLine(" return {0}_[index];", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) + { + // Note: We can return the original list here, because we make it unmodifiable when we build + // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddDeprecatedFlag(writer); + writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return PrepareBuilder().{0}_; }}", Name); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public int {0}Count {{", PropertyName); + writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); + writer.WriteLine(" return result.Get{0}(index);", PropertyName); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName); + AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_[index] = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + // Extra overload for builder (just on messages) + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Set{0}(int index, {1}.Builder builderForValue) {{", PropertyName, TypeName); + AddNullCheck(writer, "builderForValue"); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_[index] = builderForValue.Build();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName); + AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + // Extra overload for builder (just on messages) + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Add{0}({1}.Builder builderForValue) {{", PropertyName, TypeName); + AddNullCheck(writer, "builderForValue"); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Add(builderForValue.Build());", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Add(values);", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Clear();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) + { + writer.WriteLine("if (other.{0}_.Count != 0) {{", Name); + writer.WriteLine(" result.{0}_.Add(other.{0}_);", Name); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) + { + writer.WriteLine("{0}_.MakeReadOnly();", Name); + } + + public void GenerateParsingCode(TextGenerator writer) + { + writer.WriteLine( + "input.Read{0}Array(tag, field_name, result.{1}_, {2}.DefaultInstance, extensionRegistry);", + MessageOrGroup, Name, TypeName); + } + + public void GenerateSerializationCode(TextGenerator writer) + { + writer.WriteLine("if ({0}_.Count > 0) {{", Name); + writer.Indent(); + writer.WriteLine("output.Write{0}Array({1}, field_names[{3}], {2}_);", MessageOrGroup, Number, Name, + FieldOrdinal, Descriptor.FieldType); + writer.Outdent(); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) + { + writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, PropertyName); + writer.WriteLine(" size += pb::CodedOutputStream.Compute{0}Size({1}, element);", MessageOrGroup, Number); + writer.WriteLine("}"); + } + + public override void WriteHash(TextGenerator writer) + { + writer.WriteLine("foreach({0} i in {1}_)", TypeName, Name); + writer.WriteLine(" hash ^= i.GetHashCode();"); + } + + public override void WriteEquals(TextGenerator writer) + { + writer.WriteLine("if({0}_.Count != other.{0}_.Count) return false;", Name); + writer.WriteLine("for(int ix=0; ix < {0}_.Count; ix++)", Name); + writer.WriteLine(" if(!{0}_[ix].Equals(other.{0}_[ix])) return false;", Name); + } + + public override void WriteToString(TextGenerator writer) + { + writer.WriteLine("PrintField(\"{0}\", {1}_, writer);", + Descriptor.FieldType == FieldType.Group ? Descriptor.MessageType.Name : Descriptor.Name, + Name); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs b/csharp/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs new file mode 100644 index 00000000..b795f3b6 --- /dev/null +++ b/csharp/src/ProtoGen/RepeatedPrimitiveFieldGenerator.cs @@ -0,0 +1,207 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class RepeatedPrimitiveFieldGenerator : FieldGeneratorBase, IFieldSourceGenerator + { + internal RepeatedPrimitiveFieldGenerator(FieldDescriptor descriptor, int fieldOrdinal) + : base(descriptor, fieldOrdinal) + { + } + + public void GenerateMembers(TextGenerator writer) + { + if (Descriptor.IsPacked && OptimizeSpeed) + { + writer.WriteLine("private int {0}MemoizedSerializedSize;", Name); + } + writer.WriteLine("private pbc::PopsicleList<{0}> {1}_ = new pbc::PopsicleList<{0}>();", TypeName, Name); + AddPublicMemberAttributes(writer); + writer.WriteLine("public scg::IList<{0}> {1}List {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return pbc::Lists.AsReadOnly({0}_); }}", Name); + writer.WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); + writer.WriteLine("public int {0}Count {{", PropertyName); + writer.WriteLine(" get {{ return {0}_.Count; }}", Name); + writer.WriteLine("}"); + + AddPublicMemberAttributes(writer); + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); + writer.WriteLine(" return {0}_[index];", Name); + writer.WriteLine("}"); + } + + public void GenerateBuilderMembers(TextGenerator writer) + { + // Note: We can return the original list here, because we make it unmodifiable when we build + // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddPublicMemberAttributes(writer); + writer.WriteLine("public pbc::IPopsicleList<{0}> {1}List {{", TypeName, PropertyName); + writer.WriteLine(" get {{ return PrepareBuilder().{0}_; }}", Name); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public int {0}Count {{", PropertyName); + writer.WriteLine(" get {{ return result.{0}Count; }}", PropertyName); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public {0} Get{1}(int index) {{", TypeName, PropertyName); + writer.WriteLine(" return result.Get{0}(index);", PropertyName); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public Builder Set{0}(int index, {1} value) {{", PropertyName, TypeName); + AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_[index] = value;", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public Builder Add{0}({1} value) {{", PropertyName, TypeName); + AddNullCheck(writer); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Add(value);", Name, TypeName); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddPublicMemberAttributes(writer); + writer.WriteLine("public Builder AddRange{0}(scg::IEnumerable<{1}> values) {{", PropertyName, TypeName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Add(values);", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + AddDeprecatedFlag(writer); + writer.WriteLine("public Builder Clear{0}() {{", PropertyName); + writer.WriteLine(" PrepareBuilder();"); + writer.WriteLine(" result.{0}_.Clear();", Name); + writer.WriteLine(" return this;"); + writer.WriteLine("}"); + } + + public void GenerateMergingCode(TextGenerator writer) + { + writer.WriteLine("if (other.{0}_.Count != 0) {{", Name); + writer.WriteLine(" result.{0}_.Add(other.{0}_);", Name); + writer.WriteLine("}"); + } + + public void GenerateBuildingCode(TextGenerator writer) + { + writer.WriteLine("{0}_.MakeReadOnly();", Name); + } + + public void GenerateParsingCode(TextGenerator writer) + { + writer.WriteLine("input.Read{0}Array(tag, field_name, result.{1}_);", CapitalizedTypeName, Name, + Descriptor.FieldType); + } + + public void GenerateSerializationCode(TextGenerator writer) + { + writer.WriteLine("if ({0}_.Count > 0) {{", Name); + writer.Indent(); + if (Descriptor.IsPacked) + { + writer.WriteLine("output.WritePacked{0}Array({1}, field_names[{3}], {2}MemoizedSerializedSize, {2}_);", + CapitalizedTypeName, Number, Name, FieldOrdinal, Descriptor.FieldType); + } + else + { + writer.WriteLine("output.Write{0}Array({1}, field_names[{3}], {2}_);", CapitalizedTypeName, Number, Name, + FieldOrdinal, Descriptor.FieldType); + } + writer.Outdent(); + writer.WriteLine("}"); + } + + public void GenerateSerializedSizeCode(TextGenerator writer) + { + writer.WriteLine("{"); + writer.Indent(); + writer.WriteLine("int dataSize = 0;"); + if (FixedSize == -1) + { + writer.WriteLine("foreach ({0} element in {1}List) {{", TypeName, PropertyName); + writer.WriteLine(" dataSize += pb::CodedOutputStream.Compute{0}SizeNoTag(element);", + CapitalizedTypeName, Number); + writer.WriteLine("}"); + } + else + { + writer.WriteLine("dataSize = {0} * {1}_.Count;", FixedSize, Name); + } + writer.WriteLine("size += dataSize;"); + int tagSize = CodedOutputStream.ComputeTagSize(Descriptor.FieldNumber); + if (Descriptor.IsPacked) + { + writer.WriteLine("if ({0}_.Count != 0) {{", Name); + writer.WriteLine(" size += {0} + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);", tagSize); + writer.WriteLine("}"); + } + else + { + writer.WriteLine("size += {0} * {1}_.Count;", tagSize, Name); + } + // cache the data size for packed fields. + if (Descriptor.IsPacked) + { + writer.WriteLine("{0}MemoizedSerializedSize = dataSize;", Name); + } + writer.Outdent(); + writer.WriteLine("}"); + } + + public override void WriteHash(TextGenerator writer) + { + writer.WriteLine("foreach({0} i in {1}_)", TypeName, Name); + writer.WriteLine(" hash ^= i.GetHashCode();"); + } + + public override void WriteEquals(TextGenerator writer) + { + writer.WriteLine("if({0}_.Count != other.{0}_.Count) return false;", Name); + writer.WriteLine("for(int ix=0; ix < {0}_.Count; ix++)", Name); + writer.WriteLine(" if(!{0}_[ix].Equals(other.{0}_[ix])) return false;", Name); + } + + public override void WriteToString(TextGenerator writer) + { + writer.WriteLine("PrintField(\"{0}\", {1}_, writer);", Descriptor.Name, Name); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/ServiceGenerator.cs b/csharp/src/ProtoGen/ServiceGenerator.cs new file mode 100644 index 00000000..a6b9eb28 --- /dev/null +++ b/csharp/src/ProtoGen/ServiceGenerator.cs @@ -0,0 +1,190 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class GenericServiceGenerator : SourceGeneratorBase, ISourceGenerator + { + private enum RequestOrResponse + { + Request, + Response + } + + internal GenericServiceGenerator(ServiceDescriptor descriptor) + : base(descriptor) + { + } + + public void Generate(TextGenerator writer) + { + writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("{0} abstract class {1} : pb::IService {{", ClassAccessLevel, Descriptor.Name); + writer.Indent(); + + foreach (MethodDescriptor method in Descriptor.Methods) + { + writer.WriteLine("{0} abstract void {1}(", ClassAccessLevel, + NameHelpers.UnderscoresToPascalCase(method.Name)); + writer.WriteLine(" pb::IRpcController controller,"); + writer.WriteLine(" {0} request,", GetClassName(method.InputType)); + writer.WriteLine(" global::System.Action<{0}> done);", GetClassName(method.OutputType)); + } + + // Generate Descriptor and DescriptorForType. + writer.WriteLine(); + writer.WriteLine("{0} static pbd::ServiceDescriptor Descriptor {{", ClassAccessLevel); + writer.WriteLine(" get {{ return {0}.Descriptor.Services[{1}]; }}", + DescriptorUtil.GetQualifiedUmbrellaClassName(Descriptor.File.CSharpOptions), + Descriptor.Index); + writer.WriteLine("}"); + writer.WriteLine("public pbd::ServiceDescriptor DescriptorForType {"); + writer.WriteLine(" get { return Descriptor; }"); + writer.WriteLine("}"); + + GenerateCallMethod(writer); + GenerateGetPrototype(RequestOrResponse.Request, writer); + GenerateGetPrototype(RequestOrResponse.Response, writer); + GenerateStub(writer); + + writer.Outdent(); + writer.WriteLine("}"); + } + + private void GenerateCallMethod(TextGenerator writer) + { + writer.WriteLine(); + writer.WriteLine("public void CallMethod("); + writer.WriteLine(" pbd::MethodDescriptor method,"); + writer.WriteLine(" pb::IRpcController controller,"); + writer.WriteLine(" pb::IMessage request,"); + writer.WriteLine(" global::System.Action done) {"); + writer.Indent(); + writer.WriteLine("if (method.Service != Descriptor) {"); + writer.WriteLine(" throw new global::System.ArgumentException("); + writer.WriteLine(" \"Service.CallMethod() given method descriptor for wrong service type.\");"); + writer.WriteLine("}"); + writer.WriteLine("switch(method.Index) {"); + writer.Indent(); + foreach (MethodDescriptor method in Descriptor.Methods) + { + writer.WriteLine("case {0}:", method.Index); + writer.WriteLine(" this.{0}(controller, ({1}) request,", + NameHelpers.UnderscoresToPascalCase(method.Name), GetClassName(method.InputType)); + writer.WriteLine(" pb::RpcUtil.SpecializeCallback<{0}>(", GetClassName(method.OutputType)); + writer.WriteLine(" done));"); + writer.WriteLine(" return;"); + } + writer.WriteLine("default:"); + writer.WriteLine(" throw new global::System.InvalidOperationException(\"Can't get here.\");"); + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + private void GenerateGetPrototype(RequestOrResponse which, TextGenerator writer) + { + writer.WriteLine("public pb::IMessage Get{0}Prototype(pbd::MethodDescriptor method) {{", which); + writer.Indent(); + writer.WriteLine("if (method.Service != Descriptor) {"); + writer.WriteLine(" throw new global::System.ArgumentException("); + writer.WriteLine(" \"Service.Get{0}Prototype() given method descriptor for wrong service type.\");", + which); + writer.WriteLine("}"); + writer.WriteLine("switch(method.Index) {"); + writer.Indent(); + + foreach (MethodDescriptor method in Descriptor.Methods) + { + writer.WriteLine("case {0}:", method.Index); + writer.WriteLine(" return {0}.DefaultInstance;", + GetClassName(which == RequestOrResponse.Request ? method.InputType : method.OutputType)); + } + writer.WriteLine("default:"); + writer.WriteLine(" throw new global::System.InvalidOperationException(\"Can't get here.\");"); + writer.Outdent(); + writer.WriteLine("}"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine(); + } + + private void GenerateStub(TextGenerator writer) + { + writer.WriteLine("public static Stub CreateStub(pb::IRpcChannel channel) {"); + writer.WriteLine(" return new Stub(channel);"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("{0} class Stub : {1} {{", ClassAccessLevel, GetClassName(Descriptor)); + writer.Indent(); + writer.WriteLine("internal Stub(pb::IRpcChannel channel) {"); + writer.WriteLine(" this.channel = channel;"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine("private readonly pb::IRpcChannel channel;"); + writer.WriteLine(); + writer.WriteLine("public pb::IRpcChannel Channel {"); + writer.WriteLine(" get { return channel; }"); + writer.WriteLine("}"); + + foreach (MethodDescriptor method in Descriptor.Methods) + { + writer.WriteLine(); + writer.WriteLine("{0} override void {1}(", ClassAccessLevel, + NameHelpers.UnderscoresToPascalCase(method.Name)); + writer.WriteLine(" pb::IRpcController controller,"); + writer.WriteLine(" {0} request,", GetClassName(method.InputType)); + writer.WriteLine(" global::System.Action<{0}> done) {{", GetClassName(method.OutputType)); + writer.Indent(); + writer.WriteLine("channel.CallMethod(Descriptor.Methods[{0}],", method.Index); + writer.WriteLine(" controller, request, {0}.DefaultInstance,", GetClassName(method.OutputType)); + writer.WriteLine(" pb::RpcUtil.GeneralizeCallback<{0}, {0}.Builder>(done, {0}.DefaultInstance));", + GetClassName(method.OutputType)); + writer.Outdent(); + writer.WriteLine("}"); + } + writer.Outdent(); + writer.WriteLine("}"); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/ServiceInterfaceGenerator.cs b/csharp/src/ProtoGen/ServiceInterfaceGenerator.cs new file mode 100644 index 00000000..11e3d3d0 --- /dev/null +++ b/csharp/src/ProtoGen/ServiceInterfaceGenerator.cs @@ -0,0 +1,300 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal class ServiceGenerator : SourceGeneratorBase, ISourceGenerator + { + private readonly CSharpServiceType svcType; + private ISourceGenerator _generator; + + internal ServiceGenerator(ServiceDescriptor descriptor) + : base(descriptor) + { + svcType = descriptor.File.CSharpOptions.ServiceGeneratorType; + switch (svcType) + { + case CSharpServiceType.NONE: + _generator = new NoServicesGenerator(descriptor); + break; + case CSharpServiceType.GENERIC: + _generator = new GenericServiceGenerator(descriptor); + break; + case CSharpServiceType.INTERFACE: + _generator = new ServiceInterfaceGenerator(descriptor); + break; + case CSharpServiceType.IRPCDISPATCH: + _generator = new RpcServiceGenerator(descriptor); + break; + default: + throw new ApplicationException("Unknown ServiceGeneratorType = " + svcType.ToString()); + } + } + + public void Generate(TextGenerator writer) + { + _generator.Generate(writer); + } + + private class NoServicesGenerator : SourceGeneratorBase, ISourceGenerator + { + public NoServicesGenerator(ServiceDescriptor descriptor) + : base(descriptor) + { + } + + public virtual void Generate(TextGenerator writer) + { + writer.WriteLine("/*"); + writer.WriteLine("* Service generation is now disabled by default, use the following option to enable:"); + writer.WriteLine("* option (google.protobuf.csharp_file_options).service_generator_type = GENERIC;"); + writer.WriteLine("*/"); + } + } + + private class ServiceInterfaceGenerator : SourceGeneratorBase, ISourceGenerator + { + public ServiceInterfaceGenerator(ServiceDescriptor descriptor) + : base(descriptor) + { + } + + public virtual void Generate(TextGenerator writer) + { + CSharpServiceOptions options = Descriptor.Options.GetExtension(CSharpOptions.CsharpServiceOptions); + if (options != null && options.HasInterfaceId) + { + writer.WriteLine("[global::System.Runtime.InteropServices.GuidAttribute(\"{0}\")]", + new Guid(options.InterfaceId)); + } + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("{0} partial interface I{1} {{", ClassAccessLevel, Descriptor.Name); + writer.Indent(); + + foreach (MethodDescriptor method in Descriptor.Methods) + { + CSharpMethodOptions mth = method.Options.GetExtension(CSharpOptions.CsharpMethodOptions); + if (mth.HasDispatchId) + { + writer.WriteLine("[global::System.Runtime.InteropServices.DispId({0})]", mth.DispatchId); + } + writer.WriteLine("{0} {1}({2} {3});", GetClassName(method.OutputType), + NameHelpers.UnderscoresToPascalCase(method.Name), GetClassName(method.InputType), + NameHelpers.UnderscoresToCamelCase(method.InputType.Name)); + } + + writer.Outdent(); + writer.WriteLine("}"); + } + } + + private class RpcServiceGenerator : ServiceInterfaceGenerator + { + public RpcServiceGenerator(ServiceDescriptor descriptor) + : base(descriptor) + { + } + + public override void Generate(TextGenerator writer) + { + base.Generate(writer); + + writer.WriteLine(); + + // CLIENT Proxy + { + if (Descriptor.File.CSharpOptions.ClsCompliance) + { + writer.WriteLine("[global::System.CLSCompliant(false)]"); + } + writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("{0} partial class {1} : I{1}, pb::IRpcDispatch, global::System.IDisposable {{", + ClassAccessLevel, Descriptor.Name); + writer.Indent(); + writer.WriteLine("private readonly bool dispose;"); + writer.WriteLine("private readonly pb::IRpcDispatch dispatch;"); + + writer.WriteLine("public {0}(pb::IRpcDispatch dispatch) : this(dispatch, true) {{", Descriptor.Name); + writer.WriteLine("}"); + writer.WriteLine("public {0}(pb::IRpcDispatch dispatch, bool dispose) {{", Descriptor.Name); + writer.WriteLine(" pb::ThrowHelper.ThrowIfNull(this.dispatch = dispatch, \"dispatch\");"); + writer.WriteLine(" this.dispose = dispose && dispatch is global::System.IDisposable;"); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine("public void Dispose() {"); + writer.WriteLine(" if (dispose) ((global::System.IDisposable)dispatch).Dispose();"); + writer.WriteLine("}"); + writer.WriteLine(); + writer.WriteLine( + "TMessage pb::IRpcDispatch.CallMethod(string method, pb::IMessageLite request, pb::IBuilderLite response) {"); + writer.WriteLine(" return dispatch.CallMethod(method, request, response);"); + writer.WriteLine("}"); + writer.WriteLine(); + + foreach (MethodDescriptor method in Descriptor.Methods) + { + writer.WriteLine("public {0} {1}({2} {3}) {{", GetClassName(method.OutputType), + NameHelpers.UnderscoresToPascalCase(method.Name), + GetClassName(method.InputType), + NameHelpers.UnderscoresToCamelCase(method.InputType.Name)); + writer.WriteLine(" return dispatch.CallMethod(\"{0}\", {1}, {2}.CreateBuilder());", + method.Name, + NameHelpers.UnderscoresToCamelCase(method.InputType.Name), + GetClassName(method.OutputType) + ); + writer.WriteLine("}"); + writer.WriteLine(); + } + } + // SERVER - DISPATCH + { + if (Descriptor.File.CSharpOptions.ClsCompliance) + { + writer.WriteLine("[global::System.CLSCompliant(false)]"); + } + writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("public partial class Dispatch : pb::IRpcDispatch, global::System.IDisposable {"); + writer.Indent(); + writer.WriteLine("private readonly bool dispose;"); + writer.WriteLine("private readonly I{0} implementation;", Descriptor.Name); + + writer.WriteLine("public Dispatch(I{0} implementation) : this(implementation, true) {{", + Descriptor.Name); + writer.WriteLine("}"); + writer.WriteLine("public Dispatch(I{0} implementation, bool dispose) {{", Descriptor.Name); + writer.WriteLine(" pb::ThrowHelper.ThrowIfNull(this.implementation = implementation, \"implementation\");"); + writer.WriteLine(" this.dispose = dispose && implementation is global::System.IDisposable;"); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine("public void Dispose() {"); + writer.WriteLine(" if (dispose) ((global::System.IDisposable)implementation).Dispose();"); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine( + "public TMessage CallMethod(string methodName, pb::IMessageLite request, pb::IBuilderLite response)"); + writer.WriteLine(" where TMessage : pb::IMessageLite"); + writer.WriteLine(" where TBuilder : pb::IBuilderLite {"); + writer.Indent(); + writer.WriteLine("switch(methodName) {"); + writer.Indent(); + + foreach (MethodDescriptor method in Descriptor.Methods) + { + writer.WriteLine( + "case \"{0}\": return response.MergeFrom(implementation.{1}(({2})request)).Build();", + method.Name, NameHelpers.UnderscoresToPascalCase(method.Name), + GetClassName(method.InputType)); + } + writer.WriteLine("default: throw pb::ThrowHelper.CreateMissingMethod(typeof(I{0}), methodName);", Descriptor.Name); + writer.Outdent(); + writer.WriteLine("}"); //end switch + writer.Outdent(); + writer.WriteLine("}"); //end invoke + writer.Outdent(); + writer.WriteLine("}"); //end server + } + // SERVER - STUB + { + if (Descriptor.File.CSharpOptions.ClsCompliance) + { + writer.WriteLine("[global::System.CLSCompliant(false)]"); + } + writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer.WriteLine( + "public partial class ServerStub : pb::IRpcServerStub, global::System.IDisposable {"); + writer.Indent(); + writer.WriteLine("private readonly bool dispose;"); + writer.WriteLine("private readonly pb::IRpcDispatch implementation;", Descriptor.Name); + + writer.WriteLine("public ServerStub(I{0} implementation) : this(implementation, true) {{", + Descriptor.Name); + writer.WriteLine("}"); + writer.WriteLine( + "public ServerStub(I{0} implementation, bool dispose) : this(new Dispatch(implementation, dispose), dispose) {{", + Descriptor.Name); + writer.WriteLine("}"); + + writer.WriteLine("public ServerStub(pb::IRpcDispatch implementation) : this(implementation, true) {"); + writer.WriteLine("}"); + writer.WriteLine("public ServerStub(pb::IRpcDispatch implementation, bool dispose) {"); + writer.WriteLine(" pb::ThrowHelper.ThrowIfNull(this.implementation = implementation, \"implementation\");"); + writer.WriteLine(" this.dispose = dispose && implementation is global::System.IDisposable;"); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine("public void Dispose() {"); + writer.WriteLine(" if (dispose) ((global::System.IDisposable)implementation).Dispose();"); + writer.WriteLine("}"); + writer.WriteLine(); + + writer.WriteLine( + "public pb::IMessageLite CallMethod(string methodName, pb::ICodedInputStream input, pb::ExtensionRegistry registry) {{", + Descriptor.Name); + writer.Indent(); + writer.WriteLine("switch(methodName) {"); + writer.Indent(); + + foreach (MethodDescriptor method in Descriptor.Methods) + { + writer.WriteLine( + "case \"{0}\": return implementation.CallMethod(methodName, {1}.ParseFrom(input, registry), {2}.CreateBuilder());", + method.Name, GetClassName(method.InputType), GetClassName(method.OutputType)); + } + writer.WriteLine("default: throw pb::ThrowHelper.CreateMissingMethod(typeof(I{0}), methodName);", Descriptor.Name); + writer.Outdent(); + writer.WriteLine("}"); //end switch + writer.Outdent(); + writer.WriteLine("}"); //end invoke + writer.Outdent(); + writer.WriteLine("}"); //end server + } + + writer.Outdent(); + writer.WriteLine("}"); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/SourceGeneratorBase.cs b/csharp/src/ProtoGen/SourceGeneratorBase.cs new file mode 100644 index 00000000..535c6f73 --- /dev/null +++ b/csharp/src/ProtoGen/SourceGeneratorBase.cs @@ -0,0 +1,167 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + internal abstract class SourceGeneratorBase where T : IDescriptor + { + private readonly T descriptor; + + protected readonly bool OptimizeSpeed; + protected readonly bool OptimizeSize; + protected readonly bool UseLiteRuntime; + protected readonly string RuntimeSuffix; + + protected SourceGeneratorBase(T descriptor) + { + this.descriptor = descriptor; + + OptimizeSize = descriptor.File.Options.OptimizeFor == + FileOptions.Types.OptimizeMode.CODE_SIZE; + OptimizeSpeed = descriptor.File.Options.OptimizeFor == + FileOptions.Types.OptimizeMode.SPEED; + UseLiteRuntime = descriptor.File.Options.OptimizeFor == + FileOptions.Types.OptimizeMode.LITE_RUNTIME; + //Lite runtime uses OptimizeSpeed code branches + OptimizeSpeed |= UseLiteRuntime; + RuntimeSuffix = UseLiteRuntime ? "Lite" : ""; + } + + protected T Descriptor + { + get { return descriptor; } + } + + internal static string GetClassName(IDescriptor descriptor) + { + return ToCSharpName(descriptor.FullName, descriptor.File); + } + + // Groups are hacky: The name of the field is just the lower-cased name + // of the group type. In C#, though, we would like to retain the original + // capitalization of the type name. + internal static string GetFieldName(FieldDescriptor descriptor) + { + if (descriptor.FieldType == FieldType.Group) + { + return descriptor.MessageType.Name; + } + else + { + return descriptor.Name; + } + } + + internal static string GetFieldConstantName(FieldDescriptor field) + { + return field.CSharpOptions.PropertyName + "FieldNumber"; + } + + private static string ToCSharpName(string name, FileDescriptor file) + { + string result = file.CSharpOptions.Namespace; + if (file.CSharpOptions.NestClasses) + { + if (result != "") + { + result += "."; + } + result += file.CSharpOptions.UmbrellaClassname; + } + if (result != "") + { + result += '.'; + } + string classname; + if (file.Package == "") + { + classname = name; + } + else + { + // Strip the proto package from full_name since we've replaced it with + // the C# namespace. + classname = name.Substring(file.Package.Length + 1); + } + result += classname.Replace(".", ".Types."); + return "global::" + result; + } + + protected string ClassAccessLevel + { + get { return descriptor.File.CSharpOptions.PublicClasses ? "public" : "internal"; } + } + + protected void WriteGeneratedCodeAttributes(TextGenerator writer) + { + if (descriptor.File.CSharpOptions.GeneratedCodeAttributes) + { + writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]"); + writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]", + GetType().Assembly.GetName().Name, GetType().Assembly.GetName().Version); + } + } + + protected void WriteChildren(TextGenerator writer, string region, IEnumerable children) + where TChild : IDescriptor + { + // Copy the set of children; makes access easier + List copy = new List(children); + if (copy.Count == 0) + { + return; + } + + if (region != null) + { + writer.WriteLine("#region {0}", region); + } + foreach (TChild child in children) + { + SourceGenerators.CreateGenerator(child).Generate(writer); + } + if (region != null) + { + writer.WriteLine("#endregion"); + writer.WriteLine(); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/SourceGenerators.cs b/csharp/src/ProtoGen/SourceGenerators.cs new file mode 100644 index 00000000..38458f05 --- /dev/null +++ b/csharp/src/ProtoGen/SourceGenerators.cs @@ -0,0 +1,87 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + public delegate TResult Func(T arg); + + internal static class SourceGenerators + { + private static readonly Dictionary> GeneratorFactories = + new Dictionary> + { + {typeof(FileDescriptor), descriptor => new UmbrellaClassGenerator((FileDescriptor) descriptor)}, + {typeof(EnumDescriptor), descriptor => new EnumGenerator((EnumDescriptor) descriptor)}, + {typeof(ServiceDescriptor), descriptor => new ServiceGenerator((ServiceDescriptor) descriptor)}, + {typeof(MessageDescriptor), descriptor => new MessageGenerator((MessageDescriptor) descriptor)}, + // For other fields, we have IFieldSourceGenerators. + {typeof(FieldDescriptor), descriptor => new ExtensionGenerator((FieldDescriptor) descriptor)} + }; + + public static IFieldSourceGenerator CreateFieldGenerator(FieldDescriptor field, int fieldOrdinal) + { + switch (field.MappedType) + { + case MappedType.Message: + return field.IsRepeated + ? (IFieldSourceGenerator) new RepeatedMessageFieldGenerator(field, fieldOrdinal) + : new MessageFieldGenerator(field, fieldOrdinal); + case MappedType.Enum: + return field.IsRepeated + ? (IFieldSourceGenerator) new RepeatedEnumFieldGenerator(field, fieldOrdinal) + : new EnumFieldGenerator(field, fieldOrdinal); + default: + return field.IsRepeated + ? (IFieldSourceGenerator) new RepeatedPrimitiveFieldGenerator(field, fieldOrdinal) + : new PrimitiveFieldGenerator(field, fieldOrdinal); + } + } + + public static ISourceGenerator CreateGenerator(T descriptor) where T : IDescriptor + { + Func factory; + if (!GeneratorFactories.TryGetValue(typeof(T), out factory)) + { + throw new ArgumentException("No generator registered for " + typeof(T).Name); + } + return factory(descriptor); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/UmbrellaClassGenerator.cs b/csharp/src/ProtoGen/UmbrellaClassGenerator.cs new file mode 100644 index 00000000..d83b2dbd --- /dev/null +++ b/csharp/src/ProtoGen/UmbrellaClassGenerator.cs @@ -0,0 +1,294 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections; +using System.Collections.Generic; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoGen +{ + /// + /// Generator for the class describing the .proto file in general, + /// containing things like the message descriptor. + /// + internal sealed class UmbrellaClassGenerator : SourceGeneratorBase, ISourceGenerator + { + internal UmbrellaClassGenerator(FileDescriptor descriptor) + : base(descriptor) + { + } + + // Recursively searches the given message to see if it contains any extensions. + private static bool UsesExtensions(IMessage message) + { + // We conservatively assume that unknown fields are extensions. + if (message.UnknownFields.FieldDictionary.Count > 0) + { + return true; + } + + foreach (KeyValuePair keyValue in message.AllFields) + { + FieldDescriptor field = keyValue.Key; + if (field.IsExtension) + { + return true; + } + if (field.MappedType == MappedType.Message) + { + if (field.IsRepeated) + { + foreach (IMessage subMessage in (IEnumerable) keyValue.Value) + { + if (UsesExtensions(subMessage)) + { + return true; + } + } + } + else + { + if (UsesExtensions((IMessage) keyValue.Value)) + { + return true; + } + } + } + } + return false; + } + + public void Generate(TextGenerator writer) + { + WriteIntroduction(writer); + WriteExtensionRegistration(writer); + WriteChildren(writer, "Extensions", Descriptor.Extensions); + writer.WriteLine("#region Static variables"); + foreach (MessageDescriptor message in Descriptor.MessageTypes) + { + new MessageGenerator(message).GenerateStaticVariables(writer); + } + writer.WriteLine("#endregion"); + if (!UseLiteRuntime) + { + WriteDescriptor(writer); + } + else + { + WriteLiteExtensions(writer); + } + // The class declaration either gets closed before or after the children are written. + if (!Descriptor.CSharpOptions.NestClasses) + { + writer.Outdent(); + writer.WriteLine("}"); + + // Close the namespace around the umbrella class if defined + if (!Descriptor.CSharpOptions.NestClasses && Descriptor.CSharpOptions.UmbrellaNamespace != "") + { + writer.Outdent(); + writer.WriteLine("}"); + } + } + WriteChildren(writer, "Enums", Descriptor.EnumTypes); + WriteChildren(writer, "Messages", Descriptor.MessageTypes); + WriteChildren(writer, "Services", Descriptor.Services); + if (Descriptor.CSharpOptions.NestClasses) + { + writer.Outdent(); + writer.WriteLine("}"); + } + if (Descriptor.CSharpOptions.Namespace != "") + { + writer.Outdent(); + writer.WriteLine("}"); + } + writer.WriteLine(); + writer.WriteLine("#endregion Designer generated code"); + } + + private void WriteIntroduction(TextGenerator writer) + { + writer.WriteLine("// Generated by {0}. DO NOT EDIT!", this.GetType().Assembly.FullName); + writer.WriteLine("#pragma warning disable 1591, 0612, 3021"); + writer.WriteLine("#region Designer generated code"); + + writer.WriteLine(); + writer.WriteLine("using pb = global::Google.ProtocolBuffers;"); + writer.WriteLine("using pbc = global::Google.ProtocolBuffers.Collections;"); + writer.WriteLine("using pbd = global::Google.ProtocolBuffers.Descriptors;"); + writer.WriteLine("using scg = global::System.Collections.Generic;"); + + if (Descriptor.CSharpOptions.Namespace != "") + { + writer.WriteLine("namespace {0} {{", Descriptor.CSharpOptions.Namespace); + writer.Indent(); + writer.WriteLine(); + } + // Add the namespace around the umbrella class if defined + if (!Descriptor.CSharpOptions.NestClasses && Descriptor.CSharpOptions.UmbrellaNamespace != "") + { + writer.WriteLine("namespace {0} {{", Descriptor.CSharpOptions.UmbrellaNamespace); + writer.Indent(); + writer.WriteLine(); + } + + if (Descriptor.CSharpOptions.CodeContracts) + { + writer.WriteLine("[global::System.Diagnostics.Contracts.ContractVerificationAttribute(false)]"); + } + writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer.WriteLine("{0} static partial class {1} {{", ClassAccessLevel, + Descriptor.CSharpOptions.UmbrellaClassname); + writer.WriteLine(); + writer.Indent(); + } + + private void WriteExtensionRegistration(TextGenerator writer) + { + writer.WriteLine("#region Extension registration"); + writer.WriteLine("public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {"); + writer.Indent(); + foreach (FieldDescriptor extension in Descriptor.Extensions) + { + new ExtensionGenerator(extension).GenerateExtensionRegistrationCode(writer); + } + foreach (MessageDescriptor message in Descriptor.MessageTypes) + { + new MessageGenerator(message).GenerateExtensionRegistrationCode(writer); + } + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine("#endregion"); + } + + private void WriteDescriptor(TextGenerator writer) + { + writer.WriteLine("#region Descriptor"); + + writer.WriteLine("public static pbd::FileDescriptor Descriptor {"); + writer.WriteLine(" get { return descriptor; }"); + writer.WriteLine("}"); + writer.WriteLine("private static pbd::FileDescriptor descriptor;"); + writer.WriteLine(); + writer.WriteLine("static {0}() {{", Descriptor.CSharpOptions.UmbrellaClassname); + writer.Indent(); + writer.WriteLine("byte[] descriptorData = global::System.Convert.FromBase64String("); + writer.Indent(); + writer.Indent(); + writer.WriteLine("string.Concat("); + writer.Indent(); + // TODO(jonskeet): Consider a C#-escaping format here instead of just Base64. + byte[] bytes = Descriptor.Proto.ToByteArray(); + string base64 = Convert.ToBase64String(bytes); + + while (base64.Length > 60) + { + writer.WriteLine("\"{0}\", ", base64.Substring(0, 60)); + base64 = base64.Substring(60); + } + writer.Outdent(); + writer.WriteLine("\"{0}\"));", base64); + writer.Outdent(); + writer.Outdent(); + writer.WriteLine( + "pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {"); + writer.Indent(); + writer.WriteLine("descriptor = root;"); + foreach (MessageDescriptor message in Descriptor.MessageTypes) + { + new MessageGenerator(message).GenerateStaticVariableInitializers(writer); + } + foreach (FieldDescriptor extension in Descriptor.Extensions) + { + new ExtensionGenerator(extension).GenerateStaticVariableInitializers(writer); + } + + if (UsesExtensions(Descriptor.Proto)) + { + // Must construct an ExtensionRegistry containing all possible extensions + // and return it. + writer.WriteLine("pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance();"); + writer.WriteLine("RegisterAllExtensions(registry);"); + foreach (FileDescriptor dependency in Descriptor.Dependencies) + { + writer.WriteLine("{0}.RegisterAllExtensions(registry);", + DescriptorUtil.GetFullUmbrellaClassName(dependency)); + } + writer.WriteLine("return registry;"); + } + else + { + writer.WriteLine("return null;"); + } + writer.Outdent(); + writer.WriteLine("};"); + + // ----------------------------------------------------------------- + // Invoke internalBuildGeneratedFileFrom() to build the file. + writer.WriteLine("pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,"); + writer.WriteLine(" new pbd::FileDescriptor[] {"); + foreach (FileDescriptor dependency in Descriptor.Dependencies) + { + writer.WriteLine(" {0}.Descriptor, ", DescriptorUtil.GetFullUmbrellaClassName(dependency)); + } + writer.WriteLine(" }, assigner);"); + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine("#endregion"); + writer.WriteLine(); + } + + private void WriteLiteExtensions(TextGenerator writer) + { + writer.WriteLine("#region Extensions"); + writer.WriteLine("internal static readonly object Descriptor;"); + writer.WriteLine("static {0}() {{", Descriptor.CSharpOptions.UmbrellaClassname); + writer.Indent(); + writer.WriteLine("Descriptor = null;"); + + foreach (MessageDescriptor message in Descriptor.MessageTypes) + { + new MessageGenerator(message).GenerateStaticVariableInitializers(writer); + } + foreach (FieldDescriptor extension in Descriptor.Extensions) + { + new ExtensionGenerator(extension).GenerateStaticVariableInitializers(writer); + } + writer.Outdent(); + writer.WriteLine("}"); + writer.WriteLine("#endregion"); + writer.WriteLine(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoGen/app.config b/csharp/src/ProtoGen/app.config new file mode 100644 index 00000000..89b324bf --- /dev/null +++ b/csharp/src/ProtoGen/app.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtoGen/protoc-gen-cs.csproj b/csharp/src/ProtoGen/protoc-gen-cs.csproj new file mode 100644 index 00000000..fdc88cc2 --- /dev/null +++ b/csharp/src/ProtoGen/protoc-gen-cs.csproj @@ -0,0 +1,101 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {250ADE34-82FD-4BAE-86D5-985FBE589C4B} + Exe + Properties + Google.ProtocolBuffers.ProtoGen + protoc-gen-cs + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + Google.ProtocolBuffers.ProtoGen.ProtocGenCs + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE + prompt + 4 + true + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {231391af-449c-4a39-986c-ad7f270f4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtoMunge/Program.cs b/csharp/src/ProtoMunge/Program.cs new file mode 100644 index 00000000..53dc3501 --- /dev/null +++ b/csharp/src/ProtoMunge/Program.cs @@ -0,0 +1,305 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.ProtoMunge +{ + /// + /// Utility console application which takes a message descriptor and a corresponding message, + /// and produces a new message with similar but random data. The data is the same length + /// as the original, but with random values within appropriate bands. (For instance, a compressed + /// integer in the range 0-127 will end up as another integer in the same range, to keep the length + /// the same.) + /// TODO(jonskeet): Potentially refactor to use an instance instead, making it simpler to + /// be thread-safe for external use. + /// + public sealed class Program + { + private static readonly Random rng = new Random(); + + private static int Main(string[] args) + { + if (args.Length != 3) + { + Console.Error.WriteLine("Usage: ProtoMunge "); + Console.Error.WriteLine( + "The descriptor type name is the fully-qualified message name, including assembly."); + Console.Error.WriteLine( + "(At a future date it may be possible to do this without building the .NET assembly at all.)"); + return 1; + } + IMessage defaultMessage; + try + { + defaultMessage = MessageUtil.GetDefaultMessage(args[0]); + } + catch (ArgumentException e) + { + Console.Error.WriteLine(e.Message); + return 1; + } + try + { + IBuilder builder = defaultMessage.WeakCreateBuilderForType(); + byte[] inputData = File.ReadAllBytes(args[1]); + builder.WeakMergeFrom(ByteString.CopyFrom(inputData)); + IMessage original = builder.WeakBuild(); + IMessage munged = Munge(original); + if (original.SerializedSize != munged.SerializedSize) + { + throw new Exception("Serialized sizes don't match"); + } + File.WriteAllBytes(args[2], munged.ToByteArray()); + return 0; + } + catch (Exception e) + { + Console.Error.WriteLine("Error: {0}", e.Message); + Console.Error.WriteLine(); + Console.Error.WriteLine("Detailed exception information: {0}", e); + return 1; + } + } + + /// + /// Munges a message recursively. + /// + /// A new message of the same type as the original message, + /// but munged so that all the data is desensitised. + private static IMessage Munge(IMessage message) + { + IBuilder builder = message.WeakCreateBuilderForType(); + foreach (var pair in message.AllFields) + { + if (pair.Key.IsRepeated) + { + foreach (object singleValue in (IEnumerable) pair.Value) + { + builder.WeakAddRepeatedField(pair.Key, CheckedMungeValue(pair.Key, singleValue)); + } + } + else + { + builder[pair.Key] = CheckedMungeValue(pair.Key, pair.Value); + } + } + IMessage munged = builder.WeakBuild(); + if (message.SerializedSize != munged.SerializedSize) + { + Console.WriteLine("Sub message sizes: {0}/{1}", message.SerializedSize, munged.SerializedSize); + } + return munged; + } + + /// + /// Munges a single value and checks that the length ends up the same as it was before. + /// + private static object CheckedMungeValue(FieldDescriptor fieldDescriptor, object value) + { + int currentSize = CodedOutputStream.ComputeFieldSize(fieldDescriptor.FieldType, fieldDescriptor.FieldNumber, + value); + object mungedValue = MungeValue(fieldDescriptor, value); + int mungedSize = CodedOutputStream.ComputeFieldSize(fieldDescriptor.FieldType, fieldDescriptor.FieldNumber, + mungedValue); + // Exceptions log more easily than assertions + if (currentSize != mungedSize) + { + throw new Exception("Munged value had wrong size. Field type: " + fieldDescriptor.FieldType + + "; old value: " + value + "; new value: " + mungedValue); + } + return mungedValue; + } + + /// + /// Munges a single value of the specified field descriptor. (i.e. if the field is + /// actually a repeated int, this method receives a single int value to munge, and + /// is called multiple times). + /// + private static object MungeValue(FieldDescriptor fieldDescriptor, object value) + { + switch (fieldDescriptor.FieldType) + { + case FieldType.SInt64: + case FieldType.Int64: + return (long) MungeVarint64((ulong) (long) value); + case FieldType.UInt64: + return MungeVarint64((ulong) value); + case FieldType.SInt32: + return (int) MungeVarint32((uint) (int) value); + case FieldType.Int32: + return MungeInt32((int) value); + case FieldType.UInt32: + return MungeVarint32((uint) value); + case FieldType.Double: + return rng.NextDouble(); + case FieldType.Float: + return (float) rng.NextDouble(); + case FieldType.Fixed64: + { + byte[] data = new byte[8]; + rng.NextBytes(data); + return BitConverter.ToUInt64(data, 0); + } + case FieldType.Fixed32: + { + byte[] data = new byte[4]; + rng.NextBytes(data); + return BitConverter.ToUInt32(data, 0); + } + case FieldType.Bool: + return rng.Next(2) == 1; + case FieldType.String: + return MungeString((string) value); + case FieldType.Group: + case FieldType.Message: + return Munge((IMessage) value); + case FieldType.Bytes: + return MungeByteString((ByteString) value); + case FieldType.SFixed64: + { + byte[] data = new byte[8]; + rng.NextBytes(data); + return BitConverter.ToInt64(data, 0); + } + case FieldType.SFixed32: + { + byte[] data = new byte[4]; + rng.NextBytes(data); + return BitConverter.ToInt32(data, 0); + } + case FieldType.Enum: + return MungeEnum(fieldDescriptor, (EnumValueDescriptor) value); + default: + // TODO(jonskeet): Different exception? + throw new ArgumentException("Invalid field descriptor"); + } + } + + private static object MungeString(string original) + { + foreach (char c in original) + { + if (c > 127) + { + throw new ArgumentException("Can't handle non-ascii yet"); + } + } + char[] chars = new char[original.Length]; + // Convert to pure ASCII - no control characters. + for (int i = 0; i < chars.Length; i++) + { + chars[i] = (char) rng.Next(32, 127); + } + return new string(chars); + } + + /// + /// Int32 fields are slightly strange - we need to keep the sign the same way it is: + /// negative numbers can munge to any other negative number (it'll always take + /// 10 bytes) but positive numbers have to stay positive, so we can't use the + /// full range of 32 bits. + /// + private static int MungeInt32(int value) + { + if (value < 0) + { + return rng.Next(int.MinValue, 0); + } + int length = CodedOutputStream.ComputeRawVarint32Size((uint) value); + uint min = length == 1 ? 0 : 1U << ((length - 1)*7); + uint max = length == 5 ? int.MaxValue : (1U << (length*7)) - 1; + return (int) NextRandomUInt64(min, max); + } + + private static uint MungeVarint32(uint original) + { + int length = CodedOutputStream.ComputeRawVarint32Size(original); + uint min = length == 1 ? 0 : 1U << ((length - 1)*7); + uint max = length == 5 ? uint.MaxValue : (1U << (length*7)) - 1; + return (uint) NextRandomUInt64(min, max); + } + + private static ulong MungeVarint64(ulong original) + { + int length = CodedOutputStream.ComputeRawVarint64Size(original); + ulong min = length == 1 ? 0 : 1UL << ((length - 1)*7); + ulong max = length == 10 ? ulong.MaxValue : (1UL << (length*7)) - 1; + return NextRandomUInt64(min, max); + } + + /// + /// Returns a random number in the range [min, max] (both inclusive). + /// + private static ulong NextRandomUInt64(ulong min, ulong max) + { + if (min > max) + { + throw new ArgumentException("min must be <= max; min=" + min + "; max = " + max); + } + ulong range = max - min; + // This isn't actually terribly good at very large ranges - but it doesn't really matter for the sake + // of this program. + return min + (ulong) (range*rng.NextDouble()); + } + + private static object MungeEnum(FieldDescriptor fieldDescriptor, EnumValueDescriptor original) + { + // Find all the values which get encoded to the same size as the current value, and pick one at random + int originalSize = CodedOutputStream.ComputeRawVarint32Size((uint) original.Number); + List sameSizeValues = new List(); + foreach (EnumValueDescriptor candidate in fieldDescriptor.EnumType.Values) + { + if (CodedOutputStream.ComputeRawVarint32Size((uint) candidate.Number) == originalSize) + { + sameSizeValues.Add(candidate); + } + } + return sameSizeValues[rng.Next(sameSizeValues.Count)]; + } + + private static object MungeByteString(ByteString byteString) + { + byte[] data = new byte[byteString.Length]; + rng.NextBytes(data); + return ByteString.CopyFrom(data); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtoMunge/Properties/AssemblyInfo.cs b/csharp/src/ProtoMunge/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..b78271b9 --- /dev/null +++ b/csharp/src/ProtoMunge/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("ProtoMunge")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtoMunge")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.4.1.555")] + +[assembly: AssemblyVersion("2.4.1.555")] +[assembly: AssemblyFileVersion("2.4.1.555")] \ No newline at end of file diff --git a/csharp/src/ProtoMunge/ProtoMunge.csproj b/csharp/src/ProtoMunge/ProtoMunge.csproj new file mode 100644 index 00000000..dae1a9a1 --- /dev/null +++ b/csharp/src/ProtoMunge/ProtoMunge.csproj @@ -0,0 +1,65 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {8F09AF72-3327-4FA7-BC09-070B80221AB9} + Exe + Properties + Google.ProtocolBuffers.ProtoMunge + ProtoMunge + v3.5 + 512 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE + prompt + 4 + true + true + Off + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/AbstractReader.cs b/csharp/src/ProtocolBuffers.Serialization/AbstractReader.cs new file mode 100644 index 00000000..e198d0b0 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/AbstractReader.cs @@ -0,0 +1,688 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using Google.ProtocolBuffers.Descriptors; + +//Disable CS3011: only CLS-compliant members can be abstract +#pragma warning disable 3011 + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Provides a base-class that provides some basic functionality for handling type dispatching + /// + public abstract class AbstractReader : ICodedInputStream + { + private const int DefaultMaxDepth = 64; + private int _depth; + + /// Constructs a new reader + protected AbstractReader() { MaxDepth = DefaultMaxDepth; } + + /// Gets or sets the maximum recursion depth allowed + public int MaxDepth { get; set; } + + /// + /// Merges the contents of stream into the provided message builder + /// + public TBuilder Merge(TBuilder builder) where TBuilder : IBuilderLite + { + return Merge(builder, ExtensionRegistry.Empty); + } + + /// + /// Merges the contents of stream into the provided message builder + /// + public abstract TBuilder Merge(TBuilder builder, ExtensionRegistry registry) + where TBuilder : IBuilderLite; + + /// + /// Peeks at the next field in the input stream and returns what information is available. + /// + /// + /// This may be called multiple times without actually reading the field. Only after the field + /// is either read, or skipped, should PeekNext return a different value. + /// + protected abstract bool PeekNext(out string field); + + /// + /// Causes the reader to skip past this field + /// + protected abstract void Skip(); + + /// + /// Returns true if it was able to read a Boolean from the input + /// + protected abstract bool Read(ref bool value); + + /// + /// Returns true if it was able to read a Int32 from the input + /// + protected abstract bool Read(ref int value); + + /// + /// Returns true if it was able to read a UInt32 from the input + /// + [CLSCompliant(false)] + protected abstract bool Read(ref uint value); + + /// + /// Returns true if it was able to read a Int64 from the input + /// + protected abstract bool Read(ref long value); + + /// + /// Returns true if it was able to read a UInt64 from the input + /// + [CLSCompliant(false)] + protected abstract bool Read(ref ulong value); + + /// + /// Returns true if it was able to read a Single from the input + /// + protected abstract bool Read(ref float value); + + /// + /// Returns true if it was able to read a Double from the input + /// + protected abstract bool Read(ref double value); + + /// + /// Returns true if it was able to read a String from the input + /// + protected abstract bool Read(ref string value); + + /// + /// Returns true if it was able to read a ByteString from the input + /// + protected abstract bool Read(ref ByteString value); + + /// + /// returns true if it was able to read a single value into the value reference. The value + /// stored may be of type System.String, System.Int32, or an IEnumLite from the IEnumLiteMap. + /// + protected abstract bool ReadEnum(ref object value); + + /// + /// Merges the input stream into the provided IBuilderLite + /// + protected abstract bool ReadMessage(IBuilderLite builder, ExtensionRegistry registry); + + /// + /// Reads the root-message preamble specific to this formatter + /// + public abstract void ReadMessageStart(); + + /// + /// Reads the root-message close specific to this formatter + /// + public abstract void ReadMessageEnd(); + + /// + /// Merges the input stream into the provided IBuilderLite + /// + public virtual bool ReadGroup(IBuilderLite value, ExtensionRegistry registry) + { + return ReadMessage(value, registry); + } + + /// + /// Cursors through the array elements and stops at the end of the array + /// + protected virtual IEnumerable ForeachArrayItem(string field) + { + string next = field; + while (true) + { + yield return next; + + if (!PeekNext(out next) || next != field) + { + break; + } + } + } + + /// + /// Reads an array of T messages + /// + public virtual bool ReadMessageArray(string field, ICollection items, IMessageLite messageType, + ExtensionRegistry registry) + { + bool success = false; + foreach (string next in ForeachArrayItem(field)) + { + IBuilderLite builder = messageType.WeakCreateBuilderForType(); + if (ReadMessage(builder, registry)) + { + items.Add((T) builder.WeakBuild()); + success |= true; + } + } + return success; + } + + /// + /// Reads an array of T messages as a proto-buffer group + /// + public virtual bool ReadGroupArray(string field, ICollection items, IMessageLite messageType, + ExtensionRegistry registry) + { + bool success = false; + foreach (string next in ForeachArrayItem(field)) + { + IBuilderLite builder = messageType.WeakCreateBuilderForType(); + if (ReadGroup(builder, registry)) + { + items.Add((T) builder.WeakBuild()); + success |= true; + } + } + return success; + } + + /// + /// Reads an array of System.Enum type T and adds them to the collection + /// + public virtual bool ReadEnumArray(string field, ICollection items) + { + bool success = false; + foreach (string next in ForeachArrayItem(field)) + { + object temp = null; + if (ReadEnum(ref temp)) + { + items.Add(temp); + success |= true; + } + } + return success; + } + + /// + /// Reads an array of T, where T is a primitive type defined by FieldType + /// + public virtual bool ReadArray(FieldType type, string field, ICollection items) + { + bool success = false; + foreach (string next in ForeachArrayItem(field)) + { + object temp = null; + if (ReadField(type, ref temp)) + { + items.Add((T) temp); + success |= true; + } + } + return success; + } + + /// + /// returns true if it was able to read a single primitive value of FieldType into the value reference + /// + public virtual bool ReadField(FieldType type, ref object value) + { + switch (type) + { + case FieldType.Bool: + { + bool temp = false; + if (Read(ref temp)) + { + value = temp; + } + else + { + return false; + } + break; + } + case FieldType.Int64: + case FieldType.SInt64: + case FieldType.SFixed64: + { + long temp = 0; + if (Read(ref temp)) + { + value = temp; + } + else + { + return false; + } + break; + } + case FieldType.UInt64: + case FieldType.Fixed64: + { + ulong temp = 0; + if (Read(ref temp)) + { + value = temp; + } + else + { + return false; + } + break; + } + case FieldType.Int32: + case FieldType.SInt32: + case FieldType.SFixed32: + { + int temp = 0; + if (Read(ref temp)) + { + value = temp; + } + else + { + return false; + } + break; + } + case FieldType.UInt32: + case FieldType.Fixed32: + { + uint temp = 0; + if (Read(ref temp)) + { + value = temp; + } + else + { + return false; + } + break; + } + case FieldType.Float: + { + float temp = float.NaN; + if (Read(ref temp)) + { + value = temp; + } + else + { + return false; + } + break; + } + case FieldType.Double: + { + double temp = float.NaN; + if (Read(ref temp)) + { + value = temp; + } + else + { + return false; + } + break; + } + case FieldType.String: + { + string temp = null; + if (Read(ref temp)) + { + value = temp; + } + else + { + return false; + } + break; + } + case FieldType.Bytes: + { + ByteString temp = null; + if (Read(ref temp)) + { + value = temp; + } + else + { + return false; + } + break; + } + default: + throw InvalidProtocolBufferException.InvalidTag(); + } + return true; + } + + #region ICodedInputStream Members + + bool ICodedInputStream.ReadTag(out uint fieldTag, out string fieldName) + { + fieldTag = 0; + if (PeekNext(out fieldName)) + { + return true; + } + return false; + } + + bool ICodedInputStream.ReadDouble(ref double value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadFloat(ref float value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadUInt64(ref ulong value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadInt64(ref long value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadInt32(ref int value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadFixed64(ref ulong value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadFixed32(ref uint value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadBool(ref bool value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadString(ref string value) + { + return Read(ref value); + } + + void ICodedInputStream.ReadGroup(int fieldNumber, IBuilderLite builder, ExtensionRegistry extensionRegistry) + { + if (_depth++ > MaxDepth) + { + throw new RecursionLimitExceededException(); + } + ReadGroup(builder, extensionRegistry); + _depth--; + } + + void ICodedInputStream.ReadUnknownGroup(int fieldNumber, IBuilderLite builder) + { + throw new NotSupportedException(); + } + + void ICodedInputStream.ReadMessage(IBuilderLite builder, ExtensionRegistry extensionRegistry) + { + if (_depth++ > MaxDepth) + { + throw new RecursionLimitExceededException(); + } + ReadMessage(builder, extensionRegistry); + _depth--; + } + + bool ICodedInputStream.ReadBytes(ref ByteString value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadUInt32(ref uint value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadEnum(ref IEnumLite value, out object unknown, IEnumLiteMap mapping) + { + value = null; + unknown = null; + if (ReadEnum(ref unknown)) + { + if (unknown is int) + { + value = mapping.FindValueByNumber((int) unknown); + } + else if (unknown is string) + { + value = mapping.FindValueByName((string) unknown); + } + return value != null; + } + return false; + } + + bool ICodedInputStream.ReadEnum(ref T value, out object rawValue) + { + rawValue = null; + if (ReadEnum(ref rawValue)) + { + if (!EnumParser.TryConvert(rawValue, ref value)) + { + value = default(T); + return false; + } + return true; + } + return false; + } + + bool ICodedInputStream.ReadSFixed32(ref int value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadSFixed64(ref long value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadSInt32(ref int value) + { + return Read(ref value); + } + + bool ICodedInputStream.ReadSInt64(ref long value) + { + return Read(ref value); + } + + void ICodedInputStream.ReadPrimitiveArray(FieldType fieldType, uint fieldTag, string fieldName, + ICollection list) + { + ReadArray(fieldType, fieldName, list); + } + + void ICodedInputStream.ReadEnumArray(uint fieldTag, string fieldName, ICollection list, + out ICollection unknown, IEnumLiteMap mapping) + { + unknown = null; + List array = new List(); + if (ReadEnumArray(fieldName, array)) + { + foreach (object rawValue in array) + { + IEnumLite item = null; + if (rawValue is int) + { + item = mapping.FindValueByNumber((int) rawValue); + } + else if (rawValue is string) + { + item = mapping.FindValueByName((string) rawValue); + } + + if (item != null) + { + list.Add(item); + } + else + { + if (unknown == null) + { + unknown = new List(); + } + unknown.Add(rawValue); + } + } + } + } + + void ICodedInputStream.ReadEnumArray(uint fieldTag, string fieldName, ICollection list, + out ICollection unknown) + { + unknown = null; + List array = new List(); + if (ReadEnumArray(fieldName, array)) + { + foreach (object rawValue in array) + { + T val = default(T); + if (EnumParser.TryConvert(rawValue, ref val)) + { + list.Add(val); + } + else + { + if (unknown == null) + { + unknown = new List(); + } + unknown.Add(rawValue); + } + } + } + } + + void ICodedInputStream.ReadMessageArray(uint fieldTag, string fieldName, ICollection list, T messageType, + ExtensionRegistry registry) + { + if (_depth++ > MaxDepth) + { + throw new RecursionLimitExceededException(); + } + ReadMessageArray(fieldName, list, messageType, registry); + _depth--; + } + + void ICodedInputStream.ReadGroupArray(uint fieldTag, string fieldName, ICollection list, T messageType, + ExtensionRegistry registry) + { + if (_depth++ > MaxDepth) + { + throw new RecursionLimitExceededException(); + } + ReadGroupArray(fieldName, list, messageType, registry); + _depth--; + } + + bool ICodedInputStream.ReadPrimitiveField(FieldType fieldType, ref object value) + { + return ReadField(fieldType, ref value); + } + + bool ICodedInputStream.IsAtEnd + { + get + { + string next; + return PeekNext(out next) == false; + } + } + + bool ICodedInputStream.SkipField() + { + Skip(); + return true; + } + + void ICodedInputStream.ReadStringArray(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.String, fieldName, list); + } + + void ICodedInputStream.ReadBytesArray(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.Bytes, fieldName, list); + } + + void ICodedInputStream.ReadBoolArray(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.Bool, fieldName, list); + } + + void ICodedInputStream.ReadInt32Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.Int32, fieldName, list); + } + + void ICodedInputStream.ReadSInt32Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.SInt32, fieldName, list); + } + + void ICodedInputStream.ReadUInt32Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.UInt32, fieldName, list); + } + + void ICodedInputStream.ReadFixed32Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.Fixed32, fieldName, list); + } + + void ICodedInputStream.ReadSFixed32Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.SFixed32, fieldName, list); + } + + void ICodedInputStream.ReadInt64Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.Int64, fieldName, list); + } + + void ICodedInputStream.ReadSInt64Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.SInt64, fieldName, list); + } + + void ICodedInputStream.ReadUInt64Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.UInt64, fieldName, list); + } + + void ICodedInputStream.ReadFixed64Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.Fixed64, fieldName, list); + } + + void ICodedInputStream.ReadSFixed64Array(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.SFixed64, fieldName, list); + } + + void ICodedInputStream.ReadDoubleArray(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.Double, fieldName, list); + } + + void ICodedInputStream.ReadFloatArray(uint fieldTag, string fieldName, ICollection list) + { + ReadArray(FieldType.Float, fieldName, list); + } + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/AbstractTextReader.cs b/csharp/src/ProtocolBuffers.Serialization/AbstractTextReader.cs new file mode 100644 index 00000000..b40a560a --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/AbstractTextReader.cs @@ -0,0 +1,177 @@ +using System; +using System.Globalization; +using System.Xml; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Provides a base class for text-parsing readers + /// + public abstract class AbstractTextReader : AbstractReader + { + /// Constructs a new reader + protected AbstractTextReader() { } + + /// + /// Reads a typed field as a string + /// + protected abstract bool ReadAsText(ref string textValue, Type type); + + /// + /// Returns true if it was able to read a String from the input + /// + protected override bool Read(ref string value) + { + string text = null; + if (ReadAsText(ref text, typeof(string))) + { + value = text; + return true; + } + return false; + } + + /// + /// Returns true if it was able to read a Boolean from the input + /// + protected override bool Read(ref bool value) + { + string text = null; + if (ReadAsText(ref text, typeof(bool))) + { + value = XmlConvert.ToBoolean(text); + return true; + } + return false; + } + + /// + /// Returns true if it was able to read a Int32 from the input + /// + protected override bool Read(ref int value) + { + string text = null; + if (ReadAsText(ref text, typeof(int))) + { + value = XmlConvert.ToInt32(text); + return true; + } + return false; + } + + /// + /// Returns true if it was able to read a UInt32 from the input + /// + [CLSCompliant(false)] + protected override bool Read(ref uint value) + { + string text = null; + if (ReadAsText(ref text, typeof(uint))) + { + value = XmlConvert.ToUInt32(text); + return true; + } + return false; + } + + /// + /// Returns true if it was able to read a Int64 from the input + /// + protected override bool Read(ref long value) + { + string text = null; + if (ReadAsText(ref text, typeof(long))) + { + value = XmlConvert.ToInt64(text); + return true; + } + return false; + } + + /// + /// Returns true if it was able to read a UInt64 from the input + /// + [CLSCompliant(false)] + protected override bool Read(ref ulong value) + { + string text = null; + if (ReadAsText(ref text, typeof(ulong))) + { + value = XmlConvert.ToUInt64(text); + return true; + } + return false; + } + + /// + /// Returns true if it was able to read a Single from the input + /// + protected override bool Read(ref float value) + { + string text = null; + if (ReadAsText(ref text, typeof(float))) + { + value = XmlConvert.ToSingle(text); + return true; + } + return false; + } + + /// + /// Returns true if it was able to read a Double from the input + /// + protected override bool Read(ref double value) + { + string text = null; + if (ReadAsText(ref text, typeof(double))) + { + value = XmlConvert.ToDouble(text); + return true; + } + return false; + } + + /// + /// Provides decoding of bytes read from the input stream + /// + protected virtual ByteString DecodeBytes(string bytes) + { + return ByteString.FromBase64(bytes); + } + + /// + /// Returns true if it was able to read a ByteString from the input + /// + protected override bool Read(ref ByteString value) + { + string text = null; + if (ReadAsText(ref text, typeof(ByteString))) + { + value = DecodeBytes(text); + return true; + } + return false; + } + + /// + /// returns true if it was able to read a single value into the value reference. The value + /// stored may be of type System.String, System.Int32, or an IEnumLite from the IEnumLiteMap. + /// + protected override bool ReadEnum(ref object value) + { + string text = null; + if (ReadAsText(ref text, typeof(Enum))) + { + int number; + if (FrameworkPortability.TryParseInt32(text, NumberStyles.Integer, FrameworkPortability.InvariantCulture, out number)) + { + value = number; + return true; + } + value = text; + return true; + } + return false; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/AbstractTextWriter.cs b/csharp/src/ProtocolBuffers.Serialization/AbstractTextWriter.cs new file mode 100644 index 00000000..2c778dfc --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/AbstractTextWriter.cs @@ -0,0 +1,106 @@ +using System; +using System.Xml; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Provides a base class for text writers + /// + public abstract class AbstractTextWriter : AbstractWriter + { + /// + /// Encodes raw bytes to be written to the stream + /// + protected virtual string EncodeBytes(ByteString bytes) + { + return bytes.ToBase64(); + } + + /// + /// Writes a typed field as a text value + /// + protected abstract void WriteAsText(string field, string textValue, object typedValue); + + /// + /// Writes a String value + /// + protected override void Write(string field, string value) + { + WriteAsText(field, value, value); + } + + /// + /// Writes a Boolean value + /// + protected override void Write(string field, bool value) + { + WriteAsText(field, XmlConvert.ToString(value), value); + } + + /// + /// Writes a Int32 value + /// + protected override void Write(string field, int value) + { + WriteAsText(field, XmlConvert.ToString(value), value); + } + + /// + /// Writes a UInt32 value + /// + [CLSCompliant(false)] + protected override void Write(string field, uint value) + { + WriteAsText(field, XmlConvert.ToString(value), value); + } + + /// + /// Writes a Int64 value + /// + protected override void Write(string field, long value) + { + WriteAsText(field, XmlConvert.ToString(value), value); + } + + /// + /// Writes a UInt64 value + /// + [CLSCompliant(false)] + protected override void Write(string field, ulong value) + { + WriteAsText(field, XmlConvert.ToString(value), value); + } + + /// + /// Writes a Single value + /// + protected override void Write(string field, float value) + { + WriteAsText(field, XmlConvert.ToString(value), value); + } + + /// + /// Writes a Double value + /// + protected override void Write(string field, double value) + { + WriteAsText(field, XmlConvert.ToString(value), value); + } + + /// + /// Writes a set of bytes + /// + protected override void Write(string field, ByteString value) + { + WriteAsText(field, EncodeBytes(value), value); + } + + /// + /// Writes a System.Enum by the numeric and textual value + /// + protected override void WriteEnum(string field, int number, string name) + { + WriteAsText(field, name, number); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/AbstractWriter.cs b/csharp/src/ProtocolBuffers.Serialization/AbstractWriter.cs new file mode 100644 index 00000000..2dc6b887 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/AbstractWriter.cs @@ -0,0 +1,507 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using Google.ProtocolBuffers.Descriptors; + +//Disable CS3011: only CLS-compliant members can be abstract +#pragma warning disable 3011 + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Provides a base class for writers that performs some basic type dispatching + /// + public abstract class AbstractWriter : ICodedOutputStream + { + /// + /// Completes any pending write operations + /// + public virtual void Flush() + { + } + + /// + /// Writes the message to the the formatted stream. + /// + public abstract void WriteMessage(IMessageLite message); + + /// + /// Used to write any nessary root-message preamble. After this call you can call + /// IMessageLite.MergeTo(...) and complete the message with a call to WriteMessageEnd(). + /// These three calls are identical to just calling WriteMessage(message); + /// + /// + /// AbstractWriter writer; + /// writer.WriteMessageStart(); + /// message.WriteTo(writer); + /// writer.WriteMessageEnd(); + /// // ... or, but not both ... + /// writer.WriteMessage(message); + /// + public abstract void WriteMessageStart(); + + /// + /// Used to complete a root-message previously started with a call to WriteMessageStart() + /// + public abstract void WriteMessageEnd(); + + /// + /// Writes a Boolean value + /// + protected abstract void Write(string field, Boolean value); + + /// + /// Writes a Int32 value + /// + protected abstract void Write(string field, Int32 value); + + /// + /// Writes a UInt32 value + /// + [CLSCompliant(false)] + protected abstract void Write(string field, UInt32 value); + + /// + /// Writes a Int64 value + /// + protected abstract void Write(string field, Int64 value); + + /// + /// Writes a UInt64 value + /// + [CLSCompliant(false)] + protected abstract void Write(string field, UInt64 value); + + /// + /// Writes a Single value + /// + protected abstract void Write(string field, Single value); + + /// + /// Writes a Double value + /// + protected abstract void Write(string field, Double value); + + /// + /// Writes a String value + /// + protected abstract void Write(string field, String value); + + /// + /// Writes a set of bytes + /// + protected abstract void Write(string field, ByteString value); + + /// + /// Writes a message or group as a field + /// + protected abstract void WriteMessageOrGroup(string field, IMessageLite message); + + /// + /// Writes a System.Enum by the numeric and textual value + /// + protected abstract void WriteEnum(string field, int number, string name); + + /// + /// Writes a field of the type determined by field.FieldType + /// + protected virtual void WriteField(FieldType fieldType, string field, object value) + { + switch (fieldType) + { + case FieldType.Bool: + Write(field, (bool) value); + break; + case FieldType.Int64: + case FieldType.SInt64: + case FieldType.SFixed64: + Write(field, (long) value); + break; + case FieldType.UInt64: + case FieldType.Fixed64: + Write(field, (ulong) value); + break; + case FieldType.Int32: + case FieldType.SInt32: + case FieldType.SFixed32: + Write(field, (int) value); + break; + case FieldType.UInt32: + case FieldType.Fixed32: + Write(field, (uint) value); + break; + case FieldType.Float: + Write(field, (float) value); + break; + case FieldType.Double: + Write(field, (double) value); + break; + case FieldType.String: + Write(field, (string) value); + break; + case FieldType.Bytes: + Write(field, (ByteString) value); + break; + case FieldType.Group: + WriteMessageOrGroup(field, (IMessageLite) value); + break; + case FieldType.Message: + WriteMessageOrGroup(field, (IMessageLite) value); + break; + case FieldType.Enum: + { + if (value is IEnumLite) + { + WriteEnum(field, ((IEnumLite) value).Number, ((IEnumLite) value).Name); + } + else if (value is IConvertible) + { + WriteEnum(field, ((IConvertible)value).ToInt32(FrameworkPortability.InvariantCulture), + ((IConvertible)value).ToString(FrameworkPortability.InvariantCulture)); + } + else + { + throw new ArgumentException("Expected an Enum type for field " + field); + } + break; + } + default: + throw InvalidProtocolBufferException.InvalidTag(); + } + } + + /// + /// Writes an array of field values + /// + protected virtual void WriteArray(FieldType fieldType, string field, IEnumerable items) + { + foreach (object obj in items) + { + WriteField(fieldType, field, obj); + } + } + + /// + /// Writes a numeric unknown field of wire type: Fixed32, Fixed64, or Variant + /// + [CLSCompliant(false)] + protected virtual void WriteUnknown(WireFormat.WireType wireType, int fieldNumber, ulong value) + { + } + + /// + /// Writes an unknown field, Expect WireType of GroupStart or LengthPrefix + /// + [CLSCompliant(false)] + protected virtual void WriteUnknown(WireFormat.WireType wireType, int fieldNumber, ByteString value) + { + } + + #region ICodedOutputStream Members + + void ICodedOutputStream.WriteUnknownGroup(int fieldNumber, IMessageLite value) + { + } + + void ICodedOutputStream.WriteUnknownBytes(int fieldNumber, ByteString value) + { + } + + void ICodedOutputStream.WriteUnknownField(int fieldNumber, WireFormat.WireType type, ulong value) + { + } + + void ICodedOutputStream.WriteMessageSetExtension(int fieldNumber, string fieldName, IMessageLite value) + { + } + + void ICodedOutputStream.WriteMessageSetExtension(int fieldNumber, string fieldName, ByteString value) + { + } + + void ICodedOutputStream.WriteField(FieldType fieldType, int fieldNumber, string fieldName, object value) + { + WriteField(fieldType, fieldName, value); + } + + void ICodedOutputStream.WriteDouble(int fieldNumber, string fieldName, double value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteFloat(int fieldNumber, string fieldName, float value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteUInt64(int fieldNumber, string fieldName, ulong value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteInt64(int fieldNumber, string fieldName, long value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteInt32(int fieldNumber, string fieldName, int value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteFixed64(int fieldNumber, string fieldName, ulong value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteFixed32(int fieldNumber, string fieldName, uint value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteBool(int fieldNumber, string fieldName, bool value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteString(int fieldNumber, string fieldName, string value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteGroup(int fieldNumber, string fieldName, IMessageLite value) + { + WriteMessageOrGroup(fieldName, value); + } + + void ICodedOutputStream.WriteMessage(int fieldNumber, string fieldName, IMessageLite value) + { + WriteMessageOrGroup(fieldName, value); + } + + void ICodedOutputStream.WriteBytes(int fieldNumber, string fieldName, ByteString value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteUInt32(int fieldNumber, string fieldName, uint value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteEnum(int fieldNumber, string fieldName, int value, object rawValue) + { + WriteEnum(fieldName, value, rawValue.ToString()); + } + + void ICodedOutputStream.WriteSFixed32(int fieldNumber, string fieldName, int value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteSFixed64(int fieldNumber, string fieldName, long value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteSInt32(int fieldNumber, string fieldName, int value) + { + Write(fieldName, value); + } + + void ICodedOutputStream.WriteSInt64(int fieldNumber, string fieldName, long value) + { + Write(fieldName, value); + } + + + void ICodedOutputStream.WriteArray(FieldType fieldType, int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(fieldType, fieldName, list); + } + + void ICodedOutputStream.WriteGroupArray(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Group, fieldName, list); + } + + void ICodedOutputStream.WriteMessageArray(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Message, fieldName, list); + } + + void ICodedOutputStream.WriteStringArray(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.String, fieldName, list); + } + + void ICodedOutputStream.WriteBytesArray(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Bytes, fieldName, list); + } + + void ICodedOutputStream.WriteBoolArray(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Bool, fieldName, list); + } + + void ICodedOutputStream.WriteInt32Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Int32, fieldName, list); + } + + void ICodedOutputStream.WriteSInt32Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.SInt32, fieldName, list); + } + + void ICodedOutputStream.WriteUInt32Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.UInt32, fieldName, list); + } + + void ICodedOutputStream.WriteFixed32Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Fixed32, fieldName, list); + } + + void ICodedOutputStream.WriteSFixed32Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.SFixed32, fieldName, list); + } + + void ICodedOutputStream.WriteInt64Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Int64, fieldName, list); + } + + void ICodedOutputStream.WriteSInt64Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.SInt64, fieldName, list); + } + + void ICodedOutputStream.WriteUInt64Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.UInt64, fieldName, list); + } + + void ICodedOutputStream.WriteFixed64Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Fixed64, fieldName, list); + } + + void ICodedOutputStream.WriteSFixed64Array(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.SFixed64, fieldName, list); + } + + void ICodedOutputStream.WriteDoubleArray(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Double, fieldName, list); + } + + void ICodedOutputStream.WriteFloatArray(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Float, fieldName, list); + } + + void ICodedOutputStream.WriteEnumArray(int fieldNumber, string fieldName, IEnumerable list) + { + WriteArray(FieldType.Enum, fieldName, list); + } + + void ICodedOutputStream.WritePackedArray(FieldType fieldType, int fieldNumber, string fieldName, + IEnumerable list) + { + WriteArray(fieldType, fieldName, list); + } + + + void ICodedOutputStream.WritePackedBoolArray(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.Bool, fieldName, list); + } + + void ICodedOutputStream.WritePackedInt32Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.Int32, fieldName, list); + } + + void ICodedOutputStream.WritePackedSInt32Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.SInt32, fieldName, list); + } + + void ICodedOutputStream.WritePackedUInt32Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.UInt32, fieldName, list); + } + + void ICodedOutputStream.WritePackedFixed32Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.Fixed32, fieldName, list); + } + + void ICodedOutputStream.WritePackedSFixed32Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.SFixed32, fieldName, list); + } + + void ICodedOutputStream.WritePackedInt64Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.Int64, fieldName, list); + } + + void ICodedOutputStream.WritePackedSInt64Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.SInt64, fieldName, list); + } + + void ICodedOutputStream.WritePackedUInt64Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.UInt64, fieldName, list); + } + + void ICodedOutputStream.WritePackedFixed64Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.Fixed64, fieldName, list); + } + + void ICodedOutputStream.WritePackedSFixed64Array(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.SFixed64, fieldName, list); + } + + void ICodedOutputStream.WritePackedDoubleArray(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.Double, fieldName, list); + } + + void ICodedOutputStream.WritePackedFloatArray(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.Float, fieldName, list); + } + + void ICodedOutputStream.WritePackedEnumArray(int fieldNumber, string fieldName, int computedSize, + IEnumerable list) + { + WriteArray(FieldType.Enum, fieldName, list); + } + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/DictionaryReader.cs b/csharp/src/ProtocolBuffers.Serialization/DictionaryReader.cs new file mode 100644 index 00000000..c460523c --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/DictionaryReader.cs @@ -0,0 +1,267 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Allows reading messages from a name/value dictionary + /// + public class DictionaryReader : AbstractReader + { + private readonly IEnumerator> _input; + private bool _ready; + + /// + /// Creates a dictionary reader from an enumeration of KeyValuePair data, like an IDictionary + /// + public DictionaryReader(IEnumerable> input) + { + _input = input.GetEnumerator(); + _ready = _input.MoveNext(); + } + + /// + /// No-op + /// + public override void ReadMessageStart() + { } + + /// + /// No-op + /// + public override void ReadMessageEnd() + { } + + /// + /// Merges the contents of stream into the provided message builder + /// + public override TBuilder Merge(TBuilder builder, ExtensionRegistry registry) + { + builder.WeakMergeFrom(this, registry); + return builder; + } + + /// + /// Peeks at the next field in the input stream and returns what information is available. + /// + /// + /// This may be called multiple times without actually reading the field. Only after the field + /// is either read, or skipped, should PeekNext return a different value. + /// + protected override bool PeekNext(out string field) + { + field = _ready ? _input.Current.Key : null; + return _ready; + } + + /// + /// Causes the reader to skip past this field + /// + protected override void Skip() + { + _ready = _input.MoveNext(); + } + + private bool GetValue(ref T value) + { + if (!_ready) + { + return false; + } + + object obj = _input.Current.Value; + if (obj is T) + { + value = (T) obj; + } + else + { + try + { + if (obj is IConvertible) + { + value = (T)Convert.ChangeType(obj, typeof(T), FrameworkPortability.InvariantCulture); + } + else + { + value = (T) obj; + } + } + catch + { + _ready = _input.MoveNext(); + return false; + } + } + _ready = _input.MoveNext(); + return true; + } + + /// + /// Returns true if it was able to read a Boolean from the input + /// + protected override bool Read(ref bool value) + { + return GetValue(ref value); + } + + /// + /// Returns true if it was able to read a Int32 from the input + /// + protected override bool Read(ref int value) + { + return GetValue(ref value); + } + + /// + /// Returns true if it was able to read a UInt32 from the input + /// + [CLSCompliant(false)] + protected override bool Read(ref uint value) + { + return GetValue(ref value); + } + + /// + /// Returns true if it was able to read a Int64 from the input + /// + protected override bool Read(ref long value) + { + return GetValue(ref value); + } + + /// + /// Returns true if it was able to read a UInt64 from the input + /// + [CLSCompliant(false)] + protected override bool Read(ref ulong value) + { + return GetValue(ref value); + } + + /// + /// Returns true if it was able to read a Single from the input + /// + protected override bool Read(ref float value) + { + return GetValue(ref value); + } + + /// + /// Returns true if it was able to read a Double from the input + /// + protected override bool Read(ref double value) + { + return GetValue(ref value); + } + + /// + /// Returns true if it was able to read a String from the input + /// + protected override bool Read(ref string value) + { + return GetValue(ref value); + } + + /// + /// Returns true if it was able to read a ByteString from the input + /// + protected override bool Read(ref ByteString value) + { + byte[] rawbytes = null; + if (GetValue(ref rawbytes)) + { + value = ByteString.CopyFrom(rawbytes); + return true; + } + return false; + } + + /// + /// returns true if it was able to read a single value into the value reference. The value + /// stored may be of type System.String, System.Int32, or an IEnumLite from the IEnumLiteMap. + /// + protected override bool ReadEnum(ref object value) + { + return GetValue(ref value); + } + + /// + /// Merges the input stream into the provided IBuilderLite + /// + protected override bool ReadMessage(IBuilderLite builder, ExtensionRegistry registry) + { + IDictionary values = null; + if (GetValue(ref values)) + { + new DictionaryReader(values).Merge(builder, registry); + return true; + } + return false; + } + + public override bool ReadArray(FieldType type, string field, ICollection items) + { + object[] array = null; + if (GetValue(ref array)) + { + if (typeof(T) == typeof(ByteString)) + { + ICollection output = (ICollection) items; + foreach (byte[] item in array) + { + output.Add(ByteString.CopyFrom(item)); + } + } + else + { + foreach (T item in array) + { + items.Add(item); + } + } + return true; + } + return false; + } + + public override bool ReadEnumArray(string field, ICollection items) + { + object[] array = null; + if (GetValue(ref array)) + { + foreach (object item in array) + { + items.Add(item); + } + return true; + } + return false; + } + + public override bool ReadMessageArray(string field, ICollection items, IMessageLite messageType, + ExtensionRegistry registry) + { + object[] array = null; + if (GetValue(ref array)) + { + foreach (IDictionary item in array) + { + IBuilderLite builder = messageType.WeakCreateBuilderForType(); + new DictionaryReader(item).Merge(builder); + items.Add((T) builder.WeakBuild()); + } + return true; + } + return false; + } + + public override bool ReadGroupArray(string field, ICollection items, IMessageLite messageType, + ExtensionRegistry registry) + { + return ReadMessageArray(field, items, messageType, registry); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/DictionaryWriter.cs b/csharp/src/ProtocolBuffers.Serialization/DictionaryWriter.cs new file mode 100644 index 00000000..6d823301 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/DictionaryWriter.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Allows writing messages to a name/value dictionary + /// + public class DictionaryWriter : AbstractWriter + { + private readonly IDictionary _output; + + /// + /// Constructs a writer using a new dictionary + /// + public DictionaryWriter() + : this(new Dictionary(StringComparer.Ordinal)) + { + } + + /// + /// Constructs a writer using an existing dictionary + /// + public DictionaryWriter(IDictionary output) + { + ThrowHelper.ThrowIfNull(output, "output"); + _output = output; + } + + /// + /// Creates the dictionary instance for a child message. + /// + protected virtual DictionaryWriter Create() + { + return new DictionaryWriter(); + } + + /// + /// Accesses the dictionary that is backing this writer + /// + public IDictionary ToDictionary() + { + return _output; + } + + /// + /// Writes the message to the the formatted stream. + /// + public override void WriteMessage(IMessageLite message) + { + message.WriteTo(this); + } + + + /// + /// No-op + /// + public override void WriteMessageStart() + { } + + /// + /// No-op + /// + public override void WriteMessageEnd() + { } + + /// + /// Writes a Boolean value + /// + protected override void Write(string field, bool value) + { + _output[field] = value; + } + + /// + /// Writes a Int32 value + /// + protected override void Write(string field, int value) + { + _output[field] = value; + } + + /// + /// Writes a UInt32 value + /// + [CLSCompliant(false)] + protected override void Write(string field, uint value) + { + _output[field] = value; + } + + /// + /// Writes a Int64 value + /// + protected override void Write(string field, long value) + { + _output[field] = value; + } + + /// + /// Writes a UInt64 value + /// + [CLSCompliant(false)] + protected override void Write(string field, ulong value) + { + _output[field] = value; + } + + /// + /// Writes a Single value + /// + protected override void Write(string field, float value) + { + _output[field] = value; + } + + /// + /// Writes a Double value + /// + protected override void Write(string field, double value) + { + _output[field] = value; + } + + /// + /// Writes a String value + /// + protected override void Write(string field, string value) + { + _output[field] = value; + } + + /// + /// Writes a set of bytes + /// + protected override void Write(string field, ByteString value) + { + _output[field] = value.ToByteArray(); + } + + /// + /// Writes a message or group as a field + /// + protected override void WriteMessageOrGroup(string field, IMessageLite message) + { + DictionaryWriter writer = Create(); + writer.WriteMessage(message); + + _output[field] = writer.ToDictionary(); + } + + /// + /// Writes a System.Enum by the numeric and textual value + /// + protected override void WriteEnum(string field, int number, string name) + { + _output[field] = number; + } + + /// + /// Writes an array of field values + /// + protected override void WriteArray(FieldType fieldType, string field, IEnumerable items) + { + List objects = new List(); + foreach (object o in items) + { + switch (fieldType) + { + case FieldType.Group: + case FieldType.Message: + { + DictionaryWriter writer = Create(); + writer.WriteMessage((IMessageLite) o); + objects.Add(writer.ToDictionary()); + } + break; + case FieldType.Bytes: + objects.Add(((ByteString) o).ToByteArray()); + break; + case FieldType.Enum: + if (o is IEnumLite) + { + objects.Add(((IEnumLite) o).Number); + } + else + { + objects.Add((int) o); + } + break; + default: + objects.Add(o); + break; + } + } + + _output[field] = objects.ToArray(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/Extensions.cs b/csharp/src/ProtocolBuffers.Serialization/Extensions.cs new file mode 100644 index 00000000..8aef0a9e --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/Extensions.cs @@ -0,0 +1,213 @@ +using System; +using System.Text; +using System.IO; +using System.Xml; +using Google.ProtocolBuffers.Serialization; +using Google.ProtocolBuffers.Serialization.Http; + +namespace Google.ProtocolBuffers +{ + /// + /// Extension methods for using serializers on instances of IMessageLite/IBuilderLite + /// + public static class Extensions + { + #region IMessageLite Extension + /// + /// Serializes the message to JSON text. This is a trivial wrapper + /// around Serialization.JsonFormatWriter.WriteMessage. + /// + public static string ToJson( +#if !NOEXTENSIONS + this +#endif + IMessageLite message) + { + JsonFormatWriter w = JsonFormatWriter.CreateInstance(); + w.WriteMessage(message); + return w.ToString(); + } + /// + /// Serializes the message to XML text. This is a trivial wrapper + /// around Serialization.XmlFormatWriter.WriteMessage. + /// + public static string ToXml( +#if !NOEXTENSIONS + this +#endif + IMessageLite message) + { + StringWriter w = new StringWriter(new StringBuilder(4096)); + XmlFormatWriter.CreateInstance(w).WriteMessage(message); + return w.ToString(); + } + /// + /// Serializes the message to XML text using the element name provided. + /// This is a trivial wrapper around Serialization.XmlFormatWriter.WriteMessage. + /// + public static string ToXml( +#if !NOEXTENSIONS + this +#endif + IMessageLite message, string rootElementName) + { + StringWriter w = new StringWriter(new StringBuilder(4096)); + XmlFormatWriter.CreateInstance(w).WriteMessage(rootElementName, message); + return w.ToString(); + } + + /// + /// Writes the message instance to the stream using the content type provided + /// + /// An instance of a message + /// Options specific to writing this message and/or content type + /// The mime type of the content to be written + /// The stream to write the message to + public static void WriteTo( +#if !NOEXTENSIONS + this +#endif + IMessageLite message, MessageFormatOptions options, string contentType, Stream output) + { + ICodedOutputStream codedOutput = MessageFormatFactory.CreateOutputStream(options, contentType, output); + + // Output the appropriate message preamble + codedOutput.WriteMessageStart(); + + // Write the message content to the output + message.WriteTo(codedOutput); + + // Write the closing message fragment + codedOutput.WriteMessageEnd(); + codedOutput.Flush(); + } + + #endregion + #region IBuilderLite Extensions + /// + /// Merges a JSON object into this builder and returns + /// + public static TBuilder MergeFromJson( +#if !NOEXTENSIONS + this +#endif + TBuilder builder, string jsonText) where TBuilder : IBuilderLite + { + return JsonFormatReader.CreateInstance(jsonText) + .Merge(builder); + } + /// + /// Merges a JSON object into this builder and returns + /// + public static TBuilder MergeFromJson( +#if !NOEXTENSIONS + this +#endif + TBuilder builder, TextReader reader) where TBuilder : IBuilderLite + { + return MergeFromJson(builder, reader, ExtensionRegistry.Empty); + } + /// + /// Merges a JSON object into this builder using the extensions provided and returns + /// + public static TBuilder MergeFromJson( +#if !NOEXTENSIONS + this +#endif + TBuilder builder, TextReader reader, ExtensionRegistry extensionRegistry) where TBuilder : IBuilderLite + { + return JsonFormatReader.CreateInstance(reader) + .Merge(builder, extensionRegistry); + } + + /// + /// Merges an XML object into this builder and returns + /// + public static TBuilder MergeFromXml( +#if !NOEXTENSIONS + this +#endif + TBuilder builder, XmlReader reader) where TBuilder : IBuilderLite + { + return MergeFromXml(builder, XmlFormatReader.DefaultRootElementName, reader, ExtensionRegistry.Empty); + } + + /// + /// Merges an XML object into this builder and returns + /// + public static TBuilder MergeFromXml( +#if !NOEXTENSIONS + this +#endif + TBuilder builder, string rootElementName, XmlReader reader) where TBuilder : IBuilderLite + { + return MergeFromXml(builder, rootElementName, reader, ExtensionRegistry.Empty); + } + + /// + /// Merges an XML object into this builder using the extensions provided and returns + /// + public static TBuilder MergeFromXml( +#if !NOEXTENSIONS + this +#endif + TBuilder builder, string rootElementName, XmlReader reader, + ExtensionRegistry extensionRegistry) where TBuilder : IBuilderLite + { + return XmlFormatReader.CreateInstance(reader) + .Merge(rootElementName, builder, extensionRegistry); + } + + /// + /// Merges the message from the input stream based on the contentType provided + /// + /// A type derived from IBuilderLite + /// An instance of a message builder + /// Options specific to reading this message and/or content type + /// The mime type of the input stream content + /// The stream to read the message from + /// The same builder instance that was supplied in the builder parameter + public static TBuilder MergeFrom( +#if !NOEXTENSIONS + this +#endif + TBuilder builder, MessageFormatOptions options, string contentType, Stream input) where TBuilder : IBuilderLite + { + ICodedInputStream codedInput = MessageFormatFactory.CreateInputStream(options, contentType, input); + codedInput.ReadMessageStart(); + builder.WeakMergeFrom(codedInput, options.ExtensionRegistry); + codedInput.ReadMessageEnd(); + return builder; + } + + #endregion + #region IRpcServerStub Extensions + + /// + /// Used to implement a service endpoint on an HTTP server. This works with services generated with the + /// service_generator_type option set to IRPCDISPATCH. + /// + /// The service execution stub + /// The name of the method being invoked + /// optional arguments for the format reader/writer + /// The mime type for the input stream + /// The input stream + /// The mime type for the output stream + /// The output stream + public static void HttpCallMethod( +#if !NOEXTENSIONS + this +#endif + IRpcServerStub stub, string methodName, MessageFormatOptions options, + string contentType, Stream input, string responseType, Stream output) + { + ICodedInputStream codedInput = MessageFormatFactory.CreateInputStream(options, contentType, input); + codedInput.ReadMessageStart(); + IMessageLite response = stub.CallMethod(methodName, codedInput, options.ExtensionRegistry); + codedInput.ReadMessageEnd(); + WriteTo(response, options, responseType, output); + } + + #endregion + } +} diff --git a/csharp/src/ProtocolBuffers.Serialization/Http/FormUrlEncodedReader.cs b/csharp/src/ProtocolBuffers.Serialization/Http/FormUrlEncodedReader.cs new file mode 100644 index 00000000..508d76a9 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/Http/FormUrlEncodedReader.cs @@ -0,0 +1,162 @@ +using System; +using System.IO; +using System.Text; + +namespace Google.ProtocolBuffers.Serialization.Http +{ + /// + /// Allows reading messages from a name/value dictionary + /// + public class FormUrlEncodedReader : AbstractTextReader + { + private readonly TextReader _input; + private string _fieldName, _fieldValue; + private bool _ready; + + /// + /// Creates a dictionary reader from an enumeration of KeyValuePair data, like an IDictionary + /// + FormUrlEncodedReader(TextReader input) + { + _input = input; + int ch = input.Peek(); + if (ch == '?') + { + input.Read(); + } + _ready = ReadNext(); + } + + #region CreateInstance overloads + /// + /// Constructs a FormUrlEncodedReader to parse form data, or url query text into a message. + /// + public static FormUrlEncodedReader CreateInstance(Stream stream) + { + return new FormUrlEncodedReader(new StreamReader(stream, Encoding.UTF8, false)); + } + + /// + /// Constructs a FormUrlEncodedReader to parse form data, or url query text into a message. + /// + public static FormUrlEncodedReader CreateInstance(byte[] bytes) + { + return new FormUrlEncodedReader(new StreamReader(new MemoryStream(bytes, false), Encoding.UTF8, false)); + } + + /// + /// Constructs a FormUrlEncodedReader to parse form data, or url query text into a message. + /// + public static FormUrlEncodedReader CreateInstance(string text) + { + return new FormUrlEncodedReader(new StringReader(text)); + } + + /// + /// Constructs a FormUrlEncodedReader to parse form data, or url query text into a message. + /// + public static FormUrlEncodedReader CreateInstance(TextReader input) + { + return new FormUrlEncodedReader(input); + } + #endregion + + private bool ReadNext() + { + StringBuilder field = new StringBuilder(32); + StringBuilder value = new StringBuilder(64); + int ch; + while (-1 != (ch = _input.Read()) && ch != '=' && ch != '&') + { + field.Append((char)ch); + } + + if (ch != -1 && ch != '&') + { + while (-1 != (ch = _input.Read()) && ch != '&') + { + value.Append((char)ch); + } + } + + _fieldName = field.ToString(); + _fieldValue = Uri.UnescapeDataString(value.Replace('+', ' ').ToString()); + + return !String.IsNullOrEmpty(_fieldName); + } + + /// + /// No-op + /// + public override void ReadMessageStart() + { } + + /// + /// No-op + /// + public override void ReadMessageEnd() + { } + + /// + /// Merges the contents of stream into the provided message builder + /// + public override TBuilder Merge(TBuilder builder, ExtensionRegistry registry) + { + builder.WeakMergeFrom(this, registry); + return builder; + } + + /// + /// Causes the reader to skip past this field + /// + protected override void Skip() + { + _ready = ReadNext(); + } + + /// + /// Peeks at the next field in the input stream and returns what information is available. + /// + /// + /// This may be called multiple times without actually reading the field. Only after the field + /// is either read, or skipped, should PeekNext return a different value. + /// + protected override bool PeekNext(out string field) + { + field = _ready ? _fieldName : null; + return field != null; + } + + /// + /// Returns true if it was able to read a String from the input + /// + protected override bool ReadAsText(ref string value, Type typeInfo) + { + if (_ready) + { + value = _fieldValue; + _ready = ReadNext(); + return true; + } + return false; + } + + /// + /// It's unlikely this will work for anything but text data as bytes UTF8 are transformed to text and back to bytes + /// + protected override ByteString DecodeBytes(string bytes) + { return ByteString.CopyFromUtf8(bytes); } + + /// + /// Not Supported + /// + public override bool ReadGroup(IBuilderLite value, ExtensionRegistry registry) + { throw new NotSupportedException(); } + + /// + /// Not Supported + /// + protected override bool ReadMessage(IBuilderLite builder, ExtensionRegistry registry) + { throw new NotSupportedException(); } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs b/csharp/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs new file mode 100644 index 00000000..270af64b --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/Http/MessageFormatFactory.cs @@ -0,0 +1,112 @@ +using System; +using System.IO; +using System.Xml; +using System.Text; + +namespace Google.ProtocolBuffers.Serialization.Http +{ + /// + /// Extensions and helpers to abstract the reading/writing of messages by a client-specified content type. + /// + public static class MessageFormatFactory + { + /// + /// Constructs an ICodedInputStream from the input stream based on the contentType provided + /// + /// Options specific to reading this message and/or content type + /// The mime type of the input stream content + /// The stream to read the message from + /// The ICodedInputStream that can be given to the IBuilder.MergeFrom(...) method + public static ICodedInputStream CreateInputStream(MessageFormatOptions options, string contentType, Stream input) + { + ICodedInputStream codedInput = ContentTypeToInputStream(contentType, options, input); + + if (codedInput is XmlFormatReader) + { + XmlFormatReader reader = (XmlFormatReader)codedInput; + reader.RootElementName = options.XmlReaderRootElementName; + reader.Options = options.XmlReaderOptions; + } + + return codedInput; + } + + /// + /// Writes the message instance to the stream using the content type provided + /// + /// Options specific to writing this message and/or content type + /// The mime type of the content to be written + /// The stream to write the message to + /// If you do not dispose of ICodedOutputStream some formats may yield incomplete output + public static ICodedOutputStream CreateOutputStream(MessageFormatOptions options, string contentType, Stream output) + { + ICodedOutputStream codedOutput = ContentTypeToOutputStream(contentType, options, output); + + if (codedOutput is JsonFormatWriter) + { + JsonFormatWriter writer = (JsonFormatWriter)codedOutput; + if (options.FormattedOutput) + { + writer.Formatted(); + } + } + else if (codedOutput is XmlFormatWriter) + { + XmlFormatWriter writer = (XmlFormatWriter)codedOutput; + if (options.FormattedOutput) + { + XmlWriterSettings settings = new XmlWriterSettings() + { + CheckCharacters = false, + NewLineHandling = NewLineHandling.Entitize, + OmitXmlDeclaration = true, + Encoding = new UTF8Encoding(false), + Indent = true, + IndentChars = " ", + }; + // Don't know how else to change xml writer options? + codedOutput = writer = XmlFormatWriter.CreateInstance(XmlWriter.Create(output, settings)); + } + writer.RootElementName = options.XmlWriterRootElementName; + writer.Options = options.XmlWriterOptions; + } + + return codedOutput; + } + + private static ICodedInputStream ContentTypeToInputStream(string contentType, MessageFormatOptions options, Stream input) + { + contentType = (contentType ?? String.Empty).Split(';')[0].Trim(); + + CodedInputBuilder factory; + if(!options.MimeInputTypesReadOnly.TryGetValue(contentType, out factory) || factory == null) + { + if(String.IsNullOrEmpty(options.DefaultContentType) || + !options.MimeInputTypesReadOnly.TryGetValue(options.DefaultContentType, out factory) || factory == null) + { + throw new ArgumentOutOfRangeException("contentType"); + } + } + + return factory(input); + } + + private static ICodedOutputStream ContentTypeToOutputStream(string contentType, MessageFormatOptions options, Stream output) + { + contentType = (contentType ?? String.Empty).Split(';')[0].Trim(); + + CodedOutputBuilder factory; + if (!options.MimeOutputTypesReadOnly.TryGetValue(contentType, out factory) || factory == null) + { + if (String.IsNullOrEmpty(options.DefaultContentType) || + !options.MimeOutputTypesReadOnly.TryGetValue(options.DefaultContentType, out factory) || factory == null) + { + throw new ArgumentOutOfRangeException("contentType"); + } + } + + return factory(output); + } + + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs b/csharp/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs new file mode 100644 index 00000000..1480e50a --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs @@ -0,0 +1,176 @@ +using System; +using System.IO; +using System.Collections.Generic; +using Google.ProtocolBuffers.Collections; + +namespace Google.ProtocolBuffers.Serialization.Http +{ + /// + /// A delegate used to specify a method that constructs an ICodedInputStream from a .NET Stream. + /// + public delegate ICodedInputStream CodedInputBuilder(Stream stream); + /// + /// A delegate used to specify a method that constructs an ICodedOutputStream from a .NET Stream. + /// + public delegate ICodedOutputStream CodedOutputBuilder(Stream stream); + + /// + /// Defines control information for the various formatting used with HTTP services + /// + public class MessageFormatOptions + { + /// The mime type for xml content + /// Other valid xml mime types include: application/binary, application/x-protobuf + public const string ContentTypeProtoBuffer = "application/vnd.google.protobuf"; + + /// The mime type for xml content + /// Other valid xml mime types include: text/xml + public const string ContentTypeXml = "application/xml"; + + /// The mime type for json content + /// + /// Other valid json mime types include: application/json, application/x-json, + /// application/x-javascript, text/javascript, text/x-javascript, text/x-json, text/json + /// + public const string ContentTypeJson = "application/json"; + + /// The mime type for query strings and x-www-form-urlencoded content + /// This mime type is input-only + public const string ContentFormUrlEncoded = "application/x-www-form-urlencoded"; + + /// + /// Default mime-type handling for input + /// + private static readonly IDictionary MimeInputDefaults = + new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + {"application/json", JsonFormatReader.CreateInstance}, + {"application/x-json", JsonFormatReader.CreateInstance}, + {"application/x-javascript", JsonFormatReader.CreateInstance}, + {"text/javascript", JsonFormatReader.CreateInstance}, + {"text/x-javascript", JsonFormatReader.CreateInstance}, + {"text/x-json", JsonFormatReader.CreateInstance}, + {"text/json", JsonFormatReader.CreateInstance}, + {"text/xml", XmlFormatReader.CreateInstance}, + {"application/xml", XmlFormatReader.CreateInstance}, + {"application/binary", CodedInputStream.CreateInstance}, + {"application/x-protobuf", CodedInputStream.CreateInstance}, + {"application/vnd.google.protobuf", CodedInputStream.CreateInstance}, + {"application/x-www-form-urlencoded", FormUrlEncodedReader.CreateInstance}, + } + ); + + /// + /// Default mime-type handling for output + /// + private static readonly IDictionary MimeOutputDefaults = + new ReadOnlyDictionary( + new Dictionary(StringComparer.OrdinalIgnoreCase) + { + {"application/json", JsonFormatWriter.CreateInstance}, + {"application/x-json", JsonFormatWriter.CreateInstance}, + {"application/x-javascript", JsonFormatWriter.CreateInstance}, + {"text/javascript", JsonFormatWriter.CreateInstance}, + {"text/x-javascript", JsonFormatWriter.CreateInstance}, + {"text/x-json", JsonFormatWriter.CreateInstance}, + {"text/json", JsonFormatWriter.CreateInstance}, + {"text/xml", XmlFormatWriter.CreateInstance}, + {"application/xml", XmlFormatWriter.CreateInstance}, + {"application/binary", CodedOutputStream.CreateInstance}, + {"application/x-protobuf", CodedOutputStream.CreateInstance}, + {"application/vnd.google.protobuf", CodedOutputStream.CreateInstance}, + } + ); + + + + + private string _defaultContentType; + private string _xmlReaderRootElementName; + private string _xmlWriterRootElementName; + private ExtensionRegistry _extensionRegistry; + private Dictionary _mimeInputTypes; + private Dictionary _mimeOutputTypes; + + /// Provides access to modify the mime-type input stream construction + public IDictionary MimeInputTypes + { + get + { + return _mimeInputTypes ?? + (_mimeInputTypes = new Dictionary( + MimeInputDefaults, StringComparer.OrdinalIgnoreCase)); + } + } + + /// Provides access to modify the mime-type input stream construction + public IDictionary MimeOutputTypes + { + get + { + return _mimeOutputTypes ?? + (_mimeOutputTypes = new Dictionary( + MimeOutputDefaults, StringComparer.OrdinalIgnoreCase)); + } + } + + internal IDictionary MimeInputTypesReadOnly + { get { return _mimeInputTypes ?? MimeInputDefaults; } } + + internal IDictionary MimeOutputTypesReadOnly + { get { return _mimeOutputTypes ?? MimeOutputDefaults; } } + + /// + /// The default content type to use if the input type is null or empty. If this + /// value is not supplied an ArgumentOutOfRangeException exception will be raised. + /// + public string DefaultContentType + { + get { return _defaultContentType ?? String.Empty; } + set { _defaultContentType = value; } + } + + /// + /// The extension registry to use when reading messages + /// + public ExtensionRegistry ExtensionRegistry + { + get { return _extensionRegistry ?? ExtensionRegistry.Empty; } + set { _extensionRegistry = value; } + } + + /// + /// The name of the xml root element when reading messages + /// + public string XmlReaderRootElementName + { + get { return _xmlReaderRootElementName ?? XmlFormatReader.DefaultRootElementName; } + set { _xmlReaderRootElementName = value; } + } + + /// + /// Xml reader options + /// + public XmlReaderOptions XmlReaderOptions { get; set; } + + /// + /// True to use formatted output including new-lines and default indentation + /// + public bool FormattedOutput { get; set; } + + /// + /// The name of the xml root element when writing messages + /// + public string XmlWriterRootElementName + { + get { return _xmlWriterRootElementName ?? XmlFormatWriter.DefaultRootElementName; } + set { _xmlWriterRootElementName = value; } + } + + /// + /// Xml writer options + /// + public XmlWriterOptions XmlWriterOptions { get; set; } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/JsonFormatReader.cs b/csharp/src/ProtocolBuffers.Serialization/JsonFormatReader.cs new file mode 100644 index 00000000..423196d8 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/JsonFormatReader.cs @@ -0,0 +1,262 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// JsonFormatReader is used to parse Json into a message or an array of messages + /// + public class JsonFormatReader : AbstractTextReader + { + private readonly JsonCursor _input; + // The expected token that ends the current item, either ']' or '}' + private readonly Stack _stopChar; + + private enum ReaderState + { + Start, + BeginValue, + EndValue, + BeginObject, + BeginArray + } + + private string _current; + private ReaderState _state; + + /// + /// Constructs a JsonFormatReader to parse Json into a message, this method does not use text encoding, all bytes MUST + /// represent ASCII character values. + /// + public static JsonFormatReader CreateInstance(Stream stream) + { + return new JsonFormatReader(JsonCursor.CreateInstance(stream)); + } + + /// + /// Constructs a JsonFormatReader to parse Json into a message, this method does not use text encoding, all bytes MUST + /// represent ASCII character values. + /// + public static JsonFormatReader CreateInstance(byte[] bytes) + { + return new JsonFormatReader(JsonCursor.CreateInstance(bytes)); + } + + /// + /// Constructs a JsonFormatReader to parse Json into a message + /// + public static JsonFormatReader CreateInstance(string jsonText) + { + return new JsonFormatReader(JsonCursor.CreateInstance(jsonText)); + } + + /// + /// Constructs a JsonFormatReader to parse Json into a message + /// + public static JsonFormatReader CreateInstance(TextReader input) + { + return new JsonFormatReader(JsonCursor.CreateInstance(input)); + } + + /// + /// Constructs a JsonFormatReader to parse Json into a message + /// + internal JsonFormatReader(JsonCursor input) + { + _input = input; + _stopChar = new Stack(); + _stopChar.Push(-1); + _state = ReaderState.Start; + } + + /// + /// Constructs a JsonFormatReader to parse Json into a message + /// + protected JsonFormatReader(TextReader input) + : this(JsonCursor.CreateInstance(input)) + { + } + + /// + /// Returns true if the reader is currently on an array element + /// + public bool IsArrayMessage + { + get { return _input.NextChar == '['; } + } + + /// + /// Returns an enumerator that is used to cursor over an array of messages + /// + /// + /// This is generally used when receiving an array of messages rather than a single root message + /// + public IEnumerable EnumerateArray() + { + foreach (string ignored in ForeachArrayItem(_current)) + { + yield return this; + } + } + + /// + /// Reads the root-message preamble specific to this formatter + /// + public override void ReadMessageStart() + { + _input.Consume('{'); + _stopChar.Push('}'); + + _state = ReaderState.BeginObject; + } + + /// + /// Reads the root-message close specific to this formatter + /// + public override void ReadMessageEnd() + { + _input.Consume((char)_stopChar.Pop()); + _state = ReaderState.EndValue; + } + + /// + /// Merges the contents of stream into the provided message builder + /// + public override TBuilder Merge(TBuilder builder, ExtensionRegistry registry) + { + ReadMessageStart(); + builder.WeakMergeFrom(this, registry); + ReadMessageEnd(); + return builder; + } + + /// + /// Causes the reader to skip past this field + /// + protected override void Skip() + { + object temp; + _input.ReadVariant(out temp); + _state = ReaderState.EndValue; + } + + /// + /// Peeks at the next field in the input stream and returns what information is available. + /// + /// + /// This may be called multiple times without actually reading the field. Only after the field + /// is either read, or skipped, should PeekNext return a different value. + /// + protected override bool PeekNext(out string field) + { + field = _current; + if (_state == ReaderState.BeginValue) + { + return true; + } + + int next = _input.NextChar; + if (next == _stopChar.Peek()) + { + return false; + } + + _input.Assert(next != -1, "Unexpected end of file."); + + //not sure about this yet, it will allow {, "a":true } + if (_state == ReaderState.EndValue && !_input.TryConsume(',')) + { + return false; + } + + field = _current = _input.ReadString(); + _input.Consume(':'); + _state = ReaderState.BeginValue; + return true; + } + + /// + /// Returns true if it was able to read a String from the input + /// + protected override bool ReadAsText(ref string value, Type typeInfo) + { + object temp; + JsonCursor.JsType type = _input.ReadVariant(out temp); + _state = ReaderState.EndValue; + + _input.Assert(type != JsonCursor.JsType.Array && type != JsonCursor.JsType.Object, + "Encountered {0} while expecting {1}", type, typeInfo); + if (type == JsonCursor.JsType.Null) + { + return false; + } + if (type == JsonCursor.JsType.True) + { + value = "1"; + } + else if (type == JsonCursor.JsType.False) + { + value = "0"; + } + else + { + value = temp as string; + } + + //exponent representation of integer number: + if (value != null && type == JsonCursor.JsType.Number && + (typeInfo != typeof(double) && typeInfo != typeof(float)) && + value.IndexOf("e", StringComparison.OrdinalIgnoreCase) > 0) + { + value = XmlConvert.ToString((long) Math.Round(XmlConvert.ToDouble(value), 0)); + } + return value != null; + } + + /// + /// Returns true if it was able to read a ByteString from the input + /// + protected override bool Read(ref ByteString value) + { + string bytes = null; + if (Read(ref bytes)) + { + value = ByteString.FromBase64(bytes); + return true; + } + return false; + } + + /// + /// Cursors through the array elements and stops at the end of the array + /// + protected override IEnumerable ForeachArrayItem(string field) + { + _input.Consume('['); + _stopChar.Push(']'); + _state = ReaderState.BeginArray; + while (_input.NextChar != ']') + { + _current = field; + yield return field; + if (!_input.TryConsume(',')) + { + break; + } + } + _input.Consume((char) _stopChar.Pop()); + _state = ReaderState.EndValue; + } + + /// + /// Merges the input stream into the provided IBuilderLite + /// + protected override bool ReadMessage(IBuilderLite builder, ExtensionRegistry registry) + { + Merge(builder, registry); + return true; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs b/csharp/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs new file mode 100644 index 00000000..15e0424e --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/JsonFormatWriter.cs @@ -0,0 +1,541 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// JsonFormatWriter is a .NET 2.0 friendly json formatter for proto buffer messages. For .NET 3.5 + /// you may also use the XmlFormatWriter with an XmlWriter created by the + /// JsonReaderWriterFactory. + /// + public abstract class JsonFormatWriter : AbstractTextWriter + { + #region buffering implementations + + private class JsonTextWriter : JsonFormatWriter + { + private readonly char[] _buffer; + private TextWriter _output; + private int _bufferPos; + + public JsonTextWriter(TextWriter output) + { + _buffer = new char[4096]; + _bufferPos = 0; + _output = output; + _counter.Add(0); + } + + /// + /// Returns the output of TextWriter.ToString() where TextWriter is the ctor argument. + /// + public override string ToString() + { + Flush(); + + if (_output != null) + { + return _output.ToString(); + } + + return new String(_buffer, 0, _bufferPos); + } + + protected override void WriteToOutput(char[] chars, int offset, int len) + { + if (_bufferPos + len >= _buffer.Length) + { + if (_output == null) + { + _output = new StringWriter(new StringBuilder(_buffer.Length*2 + len)); + } + Flush(); + } + + if (len < _buffer.Length) + { + if (len <= 12) + { + int stop = offset + len; + for (int i = offset; i < stop; i++) + { + _buffer[_bufferPos++] = chars[i]; + } + } + else + { + Buffer.BlockCopy(chars, offset << 1, _buffer, _bufferPos << 1, len << 1); + _bufferPos += len; + } + } + else + { + _output.Write(chars, offset, len); + } + } + + protected override void WriteToOutput(char ch) + { + if (_bufferPos >= _buffer.Length) + { + if (_output == null) + { + _output = new StringWriter(new StringBuilder(_buffer.Length * 2)); + } + Flush(); + } + _buffer[_bufferPos++] = ch; + } + + public override void Flush() + { + if (_bufferPos > 0 && _output != null) + { + _output.Write(_buffer, 0, _bufferPos); + _bufferPos = 0; + } + base.Flush(); + } + } + + private class JsonStreamWriter : JsonFormatWriter + { + static readonly Encoding Encoding = new UTF8Encoding(false); + private readonly byte[] _buffer; + private Stream _output; + private int _bufferPos; + + public JsonStreamWriter(Stream output) + { + _buffer = new byte[8192]; + _bufferPos = 0; + _output = output; + _counter.Add(0); + } + + protected override void WriteToOutput(char[] chars, int offset, int len) + { + if (_bufferPos + len >= _buffer.Length) + { + Flush(); + } + + if (len < _buffer.Length) + { + if (len <= 12) + { + int stop = offset + len; + for (int i = offset; i < stop; i++) + { + _buffer[_bufferPos++] = (byte) chars[i]; + } + } + else + { + _bufferPos += Encoding.GetBytes(chars, offset, len, _buffer, _bufferPos); + } + } + else + { + byte[] temp = Encoding.GetBytes(chars, offset, len); + _output.Write(temp, 0, temp.Length); + } + } + + protected override void WriteToOutput(char ch) + { + if (_bufferPos >= _buffer.Length) + { + Flush(); + } + _buffer[_bufferPos++] = (byte) ch; + } + + public override void Flush() + { + if (_bufferPos > 0 && _output != null) + { + _output.Write(_buffer, 0, _bufferPos); + _bufferPos = 0; + } + base.Flush(); + } + } + + #endregion + + //Tracks the writer depth and the array element count at that depth. + private readonly List _counter; + //True if the top-level of the writer is an array as opposed to a single message. + private bool _isArray; + + /// + /// Constructs a JsonFormatWriter, use the ToString() member to extract the final Json on completion. + /// + protected JsonFormatWriter() + { + _counter = new List(); + } + + /// + /// Constructs a JsonFormatWriter, use ToString() to extract the final output + /// + public static JsonFormatWriter CreateInstance() + { + return new JsonTextWriter(null); + } + + /// + /// Constructs a JsonFormatWriter to output to the given text writer + /// + public static JsonFormatWriter CreateInstance(TextWriter output) + { + return new JsonTextWriter(output); + } + + /// + /// Constructs a JsonFormatWriter to output to the given stream + /// + public static JsonFormatWriter CreateInstance(Stream output) + { + return new JsonStreamWriter(output); + } + + /// Write to the output stream + protected void WriteToOutput(string format, params object[] args) + { + WriteToOutput(String.Format(format, args)); + } + + /// Write to the output stream + protected void WriteToOutput(string text) + { + WriteToOutput(text.ToCharArray(), 0, text.Length); + } + + /// Write to the output stream + protected abstract void WriteToOutput(char ch); + + /// Write to the output stream + protected abstract void WriteToOutput(char[] chars, int offset, int len); + + /// Sets the output formatting to use Environment.NewLine with 4-character indentions + public JsonFormatWriter Formatted() + { + NewLine = FrameworkPortability.NewLine; + Indent = " "; + Whitespace = " "; + return this; + } + + /// Gets or sets the characters to use for the new-line, default = empty + public string NewLine { get; set; } + + /// Gets or sets the text to use for indenting, default = empty + public string Indent { get; set; } + + /// Gets or sets the whitespace to use to separate the text, default = empty + public string Whitespace { get; set; } + + private void Seperator() + { + if (_counter.Count == 0) + { + throw new InvalidOperationException("Mismatched open/close in Json writer."); + } + + int index = _counter.Count - 1; + if (_counter[index] > 0) + { + WriteToOutput(','); + } + + WriteLine(String.Empty); + _counter[index] = _counter[index] + 1; + } + + private void WriteLine(string content) + { + if (!String.IsNullOrEmpty(NewLine)) + { + WriteToOutput(NewLine); + for (int i = 1; i < _counter.Count; i++) + { + WriteToOutput(Indent); + } + } + else if (!String.IsNullOrEmpty(Whitespace)) + { + WriteToOutput(Whitespace); + } + + WriteToOutput(content); + } + + private void WriteName(string field) + { + Seperator(); + if (!String.IsNullOrEmpty(field)) + { + WriteToOutput('"'); + WriteToOutput(field); + WriteToOutput('"'); + WriteToOutput(':'); + if (!String.IsNullOrEmpty(Whitespace)) + { + WriteToOutput(Whitespace); + } + } + } + + private void EncodeText(string value) + { + char[] text = value.ToCharArray(); + int len = text.Length; + int pos = 0; + + while (pos < len) + { + int next = pos; + while (next < len && text[next] >= 32 && text[next] < 127 && text[next] != '\\' && text[next] != '/' && + text[next] != '"') + { + next++; + } + WriteToOutput(text, pos, next - pos); + if (next < len) + { + switch (text[next]) + { + case '"': + WriteToOutput(@"\"""); + break; + case '\\': + WriteToOutput(@"\\"); + break; + //odd at best to escape '/', most Json implementations don't, but it is defined in the rfc-4627 + case '/': + WriteToOutput(@"\/"); + break; + case '\b': + WriteToOutput(@"\b"); + break; + case '\f': + WriteToOutput(@"\f"); + break; + case '\n': + WriteToOutput(@"\n"); + break; + case '\r': + WriteToOutput(@"\r"); + break; + case '\t': + WriteToOutput(@"\t"); + break; + default: + WriteToOutput(@"\u{0:x4}", (int) text[next]); + break; + } + next++; + } + pos = next; + } + } + + /// + /// Writes a String value + /// + protected override void WriteAsText(string field, string textValue, object typedValue) + { + WriteName(field); + if (typedValue is bool || typedValue is int || typedValue is uint || typedValue is long || + typedValue is ulong || typedValue is double || typedValue is float) + { + WriteToOutput(textValue); + } + else + { + WriteToOutput('"'); + if (typedValue is string) + { + EncodeText(textValue); + } + else + { + WriteToOutput(textValue); + } + WriteToOutput('"'); + } + } + + /// + /// Writes a Double value + /// + protected override void Write(string field, double value) + { + if (double.IsNaN(value) || double.IsNegativeInfinity(value) || double.IsPositiveInfinity(value)) + { + throw new InvalidOperationException("This format does not support NaN, Infinity, or -Infinity"); + } + base.Write(field, value); + } + + /// + /// Writes a Single value + /// + protected override void Write(string field, float value) + { + if (float.IsNaN(value) || float.IsNegativeInfinity(value) || float.IsPositiveInfinity(value)) + { + throw new InvalidOperationException("This format does not support NaN, Infinity, or -Infinity"); + } + base.Write(field, value); + } + + // Treat enum as string + protected override void WriteEnum(string field, int number, string name) + { + Write(field, name); + } + + /// + /// Writes an array of field values + /// + protected override void WriteArray(FieldType type, string field, IEnumerable items) + { + IEnumerator enumerator = items.GetEnumerator(); + try + { + if (!enumerator.MoveNext()) + { + return; + } + } + finally + { + if (enumerator is IDisposable) + { + ((IDisposable) enumerator).Dispose(); + } + } + + WriteName(field); + WriteToOutput("["); + _counter.Add(0); + + base.WriteArray(type, String.Empty, items); + + _counter.RemoveAt(_counter.Count - 1); + WriteLine("]"); + } + + /// + /// Writes a message + /// + protected override void WriteMessageOrGroup(string field, IMessageLite message) + { + WriteName(field); + WriteMessage(message); + } + + /// + /// Writes the message to the the formatted stream. + /// + public override void WriteMessage(IMessageLite message) + { + WriteMessageStart(); + message.WriteTo(this); + WriteMessageEnd(); + } + + /// + /// Used to write the root-message preamble, in json this is the left-curly brace '{'. + /// After this call you can call IMessageLite.MergeTo(...) and complete the message with + /// a call to WriteMessageEnd(). + /// + public override void WriteMessageStart() + { + if (_isArray) + { + Seperator(); + } + WriteToOutput("{"); + _counter.Add(0); + } + + /// + /// Used to complete a root-message previously started with a call to WriteMessageStart() + /// + public override void WriteMessageEnd() + { + _counter.RemoveAt(_counter.Count - 1); + WriteLine("}"); + Flush(); + } + + /// + /// Used in streaming arrays of objects to the writer + /// + /// + /// + /// using(writer.StartArray()) + /// foreach(IMessageLite m in messages) + /// writer.WriteMessage(m); + /// + /// + public sealed class JsonArray : IDisposable + { + private JsonFormatWriter _writer; + + internal JsonArray(JsonFormatWriter writer) + { + _writer = writer; + _writer.WriteToOutput("["); + _writer._counter.Add(0); + } + + /// + /// Causes the end of the array character to be written. + /// + private void EndArray() + { + if (_writer != null) + { + _writer._counter.RemoveAt(_writer._counter.Count - 1); + _writer.WriteLine("]"); + _writer.Flush(); + } + _writer = null; + } + + void IDisposable.Dispose() + { + EndArray(); + } + } + + /// + /// Used to write an array of messages as the output rather than a single message. + /// + /// + /// + /// using(writer.StartArray()) + /// foreach(IMessageLite m in messages) + /// writer.WriteMessage(m); + /// + /// + public JsonArray StartArray() + { + if (_isArray) + { + Seperator(); + } + _isArray = true; + return new JsonArray(this); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/JsonTextCursor.cs b/csharp/src/ProtocolBuffers.Serialization/JsonTextCursor.cs new file mode 100644 index 00000000..19c45af7 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/JsonTextCursor.cs @@ -0,0 +1,442 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.IO; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// JSon Tokenizer used by JsonFormatReader + /// + internal abstract class JsonCursor + { + public enum JsType + { + String, + Number, + Object, + Array, + True, + False, + Null + } + + #region Buffering implementations + + private class JsonStreamCursor : JsonCursor + { + private readonly byte[] _buffer; + private int _bufferPos; + private readonly Stream _input; + + public JsonStreamCursor(Stream input) + { + _input = input; + _next = _input.ReadByte(); + } + + public JsonStreamCursor(byte[] input) + { + _input = null; + _buffer = input; + _next = _buffer[_bufferPos]; + } + + protected override int Peek() + { + if (_input != null) + { + return _next; + } + else if (_bufferPos < _buffer.Length) + { + return _buffer[_bufferPos]; + } + else + { + return -1; + } + } + + protected override int Read() + { + if (_input != null) + { + int result = _next; + _next = _input.ReadByte(); + return result; + } + else if (_bufferPos < _buffer.Length) + { + return _buffer[_bufferPos++]; + } + else + { + return -1; + } + } + } + + private class JsonTextCursor : JsonCursor + { + private readonly char[] _buffer; + private int _bufferPos; + private readonly TextReader _input; + + public JsonTextCursor(char[] input) + { + _input = null; + _buffer = input; + _bufferPos = 0; + _next = Peek(); + } + + public JsonTextCursor(TextReader input) + { + _input = input; + _next = Peek(); + } + + protected override int Peek() + { + if (_input != null) + { + return _input.Peek(); + } + else if (_bufferPos < _buffer.Length) + { + return _buffer[_bufferPos]; + } + else + { + return -1; + } + } + + protected override int Read() + { + if (_input != null) + { + return _input.Read(); + } + else if (_bufferPos < _buffer.Length) + { + return _buffer[_bufferPos++]; + } + else + { + return -1; + } + } + } + + #endregion + + protected int _next; + private int _lineNo, _linePos; + + public static JsonCursor CreateInstance(byte[] input) + { + return new JsonStreamCursor(input); + } + + public static JsonCursor CreateInstance(Stream input) + { + return new JsonStreamCursor(input); + } + + public static JsonCursor CreateInstance(string input) + { + return new JsonTextCursor(input.ToCharArray()); + } + + public static JsonCursor CreateInstance(TextReader input) + { + return new JsonTextCursor(input); + } + + protected JsonCursor() + { + _lineNo = 1; + _linePos = 0; + } + + /// Returns the next character without actually 'reading' it + protected abstract int Peek(); + + /// Reads the next character in the input + protected abstract int Read(); + + public Char NextChar + { + get + { + SkipWhitespace(); + return (char) _next; + } + } + + #region Assert(...) + + [DebuggerNonUserCode] + private string CharDisplay(int ch) + { + return ch == -1 + ? "EOF" + : (ch > 32 && ch < 127) + ? String.Format("'{0}'", (char) ch) + : String.Format("'\\u{0:x4}'", ch); + } + + [DebuggerNonUserCode] + private void Assert(bool cond, char expected) + { + if (!cond) + { + throw new FormatException( + String.Format(FrameworkPortability.InvariantCulture, + "({0}:{1}) error: Unexpected token {2}, expected: {3}.", + _lineNo, _linePos, + CharDisplay(_next), + CharDisplay(expected) + )); + } + } + + [DebuggerNonUserCode] + public void Assert(bool cond, string message) + { + if (!cond) + { + throw new FormatException( + String.Format(FrameworkPortability.InvariantCulture, + "({0},{1}) error: {2}", _lineNo, _linePos, message)); + } + } + + [DebuggerNonUserCode] + public void Assert(bool cond, string format, params object[] args) + { + if (!cond) + { + if (args != null && args.Length > 0) + { + format = String.Format(format, args); + } + throw new FormatException( + String.Format(FrameworkPortability.InvariantCulture, + "({0},{1}) error: {2}", _lineNo, _linePos, format)); + } + } + + #endregion + + private char ReadChar() + { + int ch = Read(); + Assert(ch != -1, "Unexpected end of file."); + if (ch == '\n') + { + _lineNo++; + _linePos = 0; + } + else if (ch != '\r') + { + _linePos++; + } + _next = Peek(); + return (char) ch; + } + + public void Consume(char ch) + { + Assert(TryConsume(ch), ch); + } + + public bool TryConsume(char ch) + { + SkipWhitespace(); + if (_next == ch) + { + ReadChar(); + return true; + } + return false; + } + + public void Consume(string sequence) + { + SkipWhitespace(); + + foreach (char ch in sequence) + { + Assert(ch == ReadChar(), "Expected token '{0}'.", sequence); + } + } + + public void SkipWhitespace() + { + int chnext = _next; + while (chnext != -1) + { + if (!Char.IsWhiteSpace((char) chnext)) + { + break; + } + ReadChar(); + chnext = _next; + } + } + + public string ReadString() + { + SkipWhitespace(); + Consume('"'); + List sb = new List(100); + while (_next != '"') + { + if (_next == '\\') + { + Consume('\\'); //skip the escape + char ch = ReadChar(); + switch (ch) + { + case 'b': + sb.Add('\b'); + break; + case 'f': + sb.Add('\f'); + break; + case 'n': + sb.Add('\n'); + break; + case 'r': + sb.Add('\r'); + break; + case 't': + sb.Add('\t'); + break; + case 'u': + { + string hex = new string(new char[] {ReadChar(), ReadChar(), ReadChar(), ReadChar()}); + int result; + Assert( + FrameworkPortability.TryParseInt32(hex, NumberStyles.AllowHexSpecifier, FrameworkPortability.InvariantCulture, + out result), + "Expected a 4-character hex specifier."); + sb.Add((char) result); + break; + } + default: + sb.Add(ch); + break; + } + } + else + { + Assert(_next != '\n' && _next != '\r' && _next != '\f' && _next != -1, '"'); + sb.Add(ReadChar()); + } + } + Consume('"'); + return new String(sb.ToArray()); + } + + public string ReadNumber() + { + SkipWhitespace(); + List sb = new List(24); + if (_next == '-') + { + sb.Add(ReadChar()); + } + Assert(_next >= '0' && _next <= '9', "Expected a numeric type."); + while ((_next >= '0' && _next <= '9') || _next == '.') + { + sb.Add(ReadChar()); + } + if (_next == 'e' || _next == 'E') + { + sb.Add(ReadChar()); + if (_next == '-' || _next == '+') + { + sb.Add(ReadChar()); + } + Assert(_next >= '0' && _next <= '9', "Expected a numeric type."); + while (_next >= '0' && _next <= '9') + { + sb.Add(ReadChar()); + } + } + return new String(sb.ToArray()); + } + + public JsType ReadVariant(out object value) + { + SkipWhitespace(); + switch (_next) + { + case 'n': + Consume("null"); + value = null; + return JsType.Null; + case 't': + Consume("true"); + value = true; + return JsType.True; + case 'f': + Consume("false"); + value = false; + return JsType.False; + case '"': + value = ReadString(); + return JsType.String; + case '{': + { + Consume('{'); + while (NextChar != '}') + { + ReadString(); + Consume(':'); + object tmp; + ReadVariant(out tmp); + if (!TryConsume(',')) + { + break; + } + } + Consume('}'); + value = null; + return JsType.Object; + } + case '[': + { + Consume('['); + List values = new List(); + while (NextChar != ']') + { + object tmp; + ReadVariant(out tmp); + values.Add(tmp); + if (!TryConsume(',')) + { + break; + } + } + Consume(']'); + value = values.ToArray(); + return JsType.Array; + } + default: + if ((_next >= '0' && _next <= '9') || _next == '-') + { + value = ReadNumber(); + return JsType.Number; + } + Assert(false, "Expected a value."); + throw new FormatException(); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs b/csharp/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..c6420b56 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/Properties/AssemblyInfo.cs @@ -0,0 +1,67 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("ProtocolBuffers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtocolBuffers")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.4.1.555")] + +[assembly: AssemblyVersion("2.4.1.555")] + +#if !NOFILEVERSION +[assembly: AssemblyFileVersion("2.4.1.555")] +#endif + +[assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.CF20.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.CF20.csproj new file mode 100644 index 00000000..0639ec65 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.CF20.csproj @@ -0,0 +1,104 @@ + + + COMPACT_FRAMEWORK + CF20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF20\Debug + obj\CF20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + Off + true + + + pdbonly + true + bin\CF20\Release + obj\CF20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.CF35.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.CF35.csproj new file mode 100644 index 00000000..22f381f9 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.CF35.csproj @@ -0,0 +1,104 @@ + + + COMPACT_FRAMEWORK + CF35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF35\Debug + obj\CF35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + Off + true + + + pdbonly + true + bin\CF35\Release + obj\CF35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.NET20.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.NET20.csproj new file mode 100644 index 00000000..dfeab79c --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.NET20.csproj @@ -0,0 +1,92 @@ + + + CLIENTPROFILE + NET20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET20\Debug + obj\NET20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + Off + + + pdbonly + true + bin\NET20\Release + obj\NET20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.NET35.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.NET35.csproj new file mode 100644 index 00000000..4bed60d7 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.NET35.csproj @@ -0,0 +1,92 @@ + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.NET40.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.NET40.csproj new file mode 100644 index 00000000..80b76a0e --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.NET40.csproj @@ -0,0 +1,92 @@ + + + CLIENTPROFILE + NET40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET40\Debug + obj\NET40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET40\Release + obj\NET40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.PL40.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.PL40.csproj new file mode 100644 index 00000000..60f87748 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.PL40.csproj @@ -0,0 +1,95 @@ + + + PORTABLE_LIBRARY + PL40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + 10.0 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Profile1 + + + true + full + false + bin\PL40\Debug + obj\PL40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + + + pdbonly + true + bin\PL40\Release + obj\PL40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.SL20.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.SL20.csproj new file mode 100644 index 00000000..f8c4c097 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.SL20.csproj @@ -0,0 +1,107 @@ + + + SILVERLIGHT + SL20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + + + true + full + false + bin\SL20\Debug + obj\SL20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL20\Release + obj\SL20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.SL30.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.SL30.csproj new file mode 100644 index 00000000..376c4936 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.SL30.csproj @@ -0,0 +1,107 @@ + + + SILVERLIGHT + SL30 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + + + true + full + false + bin\SL30\Debug + obj\SL30\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL30\Release + obj\SL30\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.SL40.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.SL40.csproj new file mode 100644 index 00000000..dc675c47 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.SL40.csproj @@ -0,0 +1,108 @@ + + + SILVERLIGHT + SL40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + v4.0 + + + true + full + false + bin\SL40\Debug + obj\SL40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL40\Release + obj\SL40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj new file mode 100644 index 00000000..b9f728b8 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffers.Serialization.csproj @@ -0,0 +1,93 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {231391AF-449C-4A39-986C-AD7F270F4750} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffers.Serialization + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.CF20.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.CF20.csproj new file mode 100644 index 00000000..b382dc3e --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.CF20.csproj @@ -0,0 +1,104 @@ + + + COMPACT_FRAMEWORK + CF20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF20\Debug + obj\CF20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + Off + true + + + pdbonly + true + bin\CF20\Release + obj\CF20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.CF35.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.CF35.csproj new file mode 100644 index 00000000..558931d5 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.CF35.csproj @@ -0,0 +1,104 @@ + + + COMPACT_FRAMEWORK + CF35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF35\Debug + obj\CF35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + Off + true + + + pdbonly + true + bin\CF35\Release + obj\CF35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.NET20.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.NET20.csproj new file mode 100644 index 00000000..1e145abe --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.NET20.csproj @@ -0,0 +1,92 @@ + + + CLIENTPROFILE + NET20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET20\Debug + obj\NET20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + Off + + + pdbonly + true + bin\NET20\Release + obj\NET20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.NET35.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.NET35.csproj new file mode 100644 index 00000000..9fd744c5 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.NET35.csproj @@ -0,0 +1,92 @@ + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.NET40.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.NET40.csproj new file mode 100644 index 00000000..1254fdf2 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.NET40.csproj @@ -0,0 +1,92 @@ + + + CLIENTPROFILE + NET40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET40\Debug + obj\NET40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET40\Release + obj\NET40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.PL40.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.PL40.csproj new file mode 100644 index 00000000..c6fbb6a7 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.PL40.csproj @@ -0,0 +1,95 @@ + + + PORTABLE_LIBRARY + PL40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + 10.0 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Profile1 + + + true + full + false + bin\PL40\Debug + obj\PL40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + + + pdbonly + true + bin\PL40\Release + obj\PL40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.SL20.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.SL20.csproj new file mode 100644 index 00000000..9e891070 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.SL20.csproj @@ -0,0 +1,107 @@ + + + SILVERLIGHT + SL20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + + + true + full + false + bin\SL20\Debug + obj\SL20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL20\Release + obj\SL20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.SL30.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.SL30.csproj new file mode 100644 index 00000000..6d3ac128 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.SL30.csproj @@ -0,0 +1,107 @@ + + + SILVERLIGHT + SL30 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + + + true + full + false + bin\SL30\Debug + obj\SL30\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL30\Release + obj\SL30\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.SL40.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.SL40.csproj new file mode 100644 index 00000000..9b341632 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.SL40.csproj @@ -0,0 +1,108 @@ + + + SILVERLIGHT + SL40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + v4.0 + + + true + full + false + bin\SL40\Debug + obj\SL40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL40\Release + obj\SL40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.csproj b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.csproj new file mode 100644 index 00000000..c1754cf2 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/ProtocolBuffersLite.Serialization.csproj @@ -0,0 +1,93 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + Library + Properties + Google.ProtocolBuffers.Serialization + Google.ProtocolBuffersLite.Serialization + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + FrameworkPortability.cs + + + + + + + + + + + + + + + + + + + + + + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + False + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/RecursionLimitExceeded.cs b/csharp/src/ProtocolBuffers.Serialization/RecursionLimitExceeded.cs new file mode 100644 index 00000000..14e72ba8 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/RecursionLimitExceeded.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// The exception raised when a recursion limit is reached while parsing input. + /// + public sealed class RecursionLimitExceededException : FormatException + { + const string message = "Possible malicious message had too many levels of nesting."; + + internal RecursionLimitExceededException() : base(message) + { + } + } +} diff --git a/csharp/src/ProtocolBuffers.Serialization/XmlFormatReader.cs b/csharp/src/ProtocolBuffers.Serialization/XmlFormatReader.cs new file mode 100644 index 00000000..a4f111d4 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/XmlFormatReader.cs @@ -0,0 +1,338 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml; +using System.Diagnostics; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Parses a proto buffer from an XML document or fragment. .NET 3.5 users may also + /// use this class to process Json by setting the options to support Json and providing + /// an XmlReader obtained from . + /// + public class XmlFormatReader : AbstractTextReader + { + public const string DefaultRootElementName = XmlFormatWriter.DefaultRootElementName; + private readonly XmlReader _input; + // Tracks the message element for each nested message read + private readonly Stack _elements; + // The default element name for ReadMessageStart + private string _rootElementName; + + private struct ElementStackEntry + { + public readonly string LocalName; + public readonly int Depth; + public readonly bool IsEmpty; + + public ElementStackEntry(string localName, int depth, bool isEmpty) : this() + { + LocalName = localName; + IsEmpty = isEmpty; + Depth = depth; + } + } + + private static XmlReaderSettings DefaultSettings + { + get + { + return new XmlReaderSettings() + {CheckCharacters = false, IgnoreComments = true, IgnoreProcessingInstructions = true}; + } + } + + /// + /// Constructs the XmlFormatReader using the stream provided as the xml + /// + public static XmlFormatReader CreateInstance(byte[] input) + { + return new XmlFormatReader(XmlReader.Create(new MemoryStream(input, false), DefaultSettings)); + } + + /// + /// Constructs the XmlFormatReader using the stream provided as the xml + /// + public static XmlFormatReader CreateInstance(Stream input) + { + return new XmlFormatReader(XmlReader.Create(input, DefaultSettings)); + } + + /// + /// Constructs the XmlFormatReader using the string provided as the xml to be read + /// + public static XmlFormatReader CreateInstance(String input) + { + return new XmlFormatReader(XmlReader.Create(new StringReader(input), DefaultSettings)); + } + + /// + /// Constructs the XmlFormatReader using the xml in the TextReader + /// + public static XmlFormatReader CreateInstance(TextReader input) + { + return new XmlFormatReader(XmlReader.Create(input, DefaultSettings)); + } + + /// + /// Constructs the XmlFormatReader with the XmlReader + /// + public static XmlFormatReader CreateInstance(XmlReader input) + { + return new XmlFormatReader(input); + } + + /// + /// Constructs the XmlFormatReader with the XmlReader and options + /// + protected XmlFormatReader(XmlReader input) + { + _input = input; + _rootElementName = DefaultRootElementName; + _elements = new Stack(); + Options = XmlReaderOptions.None; + } + + /// + /// Gets or sets the options to use when reading the xml + /// + public XmlReaderOptions Options { get; set; } + + /// + /// Sets the options to use while generating the XML + /// + public XmlFormatReader SetOptions(XmlReaderOptions options) + { + Options = options; + return this; + } + + /// + /// Gets or sets the default element name to use when using the Merge<TBuilder>() + /// + public string RootElementName + { + get { return _rootElementName; } + set + { + ThrowHelper.ThrowIfNull(value, "RootElementName"); + _rootElementName = value; + } + } + + [DebuggerNonUserCode] + private static void Assert(bool cond) + { + if (!cond) + { + throw new FormatException(); + } + } + + /// + /// Reads the root-message preamble specific to this formatter + /// + public override void ReadMessageStart() + { + ReadMessageStart(_rootElementName); + } + + /// + /// Reads the root-message preamble specific to this formatter + /// + public void ReadMessageStart(string element) + { + while (!_input.IsStartElement() && _input.Read()) + { + continue; + } + Assert(_input.IsStartElement() && _input.LocalName == element); + _elements.Push(new ElementStackEntry(element, _input.Depth, _input.IsEmptyElement)); + _input.Read(); + } + + /// + /// Reads the root-message close specific to this formatter, MUST be called + /// on the reader obtained from ReadMessageStart(string element). + /// + public override void ReadMessageEnd() + { + Assert(_elements.Count > 0); + + ElementStackEntry stop = _elements.Peek(); + while (_input.NodeType != XmlNodeType.EndElement && _input.NodeType != XmlNodeType.Element + && _input.Depth > stop.Depth && _input.Read()) + { + continue; + } + + if (!stop.IsEmpty) + { + Assert(_input.NodeType == XmlNodeType.EndElement + && _input.LocalName == stop.LocalName + && _input.Depth == stop.Depth); + + _input.Read(); + } + _elements.Pop(); + } + + /// + /// Merge the provided builder as an element named in the current context + /// + public override TBuilder Merge(TBuilder builder, ExtensionRegistry registry) + { + return Merge(_rootElementName, builder, registry); + } + + /// + /// Merge the provided builder as an element of the current context + /// + public TBuilder Merge(string element, TBuilder builder) where TBuilder : IBuilderLite + { + return Merge(element, builder, ExtensionRegistry.Empty); + } + + /// + /// Merge the provided builder as an element of the current context + /// + public TBuilder Merge(string element, TBuilder builder, ExtensionRegistry registry) + where TBuilder : IBuilderLite + { + ReadMessageStart(element); + builder.WeakMergeFrom(this, registry); + ReadMessageEnd(); + return builder; + } + + /// + /// Peeks at the next field in the input stream and returns what information is available. + /// + /// + /// This may be called multiple times without actually reading the field. Only after the field + /// is either read, or skipped, should PeekNext return a different value. + /// + protected override bool PeekNext(out string field) + { + ElementStackEntry stopNode; + if (_elements.Count == 0) + { + stopNode = new ElementStackEntry(null, _input.Depth - 1, false); + } + else + { + stopNode = _elements.Peek(); + } + + if (!stopNode.IsEmpty) + { + while (!_input.IsStartElement() && _input.Depth > stopNode.Depth && _input.Read()) + { + continue; + } + + if (_input.IsStartElement() && _input.Depth > stopNode.Depth) + { + field = _input.LocalName; + return true; + } + } + field = null; + return false; + } + + /// + /// Causes the reader to skip past this field + /// + protected override void Skip() + { + if (_input.IsStartElement()) + { + if (!_input.IsEmptyElement) + { + int depth = _input.Depth; + while (_input.Depth >= depth && _input.NodeType != XmlNodeType.EndElement) + { + Assert(_input.Read()); + } + } + _input.Read(); + } + } + + /// + /// returns true if it was able to read a single value into the value reference. The value + /// stored may be of type System.String, System.Int32, or an IEnumLite from the IEnumLiteMap. + /// + protected override bool ReadEnum(ref object value) + { + int number; + string temp; + if (null != (temp = _input.GetAttribute("value")) && FrameworkPortability.TryParseInt32(temp, out number)) + { + Skip(); + value = number; + return true; + } + return base.ReadEnum(ref value); + } + + /// + /// Returns true if it was able to read a String from the input + /// + protected override bool ReadAsText(ref string value, Type type) + { + Assert(_input.NodeType == XmlNodeType.Element); + value = _input.ReadElementContentAsString(); + + return true; + } + + /// + /// Merges the input stream into the provided IBuilderLite + /// + protected override bool ReadMessage(IBuilderLite builder, ExtensionRegistry registry) + { + Assert(_input.IsStartElement()); + ReadMessageStart(_input.LocalName); + builder.WeakMergeFrom(this, registry); + ReadMessageEnd(); + return true; + } + + private IEnumerable NonNestedArrayItems(string field) + { + return base.ForeachArrayItem(field); + } + + /// + /// Cursors through the array elements and stops at the end of the array + /// + protected override IEnumerable ForeachArrayItem(string field) + { + bool isNested = (Options & XmlReaderOptions.ReadNestedArrays) != 0; + + if (!isNested) + { + foreach (string item in NonNestedArrayItems(field)) + { + yield return item; + } + } + else + { + string found; + ReadMessageStart(field); + if (PeekNext(out found) && found == "item") + { + foreach (string item in NonNestedArrayItems("item")) + { + yield return item; + } + } + ReadMessageEnd(); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs b/csharp/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs new file mode 100644 index 00000000..4bd27562 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/XmlFormatWriter.cs @@ -0,0 +1,280 @@ +using System; +using System.Collections; +using System.IO; +using System.Text; +using System.Xml; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Writes a proto buffer to an XML document or fragment. .NET 3.5 users may also + /// use this class to produce Json by setting the options to support Json and providing + /// an XmlWriter obtained from . + /// + public class XmlFormatWriter : AbstractTextWriter + { + private static readonly Encoding DefaultEncoding = new UTF8Encoding(false); + public const string DefaultRootElementName = "root"; + + private readonly XmlWriter _output; + // The default element name used for WriteMessageStart + private string _rootElementName; + // Used to assert matching WriteMessageStart/WriteMessageEnd calls + private int _messageOpenCount; + + private static XmlWriterSettings DefaultSettings(Encoding encoding) + { + return new XmlWriterSettings() + { + CheckCharacters = false, + NewLineHandling = NewLineHandling.Entitize, + OmitXmlDeclaration = true, + Encoding = encoding, + }; + } + + /// + /// Constructs the XmlFormatWriter to write to the given TextWriter + /// + public static XmlFormatWriter CreateInstance(TextWriter output) + { + return new XmlFormatWriter(XmlWriter.Create(output, DefaultSettings(output.Encoding))); + } + + /// + /// Constructs the XmlFormatWriter to write to the given stream + /// + public static XmlFormatWriter CreateInstance(Stream output) + { + return new XmlFormatWriter(XmlWriter.Create(output, DefaultSettings(DefaultEncoding))); + } + + /// + /// Constructs the XmlFormatWriter to write to the given stream + /// + public static XmlFormatWriter CreateInstance(Stream output, Encoding encoding) + { + return new XmlFormatWriter(XmlWriter.Create(output, DefaultSettings(encoding))); + } + + /// + /// Constructs the XmlFormatWriter to write to the given XmlWriter + /// + public static XmlFormatWriter CreateInstance(XmlWriter output) + { + return new XmlFormatWriter(output); + } + + protected XmlFormatWriter(XmlWriter output) + { + _output = output; + _messageOpenCount = 0; + _rootElementName = DefaultRootElementName; + } + + /// + /// Gets or sets the default element name to use when using the Merge<TBuilder>() + /// + public string RootElementName + { + get { return _rootElementName; } + set + { + ThrowHelper.ThrowIfNull(value, "RootElementName"); + _rootElementName = value; + } + } + + /// + /// Gets or sets the options to use while generating the XML + /// + public XmlWriterOptions Options { get; set; } + + /// + /// Sets the options to use while generating the XML + /// + public XmlFormatWriter SetOptions(XmlWriterOptions options) + { + Options = options; + return this; + } + + private bool TestOption(XmlWriterOptions option) + { + return (Options & option) != 0; + } + + /// + /// Completes any pending write operations + /// + public override void Flush() + { + _output.Flush(); + base.Flush(); + } + + /// + /// Used to write the root-message preamble, in xml this is open element for RootElementName, + /// by default "<root>". After this call you can call IMessageLite.MergeTo(...) and + /// complete the message with a call to WriteMessageEnd(). + /// + public override void WriteMessageStart() + { + WriteMessageStart(_rootElementName); + } + + /// + /// Used to write the root-message preamble, in xml this is open element for elementName. + /// After this call you can call IMessageLite.MergeTo(...) and complete the message with + /// a call to WriteMessageEnd(). + /// + public void WriteMessageStart(string elementName) + { + if (TestOption(XmlWriterOptions.OutputJsonTypes)) + { + _output.WriteStartElement("root"); // json requires this is the root-element + _output.WriteAttributeString("type", "object"); + } + else + { + _output.WriteStartElement(elementName); + } + _messageOpenCount++; + } + + /// + /// Used to complete a root-message previously started with a call to WriteMessageStart() + /// + public override void WriteMessageEnd() + { + if (_messageOpenCount <= 0) + { + throw new InvalidOperationException(); + } + + _output.WriteEndElement(); + _output.Flush(); + _messageOpenCount--; + } + + /// + /// Writes a message as an element using the name defined in + /// + public override void WriteMessage(IMessageLite message) + { + WriteMessage(_rootElementName, message); + } + + /// + /// Writes a message as an element with the given name + /// + public void WriteMessage(string elementName, IMessageLite message) + { + WriteMessageStart(elementName); + message.WriteTo(this); + WriteMessageEnd(); + } + + /// + /// Writes a message + /// + protected override void WriteMessageOrGroup(string field, IMessageLite message) + { + _output.WriteStartElement(field); + + if (TestOption(XmlWriterOptions.OutputJsonTypes)) + { + _output.WriteAttributeString("type", "object"); + } + + message.WriteTo(this); + _output.WriteEndElement(); + } + + /// + /// Writes a String value + /// + protected override void WriteAsText(string field, string textValue, object typedValue) + { + _output.WriteStartElement(field); + + if (TestOption(XmlWriterOptions.OutputJsonTypes)) + { + if (typedValue is int || typedValue is uint || typedValue is long || typedValue is ulong || + typedValue is double || typedValue is float) + { + _output.WriteAttributeString("type", "number"); + } + else if (typedValue is bool) + { + _output.WriteAttributeString("type", "boolean"); + } + } + _output.WriteString(textValue); + + //Empty strings should not be written as empty elements '', rather as '' + if (_output.WriteState == WriteState.Element) + { + _output.WriteRaw(""); + } + + _output.WriteEndElement(); + } + + /// + /// Writes an array of field values + /// + protected override void WriteArray(FieldType fieldType, string field, IEnumerable items) + { + //see if it's empty + IEnumerator eitems = items.GetEnumerator(); + try + { + if (!eitems.MoveNext()) + { + return; + } + } + finally + { + if (eitems is IDisposable) + { + ((IDisposable) eitems).Dispose(); + } + } + + if (TestOption(XmlWriterOptions.OutputNestedArrays | XmlWriterOptions.OutputJsonTypes)) + { + _output.WriteStartElement(field); + if (TestOption(XmlWriterOptions.OutputJsonTypes)) + { + _output.WriteAttributeString("type", "array"); + } + + base.WriteArray(fieldType, "item", items); + _output.WriteEndElement(); + } + else + { + base.WriteArray(fieldType, field, items); + } + } + + /// + /// Writes a System.Enum by the numeric and textual value + /// + protected override void WriteEnum(string field, int number, string name) + { + _output.WriteStartElement(field); + + if (!TestOption(XmlWriterOptions.OutputJsonTypes) && TestOption(XmlWriterOptions.OutputEnumValues)) + { + _output.WriteAttributeString("value", XmlConvert.ToString(number)); + } + + _output.WriteString(name); + _output.WriteEndElement(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/XmlReaderOptions.cs b/csharp/src/ProtocolBuffers.Serialization/XmlReaderOptions.cs new file mode 100644 index 00000000..f7eca1d7 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/XmlReaderOptions.cs @@ -0,0 +1,17 @@ +using System; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Options available for the xml reader output + /// + [Flags] + public enum XmlReaderOptions + { + /// Simple xml formatting with no attributes + None, + + /// Requires that arrays items are nested in an <item> element + ReadNestedArrays = 1, + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Serialization/XmlWriterOptions.cs b/csharp/src/ProtocolBuffers.Serialization/XmlWriterOptions.cs new file mode 100644 index 00000000..7d740ee3 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Serialization/XmlWriterOptions.cs @@ -0,0 +1,24 @@ +using System; + +namespace Google.ProtocolBuffers.Serialization +{ + /// + /// Options available for the xml writer output + /// + [Flags] + public enum XmlWriterOptions + { + /// Simple xml formatting with no attributes + None, + + /// Writes the 'value' attribute on all enumerations with the numeric identifier + OutputEnumValues = 0x1, + + /// Embeds array items into child <item> elements + OutputNestedArrays = 0x4, + + /// Outputs the 'type' attribute for compatibility with the JsonReaderWriterFactory + /// This option must, by nessessity, also enable NestedArrayItems + OutputJsonTypes = 0x8, + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/AbstractMessageTest.cs b/csharp/src/ProtocolBuffers.Test/AbstractMessageTest.cs new file mode 100644 index 00000000..02793aeb --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/AbstractMessageTest.cs @@ -0,0 +1,521 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.Descriptors; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Google.ProtocolBuffers.TestProtos; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class AbstractMessageTest + { + [TestMethod] + public void Clear() + { + AbstractMessageWrapper message = + new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder(TestUtil.GetAllSet())).Clear().Build(); + TestUtil.AssertClear((TestAllTypes) message.WrappedMessage); + } + + [TestMethod] + public void Copy() + { + AbstractMessageWrapper message = + new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder()).MergeFrom(TestUtil.GetAllSet()).Build(); + TestUtil.AssertAllFieldsSet((TestAllTypes) message.WrappedMessage); + } + + [TestMethod] + public void CreateAndBuild() + { + TestAllTypes.CreateBuilder() + .Build(); + } + + [TestMethod] + public void SerializedSize() + { + TestAllTypes message = TestUtil.GetAllSet(); + IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetAllSet()); + + Assert.AreEqual(message.SerializedSize, abstractMessage.SerializedSize); + } + + [TestMethod] + public void Serialization() + { + IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetAllSet()); + TestUtil.AssertAllFieldsSet(TestAllTypes.ParseFrom(abstractMessage.ToByteString())); + Assert.AreEqual(TestUtil.GetAllSet().ToByteString(), abstractMessage.ToByteString()); + } + + [TestMethod] + public void Parsing() + { + IBuilder builder = new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder()); + AbstractMessageWrapper message = + (AbstractMessageWrapper) builder.WeakMergeFrom(TestUtil.GetAllSet().ToByteString()).WeakBuild(); + TestUtil.AssertAllFieldsSet((TestAllTypes) message.WrappedMessage); + } + + [TestMethod] + public void PackedSerialization() + { + IMessage abstractMessage = new AbstractMessageWrapper(TestUtil.GetPackedSet()); + TestUtil.AssertPackedFieldsSet(TestPackedTypes.ParseFrom(abstractMessage.ToByteString())); + Assert.AreEqual(TestUtil.GetPackedSet().ToByteString(), abstractMessage.ToByteString()); + } + + [TestMethod] + public void PackedParsing() + { + AbstractMessageWrapper.Builder builder = new AbstractMessageWrapper.Builder(TestPackedTypes.CreateBuilder()); + AbstractMessageWrapper message = builder.MergeFrom(TestUtil.GetPackedSet().ToByteString()).Build(); + TestUtil.AssertPackedFieldsSet((TestPackedTypes)message.WrappedMessage); + } + + [TestMethod] + public void UnpackedParsingOfPackedInput() + { + byte[] bytes = TestUtil.GetPackedSet().ToByteArray(); + TestUnpackedTypes message = TestUnpackedTypes.ParseFrom(bytes); + TestUtil.AssertUnpackedFieldsSet(message); + } + + [TestMethod] + public void PackedParsingOfUnpackedInput() + { + byte[] bytes = TestUnpackedTypes.ParseFrom(TestUtil.GetPackedSet().ToByteArray()).ToByteArray(); + TestPackedTypes message = TestPackedTypes.ParseFrom(bytes); + TestUtil.AssertPackedFieldsSet(message); + } + + [TestMethod] + public void UnpackedParsingOfPackedInputExtensions() + { + byte[] bytes = TestUtil.GetPackedSet().ToByteArray(); + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestProtoFile.RegisterAllExtensions(registry); + UnitTestExtrasProtoFile.RegisterAllExtensions(registry); + TestUnpackedExtensions message = TestUnpackedExtensions.ParseFrom(bytes, registry); + TestUtil.AssertUnpackedExtensionsSet(message); + } + + [TestMethod] + public void PackedParsingOfUnpackedInputExtensions() + { + byte[] bytes = TestUnpackedTypes.ParseFrom(TestUtil.GetPackedSet().ToByteArray()).ToByteArray(); + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestProtoFile.RegisterAllExtensions(registry); + TestPackedExtensions message = TestPackedExtensions.ParseFrom(bytes, registry); + TestUtil.AssertPackedExtensionsSet(message); + } + + [TestMethod] + public void OptimizedForSize() + { + // We're mostly only Checking that this class was compiled successfully. + TestOptimizedForSize message = TestOptimizedForSize.CreateBuilder().SetI(1).Build(); + message = TestOptimizedForSize.ParseFrom(message.ToByteString()); + Assert.AreEqual(2, message.SerializedSize); + } + + // ----------------------------------------------------------------- + // Tests for isInitialized(). + + private static readonly TestRequired TestRequiredUninitialized = TestRequired.DefaultInstance; + + private static readonly TestRequired TestRequiredInitialized = + TestRequired.CreateBuilder().SetA(1).SetB(2).SetC(3).Build(); + + [TestMethod] + public void IsInitialized() + { + TestRequired.Builder builder = TestRequired.CreateBuilder(); + AbstractMessageWrapper.Builder abstractBuilder = new AbstractMessageWrapper.Builder(builder); + + Assert.IsFalse(abstractBuilder.IsInitialized); + builder.A = 1; + Assert.IsFalse(abstractBuilder.IsInitialized); + builder.B = 1; + Assert.IsFalse(abstractBuilder.IsInitialized); + builder.C = 1; + Assert.IsTrue(abstractBuilder.IsInitialized); + } + + [TestMethod] + public void ForeignIsInitialized() + { + TestRequiredForeign.Builder builder = TestRequiredForeign.CreateBuilder(); + AbstractMessageWrapper.Builder abstractBuilder = new AbstractMessageWrapper.Builder(builder); + + Assert.IsTrue(abstractBuilder.IsInitialized); + + builder.SetOptionalMessage(TestRequiredUninitialized); + Assert.IsFalse(abstractBuilder.IsInitialized); + + builder.SetOptionalMessage(TestRequiredInitialized); + Assert.IsTrue(abstractBuilder.IsInitialized); + + builder.AddRepeatedMessage(TestRequiredUninitialized); + Assert.IsFalse(abstractBuilder.IsInitialized); + + builder.SetRepeatedMessage(0, TestRequiredInitialized); + Assert.IsTrue(abstractBuilder.IsInitialized); + } + + // ----------------------------------------------------------------- + // Tests for mergeFrom + + private static readonly TestAllTypes MergeSource = TestAllTypes.CreateBuilder() + .SetOptionalInt32(1) + .SetOptionalString("foo") + .SetOptionalForeignMessage(ForeignMessage.DefaultInstance) + .AddRepeatedString("bar") + .Build(); + + private static readonly TestAllTypes MergeDest = TestAllTypes.CreateBuilder() + .SetOptionalInt64(2) + .SetOptionalString("baz") + .SetOptionalForeignMessage(ForeignMessage.CreateBuilder().SetC(3).Build()) + .AddRepeatedString("qux") + .Build(); + + private const string MergeResultText = "optional_int32: 1\n" + + "optional_int64: 2\n" + + "optional_string: \"foo\"\n" + + "optional_foreign_message {\n" + + " c: 3\n" + + "}\n" + + "repeated_string: \"qux\"\n" + + "repeated_string: \"bar\"\n"; + + [TestMethod] + public void MergeFrom() + { + AbstractMessageWrapper result = (AbstractMessageWrapper) + new AbstractMessageWrapper.Builder(TestAllTypes.CreateBuilder(MergeDest)) + .MergeFrom(MergeSource) + .Build(); + + Assert.AreEqual(MergeResultText, result.ToString()); + } + + // ----------------------------------------------------------------- + // Tests for equals and hashCode + + [TestMethod] + public void EqualsAndHashCode() + { + TestAllTypes a = TestUtil.GetAllSet(); + TestAllTypes b = TestAllTypes.CreateBuilder().Build(); + TestAllTypes c = TestAllTypes.CreateBuilder(b).AddRepeatedString("x").Build(); + TestAllTypes d = TestAllTypes.CreateBuilder(c).AddRepeatedString("y").Build(); + TestAllExtensions e = TestUtil.GetAllExtensionsSet(); + TestAllExtensions f = TestAllExtensions.CreateBuilder(e) + .AddExtension(UnitTestProtoFile.RepeatedInt32Extension, 999).Build(); + + CheckEqualsIsConsistent(a); + CheckEqualsIsConsistent(b); + CheckEqualsIsConsistent(c); + CheckEqualsIsConsistent(d); + CheckEqualsIsConsistent(e); + CheckEqualsIsConsistent(f); + + CheckNotEqual(a, b); + CheckNotEqual(a, c); + CheckNotEqual(a, d); + CheckNotEqual(a, e); + CheckNotEqual(a, f); + + CheckNotEqual(b, c); + CheckNotEqual(b, d); + CheckNotEqual(b, e); + CheckNotEqual(b, f); + + CheckNotEqual(c, d); + CheckNotEqual(c, e); + CheckNotEqual(c, f); + + CheckNotEqual(d, e); + CheckNotEqual(d, f); + + CheckNotEqual(e, f); + + // Deserializing into the TestEmptyMessage such that every field is an UnknownFieldSet.Field + TestEmptyMessage eUnknownFields = TestEmptyMessage.ParseFrom(e.ToByteArray()); + TestEmptyMessage fUnknownFields = TestEmptyMessage.ParseFrom(f.ToByteArray()); + CheckNotEqual(eUnknownFields, fUnknownFields); + CheckEqualsIsConsistent(eUnknownFields); + CheckEqualsIsConsistent(fUnknownFields); + + // Subseqent reconstitutions should be identical + TestEmptyMessage eUnknownFields2 = TestEmptyMessage.ParseFrom(e.ToByteArray()); + CheckEqualsIsConsistent(eUnknownFields, eUnknownFields2); + } + + /// + /// Asserts that the given protos are equal and have the same hash code. + /// + private static void CheckEqualsIsConsistent(IMessage message) + { + // Object should be equal to itself. + Assert.AreEqual(message, message); + + // Object should be equal to a dynamic copy of itself. + DynamicMessage dynamic = DynamicMessage.CreateBuilder(message).Build(); + CheckEqualsIsConsistent(message, dynamic); + } + + /// + /// Asserts that the given protos are equal and have the same hash code. + /// + private static void CheckEqualsIsConsistent(IMessage message1, IMessage message2) + { + Assert.AreEqual(message1, message2); + Assert.AreEqual(message2, message1); + Assert.AreEqual(message2.GetHashCode(), message1.GetHashCode()); + } + + /// + /// Asserts that the given protos are not equal and have different hash codes. + /// + /// + /// It's valid for non-equal objects to have the same hash code, so + /// this test is stricter than it needs to be. However, this should happen + /// relatively rarely. (If this test fails, it's probably still due to a bug.) + /// + private static void CheckNotEqual(IMessage m1, IMessage m2) + { + String equalsError = string.Format("{0} should not be equal to {1}", m1, m2); + Assert.IsFalse(m1.Equals(m2), equalsError); + Assert.IsFalse(m2.Equals(m1), equalsError); + + Assert.IsFalse(m1.GetHashCode() == m2.GetHashCode(), + string.Format("{0} should have a different hash code from {1}", m1, m2)); + } + + /// + /// Extends AbstractMessage and wraps some other message object. The methods + /// of the Message interface which aren't explicitly implemented by + /// AbstractMessage are forwarded to the wrapped object. This allows us to + /// test that AbstractMessage's implementations work even if the wrapped + /// object does not use them. + /// + private class AbstractMessageWrapper : AbstractMessage + { + private readonly IMessage wrappedMessage; + + public IMessage WrappedMessage + { + get { return wrappedMessage; } + } + + public AbstractMessageWrapper(IMessage wrappedMessage) + { + this.wrappedMessage = wrappedMessage; + } + + public override MessageDescriptor DescriptorForType + { + get { return wrappedMessage.DescriptorForType; } + } + + public override AbstractMessageWrapper DefaultInstanceForType + { + get { return new AbstractMessageWrapper(wrappedMessage.WeakDefaultInstanceForType); } + } + + public override IDictionary AllFields + { + get { return wrappedMessage.AllFields; } + } + + public override bool HasField(FieldDescriptor field) + { + return wrappedMessage.HasField(field); + } + + public override object this[FieldDescriptor field] + { + get { return wrappedMessage[field]; } + } + + public override object this[FieldDescriptor field, int index] + { + get { return wrappedMessage[field, index]; } + } + + public override int GetRepeatedFieldCount(FieldDescriptor field) + { + return wrappedMessage.GetRepeatedFieldCount(field); + } + + public override UnknownFieldSet UnknownFields + { + get { return wrappedMessage.UnknownFields; } + } + + public override Builder CreateBuilderForType() + { + return new Builder(wrappedMessage.WeakCreateBuilderForType()); + } + + public override Builder ToBuilder() + { + return new Builder(wrappedMessage.WeakToBuilder()); + } + + internal class Builder : AbstractBuilder + { + private readonly IBuilder wrappedBuilder; + + protected override Builder ThisBuilder + { + get { return this; } + } + + internal Builder(IBuilder wrappedBuilder) + { + this.wrappedBuilder = wrappedBuilder; + } + + public override Builder MergeFrom(AbstractMessageWrapper other) + { + wrappedBuilder.WeakMergeFrom(other.wrappedMessage); + return this; + } + + public override bool IsInitialized + { + get { return wrappedBuilder.IsInitialized; } + } + + public override IDictionary AllFields + { + get { return wrappedBuilder.AllFields; } + } + + public override object this[FieldDescriptor field] + { + get { return wrappedBuilder[field]; } + set { wrappedBuilder[field] = value; } + } + + public override MessageDescriptor DescriptorForType + { + get { return wrappedBuilder.DescriptorForType; } + } + + public override int GetRepeatedFieldCount(FieldDescriptor field) + { + return wrappedBuilder.GetRepeatedFieldCount(field); + } + + public override object this[FieldDescriptor field, int index] + { + get { return wrappedBuilder[field, index]; } + set { wrappedBuilder[field, index] = value; } + } + + public override bool HasField(FieldDescriptor field) + { + return wrappedBuilder.HasField(field); + } + + public override UnknownFieldSet UnknownFields + { + get { return wrappedBuilder.UnknownFields; } + set { wrappedBuilder.UnknownFields = value; } + } + + public override AbstractMessageWrapper Build() + { + return new AbstractMessageWrapper(wrappedBuilder.WeakBuild()); + } + + public override AbstractMessageWrapper BuildPartial() + { + return new AbstractMessageWrapper(wrappedBuilder.WeakBuildPartial()); + } + + public override Builder Clone() + { + return new Builder(wrappedBuilder.WeakClone()); + } + + public override AbstractMessageWrapper DefaultInstanceForType + { + get { return new AbstractMessageWrapper(wrappedBuilder.WeakDefaultInstanceForType); } + } + + public override Builder ClearField(FieldDescriptor field) + { + wrappedBuilder.WeakClearField(field); + return this; + } + + public override Builder AddRepeatedField(FieldDescriptor field, object value) + { + wrappedBuilder.WeakAddRepeatedField(field, value); + return this; + } + + public override IBuilder CreateBuilderForField(FieldDescriptor field) + { + wrappedBuilder.CreateBuilderForField(field); + return this; + } + + public override Builder MergeFrom(IMessage other) + { + wrappedBuilder.WeakMergeFrom(other); + return this; + } + + public override Builder MergeFrom(ICodedInputStream input, ExtensionRegistry extensionRegistry) + { + wrappedBuilder.WeakMergeFrom(input, extensionRegistry); + return this; + } + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/App.xaml b/csharp/src/ProtocolBuffers.Test/App.xaml new file mode 100644 index 00000000..d4f1f2e3 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/csharp/src/ProtocolBuffers.Test/App.xaml.cs b/csharp/src/ProtocolBuffers.Test/App.xaml.cs new file mode 100644 index 00000000..0c9fd9e6 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/App.xaml.cs @@ -0,0 +1,60 @@ +using System; +using System.Windows; +using Microsoft.Silverlight.Testing; + +namespace Google.ProtocolBuffers +{ + public partial class App : Application + { + + public App() + { + this.Startup += this.Application_Startup; + this.Exit += this.Application_Exit; + this.UnhandledException += this.Application_UnhandledException; + + //InitializeComponent(); + } + + private void Application_Startup(object sender, StartupEventArgs e) + { + this.RootVisual = UnitTestSystem.CreateTestPage(); + } + + private void Application_Exit(object sender, EventArgs e) + { + + } + private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) + { + // If the app is running outside of the debugger then report the exception using + // the browser's exception mechanism. On IE this will display it a yellow alert + // icon in the status bar and Firefox will display a script error. + if (!System.Diagnostics.Debugger.IsAttached) + { + + // NOTE: This will allow the application to continue running after an exception has been thrown + // but not handled. + // For production applications this error handling should be replaced with something that will + // report the error to the website and stop the application. + e.Handled = true; + Deployment.Current.Dispatcher.BeginInvoke( + new EventHandler(ReportErrorToDOM), + new object[] { sender, e } ); + } + } + private void ReportErrorToDOM(object sender, ApplicationUnhandledExceptionEventArgs e) + { + try + { + string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; + errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); + + System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight 2 Application " + errorMsg + "\");"); + } + catch (Exception) + { + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ByteStringTest.cs b/csharp/src/ProtocolBuffers.Test/ByteStringTest.cs new file mode 100644 index 00000000..003307ae --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ByteStringTest.cs @@ -0,0 +1,148 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class ByteStringTest + { + [TestMethod] + public void EmptyByteStringHasZeroSize() + { + Assert.AreEqual(0, ByteString.Empty.Length); + } + + [TestMethod] + public void CopyFromStringWithExplicitEncoding() + { + ByteString bs = ByteString.CopyFrom("AB", Encoding.Unicode); + Assert.AreEqual(4, bs.Length); + Assert.AreEqual(65, bs[0]); + Assert.AreEqual(0, bs[1]); + Assert.AreEqual(66, bs[2]); + Assert.AreEqual(0, bs[3]); + } + + [TestMethod] + public void IsEmptyWhenEmpty() + { + Assert.IsTrue(ByteString.CopyFromUtf8("").IsEmpty); + } + + [TestMethod] + public void IsEmptyWhenNotEmpty() + { + Assert.IsFalse(ByteString.CopyFromUtf8("X").IsEmpty); + } + + [TestMethod] + public void CopyFromByteArrayCopiesContents() + { + byte[] data = new byte[1]; + data[0] = 10; + ByteString bs = ByteString.CopyFrom(data); + Assert.AreEqual(10, bs[0]); + data[0] = 5; + Assert.AreEqual(10, bs[0]); + } + + [TestMethod] + public void ToByteArrayCopiesContents() + { + ByteString bs = ByteString.CopyFromUtf8("Hello"); + byte[] data = bs.ToByteArray(); + Assert.AreEqual((byte)'H', data[0]); + Assert.AreEqual((byte)'H', bs[0]); + data[0] = 0; + Assert.AreEqual(0, data[0]); + Assert.AreEqual((byte)'H', bs[0]); + } + + [TestMethod] + public void CopyFromUtf8UsesUtf8() + { + ByteString bs = ByteString.CopyFromUtf8("\u20ac"); + Assert.AreEqual(3, bs.Length); + Assert.AreEqual(0xe2, bs[0]); + Assert.AreEqual(0x82, bs[1]); + Assert.AreEqual(0xac, bs[2]); + } + + [TestMethod] + public void CopyFromPortion() + { + byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; + ByteString bs = ByteString.CopyFrom(data, 2, 3); + Assert.AreEqual(3, bs.Length); + Assert.AreEqual(2, bs[0]); + Assert.AreEqual(3, bs[1]); + } + + [TestMethod] + public void ToStringUtf8() + { + ByteString bs = ByteString.CopyFromUtf8("\u20ac"); + Assert.AreEqual("\u20ac", bs.ToStringUtf8()); + } + + [TestMethod] + public void ToStringWithExplicitEncoding() + { + ByteString bs = ByteString.CopyFrom("\u20ac", Encoding.Unicode); + Assert.AreEqual("\u20ac", bs.ToString(Encoding.Unicode)); + } + + [TestMethod] + public void FromBase64_WithText() + { + byte[] data = new byte[] {0, 1, 2, 3, 4, 5, 6}; + string base64 = Convert.ToBase64String(data); + ByteString bs = ByteString.FromBase64(base64); + TestUtil.AssertBytesEqual(data, bs.ToByteArray()); + } + + [TestMethod] + public void FromBase64_Empty() + { + // Optimization which also fixes issue 61. + Assert.AreSame(ByteString.Empty, ByteString.FromBase64("")); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/CSharpOptionsTest.cs b/csharp/src/ProtocolBuffers.Test/CSharpOptionsTest.cs new file mode 100644 index 00000000..752d9a0c --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/CSharpOptionsTest.cs @@ -0,0 +1,127 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Descriptors; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class DescriptorUtilTest + { + [TestMethod] + public void ExplicitNamespace() + { + FileDescriptorProto proto = new FileDescriptorProto.Builder + { + Name = "x", + Package = "pack", + Options = + new FileOptions.Builder().SetExtension( + CSharpOptions.CSharpFileOptions, + new CSharpFileOptions.Builder {Namespace = "Foo.Bar"}.Build()). + Build() + }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("Foo.Bar", descriptor.CSharpOptions.Namespace); + } + + [TestMethod] + public void NoNamespaceFallsBackToPackage() + { + FileDescriptorProto proto = new FileDescriptorProto.Builder {Name = "x", Package = "pack"}.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("pack", descriptor.CSharpOptions.Namespace); + } + + [TestMethod] + public void NoNamespaceOrPackageFallsBackToEmptyString() + { + FileDescriptorProto proto = new FileDescriptorProto.Builder {Name = "x"}.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("", descriptor.CSharpOptions.Namespace); + } + + [TestMethod] + public void ExplicitlyNamedFileClass() + { + FileDescriptorProto proto = new FileDescriptorProto.Builder + { + Name = "x", + Options = + new FileOptions.Builder().SetExtension( + CSharpOptions.CSharpFileOptions, + new CSharpFileOptions.Builder {UmbrellaClassname = "Foo"}.Build()) + .Build() + }.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("Foo", descriptor.CSharpOptions.UmbrellaClassname); + } + + [TestMethod] + public void ImplicitFileClassWithProtoSuffix() + { + FileDescriptorProto proto = new FileDescriptorProto.Builder {Name = "foo_bar.proto"}.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("FooBar", descriptor.CSharpOptions.UmbrellaClassname); + } + + [TestMethod] + public void ImplicitFileClassWithProtoDevelSuffix() + { + FileDescriptorProto proto = new FileDescriptorProto.Builder {Name = "foo_bar.protodevel"}.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("FooBar", descriptor.CSharpOptions.UmbrellaClassname); + } + + [TestMethod] + public void ImplicitFileClassWithNoSuffix() + { + FileDescriptorProto proto = new FileDescriptorProto.Builder {Name = "foo_bar"}.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("FooBar", descriptor.CSharpOptions.UmbrellaClassname); + } + + [TestMethod] + public void ImplicitFileClassWithDirectoryStructure() + { + FileDescriptorProto proto = new FileDescriptorProto.Builder {Name = "x/y/foo_bar"}.Build(); + FileDescriptor descriptor = FileDescriptor.BuildFrom(proto, null); + Assert.AreEqual("FooBar", descriptor.CSharpOptions.UmbrellaClassname); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/CodedInputStreamTest.cs b/csharp/src/ProtocolBuffers.Test/CodedInputStreamTest.cs new file mode 100644 index 00000000..b09d3340 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/CodedInputStreamTest.cs @@ -0,0 +1,639 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Diagnostics; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class CodedInputStreamTest + { + /// + /// Helper to construct a byte array from a bunch of bytes. The inputs are + /// actually ints so that I can use hex notation and not get stupid errors + /// about precision. + /// + private static byte[] Bytes(params int[] bytesAsInts) + { + byte[] bytes = new byte[bytesAsInts.Length]; + for (int i = 0; i < bytesAsInts.Length; i++) + { + bytes[i] = (byte) bytesAsInts[i]; + } + return bytes; + } + + /// + /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() and + /// + private static void AssertReadVarint(byte[] data, ulong value) + { + CodedInputStream input = CodedInputStream.CreateInstance(data); + Assert.AreEqual((uint) value, input.ReadRawVarint32()); + + input = CodedInputStream.CreateInstance(data); + Assert.AreEqual(value, input.ReadRawVarint64()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + input = CodedInputStream.CreateInstance(new SmallBlockInputStream(data, bufferSize)); + Assert.AreEqual((uint) value, input.ReadRawVarint32()); + + input = CodedInputStream.CreateInstance(new SmallBlockInputStream(data, bufferSize)); + Assert.AreEqual(value, input.ReadRawVarint64()); + Assert.IsTrue(input.IsAtEnd); + } + + // Try reading directly from a MemoryStream. We want to verify that it + // doesn't read past the end of the input, so write an extra byte - this + // lets us test the position at the end. + MemoryStream memoryStream = new MemoryStream(); + memoryStream.Write(data, 0, data.Length); + memoryStream.WriteByte(0); + memoryStream.Position = 0; + Assert.AreEqual((uint) value, CodedInputStream.ReadRawVarint32(memoryStream)); + Assert.AreEqual(data.Length, memoryStream.Position); + } + + /// + /// Parses the given bytes using ReadRawVarint32() and ReadRawVarint64() and + /// expects them to fail with an InvalidProtocolBufferException whose + /// description matches the given one. + /// + private static void AssertReadVarintFailure(InvalidProtocolBufferException expected, byte[] data) + { + CodedInputStream input = CodedInputStream.CreateInstance(data); + try + { + input.ReadRawVarint32(); + Assert.Fail("Should have thrown an exception."); + } + catch (InvalidProtocolBufferException e) + { + Assert.AreEqual(expected.Message, e.Message); + } + + input = CodedInputStream.CreateInstance(data); + try + { + input.ReadRawVarint64(); + Assert.Fail("Should have thrown an exception."); + } + catch (InvalidProtocolBufferException e) + { + Assert.AreEqual(expected.Message, e.Message); + } + + // Make sure we get the same error when reading directly from a Stream. + try + { + CodedInputStream.ReadRawVarint32(new MemoryStream(data)); + Assert.Fail("Should have thrown an exception."); + } + catch (InvalidProtocolBufferException e) + { + Assert.AreEqual(expected.Message, e.Message); + } + } + + [TestMethod] + public void ReadVarint() + { + AssertReadVarint(Bytes(0x00), 0); + AssertReadVarint(Bytes(0x01), 1); + AssertReadVarint(Bytes(0x7f), 127); + // 14882 + AssertReadVarint(Bytes(0xa2, 0x74), (0x22 << 0) | (0x74 << 7)); + // 2961488830 + AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x0b), + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x0bL << 28)); + + // 64-bit + // 7256456126 + AssertReadVarint(Bytes(0xbe, 0xf7, 0x92, 0x84, 0x1b), + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x1bL << 28)); + // 41256202580718336 + AssertReadVarint(Bytes(0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49), + (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | + (0x43L << 28) | (0x49L << 35) | (0x24L << 42) | (0x49L << 49)); + // 11964378330978735131 + AssertReadVarint(Bytes(0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01), + (0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | + (0x3bUL << 28) | (0x56UL << 35) | (0x00UL << 42) | + (0x05UL << 49) | (0x26UL << 56) | (0x01UL << 63)); + + // Failures + AssertReadVarintFailure( + InvalidProtocolBufferException.MalformedVarint(), + Bytes(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + 0x00)); + AssertReadVarintFailure( + InvalidProtocolBufferException.TruncatedMessage(), + Bytes(0x80)); + } + + /// + /// Parses the given bytes using ReadRawLittleEndian32() and checks + /// that the result matches the given value. + /// + private static void AssertReadLittleEndian32(byte[] data, uint value) + { + CodedInputStream input = CodedInputStream.CreateInstance(data); + Assert.AreEqual(value, input.ReadRawLittleEndian32()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + input = CodedInputStream.CreateInstance( + new SmallBlockInputStream(data, blockSize)); + Assert.AreEqual(value, input.ReadRawLittleEndian32()); + Assert.IsTrue(input.IsAtEnd); + } + } + + /// + /// Parses the given bytes using ReadRawLittleEndian64() and checks + /// that the result matches the given value. + /// + private static void AssertReadLittleEndian64(byte[] data, ulong value) + { + CodedInputStream input = CodedInputStream.CreateInstance(data); + Assert.AreEqual(value, input.ReadRawLittleEndian64()); + Assert.IsTrue(input.IsAtEnd); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + input = CodedInputStream.CreateInstance( + new SmallBlockInputStream(data, blockSize)); + Assert.AreEqual(value, input.ReadRawLittleEndian64()); + Assert.IsTrue(input.IsAtEnd); + } + } + + [TestMethod] + public void ReadLittleEndian() + { + AssertReadLittleEndian32(Bytes(0x78, 0x56, 0x34, 0x12), 0x12345678); + AssertReadLittleEndian32(Bytes(0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef0); + + AssertReadLittleEndian64(Bytes(0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12), + 0x123456789abcdef0L); + AssertReadLittleEndian64( + Bytes(0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a), 0x9abcdef012345678UL); + } + + [TestMethod] + public void DecodeZigZag32() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(0)); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(1)); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(2)); + Assert.AreEqual(-2, CodedInputStream.DecodeZigZag32(3)); + Assert.AreEqual(0x3FFFFFFF, CodedInputStream.DecodeZigZag32(0x7FFFFFFE)); + Assert.AreEqual(unchecked((int) 0xC0000000), CodedInputStream.DecodeZigZag32(0x7FFFFFFF)); + Assert.AreEqual(0x7FFFFFFF, CodedInputStream.DecodeZigZag32(0xFFFFFFFE)); + Assert.AreEqual(unchecked((int) 0x80000000), CodedInputStream.DecodeZigZag32(0xFFFFFFFF)); + } + + [TestMethod] + public void DecodeZigZag64() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(0)); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(1)); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(2)); + Assert.AreEqual(-2, CodedInputStream.DecodeZigZag64(3)); + Assert.AreEqual(0x000000003FFFFFFFL, CodedInputStream.DecodeZigZag64(0x000000007FFFFFFEL)); + Assert.AreEqual(unchecked((long) 0xFFFFFFFFC0000000L), CodedInputStream.DecodeZigZag64(0x000000007FFFFFFFL)); + Assert.AreEqual(0x000000007FFFFFFFL, CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFEL)); + Assert.AreEqual(unchecked((long) 0xFFFFFFFF80000000L), CodedInputStream.DecodeZigZag64(0x00000000FFFFFFFFL)); + Assert.AreEqual(0x7FFFFFFFFFFFFFFFL, CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFEL)); + Assert.AreEqual(unchecked((long) 0x8000000000000000L), CodedInputStream.DecodeZigZag64(0xFFFFFFFFFFFFFFFFL)); + } + + [TestMethod] + public void ReadWholeMessage() + { + TestAllTypes message = TestUtil.GetAllSet(); + + byte[] rawBytes = message.ToByteArray(); + Assert.AreEqual(rawBytes.Length, message.SerializedSize); + TestAllTypes message2 = TestAllTypes.ParseFrom(rawBytes); + TestUtil.AssertAllFieldsSet(message2); + + // Try different block sizes. + for (int blockSize = 1; blockSize < 256; blockSize *= 2) + { + message2 = TestAllTypes.ParseFrom(new SmallBlockInputStream(rawBytes, blockSize)); + TestUtil.AssertAllFieldsSet(message2); + } + } + + [TestMethod] + public void SkipWholeMessage() + { + TestAllTypes message = TestUtil.GetAllSet(); + byte[] rawBytes = message.ToByteArray(); + + // Create two parallel inputs. Parse one as unknown fields while using + // skipField() to skip each field on the other. Expect the same tags. + CodedInputStream input1 = CodedInputStream.CreateInstance(rawBytes); + CodedInputStream input2 = CodedInputStream.CreateInstance(rawBytes); + UnknownFieldSet.Builder unknownFields = UnknownFieldSet.CreateBuilder(); + + uint tag; + string name; + while (input1.ReadTag(out tag, out name)) + { + uint tag2; + Assert.IsTrue(input2.ReadTag(out tag2, out name)); + Assert.AreEqual(tag, tag2); + + unknownFields.MergeFieldFrom(tag, input1); + input2.SkipField(); + } + } + + /// + /// Test that a bug in SkipRawBytes has been fixed: if the skip + /// skips exactly up to a limit, this should bnot break things + /// + [TestMethod] + public void SkipRawBytesBug() + { + byte[] rawBytes = new byte[] {1, 2}; + CodedInputStream input = CodedInputStream.CreateInstance(rawBytes); + + int limit = input.PushLimit(1); + input.SkipRawBytes(1); + input.PopLimit(limit); + Assert.AreEqual(2, input.ReadRawByte()); + } + + public void ReadHugeBlob() + { + // Allocate and initialize a 1MB blob. + byte[] blob = new byte[1 << 20]; + for (int i = 0; i < blob.Length; i++) + { + blob[i] = (byte) i; + } + + // Make a message containing it. + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TestUtil.SetAllFields(builder); + builder.SetOptionalBytes(ByteString.CopyFrom(blob)); + TestAllTypes message = builder.Build(); + + // Serialize and parse it. Make sure to parse from an InputStream, not + // directly from a ByteString, so that CodedInputStream uses buffered + // reading. + TestAllTypes message2 = TestAllTypes.ParseFrom(message.ToByteString().CreateCodedInput()); + + Assert.AreEqual(message.OptionalBytes, message2.OptionalBytes); + + // Make sure all the other fields were parsed correctly. + TestAllTypes message3 = TestAllTypes.CreateBuilder(message2) + .SetOptionalBytes(TestUtil.GetAllSet().OptionalBytes) + .Build(); + TestUtil.AssertAllFieldsSet(message3); + } + + [TestMethod] + public void ReadMaliciouslyLargeBlob() + { + MemoryStream ms = new MemoryStream(); + CodedOutputStream output = CodedOutputStream.CreateInstance(ms); + + uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + output.WriteRawVarint32(tag); + output.WriteRawVarint32(0x7FFFFFFF); + output.WriteRawBytes(new byte[32]); // Pad with a few random bytes. + output.Flush(); + ms.Position = 0; + + CodedInputStream input = CodedInputStream.CreateInstance(ms); + uint testtag; + string ignore; + Assert.IsTrue(input.ReadTag(out testtag, out ignore)); + Assert.AreEqual(tag, testtag); + + try + { + ByteString bytes = null; + input.ReadBytes(ref bytes); + Assert.Fail("Should have thrown an exception!"); + } + catch (InvalidProtocolBufferException) + { + // success. + } + } + + private static TestRecursiveMessage MakeRecursiveMessage(int depth) + { + if (depth == 0) + { + return TestRecursiveMessage.CreateBuilder().SetI(5).Build(); + } + else + { + return TestRecursiveMessage.CreateBuilder() + .SetA(MakeRecursiveMessage(depth - 1)).Build(); + } + } + + private static void AssertMessageDepth(TestRecursiveMessage message, int depth) + { + if (depth == 0) + { + Assert.IsFalse(message.HasA); + Assert.AreEqual(5, message.I); + } + else + { + Assert.IsTrue(message.HasA); + AssertMessageDepth(message.A, depth - 1); + } + } + + [TestMethod] + public void MaliciousRecursion() + { + ByteString data64 = MakeRecursiveMessage(64).ToByteString(); + ByteString data65 = MakeRecursiveMessage(65).ToByteString(); + + AssertMessageDepth(TestRecursiveMessage.ParseFrom(data64), 64); + + try + { + TestRecursiveMessage.ParseFrom(data65); + Assert.Fail("Should have thrown an exception!"); + } + catch (InvalidProtocolBufferException) + { + // success. + } + + CodedInputStream input = data64.CreateCodedInput(); + input.SetRecursionLimit(8); + try + { + TestRecursiveMessage.ParseFrom(input); + Assert.Fail("Should have thrown an exception!"); + } + catch (InvalidProtocolBufferException) + { + // success. + } + } + + [TestMethod] + public void SizeLimit() + { + // Have to use a Stream rather than ByteString.CreateCodedInput as SizeLimit doesn't + // apply to the latter case. + MemoryStream ms = new MemoryStream(TestUtil.GetAllSet().ToByteString().ToByteArray()); + CodedInputStream input = CodedInputStream.CreateInstance(ms); + input.SetSizeLimit(16); + + try + { + TestAllTypes.ParseFrom(input); + Assert.Fail("Should have thrown an exception!"); + } + catch (InvalidProtocolBufferException) + { + // success. + } + } + + [TestMethod] + public void ResetSizeCounter() + { + CodedInputStream input = CodedInputStream.CreateInstance( + new SmallBlockInputStream(new byte[256], 8)); + input.SetSizeLimit(16); + input.ReadRawBytes(16); + + try + { + input.ReadRawByte(); + Assert.Fail("Should have thrown an exception!"); + } + catch (InvalidProtocolBufferException) + { + // Success. + } + + input.ResetSizeCounter(); + input.ReadRawByte(); // No exception thrown. + + try + { + input.ReadRawBytes(16); // Hits limit again. + Assert.Fail("Should have thrown an exception!"); + } + catch (InvalidProtocolBufferException) + { + // Success. + } + } + + /// + /// Tests that if we read an string that contains invalid UTF-8, no exception + /// is thrown. Instead, the invalid bytes are replaced with the Unicode + /// "replacement character" U+FFFD. + /// + [TestMethod] + public void ReadInvalidUtf8() + { + MemoryStream ms = new MemoryStream(); + CodedOutputStream output = CodedOutputStream.CreateInstance(ms); + + uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + output.WriteRawVarint32(tag); + output.WriteRawVarint32(1); + output.WriteRawBytes(new byte[] {0x80}); + output.Flush(); + ms.Position = 0; + + CodedInputStream input = CodedInputStream.CreateInstance(ms); + + uint testtag; + string ignored; + + Assert.IsTrue(input.ReadTag(out testtag, out ignored)); + Assert.AreEqual(tag, testtag); + string text = null; + input.ReadString(ref text); + Assert.AreEqual('\ufffd', text[0]); + } + + /// + /// A stream which limits the number of bytes it reads at a time. + /// We use this to make sure that CodedInputStream doesn't screw up when + /// reading in small blocks. + /// + private sealed class SmallBlockInputStream : MemoryStream + { + private readonly int blockSize; + + public SmallBlockInputStream(byte[] data, int blockSize) + : base(data) + { + this.blockSize = blockSize; + } + + public override int Read(byte[] buffer, int offset, int count) + { + return base.Read(buffer, offset, Math.Min(count, blockSize)); + } + } + + enum TestNegEnum { None = 0, Value = -2 } + + [TestMethod] + public void TestNegativeEnum() + { + byte[] bytes = new byte[10] { 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01 }; + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + object unk; + TestNegEnum val = TestNegEnum.None; + + Assert.IsTrue(input.ReadEnum(ref val, out unk)); + Assert.IsTrue(input.IsAtEnd); + Assert.AreEqual(TestNegEnum.Value, val); + } + + [TestMethod] + public void TestNegativeEnumPackedArray() + { + int arraySize = 1 + (10 * 5); + int msgSize = 1 + 1 + arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WritePackedInt32Array(8, "", arraySize, new int[] { 0, -1, -2, -3, -4, -5 }); + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + uint tag; + string name; + Assert.IsTrue(input.ReadTag(out tag, out name)); + + List values = new List(); + ICollection unk; + input.ReadEnumArray(tag, name, values, out unk); + + Assert.AreEqual(2, values.Count); + Assert.AreEqual(TestNegEnum.None, values[0]); + Assert.AreEqual(TestNegEnum.Value, values[1]); + + Assert.IsNotNull(unk); + Assert.AreEqual(4, unk.Count); + } + + [TestMethod] + public void TestNegativeEnumArray() + { + int arraySize = 1 + 1 + (11 * 5); + int msgSize = arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WriteInt32Array(8, "", new int[] { 0, -1, -2, -3, -4, -5 }); + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + uint tag; + string name; + Assert.IsTrue(input.ReadTag(out tag, out name)); + + List values = new List(); + ICollection unk; + input.ReadEnumArray(tag, name, values, out unk); + + Assert.AreEqual(2, values.Count); + Assert.AreEqual(TestNegEnum.None, values[0]); + Assert.AreEqual(TestNegEnum.Value, values[1]); + + Assert.IsNotNull(unk); + Assert.AreEqual(4, unk.Count); + } + + //Issue 71: CodedInputStream.ReadBytes go to slow path unnecessarily + [TestMethod] + public void TestSlowPathAvoidance() + { + using (var ms = new MemoryStream()) + { + CodedOutputStream output = CodedOutputStream.CreateInstance(ms); + output.WriteField(FieldType.Bytes, 1, "bytes", ByteString.CopyFrom(new byte[100])); + output.WriteField(FieldType.Bytes, 2, "bytes", ByteString.CopyFrom(new byte[100])); + output.Flush(); + + ms.Position = 0; + CodedInputStream input = CodedInputStream.CreateInstance(ms, new byte[ms.Length / 2]); + + uint tag; + string ignore; + ByteString value; + + Assert.IsTrue(input.ReadTag(out tag, out ignore)); + Assert.AreEqual(1, WireFormat.GetTagFieldNumber(tag)); + value = ByteString.Empty; + Assert.IsTrue(input.ReadBytes(ref value) && value.Length == 100); + + Assert.IsTrue(input.ReadTag(out tag, out ignore)); + Assert.AreEqual(2, WireFormat.GetTagFieldNumber(tag)); + value = ByteString.Empty; + Assert.IsTrue(input.ReadBytes(ref value) && value.Length == 100); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs b/csharp/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs new file mode 100644 index 00000000..8e4e9090 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/CodedOutputStreamTest.cs @@ -0,0 +1,472 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class CodedOutputStreamTest + { + /// + /// Writes the given value using WriteRawVarint32() and WriteRawVarint64() and + /// checks that the result matches the given bytes + /// + private static void AssertWriteVarint(byte[] data, ulong value) + { + // Only do 32-bit write if the value fits in 32 bits. + if ((value >> 32) == 0) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = CodedOutputStream.CreateInstance(rawOutput); + output.WriteRawVarint32((uint) value); + output.Flush(); + TestUtil.AssertBytesEqual(data, rawOutput.ToArray()); + // Also try computing size. + Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint32Size((uint) value)); + } + + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = CodedOutputStream.CreateInstance(rawOutput); + output.WriteRawVarint64(value); + output.Flush(); + TestUtil.AssertBytesEqual(data, rawOutput.ToArray()); + + // Also try computing size. + Assert.AreEqual(data.Length, CodedOutputStream.ComputeRawVarint64Size(value)); + } + + // Try different buffer sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + // Only do 32-bit write if the value fits in 32 bits. + if ((value >> 32) == 0) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = + CodedOutputStream.CreateInstance(rawOutput, bufferSize); + output.WriteRawVarint32((uint) value); + output.Flush(); + TestUtil.AssertBytesEqual(data, rawOutput.ToArray()); + } + + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = CodedOutputStream.CreateInstance(rawOutput, bufferSize); + output.WriteRawVarint64(value); + output.Flush(); + TestUtil.AssertBytesEqual(data, rawOutput.ToArray()); + } + } + } + + /// + /// Tests WriteRawVarint32() and WriteRawVarint64() + /// + [TestMethod] + public void WriteVarint() + { + AssertWriteVarint(new byte[] {0x00}, 0); + AssertWriteVarint(new byte[] {0x01}, 1); + AssertWriteVarint(new byte[] {0x7f}, 127); + // 14882 + AssertWriteVarint(new byte[] {0xa2, 0x74}, (0x22 << 0) | (0x74 << 7)); + // 2961488830 + AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x0b}, + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x0bL << 28)); + + // 64-bit + // 7256456126 + AssertWriteVarint(new byte[] {0xbe, 0xf7, 0x92, 0x84, 0x1b}, + (0x3e << 0) | (0x77 << 7) | (0x12 << 14) | (0x04 << 21) | + (0x1bL << 28)); + // 41256202580718336 + AssertWriteVarint( + new byte[] {0x80, 0xe6, 0xeb, 0x9c, 0xc3, 0xc9, 0xa4, 0x49}, + (0x00 << 0) | (0x66 << 7) | (0x6b << 14) | (0x1c << 21) | + (0x43UL << 28) | (0x49L << 35) | (0x24UL << 42) | (0x49UL << 49)); + // 11964378330978735131 + AssertWriteVarint( + new byte[] {0x9b, 0xa8, 0xf9, 0xc2, 0xbb, 0xd6, 0x80, 0x85, 0xa6, 0x01}, + unchecked((ulong) + ((0x1b << 0) | (0x28 << 7) | (0x79 << 14) | (0x42 << 21) | + (0x3bL << 28) | (0x56L << 35) | (0x00L << 42) | + (0x05L << 49) | (0x26L << 56) | (0x01L << 63)))); + } + + /// + /// Parses the given bytes using WriteRawLittleEndian32() and checks + /// that the result matches the given value. + /// + private static void AssertWriteLittleEndian32(byte[] data, uint value) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = CodedOutputStream.CreateInstance(rawOutput); + output.WriteRawLittleEndian32(value); + output.Flush(); + TestUtil.AssertBytesEqual(data, rawOutput.ToArray()); + + // Try different buffer sizes. + for (int bufferSize = 1; bufferSize <= 16; bufferSize *= 2) + { + rawOutput = new MemoryStream(); + output = CodedOutputStream.CreateInstance(rawOutput, bufferSize); + output.WriteRawLittleEndian32(value); + output.Flush(); + TestUtil.AssertBytesEqual(data, rawOutput.ToArray()); + } + } + + /// + /// Parses the given bytes using WriteRawLittleEndian64() and checks + /// that the result matches the given value. + /// + private static void AssertWriteLittleEndian64(byte[] data, ulong value) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = CodedOutputStream.CreateInstance(rawOutput); + output.WriteRawLittleEndian64(value); + output.Flush(); + TestUtil.AssertBytesEqual(data, rawOutput.ToArray()); + + // Try different block sizes. + for (int blockSize = 1; blockSize <= 16; blockSize *= 2) + { + rawOutput = new MemoryStream(); + output = CodedOutputStream.CreateInstance(rawOutput, blockSize); + output.WriteRawLittleEndian64(value); + output.Flush(); + TestUtil.AssertBytesEqual(data, rawOutput.ToArray()); + } + } + + /// + /// Tests writeRawLittleEndian32() and writeRawLittleEndian64(). + /// + [TestMethod] + public void WriteLittleEndian() + { + AssertWriteLittleEndian32(new byte[] {0x78, 0x56, 0x34, 0x12}, 0x12345678); + AssertWriteLittleEndian32(new byte[] {0xf0, 0xde, 0xbc, 0x9a}, 0x9abcdef0); + + AssertWriteLittleEndian64( + new byte[] {0xf0, 0xde, 0xbc, 0x9a, 0x78, 0x56, 0x34, 0x12}, + 0x123456789abcdef0L); + AssertWriteLittleEndian64( + new byte[] {0x78, 0x56, 0x34, 0x12, 0xf0, 0xde, 0xbc, 0x9a}, + 0x9abcdef012345678UL); + } + + [TestMethod] + public void WriteWholeMessage() + { + TestAllTypes message = TestUtil.GetAllSet(); + + byte[] rawBytes = message.ToByteArray(); + TestUtil.AssertEqualBytes(TestUtil.GoldenMessage.ToByteArray(), rawBytes); + + // Try different block sizes. + for (int blockSize = 1; blockSize < 256; blockSize *= 2) + { + MemoryStream rawOutput = new MemoryStream(); + CodedOutputStream output = + CodedOutputStream.CreateInstance(rawOutput, blockSize); + message.WriteTo(output); + output.Flush(); + TestUtil.AssertEqualBytes(rawBytes, rawOutput.ToArray()); + } + } + + /// + /// Tests writing a whole message with every packed field type. Ensures the + /// wire format of packed fields is compatible with C++. + /// + [TestMethod] + public void WriteWholePackedFieldsMessage() + { + TestPackedTypes message = TestUtil.GetPackedSet(); + + byte[] rawBytes = message.ToByteArray(); + TestUtil.AssertEqualBytes(TestUtil.GetGoldenPackedFieldsMessage().ToByteArray(), + rawBytes); + } + + [TestMethod] + public void EncodeZigZag32() + { + Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag32(0)); + Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag32(-1)); + Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag32(1)); + Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag32(-2)); + Assert.AreEqual(0x7FFFFFFEu, CodedOutputStream.EncodeZigZag32(0x3FFFFFFF)); + Assert.AreEqual(0x7FFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0xC0000000))); + Assert.AreEqual(0xFFFFFFFEu, CodedOutputStream.EncodeZigZag32(0x7FFFFFFF)); + Assert.AreEqual(0xFFFFFFFFu, CodedOutputStream.EncodeZigZag32(unchecked((int) 0x80000000))); + } + + [TestMethod] + public void EncodeZigZag64() + { + Assert.AreEqual(0u, CodedOutputStream.EncodeZigZag64(0)); + Assert.AreEqual(1u, CodedOutputStream.EncodeZigZag64(-1)); + Assert.AreEqual(2u, CodedOutputStream.EncodeZigZag64(1)); + Assert.AreEqual(3u, CodedOutputStream.EncodeZigZag64(-2)); + Assert.AreEqual(0x000000007FFFFFFEuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000003FFFFFFFUL))); + Assert.AreEqual(0x000000007FFFFFFFuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFFC0000000UL))); + Assert.AreEqual(0x00000000FFFFFFFEuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x000000007FFFFFFFUL))); + Assert.AreEqual(0x00000000FFFFFFFFuL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0xFFFFFFFF80000000UL))); + Assert.AreEqual(0xFFFFFFFFFFFFFFFEL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x7FFFFFFFFFFFFFFFUL))); + Assert.AreEqual(0xFFFFFFFFFFFFFFFFL, + CodedOutputStream.EncodeZigZag64(unchecked((long) 0x8000000000000000UL))); + } + + [TestMethod] + public void RoundTripZigZag32() + { + // Some easier-to-verify round-trip tests. The inputs (other than 0, 1, -1) + // were chosen semi-randomly via keyboard bashing. + Assert.AreEqual(0, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(0))); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(1))); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-1))); + Assert.AreEqual(14927, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(14927))); + Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag32(CodedOutputStream.EncodeZigZag32(-3612))); + } + + [TestMethod] + public void RoundTripZigZag64() + { + Assert.AreEqual(0, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(0))); + Assert.AreEqual(1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(1))); + Assert.AreEqual(-1, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-1))); + Assert.AreEqual(14927, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(14927))); + Assert.AreEqual(-3612, CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-3612))); + + Assert.AreEqual(856912304801416L, + CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(856912304801416L))); + Assert.AreEqual(-75123905439571256L, + CodedInputStream.DecodeZigZag64(CodedOutputStream.EncodeZigZag64(-75123905439571256L))); + } + + [TestMethod] + public void TestNegativeEnumNoTag() + { + Assert.AreEqual(10, CodedOutputStream.ComputeInt32SizeNoTag(-2)); + Assert.AreEqual(10, CodedOutputStream.ComputeEnumSizeNoTag(-2)); + + byte[] bytes = new byte[10]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WriteEnumNoTag(-2); + + Assert.AreEqual(0, output.SpaceLeft); + Assert.AreEqual("FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes)); + } + + [TestMethod] + public void TestNegativeEnumWithTag() + { + Assert.AreEqual(11, CodedOutputStream.ComputeInt32Size(8, -2)); + Assert.AreEqual(11, CodedOutputStream.ComputeEnumSize(8, -2)); + + byte[] bytes = new byte[11]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WriteEnum(8, "", -2, -2); + + Assert.AreEqual(0, output.SpaceLeft); + //fyi, 0x40 == 0x08 << 3 + 0, field num + wire format shift + Assert.AreEqual("40-FE-FF-FF-FF-FF-FF-FF-FF-FF-01", BitConverter.ToString(bytes)); + } + + [TestMethod] + public void TestNegativeEnumArrayPacked() + { + int arraySize = 1 + (10 * 5); + int msgSize = 1 + 1 + arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WritePackedEnumArray(8, "", arraySize, new int[] { 0, -1, -2, -3, -4, -5 }); + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + uint tag; + string name; + Assert.IsTrue(input.ReadTag(out tag, out name)); + + List values = new List(); + input.ReadInt32Array(tag, name, values); + + Assert.AreEqual(6, values.Count); + for (int i = 0; i > -6; i--) + Assert.AreEqual(i, values[Math.Abs(i)]); + } + + [TestMethod] + public void TestNegativeEnumArray() + { + int arraySize = 1 + 1 + (11 * 5); + int msgSize = arraySize; + byte[] bytes = new byte[msgSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + output.WriteEnumArray(8, "", new int[] { 0, -1, -2, -3, -4, -5 }); + + Assert.AreEqual(0, output.SpaceLeft); + + CodedInputStream input = CodedInputStream.CreateInstance(bytes); + uint tag; + string name; + Assert.IsTrue(input.ReadTag(out tag, out name)); + + List values = new List(); + input.ReadInt32Array(tag, name, values); + + Assert.AreEqual(6, values.Count); + for (int i = 0; i > -6; i--) + Assert.AreEqual(i, values[Math.Abs(i)]); + } + + [TestMethod] + public void TestCodedInputOutputPosition() + { + byte[] content = new byte[110]; + for (int i = 0; i < content.Length; i++) + content[i] = (byte)i; + + byte[] child = new byte[120]; + { + MemoryStream ms = new MemoryStream(child); + CodedOutputStream cout = CodedOutputStream.CreateInstance(ms, 20); + // Field 11: numeric value: 500 + cout.WriteTag(11, WireFormat.WireType.Varint); + Assert.AreEqual(1, cout.Position); + cout.WriteInt32NoTag(500); + Assert.AreEqual(3, cout.Position); + //Field 12: length delimited 120 bytes + cout.WriteTag(12, WireFormat.WireType.LengthDelimited); + Assert.AreEqual(4, cout.Position); + cout.WriteBytesNoTag(ByteString.CopyFrom(content)); + Assert.AreEqual(115, cout.Position); + // Field 13: fixed numeric value: 501 + cout.WriteTag(13, WireFormat.WireType.Fixed32); + Assert.AreEqual(116, cout.Position); + cout.WriteSFixed32NoTag(501); + Assert.AreEqual(120, cout.Position); + cout.Flush(); + } + + byte[] bytes = new byte[130]; + { + CodedOutputStream cout = CodedOutputStream.CreateInstance(bytes); + // Field 1: numeric value: 500 + cout.WriteTag(1, WireFormat.WireType.Varint); + Assert.AreEqual(1, cout.Position); + cout.WriteInt32NoTag(500); + Assert.AreEqual(3, cout.Position); + //Field 2: length delimited 120 bytes + cout.WriteTag(2, WireFormat.WireType.LengthDelimited); + Assert.AreEqual(4, cout.Position); + cout.WriteBytesNoTag(ByteString.CopyFrom(child)); + Assert.AreEqual(125, cout.Position); + // Field 3: fixed numeric value: 500 + cout.WriteTag(3, WireFormat.WireType.Fixed32); + Assert.AreEqual(126, cout.Position); + cout.WriteSFixed32NoTag(501); + Assert.AreEqual(130, cout.Position); + cout.Flush(); + } + //Now test Input stream: + { + CodedInputStream cin = CodedInputStream.CreateInstance(new MemoryStream(bytes), new byte[50]); + uint tag; + int intValue = 0; + string ignore; + Assert.AreEqual(0, cin.Position); + // Field 1: + Assert.IsTrue(cin.ReadTag(out tag, out ignore) && tag >> 3 == 1); + Assert.AreEqual(1, cin.Position); + Assert.IsTrue(cin.ReadInt32(ref intValue) && intValue == 500); + Assert.AreEqual(3, cin.Position); + //Field 2: + Assert.IsTrue(cin.ReadTag(out tag, out ignore) && tag >> 3 == 2); + Assert.AreEqual(4, cin.Position); + uint childlen = cin.ReadRawVarint32(); + Assert.AreEqual(120u, childlen); + Assert.AreEqual(5, cin.Position); + int oldlimit = cin.PushLimit((int)childlen); + Assert.AreEqual(5, cin.Position); + // Now we are reading child message + { + // Field 11: numeric value: 500 + Assert.IsTrue(cin.ReadTag(out tag, out ignore) && tag >> 3 == 11); + Assert.AreEqual(6, cin.Position); + Assert.IsTrue(cin.ReadInt32(ref intValue) && intValue == 500); + Assert.AreEqual(8, cin.Position); + //Field 12: length delimited 120 bytes + Assert.IsTrue(cin.ReadTag(out tag, out ignore) && tag >> 3 == 12); + Assert.AreEqual(9, cin.Position); + ByteString bstr = null; + Assert.IsTrue(cin.ReadBytes(ref bstr) && bstr.Length == 110 && bstr.ToByteArray()[109] == 109); + Assert.AreEqual(120, cin.Position); + // Field 13: fixed numeric value: 501 + Assert.IsTrue(cin.ReadTag(out tag, out ignore) && tag >> 3 == 13); + // ROK - Previously broken here, this returned 126 failing to account for bufferSizeAfterLimit + Assert.AreEqual(121, cin.Position); + Assert.IsTrue(cin.ReadSFixed32(ref intValue) && intValue == 501); + Assert.AreEqual(125, cin.Position); + Assert.IsTrue(cin.IsAtEnd); + } + cin.PopLimit(oldlimit); + Assert.AreEqual(125, cin.Position); + // Field 3: fixed numeric value: 501 + Assert.IsTrue(cin.ReadTag(out tag, out ignore) && tag >> 3 == 3); + Assert.AreEqual(126, cin.Position); + Assert.IsTrue(cin.ReadSFixed32(ref intValue) && intValue == 501); + Assert.AreEqual(130, cin.Position); + Assert.IsTrue(cin.IsAtEnd); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs b/csharp/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs new file mode 100644 index 00000000..0bce60d9 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Collections/PopsicleListTest.cs @@ -0,0 +1,153 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers.Collections +{ + [TestClass] + public class PopsicleListTest + { + [TestMethod] + public void MutatingOperationsOnFrozenList() + { + PopsicleList list = new PopsicleList(); + list.MakeReadOnly(); + TestUtil.AssertNotSupported(() => list.Add("")); + TestUtil.AssertNotSupported(() => list.Clear()); + TestUtil.AssertNotSupported(() => list.Insert(0, "")); + TestUtil.AssertNotSupported(() => list.Remove("")); + TestUtil.AssertNotSupported(() => list.RemoveAt(0)); + TestUtil.AssertNotSupported(() => list.Add(new[] { "", "" })); + } + + [TestMethod] + public void NonMutatingOperationsOnFrozenList() + { + PopsicleList list = new PopsicleList(); + list.MakeReadOnly(); + Assert.IsFalse(list.Contains("")); + Assert.AreEqual(0, list.Count); + list.CopyTo(new string[5], 0); + list.GetEnumerator(); + Assert.AreEqual(-1, list.IndexOf("")); + Assert.IsTrue(list.IsReadOnly); + } + + [TestMethod] + public void MutatingOperationsOnFluidList() + { + PopsicleList list = new PopsicleList(); + list.Add(""); + list.Clear(); + list.Insert(0, ""); + list.Remove(""); + list.Add("x"); // Just to make the next call valid + list.RemoveAt(0); + } + + [TestMethod] + public void NonMutatingOperationsOnFluidList() + { + PopsicleList list = new PopsicleList(); + Assert.IsFalse(list.Contains("")); + Assert.AreEqual(0, list.Count); + list.CopyTo(new string[5], 0); + list.GetEnumerator(); + Assert.AreEqual(-1, list.IndexOf("")); + Assert.IsFalse(list.IsReadOnly); + } + + [TestMethod] + public void DoesNotAddNullEnumerable() + { + PopsicleList list = new PopsicleList(); + try + { + list.Add((IEnumerable)null); + } + catch (ArgumentNullException) + { return; } + + Assert.Fail("List should not allow nulls."); + } + + [TestMethod] + public void DoesNotAddRangeWithNull() + { + PopsicleList list = new PopsicleList(); + try + { + list.Add(new[] { "a", "b", null }); + } + catch (ArgumentNullException) + { return; } + + Assert.Fail("List should not allow nulls."); + } + + [TestMethod] + public void DoesNotAddNull() + { + PopsicleList list = new PopsicleList(); + try + { + list.Add((string)null); + } + catch (ArgumentNullException) + { return; } + + Assert.Fail("List should not allow nulls."); + } + + [TestMethod] + public void DoesNotSetNull() + { + PopsicleList list = new PopsicleList(); + list.Add("a"); + try + { + list[0] = null; + } + catch (ArgumentNullException) + { return; } + + Assert.Fail("List should not allow nulls."); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/Compatibility/BinaryCompatibilityTests.cs b/csharp/src/ProtocolBuffers.Test/Compatibility/BinaryCompatibilityTests.cs new file mode 100644 index 00000000..9707f8e8 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Compatibility/BinaryCompatibilityTests.cs @@ -0,0 +1,20 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers.Compatibility +{ + [TestClass] + public class BinaryCompatibilityTests : CompatibilityTests + { + protected override object SerializeMessage(TMessage message) + { + byte[] bresult = message.ToByteArray(); + return Convert.ToBase64String(bresult); + } + + protected override TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + { + return builder.MergeFrom((byte[])Convert.FromBase64String((string)message), registry); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/Compatibility/CompatibilityTests.cs b/csharp/src/ProtocolBuffers.Test/Compatibility/CompatibilityTests.cs new file mode 100644 index 00000000..20189617 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Compatibility/CompatibilityTests.cs @@ -0,0 +1,227 @@ +using System; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + + +namespace Google.ProtocolBuffers.Compatibility +{ + /// + /// This abstract base implements several tests to ensure that well-known messages can be written + /// and read to/from various formats without loosing data. Implementations overload the two serailization + /// methods to provide the tests with the means to read and write for a given format. + /// + public abstract class CompatibilityTests + { + protected abstract object SerializeMessage(TMessage message) + where TMessage : IMessageLite + where TBuilder : IBuilderLite; + + protected abstract TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + where TMessage : IMessageLite + where TBuilder : IBuilderLite; + + protected virtual void AssertOutputEquals(object lhs, object rhs) + { + Assert.AreEqual(lhs, rhs); + } + + [TestMethod] + public virtual void RoundTripWithEmptyChildMessageSize() + { + SizeMessage1 msg = SizeMessage1.CreateBuilder() + .SetField100(100) + .SetField15(SizeMessage1SubMessage.DefaultInstance) + .BuildPartial(); + byte[] contents = msg.ToByteArray(); + object content = SerializeMessage(msg); + + SizeMessage1 copy = DeserializeMessage(content, SizeMessage1.CreateBuilder(), ExtensionRegistry.Empty).BuildPartial(); + + Assert.AreEqual(msg, copy); + AssertOutputEquals(content, SerializeMessage(copy)); + Assert.AreEqual(Convert.ToBase64String(contents), Convert.ToBase64String(copy.ToByteArray())); + } + + [TestMethod] + public virtual void RoundTripWithEmptyChildMessageSpeed() + { + SpeedMessage1 msg = SpeedMessage1.CreateBuilder() + .SetField100(100) + .SetField15(SpeedMessage1SubMessage.DefaultInstance) + .BuildPartial(); + byte[] contents = msg.ToByteArray(); + object content = SerializeMessage(msg); + + SpeedMessage1 copy = DeserializeMessage(content, SpeedMessage1.CreateBuilder(), ExtensionRegistry.Empty).BuildPartial(); + + Assert.AreEqual(msg, copy); + AssertOutputEquals(content, SerializeMessage(copy)); + Assert.AreEqual(Convert.ToBase64String(contents), Convert.ToBase64String(copy.ToByteArray())); + } + + [TestMethod] + public virtual void RoundTripMessage1OptimizeSize() + { + SizeMessage1 msg = SizeMessage1.CreateBuilder().MergeFrom(TestResources.google_message1).Build(); + object content = SerializeMessage(msg); + + SizeMessage1 copy = DeserializeMessage(content, SizeMessage1.CreateBuilder(), ExtensionRegistry.Empty).Build(); + + Assert.AreEqual(msg, copy); + AssertOutputEquals(content, SerializeMessage(copy)); + Assert.AreEqual(Convert.ToBase64String(TestResources.google_message1), Convert.ToBase64String(copy.ToByteArray())); + } + + [TestMethod] + public virtual void RoundTripMessage2OptimizeSize() + { + SizeMessage2 msg = SizeMessage2.CreateBuilder().MergeFrom(TestResources.google_message2).Build(); + object content = SerializeMessage(msg); + + SizeMessage2 copy = DeserializeMessage(content, SizeMessage2.CreateBuilder(), ExtensionRegistry.Empty).Build(); + + Assert.AreEqual(msg, copy); + AssertOutputEquals(content, SerializeMessage(copy)); + Assert.AreEqual(Convert.ToBase64String(TestResources.google_message2), Convert.ToBase64String(copy.ToByteArray())); + } + + [TestMethod] + public virtual void RoundTripMessage1OptimizeSpeed() + { + SpeedMessage1 msg = SpeedMessage1.CreateBuilder().MergeFrom(TestResources.google_message1).Build(); + object content = SerializeMessage(msg); + + SpeedMessage1 copy = DeserializeMessage(content, SpeedMessage1.CreateBuilder(), ExtensionRegistry.Empty).Build(); + + Assert.AreEqual(msg, copy); + AssertOutputEquals(content, SerializeMessage(copy)); + Assert.AreEqual(Convert.ToBase64String(TestResources.google_message1), Convert.ToBase64String(copy.ToByteArray())); + } + + [TestMethod] + public virtual void RoundTripMessage2OptimizeSpeed() + { + SpeedMessage2 msg = SpeedMessage2.CreateBuilder().MergeFrom(TestResources.google_message2).Build(); + object content = SerializeMessage(msg); + + SpeedMessage2 copy = DeserializeMessage(content, SpeedMessage2.CreateBuilder(), ExtensionRegistry.Empty).Build(); + + Assert.AreEqual(msg, copy); + AssertOutputEquals(content, SerializeMessage(copy)); + Assert.AreEqual(Convert.ToBase64String(TestResources.google_message2), Convert.ToBase64String(copy.ToByteArray())); + } + + #region Test message builders + + protected static TestAllTypes.Builder AddAllTypes(TestAllTypes.Builder builder) + { + return builder.SetOptionalInt32(1001) + .SetOptionalInt64(1001) + .SetOptionalUint32(1001) + .SetOptionalUint64(1001) + .SetOptionalSint32(-1001) + .SetOptionalSint64(-1001) + .SetOptionalFixed32(1001) + .SetOptionalFixed64(1001) + .SetOptionalSfixed32(-1001) + .SetOptionalSfixed64(-1001) + .SetOptionalFloat(1001.1001f) + .SetOptionalDouble(1001.1001) + .SetOptionalBool(true) + .SetOptionalString("this is a string value") + .SetOptionalBytes(ByteString.CopyFromUtf8("this is an array of bytes")) + .SetOptionalGroup(new TestAllTypes.Types.OptionalGroup.Builder().SetA(1001)) + .SetOptionalNestedMessage(new TestAllTypes.Types.NestedMessage.Builder().SetBb(1001)) + .SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.FOO) + ; + } + + protected static TestAllTypes.Builder AddRepeatedTypes(TestAllTypes.Builder builder, int size) + { + //repeated values + for (int i = 0; i < size; i++) + builder.AddRepeatedInt32(1001 + i) + .AddRepeatedInt64(1001) + .AddRepeatedUint32(1001) + .AddRepeatedUint64(1001) + .AddRepeatedSint32(-1001) + .AddRepeatedSint64(-1001) + .AddRepeatedFixed32(1001) + .AddRepeatedFixed64(1001) + .AddRepeatedSfixed32(-1001) + .AddRepeatedSfixed64(-1001) + .AddRepeatedFloat(1001.1001f) + .AddRepeatedDouble(1001.1001) + .AddRepeatedBool(true) + .AddRepeatedString("this is a string value") + .AddRepeatedBytes(ByteString.CopyFromUtf8("this is an array of bytes")) + .AddRepeatedGroup(new TestAllTypes.Types.RepeatedGroup.Builder().SetA(1001)) + .AddRepeatedNestedMessage(new TestAllTypes.Types.NestedMessage.Builder().SetBb(1001)) + .AddRepeatedNestedEnum(TestAllTypes.Types.NestedEnum.FOO) + ; + return builder; + } + + protected static TestPackedTypes.Builder AddPackedTypes(TestPackedTypes.Builder builder, int size) + { + for(int i=0; i < size; i++ ) + builder.AddPackedInt32(1001) + .AddPackedInt64(1001) + .AddPackedUint32(1001) + .AddPackedUint64(1001) + .AddPackedSint32(-1001) + .AddPackedSint64(-1001) + .AddPackedFixed32(1001) + .AddPackedFixed64(1001) + .AddPackedSfixed32(-1001) + .AddPackedSfixed64(-1001) + .AddPackedFloat(1001.1001f) + .AddPackedDouble(1001.1001) + .AddPackedBool(true) + .AddPackedEnum(ForeignEnum.FOREIGN_FOO) + ; + return builder; + } + + #endregion + + [TestMethod] + public void TestRoundTripAllTypes() + { + TestAllTypes msg = AddAllTypes(new TestAllTypes.Builder()).Build(); + object content = SerializeMessage(msg); + + TestAllTypes copy = DeserializeMessage(content, TestAllTypes.CreateBuilder(), ExtensionRegistry.Empty).Build(); + + Assert.AreEqual(msg, copy); + AssertOutputEquals(content, SerializeMessage(copy)); + Assert.AreEqual(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray())); + } + + [TestMethod] + public void TestRoundTripRepeatedTypes() + { + TestAllTypes msg = AddRepeatedTypes(new TestAllTypes.Builder(), 5).Build(); + object content = SerializeMessage(msg); + + TestAllTypes copy = DeserializeMessage(content, TestAllTypes.CreateBuilder(), ExtensionRegistry.Empty).Build(); + + Assert.AreEqual(msg, copy); + AssertOutputEquals(content, SerializeMessage(copy)); + Assert.AreEqual(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray())); + } + + [TestMethod] + public void TestRoundTripPackedTypes() + { + TestPackedTypes msg = AddPackedTypes(new TestPackedTypes.Builder(), 5).Build(); + object content = SerializeMessage(msg); + + TestPackedTypes copy = DeserializeMessage(content, TestPackedTypes.CreateBuilder(), ExtensionRegistry.Empty).Build(); + + Assert.AreEqual(msg, copy); + AssertOutputEquals(content, SerializeMessage(copy)); + Assert.AreEqual(Convert.ToBase64String(msg.ToByteArray()), Convert.ToBase64String(copy.ToByteArray())); + } + } +} diff --git a/csharp/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs b/csharp/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs new file mode 100644 index 00000000..73037cce --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Compatibility/DictionaryCompatibilityTests.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Google.ProtocolBuffers.Serialization; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers.Compatibility +{ + [TestClass] + public class DictionaryCompatibilityTests : CompatibilityTests + { + protected override object SerializeMessage(TMessage message) + { + DictionaryWriter writer = new DictionaryWriter(); + writer.WriteMessage(message); + return writer.ToDictionary(); + } + + protected override TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + { + new DictionaryReader((IDictionary)message).Merge(builder); + return builder; + } + + protected override void AssertOutputEquals(object lhs, object rhs) + { + IDictionary left = (IDictionary)lhs; + IDictionary right = (IDictionary)rhs; + + Assert.AreEqual( + String.Join(",", new List(left.Keys).ToArray()), + String.Join(",", new List(right.Keys).ToArray()) + ); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs b/csharp/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs new file mode 100644 index 00000000..74603108 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Compatibility/JsonCompatibilityTests.cs @@ -0,0 +1,44 @@ +using System.IO; +using System.Text; +using Google.ProtocolBuffers.Serialization; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers.Compatibility +{ + [TestClass] + public class JsonCompatibilityTests : CompatibilityTests + { + protected override object SerializeMessage(TMessage message) + { + StringWriter sw = new StringWriter(); + JsonFormatWriter.CreateInstance(sw) + .WriteMessage(message); + return sw.ToString(); + } + + protected override TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + { + JsonFormatReader.CreateInstance((string)message).Merge(builder); + return builder; + } + } + + [TestClass] + public class JsonCompatibilityFormattedTests : CompatibilityTests + { + protected override object SerializeMessage(TMessage message) + { + StringWriter sw = new StringWriter(); + JsonFormatWriter.CreateInstance(sw) + .Formatted() + .WriteMessage(message); + return sw.ToString(); + } + + protected override TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + { + JsonFormatReader.CreateInstance((string)message).Merge(builder); + return builder; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/Compatibility/TestResources.cs b/csharp/src/ProtocolBuffers.Test/Compatibility/TestResources.cs new file mode 100644 index 00000000..c3ce5883 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Compatibility/TestResources.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers.Compatibility +{ + static class TestResources + { + public static byte[] google_message1 + { + get + { + Stream resource = typeof(TestResources).Assembly.GetManifestResourceStream( + typeof(TestResources).Namespace + ".google_message1.dat"); + + Assert.IsNotNull(resource, "Unable to the locate resource: google_message1"); + + byte[] bytes = new byte[resource.Length]; + int amtRead = resource.Read(bytes, 0, bytes.Length); + Assert.AreEqual(bytes.Length, amtRead); + return bytes; + } + } + public static byte[] google_message2 + { + get + { + Stream resource = typeof(TestResources).Assembly.GetManifestResourceStream( + typeof(TestResources).Namespace + ".google_message2.dat"); + + Assert.IsNotNull(resource, "Unable to the locate resource: google_message2"); + + byte[] bytes = new byte[resource.Length]; + int amtRead = resource.Read(bytes, 0, bytes.Length); + Assert.AreEqual(bytes.Length, amtRead); + return bytes; + } + } + } +} diff --git a/csharp/src/ProtocolBuffers.Test/Compatibility/TextCompatibilityTests.cs b/csharp/src/ProtocolBuffers.Test/Compatibility/TextCompatibilityTests.cs new file mode 100644 index 00000000..c2eaadf6 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Compatibility/TextCompatibilityTests.cs @@ -0,0 +1,36 @@ +using System.ComponentModel; +using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers.Compatibility +{ + [TestClass] + public class TextCompatibilityTests : CompatibilityTests + { + protected override object SerializeMessage(TMessage message) + { + StringWriter text = new StringWriter(); + message.PrintTo(text); + return text.ToString(); + } + + protected override TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + { + TextFormat.Merge(new StringReader((string)message), registry, (IBuilder)builder); + return builder; + } + //This test can take a very long time to run. + [TestMethod] + public override void RoundTripMessage2OptimizeSize() + { + //base.RoundTripMessage2OptimizeSize(); + } + + //This test can take a very long time to run. + [TestMethod] + public override void RoundTripMessage2OptimizeSpeed() + { + //base.RoundTripMessage2OptimizeSpeed(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs b/csharp/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs new file mode 100644 index 00000000..70614744 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Compatibility/XmlCompatibilityTests.cs @@ -0,0 +1,46 @@ +using System.IO; +using System.Xml; +using Google.ProtocolBuffers.Serialization; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers.Compatibility +{ + [TestClass] + public class XmlCompatibilityTests : CompatibilityTests + { + protected override object SerializeMessage(TMessage message) + { + StringWriter text = new StringWriter(); + XmlFormatWriter writer = XmlFormatWriter.CreateInstance(text); + writer.WriteMessage("root", message); + return text.ToString(); + } + + protected override TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + { + XmlFormatReader reader = XmlFormatReader.CreateInstance((string)message); + return reader.Merge("root", builder, registry); + } + } + + [TestClass] + public class XmlCompatibilityFormattedTests : CompatibilityTests + { + protected override object SerializeMessage(TMessage message) + { + StringWriter text = new StringWriter(); + XmlWriter xwtr = XmlWriter.Create(text, new XmlWriterSettings { Indent = true, IndentChars = " " }); + + XmlFormatWriter writer = XmlFormatWriter.CreateInstance(xwtr).SetOptions(XmlWriterOptions.OutputNestedArrays); + writer.WriteMessage("root", message); + return text.ToString(); + } + + protected override TBuilder DeserializeMessage(object message, TBuilder builder, ExtensionRegistry registry) + { + XmlFormatReader reader = XmlFormatReader.CreateInstance((string)message).SetOptions(XmlReaderOptions.ReadNestedArrays); + return reader.Merge("root", builder, registry); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/Compatibility/google_message1.dat b/csharp/src/ProtocolBuffers.Test/Compatibility/google_message1.dat new file mode 100644 index 00000000..bc0f064c Binary files /dev/null and b/csharp/src/ProtocolBuffers.Test/Compatibility/google_message1.dat differ diff --git a/csharp/src/ProtocolBuffers.Test/Compatibility/google_message2.dat b/csharp/src/ProtocolBuffers.Test/Compatibility/google_message2.dat new file mode 100644 index 00000000..06c09441 Binary files /dev/null and b/csharp/src/ProtocolBuffers.Test/Compatibility/google_message2.dat differ diff --git a/csharp/src/ProtocolBuffers.Test/DeprecatedMemberTest.cs b/csharp/src/ProtocolBuffers.Test/DeprecatedMemberTest.cs new file mode 100644 index 00000000..0901f043 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/DeprecatedMemberTest.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using UnitTest.Issues.TestProtos; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class DeprecatedMemberTest + { + private static void AssertIsDeprecated(MemberInfo member) + { + Assert.IsNotNull(member); + Assert.IsTrue(member.IsDefined(typeof(ObsoleteAttribute), false), "Member not obsolete: " + member); + } + + [TestMethod] + public void TestDepreatedPrimitiveValue() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasPrimitiveValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("PrimitiveValue")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("HasPrimitiveValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("PrimitiveValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearPrimitiveValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetPrimitiveValue")); + } + [TestMethod] + public void TestDepreatedPrimitiveArray() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("PrimitiveArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("PrimitiveArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetMethod("GetPrimitiveArray")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("PrimitiveArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("PrimitiveArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("GetPrimitiveArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetPrimitiveArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddPrimitiveArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangePrimitiveArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearPrimitiveArray")); + } + [TestMethod] + public void TestDepreatedMessageValue() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasMessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("MessageValue")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("HasMessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("MessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("MergeMessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearMessageValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageValue", new[] { typeof(DeprecatedChild) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageValue", new[] { typeof(DeprecatedChild.Builder) })); + } + [TestMethod] + public void TestDepreatedMessageArray() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("MessageArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("MessageArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetMethod("GetMessageArray")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("MessageArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("MessageArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("GetMessageArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageArray", new[] { typeof(int), typeof(DeprecatedChild) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetMessageArray", new[] { typeof(int), typeof(DeprecatedChild.Builder) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddMessageArray", new[] { typeof(DeprecatedChild) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddMessageArray", new[] { typeof(DeprecatedChild.Builder) })); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangeMessageArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearMessageArray")); + } + [TestMethod] + public void TestDepreatedEnumValue() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("HasEnumValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("EnumValue")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("HasEnumValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("EnumValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearEnumValue")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetEnumValue")); + } + [TestMethod] + public void TestDepreatedEnumArray() + { + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("EnumArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetProperty("EnumArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage).GetMethod("GetEnumArray")); + + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("EnumArrayList")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetProperty("EnumArrayCount")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("GetEnumArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("SetEnumArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddEnumArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("AddRangeEnumArray")); + AssertIsDeprecated(typeof(DeprecatedFieldsMessage.Builder).GetMethod("ClearEnumArray")); + } + } +} diff --git a/csharp/src/ProtocolBuffers.Test/Descriptors/MessageDescriptorTest.cs b/csharp/src/ProtocolBuffers.Test/Descriptors/MessageDescriptorTest.cs new file mode 100644 index 00000000..79033e6e --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Descriptors/MessageDescriptorTest.cs @@ -0,0 +1,72 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Microsoft.VisualStudio.TestTools.UnitTesting; +using Google.ProtocolBuffers.TestProtos; + +namespace Google.ProtocolBuffers.Descriptors +{ + [TestClass] + public class MessageDescriptorTest + { + [TestMethod] + public void FindPropertyWithDefaultName() + { + Assert.AreSame(OptionsMessage.Descriptor.FindFieldByNumber(OptionsMessage.NormalFieldNumber), + OptionsMessage.Descriptor.FindFieldByPropertyName("Normal")); + } + + [TestMethod] + public void FindPropertyWithAutoModifiedName() + { + Assert.AreSame(OptionsMessage.Descriptor.FindFieldByNumber(OptionsMessage.OptionsMessage_FieldNumber), + OptionsMessage.Descriptor.FindFieldByPropertyName("OptionsMessage_")); + } + + [TestMethod] + public void FindPropertyWithCustomizedName() + { + Assert.AreSame(OptionsMessage.Descriptor.FindFieldByNumber(OptionsMessage.CustomNameFieldNumber), + OptionsMessage.Descriptor.FindFieldByPropertyName("CustomName")); + } + + [TestMethod] + public void FindPropertyWithInvalidName() + { + Assert.IsNull(OptionsMessage.Descriptor.FindFieldByPropertyName("Bogus")); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/DescriptorsTest.cs b/csharp/src/ProtocolBuffers.Test/DescriptorsTest.cs new file mode 100644 index 00000000..ca10c621 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/DescriptorsTest.cs @@ -0,0 +1,350 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Text; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + /// + /// Tests for descriptors. (Not in its own namespace or broken up into individual classes as the + /// size doesn't warrant it. On the other hand, this makes me feel a bit dirty...) + /// + [TestClass] + public class DescriptorsTest + { + [TestMethod] + public void FileDescriptor() + { + FileDescriptor file = UnitTestProtoFile.Descriptor; + + Assert.AreEqual("google/protobuf/unittest.proto", file.Name); + Assert.AreEqual("protobuf_unittest", file.Package); + + Assert.AreEqual("UnittestProto", file.Options.JavaOuterClassname); + Assert.AreEqual("google/protobuf/unittest.proto", file.Proto.Name); + +// TODO(jonskeet): Either change to expect 2 dependencies, or don't emit them. +// Assert.AreEqual(2, file.Dependencies.Count); + Assert.AreEqual(UnitTestImportProtoFile.Descriptor, file.Dependencies[1]); + + MessageDescriptor messageType = TestAllTypes.Descriptor; + Assert.AreEqual(messageType, file.MessageTypes[0]); + Assert.AreEqual(messageType, file.FindTypeByName("TestAllTypes")); + Assert.IsNull(file.FindTypeByName("NoSuchType")); + Assert.IsNull(file.FindTypeByName("protobuf_unittest.TestAllTypes")); + for (int i = 0; i < file.MessageTypes.Count; i++) + { + Assert.AreEqual(i, file.MessageTypes[i].Index); + } + + Assert.AreEqual(file.EnumTypes[0], file.FindTypeByName("ForeignEnum")); + Assert.IsNull(file.FindTypeByName("NoSuchType")); + Assert.IsNull(file.FindTypeByName("protobuf_unittest.ForeignEnum")); + Assert.AreEqual(1, UnitTestImportProtoFile.Descriptor.EnumTypes.Count); + Assert.AreEqual("ImportEnum", UnitTestImportProtoFile.Descriptor.EnumTypes[0].Name); + for (int i = 0; i < file.EnumTypes.Count; i++) + { + Assert.AreEqual(i, file.EnumTypes[i].Index); + } + + ServiceDescriptor service = TestGenericService.Descriptor; + Assert.AreEqual(service, UnitTestGenericServices.Descriptor.Services[0]); + Assert.AreEqual(service, + UnitTestGenericServices.Descriptor.FindTypeByName("TestGenericService")); + Assert.IsNull(UnitTestGenericServices.Descriptor.FindTypeByName("NoSuchType")); + Assert.IsNull( + UnitTestGenericServices.Descriptor.FindTypeByName( + "protobuf_unittest.TestGenericService")); + Assert.AreEqual(0, UnitTestImportProtoFile.Descriptor.Services.Count); + for (int i = 0; i < file.Services.Count; i++) + { + Assert.AreEqual(i, file.Services[i].Index); + } + + FieldDescriptor extension = UnitTestProtoFile.OptionalInt32Extension.Descriptor; + Assert.AreEqual(extension, file.Extensions[0]); + Assert.AreEqual(extension, file.FindTypeByName("optional_int32_extension")); + Assert.IsNull(file.FindTypeByName("no_such_ext")); + Assert.IsNull(file.FindTypeByName("protobuf_unittest.optional_int32_extension")); + Assert.AreEqual(0, UnitTestImportProtoFile.Descriptor.Extensions.Count); + for (int i = 0; i < file.Extensions.Count; i++) + { + Assert.AreEqual(i, file.Extensions[i].Index); + } + } + + [TestMethod] + public void MessageDescriptor() + { + MessageDescriptor messageType = TestAllTypes.Descriptor; + MessageDescriptor nestedType = TestAllTypes.Types.NestedMessage.Descriptor; + + Assert.AreEqual("TestAllTypes", messageType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes", messageType.FullName); + Assert.AreEqual(UnitTestProtoFile.Descriptor, messageType.File); + Assert.IsNull(messageType.ContainingType); + Assert.AreEqual(DescriptorProtos.MessageOptions.DefaultInstance, messageType.Options); + Assert.AreEqual("TestAllTypes", messageType.Proto.Name); + + Assert.AreEqual("NestedMessage", nestedType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedMessage", nestedType.FullName); + Assert.AreEqual(UnitTestProtoFile.Descriptor, nestedType.File); + Assert.AreEqual(messageType, nestedType.ContainingType); + + FieldDescriptor field = messageType.Fields[0]; + Assert.AreEqual("optional_int32", field.Name); + Assert.AreEqual(field, messageType.FindDescriptor("optional_int32")); + Assert.IsNull(messageType.FindDescriptor("no_such_field")); + Assert.AreEqual(field, messageType.FindFieldByNumber(1)); + Assert.IsNull(messageType.FindFieldByNumber(571283)); + for (int i = 0; i < messageType.Fields.Count; i++) + { + Assert.AreEqual(i, messageType.Fields[i].Index); + } + + Assert.AreEqual(nestedType, messageType.NestedTypes[0]); + Assert.AreEqual(nestedType, messageType.FindDescriptor("NestedMessage")); + Assert.IsNull(messageType.FindDescriptor("NoSuchType")); + for (int i = 0; i < messageType.NestedTypes.Count; i++) + { + Assert.AreEqual(i, messageType.NestedTypes[i].Index); + } + + Assert.AreEqual(messageType.EnumTypes[0], messageType.FindDescriptor("NestedEnum")); + Assert.IsNull(messageType.FindDescriptor("NoSuchType")); + for (int i = 0; i < messageType.EnumTypes.Count; i++) + { + Assert.AreEqual(i, messageType.EnumTypes[i].Index); + } + } + + [TestMethod] + public void FieldDescriptor() + { + MessageDescriptor messageType = TestAllTypes.Descriptor; + FieldDescriptor primitiveField = messageType.FindDescriptor("optional_int32"); + FieldDescriptor enumField = messageType.FindDescriptor("optional_nested_enum"); + FieldDescriptor messageField = messageType.FindDescriptor("optional_foreign_message"); + FieldDescriptor cordField = messageType.FindDescriptor("optional_cord"); + FieldDescriptor extension = UnitTestProtoFile.OptionalInt32Extension.Descriptor; + FieldDescriptor nestedExtension = TestRequired.Single.Descriptor; + + Assert.AreEqual("optional_int32", primitiveField.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.optional_int32", + primitiveField.FullName); + Assert.AreEqual(1, primitiveField.FieldNumber); + Assert.AreEqual(messageType, primitiveField.ContainingType); + Assert.AreEqual(UnitTestProtoFile.Descriptor, primitiveField.File); + Assert.AreEqual(FieldType.Int32, primitiveField.FieldType); + Assert.AreEqual(MappedType.Int32, primitiveField.MappedType); + Assert.AreEqual(DescriptorProtos.FieldOptions.DefaultInstance, primitiveField.Options); + Assert.IsFalse(primitiveField.IsExtension); + Assert.AreEqual("optional_int32", primitiveField.Proto.Name); + + Assert.AreEqual("optional_nested_enum", enumField.Name); + Assert.AreEqual(FieldType.Enum, enumField.FieldType); + Assert.AreEqual(MappedType.Enum, enumField.MappedType); + // Assert.AreEqual(TestAllTypes.Types.NestedEnum.Descriptor, enumField.EnumType); + + Assert.AreEqual("optional_foreign_message", messageField.Name); + Assert.AreEqual(FieldType.Message, messageField.FieldType); + Assert.AreEqual(MappedType.Message, messageField.MappedType); + Assert.AreEqual(ForeignMessage.Descriptor, messageField.MessageType); + + Assert.AreEqual("optional_cord", cordField.Name); + Assert.AreEqual(FieldType.String, cordField.FieldType); + Assert.AreEqual(MappedType.String, cordField.MappedType); + Assert.AreEqual(DescriptorProtos.FieldOptions.Types.CType.CORD, cordField.Options.Ctype); + + Assert.AreEqual("optional_int32_extension", extension.Name); + Assert.AreEqual("protobuf_unittest.optional_int32_extension", extension.FullName); + Assert.AreEqual(1, extension.FieldNumber); + Assert.AreEqual(TestAllExtensions.Descriptor, extension.ContainingType); + Assert.AreEqual(UnitTestProtoFile.Descriptor, extension.File); + Assert.AreEqual(FieldType.Int32, extension.FieldType); + Assert.AreEqual(MappedType.Int32, extension.MappedType); + Assert.AreEqual(DescriptorProtos.FieldOptions.DefaultInstance, + extension.Options); + Assert.IsTrue(extension.IsExtension); + Assert.AreEqual(null, extension.ExtensionScope); + Assert.AreEqual("optional_int32_extension", extension.Proto.Name); + + Assert.AreEqual("single", nestedExtension.Name); + Assert.AreEqual("protobuf_unittest.TestRequired.single", + nestedExtension.FullName); + Assert.AreEqual(TestRequired.Descriptor, + nestedExtension.ExtensionScope); + } + + [TestMethod] + public void FieldDescriptorLabel() + { + FieldDescriptor requiredField = + TestRequired.Descriptor.FindDescriptor("a"); + FieldDescriptor optionalField = + TestAllTypes.Descriptor.FindDescriptor("optional_int32"); + FieldDescriptor repeatedField = + TestAllTypes.Descriptor.FindDescriptor("repeated_int32"); + + Assert.IsTrue(requiredField.IsRequired); + Assert.IsFalse(requiredField.IsRepeated); + Assert.IsFalse(optionalField.IsRequired); + Assert.IsFalse(optionalField.IsRepeated); + Assert.IsFalse(repeatedField.IsRequired); + Assert.IsTrue(repeatedField.IsRepeated); + } + [TestMethod] + public void FieldDescriptorDefault() + { + MessageDescriptor d = TestAllTypes.Descriptor; + Assert.IsFalse(d.FindDescriptor("optional_int32").HasDefaultValue); + Assert.AreEqual(0, d.FindDescriptor("optional_int32").DefaultValue); + Assert.IsTrue(d.FindDescriptor("default_int32").HasDefaultValue); + Assert.AreEqual(41, d.FindDescriptor("default_int32").DefaultValue); + + d = TestExtremeDefaultValues.Descriptor; + Assert.AreEqual(TestExtremeDefaultValues.DefaultInstance.EscapedBytes, + d.FindDescriptor("escaped_bytes").DefaultValue); + + Assert.AreEqual(uint.MaxValue, d.FindDescriptor("large_uint32").DefaultValue); + Assert.AreEqual(ulong.MaxValue, d.FindDescriptor("large_uint64").DefaultValue); + } + [TestMethod] + public void EnumDescriptor() + { + // Note: this test is a bit different to the Java version because there's no static way of getting to the descriptor + EnumDescriptor enumType = UnitTestProtoFile.Descriptor.FindTypeByName("ForeignEnum"); + EnumDescriptor nestedType = TestAllTypes.Descriptor.FindDescriptor("NestedEnum"); + + Assert.AreEqual("ForeignEnum", enumType.Name); + Assert.AreEqual("protobuf_unittest.ForeignEnum", enumType.FullName); + Assert.AreEqual(UnitTestProtoFile.Descriptor, enumType.File); + Assert.IsNull(enumType.ContainingType); + Assert.AreEqual(DescriptorProtos.EnumOptions.DefaultInstance, + enumType.Options); + + Assert.AreEqual("NestedEnum", nestedType.Name); + Assert.AreEqual("protobuf_unittest.TestAllTypes.NestedEnum", + nestedType.FullName); + Assert.AreEqual(UnitTestProtoFile.Descriptor, nestedType.File); + Assert.AreEqual(TestAllTypes.Descriptor, nestedType.ContainingType); + + EnumValueDescriptor value = enumType.FindValueByName("FOREIGN_FOO"); + Assert.AreEqual(value, enumType.Values[0]); + Assert.AreEqual("FOREIGN_FOO", value.Name); + Assert.AreEqual(4, value.Number); + Assert.AreEqual((int) ForeignEnum.FOREIGN_FOO, value.Number); + Assert.AreEqual(value, enumType.FindValueByNumber(4)); + Assert.IsNull(enumType.FindValueByName("NO_SUCH_VALUE")); + for (int i = 0; i < enumType.Values.Count; i++) + { + Assert.AreEqual(i, enumType.Values[i].Index); + } + } + + [TestMethod] + public void ServiceDescriptor() + { + ServiceDescriptor service = TestGenericService.Descriptor; + + Assert.AreEqual("TestGenericService", service.Name); + Assert.AreEqual("protobuf_unittest.TestGenericService", service.FullName); + Assert.AreEqual(UnitTestGenericServices.Descriptor, service.File); + + Assert.AreEqual(2, service.Methods.Count); + + MethodDescriptor fooMethod = service.Methods[0]; + Assert.AreEqual("Foo", fooMethod.Name); + Assert.AreEqual(FooRequest.Descriptor, fooMethod.InputType); + Assert.AreEqual(FooResponse.Descriptor, fooMethod.OutputType); + Assert.AreEqual(fooMethod, service.FindMethodByName("Foo")); + + MethodDescriptor barMethod = service.Methods[1]; + Assert.AreEqual("Bar", barMethod.Name); + Assert.AreEqual(BarRequest.Descriptor, barMethod.InputType); + Assert.AreEqual(BarResponse.Descriptor, barMethod.OutputType); + Assert.AreEqual(barMethod, service.FindMethodByName("Bar")); + + Assert.IsNull(service.FindMethodByName("NoSuchMethod")); + + for (int i = 0; i < service.Methods.Count; i++) + { + Assert.AreEqual(i, service.Methods[i].Index); + } + } + + [TestMethod] + public void CustomOptions() + { + MessageDescriptor descriptor = TestMessageWithCustomOptions.Descriptor; + Assert.IsTrue(descriptor.Options.HasExtension(UnitTestCustomOptionsProtoFile.MessageOpt1)); + Assert.AreEqual(-56, descriptor.Options.GetExtension(UnitTestCustomOptionsProtoFile.MessageOpt1)); + + + FieldDescriptor field = descriptor.FindFieldByName("field1"); + Assert.IsNotNull(field); + + Assert.IsTrue(field.Options.HasExtension(UnitTestCustomOptionsProtoFile.FieldOpt1)); + Assert.AreEqual(8765432109uL, field.Options.GetExtension(UnitTestCustomOptionsProtoFile.FieldOpt1)); + + // TODO: Write out enum descriptors + /* + EnumDescriptor enumType = TestMessageWithCustomOptions.Types. + UnittestCustomOptions.TestMessageWithCustomOptions.AnEnum.getDescriptor(); + + Assert.IsTrue( + enumType.getOptions().hasExtension(UnittestCustomOptions.enumOpt1)); + Assert.AreEqual(Integer.valueOf(-789), + enumType.getOptions().getExtension(UnittestCustomOptions.enumOpt1)); + */ + + ServiceDescriptor service = TestGenericServiceWithCustomOptions.Descriptor; + + Assert.IsTrue(service.Options.HasExtension(UnitTestCustomOptionsProtoFile.ServiceOpt1)); + Assert.AreEqual(-9876543210L, service.Options.GetExtension(UnitTestCustomOptionsProtoFile.ServiceOpt1)); + + MethodDescriptor method = service.FindMethodByName("Foo"); + Assert.IsNotNull(method); + + Assert.IsTrue(method.Options.HasExtension(UnitTestCustomOptionsProtoFile.MethodOpt1)); + Assert.AreEqual(MethodOpt1.METHODOPT1_VAL2, + method.Options.GetExtension(UnitTestCustomOptionsProtoFile.MethodOpt1)); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/DynamicMessageTest.cs b/csharp/src/ProtocolBuffers.Test/DynamicMessageTest.cs new file mode 100644 index 00000000..92515999 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/DynamicMessageTest.cs @@ -0,0 +1,237 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class DynamicMessageTest + { + private ReflectionTester reflectionTester; + private ReflectionTester extensionsReflectionTester; + private ReflectionTester packedReflectionTester; + + [TestInitialize] + public void SetUp() + { + reflectionTester = ReflectionTester.CreateTestAllTypesInstance(); + extensionsReflectionTester = ReflectionTester.CreateTestAllExtensionsInstance(); + packedReflectionTester = ReflectionTester.CreateTestPackedTypesInstance(); + } + + [TestMethod] + public void DynamicMessageAccessors() + { + IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); + reflectionTester.SetAllFieldsViaReflection(builder); + IMessage message = builder.WeakBuild(); + reflectionTester.AssertAllFieldsSetViaReflection(message); + } + + [TestMethod] + public void DoubleBuildError() + { + DynamicMessage.Builder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); + builder.Build(); + try + { + builder.Build(); + Assert.Fail("Should have thrown exception."); + } + catch (InvalidOperationException) + { + // Success. + } + } + + [TestMethod] + public void DynamicMessageSettersRejectNull() + { + IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); + reflectionTester.AssertReflectionSettersRejectNull(builder); + } + + [TestMethod] + public void DynamicMessageExtensionAccessors() + { + // We don't need to extensively test DynamicMessage's handling of + // extensions because, frankly, it doesn't do anything special with them. + // It treats them just like any other fields. + IBuilder builder = DynamicMessage.CreateBuilder(TestAllExtensions.Descriptor); + extensionsReflectionTester.SetAllFieldsViaReflection(builder); + IMessage message = builder.WeakBuild(); + extensionsReflectionTester.AssertAllFieldsSetViaReflection(message); + } + + [TestMethod] + public void DynamicMessageExtensionSettersRejectNull() + { + IBuilder builder = DynamicMessage.CreateBuilder(TestAllExtensions.Descriptor); + extensionsReflectionTester.AssertReflectionSettersRejectNull(builder); + } + + [TestMethod] + public void DynamicMessageRepeatedSetters() + { + IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); + reflectionTester.SetAllFieldsViaReflection(builder); + reflectionTester.ModifyRepeatedFieldsViaReflection(builder); + IMessage message = builder.WeakBuild(); + reflectionTester.AssertRepeatedFieldsModifiedViaReflection(message); + } + + [TestMethod] + public void DynamicMessageRepeatedSettersRejectNull() + { + IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); + reflectionTester.AssertReflectionRepeatedSettersRejectNull(builder); + } + + [TestMethod] + public void DynamicMessageDefaults() + { + reflectionTester.AssertClearViaReflection(DynamicMessage.GetDefaultInstance(TestAllTypes.Descriptor)); + reflectionTester.AssertClearViaReflection(DynamicMessage.CreateBuilder(TestAllTypes.Descriptor).Build()); + } + + [TestMethod] + public void DynamicMessageSerializedSize() + { + TestAllTypes message = TestUtil.GetAllSet(); + + IBuilder dynamicBuilder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); + reflectionTester.SetAllFieldsViaReflection(dynamicBuilder); + IMessage dynamicMessage = dynamicBuilder.WeakBuild(); + + Assert.AreEqual(message.SerializedSize, dynamicMessage.SerializedSize); + } + + [TestMethod] + public void DynamicMessageSerialization() + { + IBuilder builder = DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); + reflectionTester.SetAllFieldsViaReflection(builder); + IMessage message = builder.WeakBuild(); + + ByteString rawBytes = message.ToByteString(); + TestAllTypes message2 = TestAllTypes.ParseFrom(rawBytes); + + TestUtil.AssertAllFieldsSet(message2); + + // In fact, the serialized forms should be exactly the same, byte-for-byte. + Assert.AreEqual(TestUtil.GetAllSet().ToByteString(), rawBytes); + } + + [TestMethod] + public void DynamicMessageParsing() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TestUtil.SetAllFields(builder); + TestAllTypes message = builder.Build(); + + ByteString rawBytes = message.ToByteString(); + + IMessage message2 = DynamicMessage.ParseFrom(TestAllTypes.Descriptor, rawBytes); + reflectionTester.AssertAllFieldsSetViaReflection(message2); + } + + [TestMethod] + public void DynamicMessagePackedSerialization() + { + IBuilder builder = DynamicMessage.CreateBuilder(TestPackedTypes.Descriptor); + packedReflectionTester.SetPackedFieldsViaReflection(builder); + IMessage message = builder.WeakBuild(); + + ByteString rawBytes = message.ToByteString(); + TestPackedTypes message2 = TestPackedTypes.ParseFrom(rawBytes); + + TestUtil.AssertPackedFieldsSet(message2); + + // In fact, the serialized forms should be exactly the same, byte-for-byte. + Assert.AreEqual(TestUtil.GetPackedSet().ToByteString(), rawBytes); + } + + [TestMethod] + public void testDynamicMessagePackedParsing() + { + TestPackedTypes.Builder builder = TestPackedTypes.CreateBuilder(); + TestUtil.SetPackedFields(builder); + TestPackedTypes message = builder.Build(); + + ByteString rawBytes = message.ToByteString(); + + IMessage message2 = DynamicMessage.ParseFrom(TestPackedTypes.Descriptor, rawBytes); + packedReflectionTester.AssertPackedFieldsSetViaReflection(message2); + } + + [TestMethod] + public void DynamicMessageCopy() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TestUtil.SetAllFields(builder); + TestAllTypes message = builder.Build(); + + DynamicMessage copy = DynamicMessage.CreateBuilder(message).Build(); + reflectionTester.AssertAllFieldsSetViaReflection(copy); + } + + [TestMethod] + public void ToBuilder() + { + DynamicMessage.Builder builder = + DynamicMessage.CreateBuilder(TestAllTypes.Descriptor); + reflectionTester.SetAllFieldsViaReflection(builder); + int unknownFieldNum = 9; + ulong unknownFieldVal = 90; + builder.SetUnknownFields(UnknownFieldSet.CreateBuilder() + .AddField(unknownFieldNum, + UnknownField.CreateBuilder().AddVarint(unknownFieldVal).Build()) + .Build()); + DynamicMessage message = builder.Build(); + + DynamicMessage derived = message.ToBuilder().Build(); + reflectionTester.AssertAllFieldsSetViaReflection(derived); + + IList values = derived.UnknownFields.FieldDictionary[unknownFieldNum].VarintList; + Assert.AreEqual(1, values.Count); + Assert.AreEqual(unknownFieldVal, values[0]); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ExtendableMessageTest.cs b/csharp/src/ProtocolBuffers.Test/ExtendableMessageTest.cs new file mode 100644 index 00000000..68f37c3c --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ExtendableMessageTest.cs @@ -0,0 +1,202 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class ExtendableMessageTest + { + [TestMethod, ExpectedException(typeof(ArgumentException))] + public void ExtensionWriterInvalidExtension() + { + TestPackedExtensions.CreateBuilder()[UnitTestProtoFile.OptionalForeignMessageExtension.Descriptor] = + ForeignMessage.DefaultInstance; + } + + [TestMethod] + public void ExtensionWriterTest() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder() + .SetExtension(UnitTestProtoFile.DefaultBoolExtension, true) + .SetExtension(UnitTestProtoFile.DefaultBytesExtension, ByteString.CopyFromUtf8("123")) + .SetExtension(UnitTestProtoFile.DefaultCordExtension, "123") + .SetExtension(UnitTestProtoFile.DefaultDoubleExtension, 123) + .SetExtension(UnitTestProtoFile.DefaultFixed32Extension, 123u) + .SetExtension(UnitTestProtoFile.DefaultFixed64Extension, 123u) + .SetExtension(UnitTestProtoFile.DefaultFloatExtension, 123) + .SetExtension(UnitTestProtoFile.DefaultForeignEnumExtension, ForeignEnum.FOREIGN_BAZ) + .SetExtension(UnitTestProtoFile.DefaultImportEnumExtension, ImportEnum.IMPORT_BAZ) + .SetExtension(UnitTestProtoFile.DefaultInt32Extension, 123) + .SetExtension(UnitTestProtoFile.DefaultInt64Extension, 123) + .SetExtension(UnitTestProtoFile.DefaultNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO) + .SetExtension(UnitTestProtoFile.DefaultSfixed32Extension, 123) + .SetExtension(UnitTestProtoFile.DefaultSfixed64Extension, 123) + .SetExtension(UnitTestProtoFile.DefaultSint32Extension, 123) + .SetExtension(UnitTestProtoFile.DefaultSint64Extension, 123) + .SetExtension(UnitTestProtoFile.DefaultStringExtension, "123") + .SetExtension(UnitTestProtoFile.DefaultStringPieceExtension, "123") + .SetExtension(UnitTestProtoFile.DefaultUint32Extension, 123u) + .SetExtension(UnitTestProtoFile.DefaultUint64Extension, 123u) + //Optional + .SetExtension(UnitTestProtoFile.OptionalBoolExtension, true) + .SetExtension(UnitTestProtoFile.OptionalBytesExtension, ByteString.CopyFromUtf8("123")) + .SetExtension(UnitTestProtoFile.OptionalCordExtension, "123") + .SetExtension(UnitTestProtoFile.OptionalDoubleExtension, 123) + .SetExtension(UnitTestProtoFile.OptionalFixed32Extension, 123u) + .SetExtension(UnitTestProtoFile.OptionalFixed64Extension, 123u) + .SetExtension(UnitTestProtoFile.OptionalFloatExtension, 123) + .SetExtension(UnitTestProtoFile.OptionalForeignEnumExtension, ForeignEnum.FOREIGN_BAZ) + .SetExtension(UnitTestProtoFile.OptionalImportEnumExtension, ImportEnum.IMPORT_BAZ) + .SetExtension(UnitTestProtoFile.OptionalInt32Extension, 123) + .SetExtension(UnitTestProtoFile.OptionalInt64Extension, 123) + .SetExtension(UnitTestProtoFile.OptionalNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO) + .SetExtension(UnitTestProtoFile.OptionalSfixed32Extension, 123) + .SetExtension(UnitTestProtoFile.OptionalSfixed64Extension, 123) + .SetExtension(UnitTestProtoFile.OptionalSint32Extension, 123) + .SetExtension(UnitTestProtoFile.OptionalSint64Extension, 123) + .SetExtension(UnitTestProtoFile.OptionalStringExtension, "123") + .SetExtension(UnitTestProtoFile.OptionalStringPieceExtension, "123") + .SetExtension(UnitTestProtoFile.OptionalUint32Extension, 123u) + .SetExtension(UnitTestProtoFile.OptionalUint64Extension, 123u) + //Repeated + .AddExtension(UnitTestProtoFile.RepeatedBoolExtension, true) + .AddExtension(UnitTestProtoFile.RepeatedBytesExtension, ByteString.CopyFromUtf8("123")) + .AddExtension(UnitTestProtoFile.RepeatedCordExtension, "123") + .AddExtension(UnitTestProtoFile.RepeatedDoubleExtension, 123) + .AddExtension(UnitTestProtoFile.RepeatedFixed32Extension, 123u) + .AddExtension(UnitTestProtoFile.RepeatedFixed64Extension, 123u) + .AddExtension(UnitTestProtoFile.RepeatedFloatExtension, 123) + .AddExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, ForeignEnum.FOREIGN_BAZ) + .AddExtension(UnitTestProtoFile.RepeatedImportEnumExtension, ImportEnum.IMPORT_BAZ) + .AddExtension(UnitTestProtoFile.RepeatedInt32Extension, 123) + .AddExtension(UnitTestProtoFile.RepeatedInt64Extension, 123) + .AddExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO) + .AddExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 123) + .AddExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 123) + .AddExtension(UnitTestProtoFile.RepeatedSint32Extension, 123) + .AddExtension(UnitTestProtoFile.RepeatedSint64Extension, 123) + .AddExtension(UnitTestProtoFile.RepeatedStringExtension, "123") + .AddExtension(UnitTestProtoFile.RepeatedStringPieceExtension, "123") + .AddExtension(UnitTestProtoFile.RepeatedUint32Extension, 123u) + .AddExtension(UnitTestProtoFile.RepeatedUint64Extension, 123u) + ; + TestAllExtensions msg = builder.Build(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestProtoFile.RegisterAllExtensions(registry); + + TestAllExtensions.Builder copyBuilder = TestAllExtensions.CreateBuilder().MergeFrom(msg.ToByteArray(), + registry); + TestAllExtensions copy = copyBuilder.Build(); + + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + + Assert.AreEqual(true, copy.GetExtension(UnitTestProtoFile.DefaultBoolExtension)); + Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(UnitTestProtoFile.DefaultBytesExtension)); + Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.DefaultCordExtension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultDoubleExtension)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.DefaultFixed32Extension)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.DefaultFixed64Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultFloatExtension)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, copy.GetExtension(UnitTestProtoFile.DefaultForeignEnumExtension)); + Assert.AreEqual(ImportEnum.IMPORT_BAZ, copy.GetExtension(UnitTestProtoFile.DefaultImportEnumExtension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultInt32Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultInt64Extension)); + Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, + copy.GetExtension(UnitTestProtoFile.DefaultNestedEnumExtension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultSfixed32Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultSfixed64Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultSint32Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.DefaultSint64Extension)); + Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.DefaultStringExtension)); + Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.DefaultStringPieceExtension)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.DefaultUint32Extension)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.DefaultUint64Extension)); + + Assert.AreEqual(true, copy.GetExtension(UnitTestProtoFile.OptionalBoolExtension)); + Assert.AreEqual(ByteString.CopyFromUtf8("123"), copy.GetExtension(UnitTestProtoFile.OptionalBytesExtension)); + Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.OptionalCordExtension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalDoubleExtension)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.OptionalFixed32Extension)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.OptionalFixed64Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalFloatExtension)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, copy.GetExtension(UnitTestProtoFile.OptionalForeignEnumExtension)); + Assert.AreEqual(ImportEnum.IMPORT_BAZ, copy.GetExtension(UnitTestProtoFile.OptionalImportEnumExtension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalInt32Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalInt64Extension)); + Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, + copy.GetExtension(UnitTestProtoFile.OptionalNestedEnumExtension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalSfixed32Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalSfixed64Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalSint32Extension)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.OptionalSint64Extension)); + Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.OptionalStringExtension)); + Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.OptionalStringPieceExtension)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.OptionalUint32Extension)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.OptionalUint64Extension)); + + Assert.AreEqual(true, copy.GetExtension(UnitTestProtoFile.RepeatedBoolExtension, 0)); + Assert.AreEqual(ByteString.CopyFromUtf8("123"), + copy.GetExtension(UnitTestProtoFile.RepeatedBytesExtension, 0)); + Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.RepeatedCordExtension, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedDoubleExtension, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.RepeatedFixed32Extension, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.RepeatedFixed64Extension, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedFloatExtension, 0)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, + copy.GetExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, 0)); + Assert.AreEqual(ImportEnum.IMPORT_BAZ, copy.GetExtension(UnitTestProtoFile.RepeatedImportEnumExtension, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedInt32Extension, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedInt64Extension, 0)); + Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, + copy.GetExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedSint32Extension, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestProtoFile.RepeatedSint64Extension, 0)); + Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.RepeatedStringExtension, 0)); + Assert.AreEqual("123", copy.GetExtension(UnitTestProtoFile.RepeatedStringPieceExtension, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.RepeatedUint32Extension, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestProtoFile.RepeatedUint64Extension, 0)); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/GeneratedBuilderTest.cs b/csharp/src/ProtocolBuffers.Test/GeneratedBuilderTest.cs new file mode 100644 index 00000000..1dcb1c21 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/GeneratedBuilderTest.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class GeneratedBuilderTest + { + class OneTimeEnumerator : IEnumerable + { + readonly T _item; + bool _enumerated; + public OneTimeEnumerator(T item) + { + _item = item; + } + public IEnumerator GetEnumerator() + { + Assert.IsFalse(_enumerated, "The collection {0} has already been enumerated", GetType()); + _enumerated = true; + yield return _item; + } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { return GetEnumerator(); } + } + + [TestMethod] + public void DoesNotEnumerateTwiceForMessageList() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRangeRepeatedForeignMessage( + new OneTimeEnumerator( + ForeignMessage.DefaultInstance)); + } + [TestMethod] + public void DoesNotEnumerateTwiceForPrimitiveList() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRangeRepeatedInt32(new OneTimeEnumerator(1)); + } + [TestMethod] + public void DoesNotEnumerateTwiceForStringList() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRangeRepeatedString(new OneTimeEnumerator("test")); + } + [TestMethod] + public void DoesNotEnumerateTwiceForEnumList() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRangeRepeatedForeignEnum(new OneTimeEnumerator(ForeignEnum.FOREIGN_BAR)); + } + + private delegate void TestMethod(); + + private static void AssertThrows(TestMethod method) where T : Exception + { + try + { + method(); + } + catch (Exception error) + { + if (error is T) + return; + throw; + } + Assert.Fail("Expected exception of type " + typeof(T)); + } + + [TestMethod] + public void DoesNotAddNullToMessageListByAddRange() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + AssertThrows( + () => b.AddRangeRepeatedForeignMessage(new ForeignMessage[] { null }) + ); + } + [TestMethod] + public void DoesNotAddNullToMessageListByAdd() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + AssertThrows( + () => b.AddRepeatedForeignMessage((ForeignMessage)null) + ); + } + [TestMethod] + public void DoesNotAddNullToMessageListBySet() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRepeatedForeignMessage(ForeignMessage.DefaultInstance); + AssertThrows( + () => b.SetRepeatedForeignMessage(0, (ForeignMessage)null) + ); + } + [TestMethod] + public void DoesNotAddNullToStringListByAddRange() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + AssertThrows( + () => b.AddRangeRepeatedString(new String[] { null }) + ); + } + [TestMethod] + public void DoesNotAddNullToStringListByAdd() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + AssertThrows( + () => b.AddRepeatedString(null) + ); + } + [TestMethod] + public void DoesNotAddNullToStringListBySet() + { + TestAllTypes.Builder b = new TestAllTypes.Builder(); + b.AddRepeatedString("one"); + AssertThrows( + () => b.SetRepeatedString(0, null) + ); + } + } +} diff --git a/csharp/src/ProtocolBuffers.Test/GeneratedMessageTest.cs b/csharp/src/ProtocolBuffers.Test/GeneratedMessageTest.cs new file mode 100644 index 00000000..b04fb399 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/GeneratedMessageTest.cs @@ -0,0 +1,532 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class GeneratedMessageTest + { + private ReflectionTester reflectionTester; + private ReflectionTester extensionsReflectionTester; + + [TestInitialize] + public void SetUp() + { + reflectionTester = ReflectionTester.CreateTestAllTypesInstance(); + extensionsReflectionTester = ReflectionTester.CreateTestAllExtensionsInstance(); + } + + [TestMethod] + public void RepeatedAddPrimitiveBeforeBuild() + { + TestAllTypes message = new TestAllTypes.Builder {RepeatedInt32List = {1, 2, 3}}.Build(); + TestUtil.AssertEqual(new int[] {1, 2, 3}, message.RepeatedInt32List); + } + + [TestMethod] + public void AddPrimitiveFailsAfterBuild() + { + TestAllTypes.Builder builder = new TestAllTypes.Builder(); + IList list = builder.RepeatedInt32List; + list.Add(1); // Fine + builder.Build(); + + try + { + list.Add(2); + Assert.Fail("List should be frozen"); + } + catch (NotSupportedException) + { + // Expected + } + } + + [TestMethod] + public void RepeatedAddMessageBeforeBuild() + { + TestAllTypes message = new TestAllTypes.Builder + { + RepeatedNestedMessageList = + {new TestAllTypes.Types.NestedMessage.Builder {Bb = 10}.Build()} + }.Build(); + Assert.AreEqual(1, message.RepeatedNestedMessageCount); + Assert.AreEqual(10, message.RepeatedNestedMessageList[0].Bb); + } + + [TestMethod] + public void AddMessageFailsAfterBuild() + { + TestAllTypes.Builder builder = new TestAllTypes.Builder(); + IList list = builder.RepeatedNestedMessageList; + builder.Build(); + + try + { + list.Add(new TestAllTypes.Types.NestedMessage.Builder {Bb = 10}.Build()); + Assert.Fail("List should be frozen"); + } + catch (NotSupportedException) + { + // Expected + } + } + + [TestMethod] + public void DefaultInstance() + { + Assert.AreSame(TestAllTypes.DefaultInstance, TestAllTypes.DefaultInstance.DefaultInstanceForType); + Assert.AreSame(TestAllTypes.DefaultInstance, TestAllTypes.CreateBuilder().DefaultInstanceForType); + } + + [TestMethod] + public void Accessors() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TestUtil.SetAllFields(builder); + TestAllTypes message = builder.Build(); + TestUtil.AssertAllFieldsSet(message); + } + + [TestMethod] + public void SettersRejectNull() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TestUtil.AssertArgumentNullException(() => builder.SetOptionalString(null)); + TestUtil.AssertArgumentNullException(() => builder.SetOptionalBytes(null)); + TestUtil.AssertArgumentNullException( + () => builder.SetOptionalNestedMessage((TestAllTypes.Types.NestedMessage) null)); + TestUtil.AssertArgumentNullException( + () => builder.SetOptionalNestedMessage((TestAllTypes.Types.NestedMessage.Builder) null)); + TestUtil.AssertArgumentNullException(() => builder.AddRepeatedString(null)); + TestUtil.AssertArgumentNullException(() => builder.AddRepeatedBytes(null)); + TestUtil.AssertArgumentNullException( + () => builder.AddRepeatedNestedMessage((TestAllTypes.Types.NestedMessage) null)); + TestUtil.AssertArgumentNullException( + () => builder.AddRepeatedNestedMessage((TestAllTypes.Types.NestedMessage.Builder) null)); + } + + [TestMethod] + public void RepeatedSetters() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TestUtil.SetAllFields(builder); + TestUtil.ModifyRepeatedFields(builder); + TestAllTypes message = builder.Build(); + TestUtil.AssertRepeatedFieldsModified(message); + } + + [TestMethod] + public void RepeatedAppend() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + + builder.AddRangeRepeatedInt32(new int[] {1, 2, 3, 4}); + builder.AddRangeRepeatedForeignEnum((new ForeignEnum[] {ForeignEnum.FOREIGN_BAZ})); + + ForeignMessage foreignMessage = ForeignMessage.CreateBuilder().SetC(12).Build(); + builder.AddRangeRepeatedForeignMessage(new ForeignMessage[] {foreignMessage}); + + TestAllTypes message = builder.Build(); + TestUtil.AssertEqual(message.RepeatedInt32List, new int[] {1, 2, 3, 4}); + TestUtil.AssertEqual(message.RepeatedForeignEnumList, new ForeignEnum[] {ForeignEnum.FOREIGN_BAZ}); + Assert.AreEqual(1, message.RepeatedForeignMessageCount); + Assert.AreEqual(12, message.GetRepeatedForeignMessage(0).C); + } + + [TestMethod] + public void RepeatedAppendRejectsNull() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + + ForeignMessage foreignMessage = ForeignMessage.CreateBuilder().SetC(12).Build(); + TestUtil.AssertArgumentNullException( + () => builder.AddRangeRepeatedForeignMessage(new[] {foreignMessage, null})); + TestUtil.AssertArgumentNullException(() => builder.AddRangeRepeatedForeignMessage(null)); + TestUtil.AssertArgumentNullException(() => builder.AddRangeRepeatedForeignEnum(null)); + TestUtil.AssertArgumentNullException(() => builder.AddRangeRepeatedString(new[] {"one", null})); + TestUtil.AssertArgumentNullException( + () => builder.AddRangeRepeatedBytes(new[] {TestUtil.ToBytes("one"), null})); + } + + [TestMethod] + public void SettingForeignMessageUsingBuilder() + { + TestAllTypes message = TestAllTypes.CreateBuilder() + // Pass builder for foreign message instance. + .SetOptionalForeignMessage(ForeignMessage.CreateBuilder().SetC(123)) + .Build(); + TestAllTypes expectedMessage = TestAllTypes.CreateBuilder() + // Create expected version passing foreign message instance explicitly. + .SetOptionalForeignMessage(ForeignMessage.CreateBuilder().SetC(123).Build()) + .Build(); + Assert.AreEqual(expectedMessage, message); + } + + [TestMethod] + public void SettingRepeatedForeignMessageUsingBuilder() + { + TestAllTypes message = TestAllTypes.CreateBuilder() + // Pass builder for foreign message instance. + .AddRepeatedForeignMessage(ForeignMessage.CreateBuilder().SetC(456)) + .Build(); + TestAllTypes expectedMessage = TestAllTypes.CreateBuilder() + // Create expected version passing foreign message instance explicitly. + .AddRepeatedForeignMessage(ForeignMessage.CreateBuilder().SetC(456).Build()) + .Build(); + Assert.AreEqual(expectedMessage, message); + } + + [TestMethod] + public void SettingRepeatedValuesUsingRangeInCollectionInitializer() + { + int[] values = {1, 2, 3}; + TestAllTypes message = new TestAllTypes.Builder + { + RepeatedSint32List = {values} + }.Build(); + Assert.IsTrue(Lists.Equals(values, message.RepeatedSint32List)); + } + + [TestMethod] + public void SettingRepeatedValuesUsingIndividualValuesInCollectionInitializer() + { + TestAllTypes message = new TestAllTypes.Builder + { + RepeatedSint32List = {6, 7} + }.Build(); + Assert.IsTrue(Lists.Equals(new int[] {6, 7}, message.RepeatedSint32List)); + } + + [TestMethod] + public void Defaults() + { + TestUtil.AssertClear(TestAllTypes.DefaultInstance); + TestUtil.AssertClear(TestAllTypes.CreateBuilder().Build()); + + Assert.AreEqual("\u1234", TestExtremeDefaultValues.DefaultInstance.Utf8String); + } + + [TestMethod] + public void ReflectionGetters() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TestUtil.SetAllFields(builder); + TestAllTypes message = builder.Build(); + reflectionTester.AssertAllFieldsSetViaReflection(message); + } + + [TestMethod] + public void ReflectionSetters() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + reflectionTester.SetAllFieldsViaReflection(builder); + TestAllTypes message = builder.Build(); + TestUtil.AssertAllFieldsSet(message); + } + + [TestMethod] + public void ReflectionClear() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + reflectionTester.SetAllFieldsViaReflection(builder); + reflectionTester.ClearAllFieldsViaReflection(builder); + TestAllTypes message = builder.Build(); + TestUtil.AssertClear(message); + } + + [TestMethod] + public void ReflectionSettersRejectNull() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + reflectionTester.AssertReflectionSettersRejectNull(builder); + } + + [TestMethod] + public void ReflectionRepeatedSetters() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + reflectionTester.SetAllFieldsViaReflection(builder); + reflectionTester.ModifyRepeatedFieldsViaReflection(builder); + TestAllTypes message = builder.Build(); + TestUtil.AssertRepeatedFieldsModified(message); + } + + [TestMethod] + public void TestReflectionRepeatedSettersRejectNull() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + reflectionTester.AssertReflectionRepeatedSettersRejectNull(builder); + } + + [TestMethod] + public void ReflectionDefaults() + { + TestUtil.TestInMultipleCultures(() => + { + reflectionTester.AssertClearViaReflection( + TestAllTypes.DefaultInstance); + reflectionTester.AssertClearViaReflection( + TestAllTypes.CreateBuilder().Build()); + }); + } + + // ================================================================= + // Extensions. + + [TestMethod] + public void ExtensionAccessors() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + TestUtil.SetAllExtensions(builder); + TestAllExtensions message = builder.Build(); + TestUtil.AssertAllExtensionsSet(message); + } + + [TestMethod] + public void ExtensionRepeatedSetters() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + TestUtil.SetAllExtensions(builder); + TestUtil.ModifyRepeatedExtensions(builder); + TestAllExtensions message = builder.Build(); + TestUtil.AssertRepeatedExtensionsModified(message); + } + + [TestMethod] + public void ExtensionDefaults() + { + TestUtil.AssertExtensionsClear(TestAllExtensions.DefaultInstance); + TestUtil.AssertExtensionsClear(TestAllExtensions.CreateBuilder().Build()); + } + + [TestMethod] + public void ExtensionReflectionGetters() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + TestUtil.SetAllExtensions(builder); + TestAllExtensions message = builder.Build(); + extensionsReflectionTester.AssertAllFieldsSetViaReflection(message); + } + + [TestMethod] + public void ExtensionReflectionSetters() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + extensionsReflectionTester.SetAllFieldsViaReflection(builder); + TestAllExtensions message = builder.Build(); + TestUtil.AssertAllExtensionsSet(message); + } + + [TestMethod] + public void ExtensionReflectionSettersRejectNull() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + extensionsReflectionTester.AssertReflectionSettersRejectNull(builder); + } + + [TestMethod] + public void ExtensionReflectionRepeatedSetters() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + extensionsReflectionTester.SetAllFieldsViaReflection(builder); + extensionsReflectionTester.ModifyRepeatedFieldsViaReflection(builder); + TestAllExtensions message = builder.Build(); + TestUtil.AssertRepeatedExtensionsModified(message); + } + + [TestMethod] + public void ExtensionReflectionRepeatedSettersRejectNull() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + extensionsReflectionTester.AssertReflectionRepeatedSettersRejectNull(builder); + } + + [TestMethod] + public void ExtensionReflectionDefaults() + { + TestUtil.TestInMultipleCultures(() => + { + extensionsReflectionTester.AssertClearViaReflection( + TestAllExtensions.DefaultInstance); + extensionsReflectionTester.AssertClearViaReflection( + TestAllExtensions.CreateBuilder().Build()); + }); + } + + [TestMethod] + public void ClearExtension() + { + // ClearExtension() is not actually used in TestUtil, so try it manually. + Assert.IsFalse(TestAllExtensions.CreateBuilder() + .SetExtension(UnitTestProtoFile.OptionalInt32Extension, 1) + .ClearExtension(UnitTestProtoFile.OptionalInt32Extension) + .HasExtension(UnitTestProtoFile.OptionalInt32Extension)); + Assert.AreEqual(0, TestAllExtensions.CreateBuilder() + .AddExtension(UnitTestProtoFile.RepeatedInt32Extension, 1) + .ClearExtension(UnitTestProtoFile.RepeatedInt32Extension) + .GetExtensionCount(UnitTestProtoFile.RepeatedInt32Extension)); + } + + [TestMethod] + public void ExtensionMergeFrom() + { + TestAllExtensions original = TestAllExtensions.CreateBuilder() + .SetExtension(UnitTestProtoFile.OptionalInt32Extension, 1).Build(); + TestAllExtensions merged = + TestAllExtensions.CreateBuilder().MergeFrom(original).Build(); + Assert.IsTrue((merged.HasExtension(UnitTestProtoFile.OptionalInt32Extension))); + Assert.AreEqual(1, (int) merged.GetExtension(UnitTestProtoFile.OptionalInt32Extension)); + } + + /* Removed multiple files option for the moment + [TestMethod] + public void MultipleFilesOption() { + // We mostly just want to check that things compile. + MessageWithNoOuter message = MessageWithNoOuter.CreateBuilder() + .SetNested(MessageWithNoOuter.Types.NestedMessage.CreateBuilder().SetI(1)) + .AddForeign(TestAllTypes.CreateBuilder().SetOptionalInt32(1)) + .SetNestedEnum(MessageWithNoOuter.Types.NestedEnum.BAZ) + .SetForeignEnum(EnumWithNoOuter.BAR) + .Build(); + Assert.AreEqual(message, MessageWithNoOuter.ParseFrom(message.ToByteString())); + + Assert.AreEqual(MultiFileProto.Descriptor, MessageWithNoOuter.Descriptor.File); + + FieldDescriptor field = MessageWithNoOuter.Descriptor.FindDescriptor("foreign_enum"); + Assert.AreEqual(MultiFileProto.Descriptor.FindTypeByName("EnumWithNoOuter") + .FindValueByNumber((int)EnumWithNoOuter.BAR), message[field]); + + Assert.AreEqual(MultiFileProto.Descriptor, ServiceWithNoOuter.Descriptor.File); + + Assert.IsFalse(TestAllExtensions.DefaultInstance.HasExtension(MultiFileProto.ExtensionWithOuter)); + }*/ + + [TestMethod] + public void OptionalFieldWithRequiredSubfieldsOptimizedForSize() + { + TestOptionalOptimizedForSize message = TestOptionalOptimizedForSize.DefaultInstance; + Assert.IsTrue(message.IsInitialized); + + message = TestOptionalOptimizedForSize.CreateBuilder().SetO( + TestRequiredOptimizedForSize.CreateBuilder().BuildPartial() + ).BuildPartial(); + Assert.IsFalse(message.IsInitialized); + + message = TestOptionalOptimizedForSize.CreateBuilder().SetO( + TestRequiredOptimizedForSize.CreateBuilder().SetX(5).BuildPartial() + ).BuildPartial(); + Assert.IsTrue(message.IsInitialized); + } + + [TestMethod] + public void OptimizedForSizeMergeUsesAllFieldsFromTarget() + { + TestOptimizedForSize withFieldSet = new TestOptimizedForSize.Builder {I = 10}.Build(); + TestOptimizedForSize.Builder builder = new TestOptimizedForSize.Builder(); + builder.MergeFrom(withFieldSet); + TestOptimizedForSize built = builder.Build(); + Assert.AreEqual(10, built.I); + } + + [TestMethod] + public void UninitializedExtensionInOptimizedForSizeMakesMessageUninitialized() + { + TestOptimizedForSize.Builder builder = new TestOptimizedForSize.Builder(); + builder.SetExtension(TestOptimizedForSize.TestExtension2, + new TestRequiredOptimizedForSize.Builder().BuildPartial()); + Assert.IsFalse(builder.IsInitialized); + Assert.IsFalse(builder.BuildPartial().IsInitialized); + + builder = new TestOptimizedForSize.Builder(); + builder.SetExtension(TestOptimizedForSize.TestExtension2, + new TestRequiredOptimizedForSize.Builder {X = 10}.BuildPartial()); + Assert.IsTrue(builder.IsInitialized); + Assert.IsTrue(builder.BuildPartial().IsInitialized); + } + + [TestMethod] + public void ToBuilder() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TestUtil.SetAllFields(builder); + TestAllTypes message = builder.Build(); + TestUtil.AssertAllFieldsSet(message.ToBuilder().Build()); + } + + [TestMethod] + public void FieldConstantValues() + { + Assert.AreEqual(TestAllTypes.Types.NestedMessage.BbFieldNumber, 1); + Assert.AreEqual(TestAllTypes.OptionalInt32FieldNumber, 1); + Assert.AreEqual(TestAllTypes.OptionalGroupFieldNumber, 16); + Assert.AreEqual(TestAllTypes.OptionalNestedMessageFieldNumber, 18); + Assert.AreEqual(TestAllTypes.OptionalNestedEnumFieldNumber, 21); + Assert.AreEqual(TestAllTypes.RepeatedInt32FieldNumber, 31); + Assert.AreEqual(TestAllTypes.RepeatedGroupFieldNumber, 46); + Assert.AreEqual(TestAllTypes.RepeatedNestedMessageFieldNumber, 48); + Assert.AreEqual(TestAllTypes.RepeatedNestedEnumFieldNumber, 51); + } + + [TestMethod] + public void ExtensionConstantValues() + { + Assert.AreEqual(TestRequired.SingleFieldNumber, 1000); + Assert.AreEqual(TestRequired.MultiFieldNumber, 1001); + Assert.AreEqual(UnitTestProtoFile.OptionalInt32ExtensionFieldNumber, 1); + Assert.AreEqual(UnitTestProtoFile.OptionalGroupExtensionFieldNumber, 16); + Assert.AreEqual(UnitTestProtoFile.OptionalNestedMessageExtensionFieldNumber, 18); + Assert.AreEqual(UnitTestProtoFile.OptionalNestedEnumExtensionFieldNumber, 21); + Assert.AreEqual(UnitTestProtoFile.RepeatedInt32ExtensionFieldNumber, 31); + Assert.AreEqual(UnitTestProtoFile.RepeatedGroupExtensionFieldNumber, 46); + Assert.AreEqual(UnitTestProtoFile.RepeatedNestedMessageExtensionFieldNumber, 48); + Assert.AreEqual(UnitTestProtoFile.RepeatedNestedEnumExtensionFieldNumber, 51); + } + + [TestMethod] + public void EmptyPackedValue() + { + TestPackedTypes empty = new TestPackedTypes.Builder().Build(); + Assert.AreEqual(0, empty.SerializedSize); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/IssuesTest.cs b/csharp/src/ProtocolBuffers.Test/IssuesTest.cs new file mode 100644 index 00000000..a80021c5 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/IssuesTest.cs @@ -0,0 +1,65 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using UnitTest.Issues.TestProtos; + + +namespace Google.ProtocolBuffers +{ + /// + /// Tests for issues which aren't easily compartmentalized into other unit tests. + /// + [TestClass] + public class IssuesTest + { + // Issue 45 + [TestMethod] + public void FieldCalledItem() + { + ItemField message = new ItemField.Builder { Item = 3 }.Build(); + FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item"); + Assert.IsNotNull(field); + Assert.AreEqual(3, (int)message[field]); + } + } +} diff --git a/csharp/src/ProtocolBuffers.Test/MessageStreamIteratorTest.cs b/csharp/src/ProtocolBuffers.Test/MessageStreamIteratorTest.cs new file mode 100644 index 00000000..78f059f7 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/MessageStreamIteratorTest.cs @@ -0,0 +1,91 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using NestedMessage = Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class MessageStreamIteratorTest + { + [TestMethod] + public void ThreeMessagesInMemory() + { + MemoryStream stream = new MemoryStream(MessageStreamWriterTest.ThreeMessageData); + IEnumerable iterator = MessageStreamIterator.FromStreamProvider(() => stream); + List messages = new List(iterator); + + Assert.AreEqual(3, messages.Count); + Assert.AreEqual(5, messages[0].Bb); + Assert.AreEqual(1500, messages[1].Bb); + Assert.IsFalse(messages[2].HasBb); + } + + [TestMethod] + public void ManyMessagesShouldNotTriggerSizeAlert() + { + int messageSize = TestUtil.GetAllSet().SerializedSize; + // Enough messages to trigger the alert unless we've reset the size + // Note that currently we need to make this big enough to copy two whole buffers, + // as otherwise when we refill the buffer the second type, the alert triggers instantly. + int correctCount = (CodedInputStream.BufferSize*2)/messageSize + 1; + using (MemoryStream stream = new MemoryStream()) + { + MessageStreamWriter writer = new MessageStreamWriter(stream); + for (int i = 0; i < correctCount; i++) + { + writer.Write(TestUtil.GetAllSet()); + } + writer.Flush(); + + stream.Position = 0; + + int count = 0; + foreach (var message in MessageStreamIterator.FromStreamProvider(() => stream) + .WithSizeLimit(CodedInputStream.BufferSize*2)) + { + count++; + TestUtil.AssertAllFieldsSet(message); + } + Assert.AreEqual(correctCount, count); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/MessageStreamWriterTest.cs b/csharp/src/ProtocolBuffers.Test/MessageStreamWriterTest.cs new file mode 100644 index 00000000..53772523 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/MessageStreamWriterTest.cs @@ -0,0 +1,79 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using NestedMessage = Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class MessageStreamWriterTest + { + internal static readonly byte[] ThreeMessageData = new byte[] + { + (1 << 3) | 2, 2, + // Field 1, 2 bytes long (first message) + (1 << 3) | 0, 5, // Field 1, value 5 + (1 << 3) | 2, 3, + // Field 1, 3 bytes long (second message) + (1 << 3) | 0, (1500 & 0x7f) | 0x80, 1500 >> 7, + // Field 1, value 1500 + (1 << 3) | 2, 0, // Field 1, no data (third message) + }; + + [TestMethod] + public void ThreeMessages() + { + NestedMessage message1 = new NestedMessage.Builder {Bb = 5}.Build(); + NestedMessage message2 = new NestedMessage.Builder {Bb = 1500}.Build(); + NestedMessage message3 = new NestedMessage.Builder().Build(); + + byte[] data; + using (MemoryStream stream = new MemoryStream()) + { + MessageStreamWriter writer = new MessageStreamWriter(stream); + writer.Write(message1); + writer.Write(message2); + writer.Write(message3); + writer.Flush(); + data = stream.ToArray(); + } + + TestUtil.AssertEqualBytes(ThreeMessageData, data); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/MessageTest.cs b/csharp/src/ProtocolBuffers.Test/MessageTest.cs new file mode 100644 index 00000000..8bb0fac7 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/MessageTest.cs @@ -0,0 +1,387 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + /// + /// Miscellaneous tests for message operations that apply to both + /// generated and dynamic messages. + /// + [TestClass] + public class MessageTest + { + // ================================================================= + // Message-merging tests. + + private static readonly TestAllTypes MergeSource = new TestAllTypes.Builder + { + OptionalInt32 = 1, + OptionalString = "foo", + OptionalForeignMessage = + ForeignMessage.DefaultInstance, + }.AddRepeatedString("bar").Build(); + + private static readonly TestAllTypes MergeDest = new TestAllTypes.Builder + { + OptionalInt64 = 2, + OptionalString = "baz", + OptionalForeignMessage = + new ForeignMessage.Builder {C = 3}.Build(), + }.AddRepeatedString("qux").Build(); + + private const string MergeResultText = + "optional_int32: 1\n" + + "optional_int64: 2\n" + + "optional_string: \"foo\"\n" + + "optional_foreign_message {\n" + + " c: 3\n" + + "}\n" + + "repeated_string: \"qux\"\n" + + "repeated_string: \"bar\"\n"; + + [TestMethod] + public void MergeFrom() + { + TestAllTypes result = TestAllTypes.CreateBuilder(MergeDest).MergeFrom(MergeSource).Build(); + + Assert.AreEqual(MergeResultText, result.ToString()); + } + + /// + /// Test merging a DynamicMessage into a GeneratedMessage. + /// As long as they have the same descriptor, this should work, but it is an + /// entirely different code path. + /// + [TestMethod] + public void MergeFromDynamic() + { + TestAllTypes result = (TestAllTypes) TestAllTypes.CreateBuilder(MergeDest) + .MergeFrom(DynamicMessage.CreateBuilder(MergeSource).Build()) + .Build(); + + Assert.AreEqual(MergeResultText, result.ToString()); + } + + /// + /// Test merging two DynamicMessages. + /// + [TestMethod] + public void DynamicMergeFrom() + { + DynamicMessage result = (DynamicMessage) DynamicMessage.CreateBuilder(MergeDest) + .MergeFrom( + (DynamicMessage) + DynamicMessage.CreateBuilder(MergeSource).Build()) + .Build(); + + Assert.AreEqual(MergeResultText, result.ToString()); + } + + // ================================================================= + // Required-field-related tests. + + private static readonly TestRequired TestRequiredUninitialized = TestRequired.DefaultInstance; + + private static readonly TestRequired TestRequiredInitialized = new TestRequired.Builder + { + A = 1, + B = 2, + C = 3 + }.Build(); + + [TestMethod] + public void Initialization() + { + TestRequired.Builder builder = TestRequired.CreateBuilder(); + + Assert.IsFalse(builder.IsInitialized); + builder.A = 1; + Assert.IsFalse(builder.IsInitialized); + builder.B = 1; + Assert.IsFalse(builder.IsInitialized); + builder.C = 1; + Assert.IsTrue(builder.IsInitialized); + } + + [TestMethod] + public void UninitializedBuilderToString() + { + TestRequired.Builder builder = TestRequired.CreateBuilder().SetA(1); + Assert.AreEqual("a: 1\n", builder.ToString()); + } + + [TestMethod] + public void RequiredForeign() + { + TestRequiredForeign.Builder builder = TestRequiredForeign.CreateBuilder(); + + Assert.IsTrue(builder.IsInitialized); + + builder.SetOptionalMessage(TestRequiredUninitialized); + Assert.IsFalse(builder.IsInitialized); + + builder.SetOptionalMessage(TestRequiredInitialized); + Assert.IsTrue(builder.IsInitialized); + + builder.AddRepeatedMessage(TestRequiredUninitialized); + Assert.IsFalse(builder.IsInitialized); + + builder.SetRepeatedMessage(0, TestRequiredInitialized); + Assert.IsTrue(builder.IsInitialized); + } + + [TestMethod] + public void RequiredExtension() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + + Assert.IsTrue(builder.IsInitialized); + + builder.SetExtension(TestRequired.Single, TestRequiredUninitialized); + Assert.IsFalse(builder.IsInitialized); + + builder.SetExtension(TestRequired.Single, TestRequiredInitialized); + Assert.IsTrue(builder.IsInitialized); + + builder.AddExtension(TestRequired.Multi, TestRequiredUninitialized); + Assert.IsFalse(builder.IsInitialized); + + builder.SetExtension(TestRequired.Multi, 0, TestRequiredInitialized); + Assert.IsTrue(builder.IsInitialized); + } + + [TestMethod] + public void RequiredDynamic() + { + MessageDescriptor descriptor = TestRequired.Descriptor; + DynamicMessage.Builder builder = DynamicMessage.CreateBuilder(descriptor); + + Assert.IsFalse(builder.IsInitialized); + builder[descriptor.FindDescriptor("a")] = 1; + Assert.IsFalse(builder.IsInitialized); + builder[descriptor.FindDescriptor("b")] = 1; + Assert.IsFalse(builder.IsInitialized); + builder[descriptor.FindDescriptor("c")] = 1; + Assert.IsTrue(builder.IsInitialized); + } + + [TestMethod] + public void RequiredDynamicForeign() + { + MessageDescriptor descriptor = TestRequiredForeign.Descriptor; + DynamicMessage.Builder builder = DynamicMessage.CreateBuilder(descriptor); + + Assert.IsTrue(builder.IsInitialized); + + builder[descriptor.FindDescriptor("optional_message")] = TestRequiredUninitialized; + Assert.IsFalse(builder.IsInitialized); + + builder[descriptor.FindDescriptor("optional_message")] = TestRequiredInitialized; + Assert.IsTrue(builder.IsInitialized); + + builder.AddRepeatedField(descriptor.FindDescriptor("repeated_message"), + TestRequiredUninitialized); + Assert.IsFalse(builder.IsInitialized); + + builder.SetRepeatedField(descriptor.FindDescriptor("repeated_message"), 0, + TestRequiredInitialized); + Assert.IsTrue(builder.IsInitialized); + } + + [TestMethod] + public void UninitializedException() + { + try + { + TestRequired.CreateBuilder().Build(); + Assert.Fail("Should have thrown an exception."); + } + catch (UninitializedMessageException e) + { + Assert.AreEqual("Message missing required fields: a, b, c", e.Message); + } + } + + [TestMethod] + public void BuildPartial() + { + // We're mostly testing that no exception is thrown. + TestRequired message = TestRequired.CreateBuilder().BuildPartial(); + Assert.IsFalse(message.IsInitialized); + } + + [TestMethod] + public void NestedUninitializedException() + { + try + { + TestRequiredForeign.CreateBuilder() + .SetOptionalMessage(TestRequiredUninitialized) + .AddRepeatedMessage(TestRequiredUninitialized) + .AddRepeatedMessage(TestRequiredUninitialized) + .Build(); + Assert.Fail("Should have thrown an exception."); + } + catch (UninitializedMessageException e) + { + Assert.AreEqual( + "Message missing required fields: " + + "optional_message.a, " + + "optional_message.b, " + + "optional_message.c, " + + "repeated_message[0].a, " + + "repeated_message[0].b, " + + "repeated_message[0].c, " + + "repeated_message[1].a, " + + "repeated_message[1].b, " + + "repeated_message[1].c", + e.Message); + } + } + + [TestMethod] + public void BuildNestedPartial() + { + // We're mostly testing that no exception is thrown. + TestRequiredForeign message = + TestRequiredForeign.CreateBuilder() + .SetOptionalMessage(TestRequiredUninitialized) + .AddRepeatedMessage(TestRequiredUninitialized) + .AddRepeatedMessage(TestRequiredUninitialized) + .BuildPartial(); + Assert.IsFalse(message.IsInitialized); + } + + [TestMethod] + public void ParseUnititialized() + { + try + { + TestRequired.ParseFrom(ByteString.Empty); + Assert.Fail("Should have thrown an exception."); + } + catch (InvalidProtocolBufferException e) + { + Assert.AreEqual("Message missing required fields: a, b, c", e.Message); + } + } + + [TestMethod] + public void ParseNestedUnititialized() + { + ByteString data = + TestRequiredForeign.CreateBuilder() + .SetOptionalMessage(TestRequiredUninitialized) + .AddRepeatedMessage(TestRequiredUninitialized) + .AddRepeatedMessage(TestRequiredUninitialized) + .BuildPartial().ToByteString(); + + try + { + TestRequiredForeign.ParseFrom(data); + Assert.Fail("Should have thrown an exception."); + } + catch (InvalidProtocolBufferException e) + { + Assert.AreEqual( + "Message missing required fields: " + + "optional_message.a, " + + "optional_message.b, " + + "optional_message.c, " + + "repeated_message[0].a, " + + "repeated_message[0].b, " + + "repeated_message[0].c, " + + "repeated_message[1].a, " + + "repeated_message[1].b, " + + "repeated_message[1].c", + e.Message); + } + } + + [TestMethod] + public void DynamicUninitializedException() + { + try + { + DynamicMessage.CreateBuilder(TestRequired.Descriptor).Build(); + Assert.Fail("Should have thrown an exception."); + } + catch (UninitializedMessageException e) + { + Assert.AreEqual("Message missing required fields: a, b, c", e.Message); + } + } + + [TestMethod] + public void DynamicBuildPartial() + { + // We're mostly testing that no exception is thrown. + DynamicMessage message = DynamicMessage.CreateBuilder(TestRequired.Descriptor).BuildPartial(); + Assert.IsFalse(message.Initialized); + } + + [TestMethod] + public void DynamicParseUnititialized() + { + try + { + MessageDescriptor descriptor = TestRequired.Descriptor; + DynamicMessage.ParseFrom(descriptor, ByteString.Empty); + Assert.Fail("Should have thrown an exception."); + } + catch (InvalidProtocolBufferException e) + { + Assert.AreEqual("Message missing required fields: a, b, c", e.Message); + } + } + + [TestMethod] + public void PackedTypesWrittenDirectlyToStream() + { + TestPackedTypes message = new TestPackedTypes.Builder {PackedInt32List = {0, 1, 2}}.Build(); + MemoryStream stream = new MemoryStream(); + message.WriteTo(stream); + stream.Position = 0; + TestPackedTypes readMessage = TestPackedTypes.ParseFrom(stream); + Assert.AreEqual(message, readMessage); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/MessageUtilTest.cs b/csharp/src/ProtocolBuffers.Test/MessageUtilTest.cs new file mode 100644 index 00000000..4c33dbbd --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/MessageUtilTest.cs @@ -0,0 +1,87 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class MessageUtilTest + { + [TestMethod] + [ExpectedException(typeof(ArgumentNullException))] + public void NullTypeName() + { + MessageUtil.GetDefaultMessage((string) null); + } + + [TestMethod] + [ExpectedException(typeof(ArgumentException))] + public void InvalidTypeName() + { + MessageUtil.GetDefaultMessage("invalidtypename"); + } + + [TestMethod] + public void ValidTypeName() + { + Assert.AreSame(TestAllTypes.DefaultInstance, + MessageUtil.GetDefaultMessage(typeof(TestAllTypes).AssemblyQualifiedName)); + } + + [TestMethod] + [ExpectedException(typeof(ArgumentNullException))] + public void NullType() + { + MessageUtil.GetDefaultMessage((Type) null); + } + + [TestMethod] + [ExpectedException(typeof(ArgumentException))] + public void NonMessageType() + { + MessageUtil.GetDefaultMessage(typeof(string)); + } + + [TestMethod] + public void ValidType() + { + Assert.AreSame(TestAllTypes.DefaultInstance, MessageUtil.GetDefaultMessage(typeof(TestAllTypes))); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/NameHelpersTest.cs b/csharp/src/ProtocolBuffers.Test/NameHelpersTest.cs new file mode 100644 index 00000000..50ab373d --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/NameHelpersTest.cs @@ -0,0 +1,82 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class NameHelpersTest + { + [TestMethod] + public void UnderscoresToPascalCase() + { + Assert.AreEqual("FooBar", NameHelpers.UnderscoresToPascalCase("Foo_bar")); + Assert.AreEqual("FooBar", NameHelpers.UnderscoresToPascalCase("foo_bar")); + Assert.AreEqual("Foo0Bar", NameHelpers.UnderscoresToPascalCase("Foo0bar")); + Assert.AreEqual("FooBar", NameHelpers.UnderscoresToPascalCase("Foo_+_Bar")); + + Assert.AreEqual("Bar", NameHelpers.UnderscoresToPascalCase("__+bar")); + Assert.AreEqual("Bar", NameHelpers.UnderscoresToPascalCase("bar_")); + Assert.AreEqual("_0Bar", NameHelpers.UnderscoresToPascalCase("_0bar")); + Assert.AreEqual("_1Bar", NameHelpers.UnderscoresToPascalCase("_1_bar")); + } + + [TestMethod] + public void UnderscoresToCamelCase() + { + Assert.AreEqual("fooBar", NameHelpers.UnderscoresToCamelCase("Foo_bar")); + Assert.AreEqual("fooBar", NameHelpers.UnderscoresToCamelCase("foo_bar")); + Assert.AreEqual("foo0Bar", NameHelpers.UnderscoresToCamelCase("Foo0bar")); + Assert.AreEqual("fooBar", NameHelpers.UnderscoresToCamelCase("Foo_+_Bar")); + + Assert.AreEqual("bar", NameHelpers.UnderscoresToCamelCase("__+bar")); + Assert.AreEqual("bar", NameHelpers.UnderscoresToCamelCase("bar_")); + Assert.AreEqual("_0Bar", NameHelpers.UnderscoresToCamelCase("_0bar")); + Assert.AreEqual("_1Bar", NameHelpers.UnderscoresToCamelCase("_1_bar")); + } + + [TestMethod] + public void StripSuffix() + { + string text = "FooBar"; + Assert.IsFalse(NameHelpers.StripSuffix(ref text, "Foo")); + Assert.AreEqual("FooBar", text); + Assert.IsTrue(NameHelpers.StripSuffix(ref text, "Bar")); + Assert.AreEqual("Foo", text); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/Properties/AppManifest.xml b/csharp/src/ProtocolBuffers.Test/Properties/AppManifest.xml new file mode 100644 index 00000000..a9552327 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Properties/AppManifest.xml @@ -0,0 +1,6 @@ + + + + diff --git a/csharp/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs b/csharp/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..cea5da58 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. + +[assembly: AssemblyTitle("ProtocolBuffers.Test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtocolBuffers.Test")] +[assembly: AssemblyCopyright("Copyright � 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.4.1.555")] + +[assembly: AssemblyVersion("2.4.1.555")] + +// We don't really need CLSCompliance, but if the assembly builds with no warnings, +// that means the generator is okay. + +[assembly: CLSCompliant(true)] \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/Properties/OutOfBrowserSettings.xml b/csharp/src/ProtocolBuffers.Test/Properties/OutOfBrowserSettings.xml new file mode 100644 index 00000000..634f44bf --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/Properties/OutOfBrowserSettings.xml @@ -0,0 +1,7 @@ + + ProtocolBuffers.Test + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.CF20.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.CF20.csproj new file mode 100644 index 00000000..9ac3eafc --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.CF20.csproj @@ -0,0 +1,190 @@ + + + COMPACT_FRAMEWORK + CF20 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF20\Debug + obj\CF20\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\CF20\Release + obj\CF20\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.CF35.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.CF35.csproj new file mode 100644 index 00000000..0c6344ed --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.CF35.csproj @@ -0,0 +1,191 @@ + + + COMPACT_FRAMEWORK + CF35 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF35\Debug + obj\CF35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\CF35\Release + obj\CF35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + true + Off + true + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.NET20.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.NET20.csproj new file mode 100644 index 00000000..f0453fa1 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.NET20.csproj @@ -0,0 +1,178 @@ + + + CLIENTPROFILE + NET20 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET20\Debug + obj\NET20\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET20\Release + obj\NET20\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + true + Off + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.NET35.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.NET35.csproj new file mode 100644 index 00000000..33630b44 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.NET35.csproj @@ -0,0 +1,179 @@ + + + CLIENTPROFILE + NET35 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.NET40.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.NET40.csproj new file mode 100644 index 00000000..74ea7211 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.NET40.csproj @@ -0,0 +1,179 @@ + + + CLIENTPROFILE + NET40 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET40\Debug + obj\NET40\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET40\Release + obj\NET40\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.PL40.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.PL40.csproj new file mode 100644 index 00000000..018cf9d6 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.PL40.csproj @@ -0,0 +1,213 @@ + + + PORTABLE_LIBRARY + PL40 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + 10.0 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + + false + false + true + true + true + Google.ProtocolBuffers.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + v4.0 + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\PL40\Debug + obj\PL40\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + + + pdbonly + true + bin\PL40\Release + obj\PL40\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.SL20.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.SL20.csproj new file mode 100644 index 00000000..e54fa25c --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.SL20.csproj @@ -0,0 +1,214 @@ + + + SILVERLIGHT + SL20 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + true + false + false + true + true + Google.ProtocolBuffers.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + v2.0 + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\SL20\Debug + obj\SL20\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\SL20\Release + obj\SL20\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + + + OfflineApplication + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.SL30.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.SL30.csproj new file mode 100644 index 00000000..76f6b1a2 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.SL30.csproj @@ -0,0 +1,215 @@ + + + SILVERLIGHT + SL30 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + true + false + false + true + true + Google.ProtocolBuffers.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + v3.5 + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\SL30\Debug + obj\SL30\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\SL30\Release + obj\SL30\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + + + OfflineApplication + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.SL40.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.SL40.csproj new file mode 100644 index 00000000..ade3dc35 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.SL40.csproj @@ -0,0 +1,215 @@ + + + SILVERLIGHT + SL40 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + true + false + false + v4.0 + true + true + Google.ProtocolBuffers.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\SL40\Debug + obj\SL40\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\SL40\Release + obj\SL40\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + + + OfflineApplication + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj new file mode 100644 index 00000000..267fedc0 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj @@ -0,0 +1,179 @@ + + + + CLIENTPROFILE + NET35 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {DD01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {231391AF-449C-4a39-986C-AD7F270F4750} + ProtocolBuffers.Serialization + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + true + + + False + Windows Installer 3.1 + true + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ReflectionTester.cs b/csharp/src/ProtocolBuffers.Test/ReflectionTester.cs new file mode 100644 index 00000000..2120ff84 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ReflectionTester.cs @@ -0,0 +1,1006 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +#pragma warning disable 618 // Disable warning about obsolete use miss-matched assert arguments + +namespace Google.ProtocolBuffers +{ + /// + /// Performs the same things that the methods of TestUtil do, but + /// via the reflection interface. This is its own class because it needs + /// to know what descriptor to use. + /// + internal class ReflectionTester + { + private readonly MessageDescriptor baseDescriptor; + private readonly ExtensionRegistry extensionRegistry; + + private readonly FileDescriptor file; + private readonly FileDescriptor importFile; + + private readonly MessageDescriptor optionalGroup; + private readonly MessageDescriptor repeatedGroup; + private readonly MessageDescriptor nestedMessage; + private readonly MessageDescriptor foreignMessage; + private readonly MessageDescriptor importMessage; + + private readonly FieldDescriptor groupA; + private readonly FieldDescriptor repeatedGroupA; + private readonly FieldDescriptor nestedB; + private readonly FieldDescriptor foreignC; + private readonly FieldDescriptor importD; + + private readonly EnumDescriptor nestedEnum; + private readonly EnumDescriptor foreignEnum; + private readonly EnumDescriptor importEnum; + + private readonly EnumValueDescriptor nestedFoo; + private readonly EnumValueDescriptor nestedBar; + private readonly EnumValueDescriptor nestedBaz; + private readonly EnumValueDescriptor foreignFoo; + private readonly EnumValueDescriptor foreignBar; + private readonly EnumValueDescriptor foreignBaz; + private readonly EnumValueDescriptor importFoo; + private readonly EnumValueDescriptor importBar; + private readonly EnumValueDescriptor importBaz; + + /// + /// Constructs an instance that will expect messages using the given + /// descriptor. Normally should be + /// a descriptor for TestAllTypes. However, if extensionRegistry is non-null, + /// then baseDescriptor should be for TestAllExtensions instead, and instead of + /// reading and writing normal fields, the tester will read and write extensions. + /// All of the TestAllExtensions extensions must be registered in the registry. + /// + private ReflectionTester(MessageDescriptor baseDescriptor, + ExtensionRegistry extensionRegistry) + { + this.baseDescriptor = baseDescriptor; + this.extensionRegistry = extensionRegistry; + + this.file = baseDescriptor.File; + // TODO(jonskeet): We've got 2 dependencies, not 1 - because of the C# options. Hmm. + // Assert.AreEqual(1, file.Dependencies.Count); + // TODO(jonskeet): Find dependency by name instead of number? + this.importFile = file.Dependencies[1]; + + MessageDescriptor testAllTypes; + if (baseDescriptor.Name == "TestAllTypes") + { + testAllTypes = baseDescriptor; + } + else + { + testAllTypes = file.FindTypeByName("TestAllTypes"); + Assert.IsNotNull(testAllTypes); + } + + if (extensionRegistry == null) + { + // Use testAllTypes, rather than baseDescriptor, to allow + // initialization using TestPackedTypes descriptors. These objects + // won't be used by the methods for packed fields. + this.optionalGroup = + testAllTypes.FindDescriptor("OptionalGroup"); + this.repeatedGroup = + testAllTypes.FindDescriptor("RepeatedGroup"); + } + else + { + this.optionalGroup = + file.FindTypeByName("OptionalGroup_extension"); + this.repeatedGroup = + file.FindTypeByName("RepeatedGroup_extension"); + } + this.nestedMessage = testAllTypes.FindDescriptor("NestedMessage"); + this.foreignMessage = file.FindTypeByName("ForeignMessage"); + this.importMessage = importFile.FindTypeByName("ImportMessage"); + + this.nestedEnum = testAllTypes.FindDescriptor("NestedEnum"); + this.foreignEnum = file.FindTypeByName("ForeignEnum"); + this.importEnum = importFile.FindTypeByName("ImportEnum"); + + Assert.IsNotNull(optionalGroup); + Assert.IsNotNull(repeatedGroup); + Assert.IsNotNull(nestedMessage); + Assert.IsNotNull(foreignMessage); + Assert.IsNotNull(importMessage); + Assert.IsNotNull(nestedEnum); + Assert.IsNotNull(foreignEnum); + Assert.IsNotNull(importEnum); + + this.nestedB = nestedMessage.FindDescriptor("bb"); + this.foreignC = foreignMessage.FindDescriptor("c"); + this.importD = importMessage.FindDescriptor("d"); + this.nestedFoo = nestedEnum.FindValueByName("FOO"); + this.nestedBar = nestedEnum.FindValueByName("BAR"); + this.nestedBaz = nestedEnum.FindValueByName("BAZ"); + this.foreignFoo = foreignEnum.FindValueByName("FOREIGN_FOO"); + this.foreignBar = foreignEnum.FindValueByName("FOREIGN_BAR"); + this.foreignBaz = foreignEnum.FindValueByName("FOREIGN_BAZ"); + this.importFoo = importEnum.FindValueByName("IMPORT_FOO"); + this.importBar = importEnum.FindValueByName("IMPORT_BAR"); + this.importBaz = importEnum.FindValueByName("IMPORT_BAZ"); + + this.groupA = optionalGroup.FindDescriptor("a"); + this.repeatedGroupA = repeatedGroup.FindDescriptor("a"); + + Assert.IsNotNull(groupA); + Assert.IsNotNull(repeatedGroupA); + Assert.IsNotNull(nestedB); + Assert.IsNotNull(foreignC); + Assert.IsNotNull(importD); + Assert.IsNotNull(nestedFoo); + Assert.IsNotNull(nestedBar); + Assert.IsNotNull(nestedBaz); + Assert.IsNotNull(foreignFoo); + Assert.IsNotNull(foreignBar); + Assert.IsNotNull(foreignBaz); + Assert.IsNotNull(importFoo); + Assert.IsNotNull(importBar); + Assert.IsNotNull(importBaz); + } + + /// + /// Creates an instance for the TestAllTypes message, with no extension registry. + /// + public static ReflectionTester CreateTestAllTypesInstance() + { + return new ReflectionTester(TestAllTypes.Descriptor, null); + } + + /// + /// Creates an instance for the TestAllExtensions message, with an + /// extension registry from TestUtil.CreateExtensionRegistry. + /// + public static ReflectionTester CreateTestAllExtensionsInstance() + { + return new ReflectionTester(TestAllExtensions.Descriptor, TestUtil.CreateExtensionRegistry()); + } + + /// + /// Creates an instance for the TestPackedTypes message, with no extensions. + /// + public static ReflectionTester CreateTestPackedTypesInstance() + { + return new ReflectionTester(TestPackedTypes.Descriptor, null); + } + + /// + /// Shorthand to get a FieldDescriptor for a field of unittest::TestAllTypes. + /// + private FieldDescriptor f(String name) + { + FieldDescriptor result; + if (extensionRegistry == null) + { + result = baseDescriptor.FindDescriptor(name); + } + else + { + result = file.FindTypeByName(name + "_extension"); + } + Assert.IsNotNull(result); + return result; + } + + /// + /// Calls parent.CreateBuilderForField() or uses the extension registry + /// to find an appropriate builder, depending on what type is being tested. + /// + private IBuilder CreateBuilderForField(IBuilder parent, FieldDescriptor field) + { + if (extensionRegistry == null) + { + return parent.CreateBuilderForField(field); + } + else + { + ExtensionInfo extension = extensionRegistry[field.ContainingType, field.FieldNumber]; + Assert.IsNotNull(extension); + Assert.IsNotNull(extension.DefaultInstance); + return (IBuilder) extension.DefaultInstance.WeakCreateBuilderForType(); + } + } + + /// + /// Sets every field of the message to the values expected by + /// AssertAllFieldsSet, using the reflection interface. + /// + /// + internal void SetAllFieldsViaReflection(IBuilder message) + { + message[f("optional_int32")] = 101; + message[f("optional_int64")] = 102L; + message[f("optional_uint32")] = 103U; + message[f("optional_uint64")] = 104UL; + message[f("optional_sint32")] = 105; + message[f("optional_sint64")] = 106L; + message[f("optional_fixed32")] = 107U; + message[f("optional_fixed64")] = 108UL; + message[f("optional_sfixed32")] = 109; + message[f("optional_sfixed64")] = 110L; + message[f("optional_float")] = 111F; + message[f("optional_double")] = 112D; + message[f("optional_bool")] = true; + message[f("optional_string")] = "115"; + message[f("optional_bytes")] = TestUtil.ToBytes("116"); + + message[f("optionalgroup")] = + CreateBuilderForField(message, f("optionalgroup")).SetField(groupA, 117).WeakBuild(); + message[f("optional_nested_message")] = + CreateBuilderForField(message, f("optional_nested_message")).SetField(nestedB, 118).WeakBuild(); + message[f("optional_foreign_message")] = + CreateBuilderForField(message, f("optional_foreign_message")).SetField(foreignC, 119).WeakBuild(); + message[f("optional_import_message")] = + CreateBuilderForField(message, f("optional_import_message")).SetField(importD, 120).WeakBuild(); + + message[f("optional_nested_enum")] = nestedBaz; + message[f("optional_foreign_enum")] = foreignBaz; + message[f("optional_import_enum")] = importBaz; + + message[f("optional_string_piece")] = "124"; + message[f("optional_cord")] = "125"; + + // ----------------------------------------------------------------- + + message.WeakAddRepeatedField(f("repeated_int32"), 201); + message.WeakAddRepeatedField(f("repeated_int64"), 202L); + message.WeakAddRepeatedField(f("repeated_uint32"), 203U); + message.WeakAddRepeatedField(f("repeated_uint64"), 204UL); + message.WeakAddRepeatedField(f("repeated_sint32"), 205); + message.WeakAddRepeatedField(f("repeated_sint64"), 206L); + message.WeakAddRepeatedField(f("repeated_fixed32"), 207U); + message.WeakAddRepeatedField(f("repeated_fixed64"), 208UL); + message.WeakAddRepeatedField(f("repeated_sfixed32"), 209); + message.WeakAddRepeatedField(f("repeated_sfixed64"), 210L); + message.WeakAddRepeatedField(f("repeated_float"), 211F); + message.WeakAddRepeatedField(f("repeated_double"), 212D); + message.WeakAddRepeatedField(f("repeated_bool"), true); + message.WeakAddRepeatedField(f("repeated_string"), "215"); + message.WeakAddRepeatedField(f("repeated_bytes"), TestUtil.ToBytes("216")); + + + message.WeakAddRepeatedField(f("repeatedgroup"), + CreateBuilderForField(message, f("repeatedgroup")).SetField(repeatedGroupA, 217) + .WeakBuild()); + message.WeakAddRepeatedField(f("repeated_nested_message"), + CreateBuilderForField(message, f("repeated_nested_message")).SetField(nestedB, + 218). + WeakBuild()); + message.WeakAddRepeatedField(f("repeated_foreign_message"), + CreateBuilderForField(message, f("repeated_foreign_message")).SetField( + foreignC, 219).WeakBuild()); + message.WeakAddRepeatedField(f("repeated_import_message"), + CreateBuilderForField(message, f("repeated_import_message")).SetField(importD, + 220). + WeakBuild()); + + message.WeakAddRepeatedField(f("repeated_nested_enum"), nestedBar); + message.WeakAddRepeatedField(f("repeated_foreign_enum"), foreignBar); + message.WeakAddRepeatedField(f("repeated_import_enum"), importBar); + + message.WeakAddRepeatedField(f("repeated_string_piece"), "224"); + message.WeakAddRepeatedField(f("repeated_cord"), "225"); + + // Add a second one of each field. + message.WeakAddRepeatedField(f("repeated_int32"), 301); + message.WeakAddRepeatedField(f("repeated_int64"), 302L); + message.WeakAddRepeatedField(f("repeated_uint32"), 303U); + message.WeakAddRepeatedField(f("repeated_uint64"), 304UL); + message.WeakAddRepeatedField(f("repeated_sint32"), 305); + message.WeakAddRepeatedField(f("repeated_sint64"), 306L); + message.WeakAddRepeatedField(f("repeated_fixed32"), 307U); + message.WeakAddRepeatedField(f("repeated_fixed64"), 308UL); + message.WeakAddRepeatedField(f("repeated_sfixed32"), 309); + message.WeakAddRepeatedField(f("repeated_sfixed64"), 310L); + message.WeakAddRepeatedField(f("repeated_float"), 311F); + message.WeakAddRepeatedField(f("repeated_double"), 312D); + message.WeakAddRepeatedField(f("repeated_bool"), false); + message.WeakAddRepeatedField(f("repeated_string"), "315"); + message.WeakAddRepeatedField(f("repeated_bytes"), TestUtil.ToBytes("316")); + + message.WeakAddRepeatedField(f("repeatedgroup"), + CreateBuilderForField(message, f("repeatedgroup")) + .SetField(repeatedGroupA, 317).WeakBuild()); + message.WeakAddRepeatedField(f("repeated_nested_message"), + CreateBuilderForField(message, f("repeated_nested_message")) + .SetField(nestedB, 318).WeakBuild()); + message.WeakAddRepeatedField(f("repeated_foreign_message"), + CreateBuilderForField(message, f("repeated_foreign_message")) + .SetField(foreignC, 319).WeakBuild()); + message.WeakAddRepeatedField(f("repeated_import_message"), + CreateBuilderForField(message, f("repeated_import_message")) + .SetField(importD, 320).WeakBuild()); + + message.WeakAddRepeatedField(f("repeated_nested_enum"), nestedBaz); + message.WeakAddRepeatedField(f("repeated_foreign_enum"), foreignBaz); + message.WeakAddRepeatedField(f("repeated_import_enum"), importBaz); + + message.WeakAddRepeatedField(f("repeated_string_piece"), "324"); + message.WeakAddRepeatedField(f("repeated_cord"), "325"); + + // ----------------------------------------------------------------- + + message[f("default_int32")] = 401; + message[f("default_int64")] = 402L; + message[f("default_uint32")] = 403U; + message[f("default_uint64")] = 404UL; + message[f("default_sint32")] = 405; + message[f("default_sint64")] = 406L; + message[f("default_fixed32")] = 407U; + message[f("default_fixed64")] = 408UL; + message[f("default_sfixed32")] = 409; + message[f("default_sfixed64")] = 410L; + message[f("default_float")] = 411F; + message[f("default_double")] = 412D; + message[f("default_bool")] = false; + message[f("default_string")] = "415"; + message[f("default_bytes")] = TestUtil.ToBytes("416"); + + message[f("default_nested_enum")] = nestedFoo; + message[f("default_foreign_enum")] = foreignFoo; + message[f("default_import_enum")] = importFoo; + + message[f("default_string_piece")] = "424"; + message[f("default_cord")] = "425"; + } + + /// + /// Clears every field of the message, using the reflection interface. + /// + /// + internal void ClearAllFieldsViaReflection(IBuilder message) + { + foreach (FieldDescriptor field in message.AllFields.Keys) + { + message.WeakClearField(field); + } + } + + // ------------------------------------------------------------------- + + /// + /// Modify the repeated fields of the specified message to contain the + /// values expected by AssertRepeatedFieldsModified, using the IBuilder + /// reflection interface. + /// + internal void ModifyRepeatedFieldsViaReflection(IBuilder message) + { + message[f("repeated_int32"), 1] = 501; + message[f("repeated_int64"), 1] = 502L; + message[f("repeated_uint32"), 1] = 503U; + message[f("repeated_uint64"), 1] = 504UL; + message[f("repeated_sint32"), 1] = 505; + message[f("repeated_sint64"), 1] = 506L; + message[f("repeated_fixed32"), 1] = 507U; + message[f("repeated_fixed64"), 1] = 508UL; + message[f("repeated_sfixed32"), 1] = 509; + message[f("repeated_sfixed64"), 1] = 510L; + message[f("repeated_float"), 1] = 511F; + message[f("repeated_double"), 1] = 512D; + message[f("repeated_bool"), 1] = true; + message[f("repeated_string"), 1] = "515"; + message.SetRepeatedField(f("repeated_bytes"), 1, TestUtil.ToBytes("516")); + + message.SetRepeatedField(f("repeatedgroup"), 1, + CreateBuilderForField(message, f("repeatedgroup")).SetField(repeatedGroupA, 517). + WeakBuild()); + message.SetRepeatedField(f("repeated_nested_message"), 1, + CreateBuilderForField(message, f("repeated_nested_message")).SetField(nestedB, 518) + .WeakBuild()); + message.SetRepeatedField(f("repeated_foreign_message"), 1, + CreateBuilderForField(message, f("repeated_foreign_message")).SetField(foreignC, + 519). + WeakBuild()); + message.SetRepeatedField(f("repeated_import_message"), 1, + CreateBuilderForField(message, f("repeated_import_message")).SetField(importD, 520) + .WeakBuild()); + + message[f("repeated_nested_enum"), 1] = nestedFoo; + message[f("repeated_foreign_enum"), 1] = foreignFoo; + message[f("repeated_import_enum"), 1] = importFoo; + + message[f("repeated_string_piece"), 1] = "524"; + message[f("repeated_cord"), 1] = "525"; + } + + // ------------------------------------------------------------------- + + /// + /// Asserts that all fields of the specified message are set to the values + /// assigned by SetAllFields, using the IMessage reflection interface. + /// + public void AssertAllFieldsSetViaReflection(IMessage message) + { + Assert.IsTrue(message.HasField(f("optional_int32"))); + Assert.IsTrue(message.HasField(f("optional_int64"))); + Assert.IsTrue(message.HasField(f("optional_uint32"))); + Assert.IsTrue(message.HasField(f("optional_uint64"))); + Assert.IsTrue(message.HasField(f("optional_sint32"))); + Assert.IsTrue(message.HasField(f("optional_sint64"))); + Assert.IsTrue(message.HasField(f("optional_fixed32"))); + Assert.IsTrue(message.HasField(f("optional_fixed64"))); + Assert.IsTrue(message.HasField(f("optional_sfixed32"))); + Assert.IsTrue(message.HasField(f("optional_sfixed64"))); + Assert.IsTrue(message.HasField(f("optional_float"))); + Assert.IsTrue(message.HasField(f("optional_double"))); + Assert.IsTrue(message.HasField(f("optional_bool"))); + Assert.IsTrue(message.HasField(f("optional_string"))); + Assert.IsTrue(message.HasField(f("optional_bytes"))); + + Assert.IsTrue(message.HasField(f("optionalgroup"))); + Assert.IsTrue(message.HasField(f("optional_nested_message"))); + Assert.IsTrue(message.HasField(f("optional_foreign_message"))); + Assert.IsTrue(message.HasField(f("optional_import_message"))); + + Assert.IsTrue(((IMessage) message[f("optionalgroup")]).HasField(groupA)); + Assert.IsTrue(((IMessage) message[f("optional_nested_message")]).HasField(nestedB)); + Assert.IsTrue(((IMessage) message[f("optional_foreign_message")]).HasField(foreignC)); + Assert.IsTrue(((IMessage) message[f("optional_import_message")]).HasField(importD)); + + Assert.IsTrue(message.HasField(f("optional_nested_enum"))); + Assert.IsTrue(message.HasField(f("optional_foreign_enum"))); + Assert.IsTrue(message.HasField(f("optional_import_enum"))); + + Assert.IsTrue(message.HasField(f("optional_string_piece"))); + Assert.IsTrue(message.HasField(f("optional_cord"))); + + Assert.AreEqual(101, message[f("optional_int32")]); + Assert.AreEqual(102L, message[f("optional_int64")]); + Assert.AreEqual(103u, message[f("optional_uint32")]); + Assert.AreEqual(104UL, message[f("optional_uint64")]); + Assert.AreEqual(105, message[f("optional_sint32")]); + Assert.AreEqual(106L, message[f("optional_sint64")]); + Assert.AreEqual(107U, message[f("optional_fixed32")]); + Assert.AreEqual(108UL, message[f("optional_fixed64")]); + Assert.AreEqual(109, message[f("optional_sfixed32")]); + Assert.AreEqual(110L, message[f("optional_sfixed64")]); + Assert.AreEqual(111F, message[f("optional_float")]); + Assert.AreEqual(112D, message[f("optional_double")]); + Assert.AreEqual(true, message[f("optional_bool")]); + Assert.AreEqual("115", message[f("optional_string")]); + Assert.AreEqual(TestUtil.ToBytes("116"), message[f("optional_bytes")]); + + Assert.AreEqual(117, ((IMessage) message[f("optionalgroup")])[groupA]); + Assert.AreEqual(118, ((IMessage) message[f("optional_nested_message")])[nestedB]); + Assert.AreEqual(119, ((IMessage) message[f("optional_foreign_message")])[foreignC]); + Assert.AreEqual(120, ((IMessage) message[f("optional_import_message")])[importD]); + + Assert.AreEqual(nestedBaz, message[f("optional_nested_enum")]); + Assert.AreEqual(foreignBaz, message[f("optional_foreign_enum")]); + Assert.AreEqual(importBaz, message[f("optional_import_enum")]); + + Assert.AreEqual("124", message[f("optional_string_piece")]); + Assert.AreEqual("125", message[f("optional_cord")]); + + // ----------------------------------------------------------------- + + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_int32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_int64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_uint32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_uint64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_sint32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_sint64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_fixed32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_fixed64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_sfixed32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_sfixed64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_float"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_double"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_bool"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_string"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_bytes"))); + + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeatedgroup"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_nested_message"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_foreign_message"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_import_message"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_nested_enum"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_foreign_enum"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_import_enum"))); + + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_string_piece"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_cord"))); + + Assert.AreEqual(201, message[f("repeated_int32"), 0]); + Assert.AreEqual(202L, message[f("repeated_int64"), 0]); + Assert.AreEqual(203U, message[f("repeated_uint32"), 0]); + Assert.AreEqual(204UL, message[f("repeated_uint64"), 0]); + Assert.AreEqual(205, message[f("repeated_sint32"), 0]); + Assert.AreEqual(206L, message[f("repeated_sint64"), 0]); + Assert.AreEqual(207U, message[f("repeated_fixed32"), 0]); + Assert.AreEqual(208UL, message[f("repeated_fixed64"), 0]); + Assert.AreEqual(209, message[f("repeated_sfixed32"), 0]); + Assert.AreEqual(210L, message[f("repeated_sfixed64"), 0]); + Assert.AreEqual(211F, message[f("repeated_float"), 0]); + Assert.AreEqual(212D, message[f("repeated_double"), 0]); + Assert.AreEqual(true, message[f("repeated_bool"), 0]); + Assert.AreEqual("215", message[f("repeated_string"), 0]); + Assert.AreEqual(TestUtil.ToBytes("216"), message[f("repeated_bytes"), 0]); + + Assert.AreEqual(217, ((IMessage) message[f("repeatedgroup"), 0])[repeatedGroupA]); + Assert.AreEqual(218, ((IMessage) message[f("repeated_nested_message"), 0])[nestedB]); + Assert.AreEqual(219, ((IMessage) message[f("repeated_foreign_message"), 0])[foreignC]); + Assert.AreEqual(220, ((IMessage) message[f("repeated_import_message"), 0])[importD]); + + Assert.AreEqual(nestedBar, message[f("repeated_nested_enum"), 0]); + Assert.AreEqual(foreignBar, message[f("repeated_foreign_enum"), 0]); + Assert.AreEqual(importBar, message[f("repeated_import_enum"), 0]); + + Assert.AreEqual("224", message[f("repeated_string_piece"), 0]); + Assert.AreEqual("225", message[f("repeated_cord"), 0]); + + Assert.AreEqual(301, message[f("repeated_int32"), 1]); + Assert.AreEqual(302L, message[f("repeated_int64"), 1]); + Assert.AreEqual(303U, message[f("repeated_uint32"), 1]); + Assert.AreEqual(304UL, message[f("repeated_uint64"), 1]); + Assert.AreEqual(305, message[f("repeated_sint32"), 1]); + Assert.AreEqual(306L, message[f("repeated_sint64"), 1]); + Assert.AreEqual(307U, message[f("repeated_fixed32"), 1]); + Assert.AreEqual(308UL, message[f("repeated_fixed64"), 1]); + Assert.AreEqual(309, message[f("repeated_sfixed32"), 1]); + Assert.AreEqual(310L, message[f("repeated_sfixed64"), 1]); + Assert.AreEqual(311F, message[f("repeated_float"), 1]); + Assert.AreEqual(312D, message[f("repeated_double"), 1]); + Assert.AreEqual(false, message[f("repeated_bool"), 1]); + Assert.AreEqual("315", message[f("repeated_string"), 1]); + Assert.AreEqual(TestUtil.ToBytes("316"), message[f("repeated_bytes"), 1]); + + Assert.AreEqual(317, ((IMessage) message[f("repeatedgroup"), 1])[repeatedGroupA]); + Assert.AreEqual(318, ((IMessage) message[f("repeated_nested_message"), 1])[nestedB]); + Assert.AreEqual(319, ((IMessage) message[f("repeated_foreign_message"), 1])[foreignC]); + Assert.AreEqual(320, ((IMessage) message[f("repeated_import_message"), 1])[importD]); + + Assert.AreEqual(nestedBaz, message[f("repeated_nested_enum"), 1]); + Assert.AreEqual(foreignBaz, message[f("repeated_foreign_enum"), 1]); + Assert.AreEqual(importBaz, message[f("repeated_import_enum"), 1]); + + Assert.AreEqual("324", message[f("repeated_string_piece"), 1]); + Assert.AreEqual("325", message[f("repeated_cord"), 1]); + + // ----------------------------------------------------------------- + + Assert.IsTrue(message.HasField(f("default_int32"))); + Assert.IsTrue(message.HasField(f("default_int64"))); + Assert.IsTrue(message.HasField(f("default_uint32"))); + Assert.IsTrue(message.HasField(f("default_uint64"))); + Assert.IsTrue(message.HasField(f("default_sint32"))); + Assert.IsTrue(message.HasField(f("default_sint64"))); + Assert.IsTrue(message.HasField(f("default_fixed32"))); + Assert.IsTrue(message.HasField(f("default_fixed64"))); + Assert.IsTrue(message.HasField(f("default_sfixed32"))); + Assert.IsTrue(message.HasField(f("default_sfixed64"))); + Assert.IsTrue(message.HasField(f("default_float"))); + Assert.IsTrue(message.HasField(f("default_double"))); + Assert.IsTrue(message.HasField(f("default_bool"))); + Assert.IsTrue(message.HasField(f("default_string"))); + Assert.IsTrue(message.HasField(f("default_bytes"))); + + Assert.IsTrue(message.HasField(f("default_nested_enum"))); + Assert.IsTrue(message.HasField(f("default_foreign_enum"))); + Assert.IsTrue(message.HasField(f("default_import_enum"))); + + Assert.IsTrue(message.HasField(f("default_string_piece"))); + Assert.IsTrue(message.HasField(f("default_cord"))); + + Assert.AreEqual(401, message[f("default_int32")]); + Assert.AreEqual(402L, message[f("default_int64")]); + Assert.AreEqual(403U, message[f("default_uint32")]); + Assert.AreEqual(404UL, message[f("default_uint64")]); + Assert.AreEqual(405, message[f("default_sint32")]); + Assert.AreEqual(406L, message[f("default_sint64")]); + Assert.AreEqual(407U, message[f("default_fixed32")]); + Assert.AreEqual(408UL, message[f("default_fixed64")]); + Assert.AreEqual(409, message[f("default_sfixed32")]); + Assert.AreEqual(410L, message[f("default_sfixed64")]); + Assert.AreEqual(411F, message[f("default_float")]); + Assert.AreEqual(412D, message[f("default_double")]); + Assert.AreEqual(false, message[f("default_bool")]); + Assert.AreEqual("415", message[f("default_string")]); + Assert.AreEqual(TestUtil.ToBytes("416"), message[f("default_bytes")]); + + Assert.AreEqual(nestedFoo, message[f("default_nested_enum")]); + Assert.AreEqual(foreignFoo, message[f("default_foreign_enum")]); + Assert.AreEqual(importFoo, message[f("default_import_enum")]); + + Assert.AreEqual("424", message[f("default_string_piece")]); + Assert.AreEqual("425", message[f("default_cord")]); + } + + /// + /// Assert that all fields of the message are cleared, and that + /// getting the fields returns their default values, using the reflection interface. + /// + public void AssertClearViaReflection(IMessage message) + { + // has_blah() should initially be false for all optional fields. + Assert.IsFalse(message.HasField(f("optional_int32"))); + Assert.IsFalse(message.HasField(f("optional_int64"))); + Assert.IsFalse(message.HasField(f("optional_uint32"))); + Assert.IsFalse(message.HasField(f("optional_uint64"))); + Assert.IsFalse(message.HasField(f("optional_sint32"))); + Assert.IsFalse(message.HasField(f("optional_sint64"))); + Assert.IsFalse(message.HasField(f("optional_fixed32"))); + Assert.IsFalse(message.HasField(f("optional_fixed64"))); + Assert.IsFalse(message.HasField(f("optional_sfixed32"))); + Assert.IsFalse(message.HasField(f("optional_sfixed64"))); + Assert.IsFalse(message.HasField(f("optional_float"))); + Assert.IsFalse(message.HasField(f("optional_double"))); + Assert.IsFalse(message.HasField(f("optional_bool"))); + Assert.IsFalse(message.HasField(f("optional_string"))); + Assert.IsFalse(message.HasField(f("optional_bytes"))); + + Assert.IsFalse(message.HasField(f("optionalgroup"))); + Assert.IsFalse(message.HasField(f("optional_nested_message"))); + Assert.IsFalse(message.HasField(f("optional_foreign_message"))); + Assert.IsFalse(message.HasField(f("optional_import_message"))); + + Assert.IsFalse(message.HasField(f("optional_nested_enum"))); + Assert.IsFalse(message.HasField(f("optional_foreign_enum"))); + Assert.IsFalse(message.HasField(f("optional_import_enum"))); + + Assert.IsFalse(message.HasField(f("optional_string_piece"))); + Assert.IsFalse(message.HasField(f("optional_cord"))); + + // Optional fields without defaults are set to zero or something like it. + Assert.AreEqual(0, message[f("optional_int32")]); + Assert.AreEqual(0L, message[f("optional_int64")]); + Assert.AreEqual(0U, message[f("optional_uint32")]); + Assert.AreEqual(0UL, message[f("optional_uint64")]); + Assert.AreEqual(0, message[f("optional_sint32")]); + Assert.AreEqual(0L, message[f("optional_sint64")]); + Assert.AreEqual(0U, message[f("optional_fixed32")]); + Assert.AreEqual(0UL, message[f("optional_fixed64")]); + Assert.AreEqual(0, message[f("optional_sfixed32")]); + Assert.AreEqual(0L, message[f("optional_sfixed64")]); + Assert.AreEqual(0F, message[f("optional_float")]); + Assert.AreEqual(0D, message[f("optional_double")]); + Assert.AreEqual(false, message[f("optional_bool")]); + Assert.AreEqual("", message[f("optional_string")]); + Assert.AreEqual(ByteString.Empty, message[f("optional_bytes")]); + + // Embedded messages should also be clear. + Assert.IsFalse(((IMessage) message[f("optionalgroup")]).HasField(groupA)); + Assert.IsFalse(((IMessage) message[f("optional_nested_message")]) + .HasField(nestedB)); + Assert.IsFalse(((IMessage) message[f("optional_foreign_message")]) + .HasField(foreignC)); + Assert.IsFalse(((IMessage) message[f("optional_import_message")]) + .HasField(importD)); + + Assert.AreEqual(0, ((IMessage) message[f("optionalgroup")])[groupA]); + Assert.AreEqual(0, ((IMessage) message[f("optional_nested_message")])[nestedB]); + Assert.AreEqual(0, ((IMessage) message[f("optional_foreign_message")])[foreignC]); + Assert.AreEqual(0, ((IMessage) message[f("optional_import_message")])[importD]); + + // Enums without defaults are set to the first value in the enum. + Assert.AreEqual(nestedFoo, message[f("optional_nested_enum")]); + Assert.AreEqual(foreignFoo, message[f("optional_foreign_enum")]); + Assert.AreEqual(importFoo, message[f("optional_import_enum")]); + + Assert.AreEqual("", message[f("optional_string_piece")]); + Assert.AreEqual("", message[f("optional_cord")]); + + // Repeated fields are empty. + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_int32"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_int64"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_uint32"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_uint64"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_sint32"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_sint64"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_fixed32"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_fixed64"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_sfixed32"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_sfixed64"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_float"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_double"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_bool"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_string"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_bytes"))); + + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeatedgroup"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_nested_message"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_foreign_message"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_import_message"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_nested_enum"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_foreign_enum"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_import_enum"))); + + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_string_piece"))); + Assert.AreEqual(0, message.GetRepeatedFieldCount(f("repeated_cord"))); + + // has_blah() should also be false for all default fields. + Assert.IsFalse(message.HasField(f("default_int32"))); + Assert.IsFalse(message.HasField(f("default_int64"))); + Assert.IsFalse(message.HasField(f("default_uint32"))); + Assert.IsFalse(message.HasField(f("default_uint64"))); + Assert.IsFalse(message.HasField(f("default_sint32"))); + Assert.IsFalse(message.HasField(f("default_sint64"))); + Assert.IsFalse(message.HasField(f("default_fixed32"))); + Assert.IsFalse(message.HasField(f("default_fixed64"))); + Assert.IsFalse(message.HasField(f("default_sfixed32"))); + Assert.IsFalse(message.HasField(f("default_sfixed64"))); + Assert.IsFalse(message.HasField(f("default_float"))); + Assert.IsFalse(message.HasField(f("default_double"))); + Assert.IsFalse(message.HasField(f("default_bool"))); + Assert.IsFalse(message.HasField(f("default_string"))); + Assert.IsFalse(message.HasField(f("default_bytes"))); + + Assert.IsFalse(message.HasField(f("default_nested_enum"))); + Assert.IsFalse(message.HasField(f("default_foreign_enum"))); + Assert.IsFalse(message.HasField(f("default_import_enum"))); + + Assert.IsFalse(message.HasField(f("default_string_piece"))); + Assert.IsFalse(message.HasField(f("default_cord"))); + + // Fields with defaults have their default values (duh). + Assert.AreEqual(41, message[f("default_int32")]); + Assert.AreEqual(42L, message[f("default_int64")]); + Assert.AreEqual(43U, message[f("default_uint32")]); + Assert.AreEqual(44UL, message[f("default_uint64")]); + Assert.AreEqual(-45, message[f("default_sint32")]); + Assert.AreEqual(46L, message[f("default_sint64")]); + Assert.AreEqual(47U, message[f("default_fixed32")]); + Assert.AreEqual(48UL, message[f("default_fixed64")]); + Assert.AreEqual(49, message[f("default_sfixed32")]); + Assert.AreEqual(-50L, message[f("default_sfixed64")]); + Assert.AreEqual(51.5F, message[f("default_float")]); + Assert.AreEqual(52e3D, message[f("default_double")]); + Assert.AreEqual(true, message[f("default_bool")]); + Assert.AreEqual("hello", message[f("default_string")]); + Assert.AreEqual(TestUtil.ToBytes("world"), message[f("default_bytes")]); + + Assert.AreEqual(nestedBar, message[f("default_nested_enum")]); + Assert.AreEqual(foreignBar, message[f("default_foreign_enum")]); + Assert.AreEqual(importBar, message[f("default_import_enum")]); + + Assert.AreEqual("abc", message[f("default_string_piece")]); + Assert.AreEqual("123", message[f("default_cord")]); + } + + // --------------------------------------------------------------- + + internal void AssertRepeatedFieldsModifiedViaReflection(IMessage message) + { + // ModifyRepeatedFields only sets the second repeated element of each + // field. In addition to verifying this, we also verify that the first + // element and size were *not* modified. + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_int32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_int64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_uint32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_uint64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_sint32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_sint64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_fixed32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_fixed64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_sfixed32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_sfixed64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_float"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_double"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_bool"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_string"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_bytes"))); + + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeatedgroup"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_nested_message"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_foreign_message"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_import_message"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_nested_enum"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_foreign_enum"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_import_enum"))); + + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_string_piece"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("repeated_cord"))); + + Assert.AreEqual(201, message[f("repeated_int32"), 0]); + Assert.AreEqual(202L, message[f("repeated_int64"), 0]); + Assert.AreEqual(203U, message[f("repeated_uint32"), 0]); + Assert.AreEqual(204UL, message[f("repeated_uint64"), 0]); + Assert.AreEqual(205, message[f("repeated_sint32"), 0]); + Assert.AreEqual(206L, message[f("repeated_sint64"), 0]); + Assert.AreEqual(207U, message[f("repeated_fixed32"), 0]); + Assert.AreEqual(208UL, message[f("repeated_fixed64"), 0]); + Assert.AreEqual(209, message[f("repeated_sfixed32"), 0]); + Assert.AreEqual(210L, message[f("repeated_sfixed64"), 0]); + Assert.AreEqual(211F, message[f("repeated_float"), 0]); + Assert.AreEqual(212D, message[f("repeated_double"), 0]); + Assert.AreEqual(true, message[f("repeated_bool"), 0]); + Assert.AreEqual("215", message[f("repeated_string"), 0]); + Assert.AreEqual(TestUtil.ToBytes("216"), message[f("repeated_bytes"), 0]); + + Assert.AreEqual(217, ((IMessage) message[f("repeatedgroup"), 0])[repeatedGroupA]); + Assert.AreEqual(218, ((IMessage) message[f("repeated_nested_message"), 0])[nestedB]); + Assert.AreEqual(219, ((IMessage) message[f("repeated_foreign_message"), 0])[foreignC]); + Assert.AreEqual(220, ((IMessage) message[f("repeated_import_message"), 0])[importD]); + + Assert.AreEqual(nestedBar, message[f("repeated_nested_enum"), 0]); + Assert.AreEqual(foreignBar, message[f("repeated_foreign_enum"), 0]); + Assert.AreEqual(importBar, message[f("repeated_import_enum"), 0]); + + Assert.AreEqual("224", message[f("repeated_string_piece"), 0]); + Assert.AreEqual("225", message[f("repeated_cord"), 0]); + + Assert.AreEqual(501, message[f("repeated_int32"), 1]); + Assert.AreEqual(502L, message[f("repeated_int64"), 1]); + Assert.AreEqual(503U, message[f("repeated_uint32"), 1]); + Assert.AreEqual(504UL, message[f("repeated_uint64"), 1]); + Assert.AreEqual(505, message[f("repeated_sint32"), 1]); + Assert.AreEqual(506L, message[f("repeated_sint64"), 1]); + Assert.AreEqual(507U, message[f("repeated_fixed32"), 1]); + Assert.AreEqual(508UL, message[f("repeated_fixed64"), 1]); + Assert.AreEqual(509, message[f("repeated_sfixed32"), 1]); + Assert.AreEqual(510L, message[f("repeated_sfixed64"), 1]); + Assert.AreEqual(511F, message[f("repeated_float"), 1]); + Assert.AreEqual(512D, message[f("repeated_double"), 1]); + Assert.AreEqual(true, message[f("repeated_bool"), 1]); + Assert.AreEqual("515", message[f("repeated_string"), 1]); + Assert.AreEqual(TestUtil.ToBytes("516"), message[f("repeated_bytes"), 1]); + + Assert.AreEqual(517, ((IMessage) message[f("repeatedgroup"), 1])[repeatedGroupA]); + Assert.AreEqual(518, ((IMessage) message[f("repeated_nested_message"), 1])[nestedB]); + Assert.AreEqual(519, ((IMessage) message[f("repeated_foreign_message"), 1])[foreignC]); + Assert.AreEqual(520, ((IMessage) message[f("repeated_import_message"), 1])[importD]); + + Assert.AreEqual(nestedFoo, message[f("repeated_nested_enum"), 1]); + Assert.AreEqual(foreignFoo, message[f("repeated_foreign_enum"), 1]); + Assert.AreEqual(importFoo, message[f("repeated_import_enum"), 1]); + + Assert.AreEqual("524", message[f("repeated_string_piece"), 1]); + Assert.AreEqual("525", message[f("repeated_cord"), 1]); + } + + /// + /// Verifies that the reflection setters for the given Builder object throw an + /// ArgumentNullException if they are passed a null value. + /// + public void AssertReflectionSettersRejectNull(IBuilder builder) + { + TestUtil.AssertArgumentNullException(() => builder[f("optional_string")] = null); + TestUtil.AssertArgumentNullException(() => builder[f("optional_bytes")] = null); + TestUtil.AssertArgumentNullException(() => builder[f("optional_nested_enum")] = null); + TestUtil.AssertArgumentNullException(() => builder[f("optional_nested_message")] = null); + TestUtil.AssertArgumentNullException(() => builder[f("optional_nested_message")] = null); + TestUtil.AssertArgumentNullException(() => builder.WeakAddRepeatedField(f("repeated_string"), null)); + TestUtil.AssertArgumentNullException(() => builder.WeakAddRepeatedField(f("repeated_bytes"), null)); + TestUtil.AssertArgumentNullException(() => builder.WeakAddRepeatedField(f("repeated_nested_enum"), null)); + TestUtil.AssertArgumentNullException(() => builder.WeakAddRepeatedField(f("repeated_nested_message"), null)); + } + + /// + /// Verifies that the reflection repeated setters for the given Builder object throw an + /// ArgumentNullException if they are passed a null value. + /// + public void AssertReflectionRepeatedSettersRejectNull(IBuilder builder) + { + builder.WeakAddRepeatedField(f("repeated_string"), "one"); + TestUtil.AssertArgumentNullException(() => builder.SetRepeatedField(f("repeated_string"), 0, null)); + builder.WeakAddRepeatedField(f("repeated_bytes"), TestUtil.ToBytes("one")); + TestUtil.AssertArgumentNullException(() => builder.SetRepeatedField(f("repeated_bytes"), 0, null)); + builder.WeakAddRepeatedField(f("repeated_nested_enum"), nestedBaz); + TestUtil.AssertArgumentNullException(() => builder.SetRepeatedField(f("repeated_nested_enum"), 0, null)); + builder.WeakAddRepeatedField(f("repeated_nested_message"), + new TestAllTypes.Types.NestedMessage.Builder {Bb = 218}.Build()); + TestUtil.AssertArgumentNullException(() => builder.SetRepeatedField(f("repeated_nested_message"), 0, null)); + } + + public void SetPackedFieldsViaReflection(IBuilder message) + { + message.WeakAddRepeatedField(f("packed_int32"), 601); + message.WeakAddRepeatedField(f("packed_int64"), 602L); + message.WeakAddRepeatedField(f("packed_uint32"), 603U); + message.WeakAddRepeatedField(f("packed_uint64"), 604UL); + message.WeakAddRepeatedField(f("packed_sint32"), 605); + message.WeakAddRepeatedField(f("packed_sint64"), 606L); + message.WeakAddRepeatedField(f("packed_fixed32"), 607U); + message.WeakAddRepeatedField(f("packed_fixed64"), 608UL); + message.WeakAddRepeatedField(f("packed_sfixed32"), 609); + message.WeakAddRepeatedField(f("packed_sfixed64"), 610L); + message.WeakAddRepeatedField(f("packed_float"), 611F); + message.WeakAddRepeatedField(f("packed_double"), 612D); + message.WeakAddRepeatedField(f("packed_bool"), true); + message.WeakAddRepeatedField(f("packed_enum"), foreignBar); + // Add a second one of each field. + message.WeakAddRepeatedField(f("packed_int32"), 701); + message.WeakAddRepeatedField(f("packed_int64"), 702L); + message.WeakAddRepeatedField(f("packed_uint32"), 703U); + message.WeakAddRepeatedField(f("packed_uint64"), 704UL); + message.WeakAddRepeatedField(f("packed_sint32"), 705); + message.WeakAddRepeatedField(f("packed_sint64"), 706L); + message.WeakAddRepeatedField(f("packed_fixed32"), 707U); + message.WeakAddRepeatedField(f("packed_fixed64"), 708UL); + message.WeakAddRepeatedField(f("packed_sfixed32"), 709); + message.WeakAddRepeatedField(f("packed_sfixed64"), 710L); + message.WeakAddRepeatedField(f("packed_float"), 711F); + message.WeakAddRepeatedField(f("packed_double"), 712D); + message.WeakAddRepeatedField(f("packed_bool"), false); + message.WeakAddRepeatedField(f("packed_enum"), foreignBaz); + } + + public void AssertPackedFieldsSetViaReflection(IMessage message) + { + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_int32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_int64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_uint32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_uint64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_sint32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_sint64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_fixed32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_fixed64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_sfixed32"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_sfixed64"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_float"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_double"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_bool"))); + Assert.AreEqual(2, message.GetRepeatedFieldCount(f("packed_enum"))); + + Assert.AreEqual(601, message[f("packed_int32"), 0]); + Assert.AreEqual(602L, message[f("packed_int64"), 0]); + Assert.AreEqual(603u, message[f("packed_uint32"), 0]); + Assert.AreEqual(604uL, message[f("packed_uint64"), 0]); + Assert.AreEqual(605, message[f("packed_sint32"), 0]); + Assert.AreEqual(606L, message[f("packed_sint64"), 0]); + Assert.AreEqual(607u, message[f("packed_fixed32"), 0]); + Assert.AreEqual(608uL, message[f("packed_fixed64"), 0]); + Assert.AreEqual(609, message[f("packed_sfixed32"), 0]); + Assert.AreEqual(610L, message[f("packed_sfixed64"), 0]); + Assert.AreEqual(611F, message[f("packed_float"), 0]); + Assert.AreEqual(612D, message[f("packed_double"), 0]); + Assert.AreEqual(true, message[f("packed_bool"), 0]); + Assert.AreEqual(foreignBar, message[f("packed_enum"), 0]); + + Assert.AreEqual(701, message[f("packed_int32"), 1]); + Assert.AreEqual(702L, message[f("packed_int64"), 1]); + Assert.AreEqual(703u, message[f("packed_uint32"), 1]); + Assert.AreEqual(704uL, message[f("packed_uint64"), 1]); + Assert.AreEqual(705, message[f("packed_sint32"), 1]); + Assert.AreEqual(706L, message[f("packed_sint64"), 1]); + Assert.AreEqual(707u, message[f("packed_fixed32"), 1]); + Assert.AreEqual(708uL, message[f("packed_fixed64"), 1]); + Assert.AreEqual(709, message[f("packed_sfixed32"), 1]); + Assert.AreEqual(710L, message[f("packed_sfixed64"), 1]); + Assert.AreEqual(711F, message[f("packed_float"), 1]); + Assert.AreEqual(712D, message[f("packed_double"), 1]); + Assert.AreEqual(false, message[f("packed_bool"), 1]); + Assert.AreEqual(foreignBaz, message[f("packed_enum"), 1]); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ReusableBuilderTest.cs b/csharp/src/ProtocolBuffers.Test/ReusableBuilderTest.cs new file mode 100644 index 00000000..a63f6575 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ReusableBuilderTest.cs @@ -0,0 +1,171 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; +using Google.ProtocolBuffers.Collections; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Google.ProtocolBuffers.TestProtos; +using Google.ProtocolBuffers.Serialization; +using UnitTest.Issues.TestProtos; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class ReusableBuilderTest + { + //Issue 28: Circular message dependencies result in null defaults for DefaultInstance + [TestMethod] + public void EnsureStaticCicularReference() + { + MyMessageAReferenceB ab = MyMessageAReferenceB.DefaultInstance; + Assert.IsNotNull(ab); + Assert.IsNotNull(ab.Value); + MyMessageBReferenceA ba = MyMessageBReferenceA.DefaultInstance; + Assert.IsNotNull(ba); + Assert.IsNotNull(ba.Value); + } + + [TestMethod] + public void TestModifyDefaultInstance() + { + //verify that the default instance has correctly been marked as read-only + Assert.AreEqual(typeof(PopsicleList), TestAllTypes.DefaultInstance.RepeatedBoolList.GetType()); + PopsicleList list = (PopsicleList)TestAllTypes.DefaultInstance.RepeatedBoolList; + Assert.IsTrue(list.IsReadOnly); + } + + [TestMethod] + public void TestUnmodifiedDefaultInstance() + { + //Simply calling ToBuilder().Build() no longer creates a copy of the message + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [TestMethod] + public void BuildMultipleWithoutChange() + { + //Calling Build() or BuildPartial() does not require a copy of the message + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + builder.SetDefaultBool(true); + + TestAllTypes first = builder.BuildPartial(); + //Still the same instance? + Assert.IsTrue(ReferenceEquals(first, builder.Build())); + //Still the same instance? + Assert.IsTrue(ReferenceEquals(first, builder.BuildPartial().ToBuilder().Build())); + } + + [TestMethod] + public void MergeFromDefaultInstance() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.MergeFrom(TestAllTypes.DefaultInstance); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [TestMethod] + public void BuildNewBuilderIsDefaultInstance() + { + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, new TestAllTypes.Builder().Build())); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, TestAllTypes.CreateBuilder().Build())); + //last test, if you clear a builder it reverts to default instance + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, + TestAllTypes.CreateBuilder().SetOptionalBool(true).Build().ToBuilder().Clear().Build())); + } + + [TestMethod] + public void BuildModifyAndRebuild() + { + TestAllTypes.Builder b1 = new TestAllTypes.Builder(); + b1.SetDefaultInt32(1); + b1.AddRepeatedInt32(2); + b1.SetOptionalForeignMessage(ForeignMessage.DefaultInstance); + + TestAllTypes m1 = b1.Build(); + + b1.SetDefaultInt32(5); + b1.AddRepeatedInt32(6); + b1.SetOptionalForeignMessage(b1.OptionalForeignMessage.ToBuilder().SetC(7)); + + TestAllTypes m2 = b1.Build(); + + Assert.AreEqual("{\"optional_foreign_message\":{},\"repeated_int32\":[2],\"default_int32\":1}", Extensions.ToJson(m1)); + Assert.AreEqual("{\"optional_foreign_message\":{\"c\":7},\"repeated_int32\":[2,6],\"default_int32\":5}", Extensions.ToJson(m2)); + } + + [TestMethod] + public void CloneOnChangePrimitive() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.SetDefaultBool(true); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [TestMethod] + public void CloneOnAddRepeatedBool() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.AddRepeatedBool(true); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [TestMethod] + public void CloneOnGetRepeatedBoolList() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + GC.KeepAlive(builder.RepeatedBoolList); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [TestMethod] + public void CloneOnChangeMessage() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.SetOptionalForeignMessage(new ForeignMessage.Builder()); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [TestMethod] + public void CloneOnClearMessage() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.ClearOptionalForeignMessage(); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [TestMethod] + public void CloneOnGetRepeatedForeignMessageList() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + GC.KeepAlive(builder.RepeatedForeignMessageList); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [TestMethod] + public void CloneOnChangeEnumValue() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + builder.SetOptionalForeignEnum(ForeignEnum.FOREIGN_BAR); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + [TestMethod] + public void CloneOnGetRepeatedForeignEnumList() + { + TestAllTypes.Builder builder = TestAllTypes.DefaultInstance.ToBuilder(); + Assert.IsTrue(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + GC.KeepAlive(builder.RepeatedForeignEnumList); + Assert.IsFalse(ReferenceEquals(TestAllTypes.DefaultInstance, builder.Build())); + } + + } +} diff --git a/csharp/src/ProtocolBuffers.Test/SerializableAttribute.cs b/csharp/src/ProtocolBuffers.Test/SerializableAttribute.cs new file mode 100644 index 00000000..0553762b --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/SerializableAttribute.cs @@ -0,0 +1,12 @@ +#if NOSERIALIZABLE && !COMPACT_FRAMEWORK + +namespace System +{ + [AttributeUsage(AttributeTargets.Class)] + public class SerializableAttribute : Attribute + { + public SerializableAttribute () : base() { } + } +} + +#endif diff --git a/csharp/src/ProtocolBuffers.Test/SerializableTest.cs b/csharp/src/ProtocolBuffers.Test/SerializableTest.cs new file mode 100644 index 00000000..90406140 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/SerializableTest.cs @@ -0,0 +1,179 @@ +#if !NOSERIALIZABLE +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters.Binary; +using System.Text; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class SerializableTest + { + /// + /// Just keep it from even compiling if we these objects don't implement the expected interface. + /// + public static readonly ISerializable CompileTimeCheckSerializableMessage = TestXmlMessage.DefaultInstance; + public static readonly ISerializable CompileTimeCheckSerializableBuilder = new TestXmlMessage.Builder(); + + [TestMethod] + public void TestPlainMessage() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .AddTextlines("a") + .AddTextlines("b") + .AddTextlines("c") + .SetNumber(0x1010101010) + .AddNumbers(1) + .AddNumbers(2) + .AddNumbers(3) + .SetChild(TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.TWO) + .SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.THREE) + .SetBinary(ByteString.CopyFrom(new byte[3]))) + .Build(); + + MemoryStream ms = new MemoryStream(); + new BinaryFormatter().Serialize(ms, message); + + ms.Position = 0; + TestXmlMessage copy = (TestXmlMessage)new BinaryFormatter().Deserialize(ms); + + Assert.AreEqual(message, copy); + } + + [TestMethod] + public void TestMessageWithExtensions() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .AddTextlines("a") + .AddTextlines("b") + .AddTextlines("c") + .SetNumber(0x1010101010) + .AddNumbers(1) + .AddNumbers(2) + .AddNumbers(3) + .SetChild(TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.TWO) + .SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.THREE) + .SetBinary(ByteString.CopyFrom(new byte[3]))) + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, " extension text value ! ") + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, new TestXmlExtension.Builder().SetNumber(42).Build()) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 101) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 102) + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionEnum, EnumOptions.ONE) + .Build(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestXmlSerializerTestProtoFile.RegisterAllExtensions(registry); + + MemoryStream ms = new MemoryStream(); + new BinaryFormatter().Serialize(ms, message); + + ms.Position = 0; + //you need to provide the extension registry as context to the serializer + BinaryFormatter bff = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.All, registry)); + TestXmlMessage copy = (TestXmlMessage)bff.Deserialize(ms); + + // And all extensions will be defined. + Assert.AreEqual(message, copy); + } + + [TestMethod] + public void TestPlainBuilder() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .AddTextlines("a") + .AddTextlines("b") + .AddTextlines("c") + .SetNumber(0x1010101010) + .AddNumbers(1) + .AddNumbers(2) + .AddNumbers(3) + .SetChild(TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.TWO) + .SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.THREE) + .SetBinary(ByteString.CopyFrom(new byte[3]))) + ; + + MemoryStream ms = new MemoryStream(); + new BinaryFormatter().Serialize(ms, builder); + + ms.Position = 0; + TestXmlMessage.Builder copy = (TestXmlMessage.Builder)new BinaryFormatter().Deserialize(ms); + + Assert.AreEqual(builder.Build(), copy.Build()); + } + + [TestMethod] + public void TestBuilderWithExtensions() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .AddTextlines("a") + .AddTextlines("b") + .AddTextlines("c") + .SetNumber(0x1010101010) + .AddNumbers(1) + .AddNumbers(2) + .AddNumbers(3) + .SetChild(TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.TWO) + .SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder() + .AddOptions(EnumOptions.THREE) + .SetBinary(ByteString.CopyFrom(new byte[3]))) + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, " extension text value ! ") + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, new TestXmlExtension.Builder().SetNumber(42).Build()) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 101) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 102) + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionEnum, EnumOptions.ONE) + ; + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestXmlSerializerTestProtoFile.RegisterAllExtensions(registry); + + MemoryStream ms = new MemoryStream(); + new BinaryFormatter().Serialize(ms, builder); + + ms.Position = 0; + //you need to provide the extension registry as context to the serializer + BinaryFormatter bff = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.All, registry)); + TestXmlMessage.Builder copy = (TestXmlMessage.Builder)bff.Deserialize(ms); + + // And all extensions will be defined. + Assert.AreEqual(builder.Build(), copy.Build()); + } + } +} +#endif \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/ServiceTest.cs b/csharp/src/ProtocolBuffers.Test/ServiceTest.cs new file mode 100644 index 00000000..ee28ca1c --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/ServiceTest.cs @@ -0,0 +1,262 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + /// + /// Tests for generated service classes. + /// TODO(jonskeet): Convert the mocking tests using Rhino.Mocks. + /// + [TestClass] + public class ServiceTest + { + private delegate void Action(T1 t1, T2 t2); + + private static readonly MethodDescriptor FooDescriptor = TestGenericService.Descriptor.Methods[0]; + private static readonly MethodDescriptor BarDescriptor = TestGenericService.Descriptor.Methods[1]; + + [TestMethod] + public void GetRequestPrototype() + { + TestGenericService service = new TestServiceImpl(); + + Assert.AreSame(service.GetRequestPrototype(FooDescriptor), FooRequest.DefaultInstance); + Assert.AreSame(service.GetRequestPrototype(BarDescriptor), BarRequest.DefaultInstance); + } + + [TestMethod] + public void GetResponsePrototype() + { + TestGenericService service = new TestServiceImpl(); + + Assert.AreSame(service.GetResponsePrototype(FooDescriptor), FooResponse.DefaultInstance); + Assert.AreSame(service.GetResponsePrototype(BarDescriptor), BarResponse.DefaultInstance); + } + + [TestMethod] + public void CallMethodFoo() + { + FooRequest fooRequest = FooRequest.CreateBuilder().Build(); + FooResponse fooResponse = FooResponse.CreateBuilder().Build(); + IRpcController controller = new RpcTestController(); + + bool fooCalled = false; + + TestGenericService service = new TestServiceImpl((request, responseAction) => + { + Assert.AreSame(fooRequest, request); + fooCalled = true; + responseAction(fooResponse); + }, null, controller); + + bool doneHandlerCalled = false; + Action doneHandler = (response => + { + Assert.AreSame(fooResponse, response); + doneHandlerCalled = true; + }); + + service.CallMethod(FooDescriptor, controller, fooRequest, doneHandler); + + Assert.IsTrue(doneHandlerCalled); + Assert.IsTrue(fooCalled); + } + + [TestMethod] + public void CallMethodBar() + { + BarRequest barRequest = BarRequest.CreateBuilder().Build(); + BarResponse barResponse = BarResponse.CreateBuilder().Build(); + IRpcController controller = new RpcTestController(); + + bool barCalled = false; + + TestGenericService service = new TestServiceImpl(null, (request, responseAction) => + { + Assert.AreSame(barRequest, request); + barCalled = true; + responseAction(barResponse); + }, controller); + + bool doneHandlerCalled = false; + Action doneHandler = (response => + { + Assert.AreSame(barResponse, response); + doneHandlerCalled = true; + }); + + service.CallMethod(BarDescriptor, controller, barRequest, doneHandler); + + Assert.IsTrue(doneHandlerCalled); + Assert.IsTrue(barCalled); + } + + [TestMethod] + public void GeneratedStubFooCall() + { + IRpcChannel channel = new RpcTestChannel(); + IRpcController controller = new RpcTestController(); + TestGenericService service = TestGenericService.CreateStub(channel); + FooResponse fooResponse = null; + Action doneHandler = r => fooResponse = r; + + service.Foo(controller, FooRequest.DefaultInstance, doneHandler); + + Assert.IsNotNull(fooResponse); + Assert.IsFalse(controller.Failed); + } + + [TestMethod] + public void GeneratedStubBarCallFails() + { + IRpcChannel channel = new RpcTestChannel(); + IRpcController controller = new RpcTestController(); + TestGenericService service = TestGenericService.CreateStub(channel); + BarResponse barResponse = null; + Action doneHandler = r => barResponse = r; + + service.Bar(controller, BarRequest.DefaultInstance, doneHandler); + + Assert.IsNull(barResponse); + Assert.IsTrue(controller.Failed); + } + + #region RpcTestController + private class RpcTestController : IRpcController + { + public string TestFailedReason { get; set; } + public bool TestCancelled { get; set; } + public Action TestCancelledCallback { get; set; } + + void IRpcController.Reset() + { + TestFailedReason = null; + TestCancelled = false; + TestCancelledCallback = null; + } + + bool IRpcController.Failed + { + get { return TestFailedReason != null; } + } + + string IRpcController.ErrorText + { + get { return TestFailedReason; } + } + + void IRpcController.StartCancel() + { + TestCancelled = true; + if (TestCancelledCallback != null) + TestCancelledCallback(this); + } + + void IRpcController.SetFailed(string reason) + { + TestFailedReason = reason; + } + + bool IRpcController.IsCanceled() + { + return TestCancelled; + } + + void IRpcController.NotifyOnCancel(Action callback) + { + TestCancelledCallback = callback; + } + } + #endregion + #region RpcTestChannel + private class RpcTestChannel : IRpcChannel + { + public MethodDescriptor TestMethodCalled { get; set; } + + void IRpcChannel.CallMethod(MethodDescriptor method, IRpcController controller, IMessage request, IMessage responsePrototype, Action done) + { + TestMethodCalled = method; + try + { + done(FooResponse.DefaultInstance); + } + catch (Exception e) + { + controller.SetFailed(e.Message); + } + } + } + #endregion + #region TestServiceImpl + private class TestServiceImpl : TestGenericService + { + private readonly Action> fooHandler; + private readonly Action> barHandler; + private readonly IRpcController expectedController; + + internal TestServiceImpl() + { + } + + internal TestServiceImpl(Action> fooHandler, + Action> barHandler, + IRpcController expectedController) + { + this.fooHandler = fooHandler; + this.barHandler = barHandler; + this.expectedController = expectedController; + } + + public override void Foo(IRpcController controller, FooRequest request, Action done) + { + Assert.AreSame(expectedController, controller); + fooHandler(request, done); + } + + public override void Bar(IRpcController controller, BarRequest request, Action done) + { + Assert.AreSame(expectedController, controller); + barHandler(request, done); + } + } + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/TestCornerCases.cs b/csharp/src/ProtocolBuffers.Test/TestCornerCases.cs new file mode 100644 index 00000000..0be4e1d4 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestCornerCases.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using UnitTest.Issues.TestProtos; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class TestCornerCases + { + [TestMethod] + public void TestRoundTripNegativeEnums() + { + NegativeEnumMessage msg = NegativeEnumMessage.CreateBuilder() + .SetValue(NegativeEnum.MinusOne) //11 + .AddValues(NegativeEnum.Zero) //2 + .AddValues(NegativeEnum.MinusOne) //11 + .AddValues(NegativeEnum.FiveBelow) //11 + //2 + .AddPackedValues(NegativeEnum.Zero) //1 + .AddPackedValues(NegativeEnum.MinusOne) //10 + .AddPackedValues(NegativeEnum.FiveBelow) //10 + .Build(); + + Assert.AreEqual(58, msg.SerializedSize); + + byte[] bytes = new byte[58]; + CodedOutputStream output = CodedOutputStream.CreateInstance(bytes); + + msg.WriteTo(output); + Assert.AreEqual(0, output.SpaceLeft); + + NegativeEnumMessage copy = NegativeEnumMessage.ParseFrom(bytes); + Assert.AreEqual(msg, copy); + } + } +} diff --git a/csharp/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs b/csharp/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs new file mode 100644 index 00000000..c16f567f --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestMimeMessageFormats.cs @@ -0,0 +1,264 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Google.ProtocolBuffers.Serialization; +using Google.ProtocolBuffers.Serialization.Http; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class TestMimeMessageFormats + { + // There is a whole host of various json mime types in use around the net, this is the set we accept... + readonly IEnumerable JsonTypes = new string[] { "application/json", "application/x-json", "application/x-javascript", "text/javascript", "text/x-javascript", "text/x-json", "text/json" }; + readonly IEnumerable XmlTypes = new string[] { "text/xml", "application/xml" }; + readonly IEnumerable ProtobufTypes = new string[] { "application/binary", "application/x-protobuf", "application/vnd.google.protobuf" }; + + [TestMethod] + public void TestReadJsonMimeTypes() + { + foreach (string type in JsonTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions(), type, Stream.Null) + is JsonFormatReader); + } + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions() { DefaultContentType = "application/json" }, null, Stream.Null) + is JsonFormatReader); + } + [TestMethod] + public void TestWriteJsonMimeTypes() + { + foreach (string type in JsonTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions(), type, Stream.Null) + is JsonFormatWriter); + } + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions() { DefaultContentType = "application/json" }, null, Stream.Null) + is JsonFormatWriter); + } + [TestMethod] + public void TestReadXmlMimeTypes() + { + foreach (string type in XmlTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions(), type, Stream.Null) + is XmlFormatReader); + } + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions() { DefaultContentType = "application/xml" }, null, Stream.Null) + is XmlFormatReader); + } + [TestMethod] + public void TestWriteXmlMimeTypes() + { + foreach (string type in XmlTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions(), type, Stream.Null) + is XmlFormatWriter); + } + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions() { DefaultContentType = "application/xml" }, null, Stream.Null) + is XmlFormatWriter); + } + [TestMethod] + public void TestReadProtoMimeTypes() + { + foreach (string type in ProtobufTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions(), type, Stream.Null) + is CodedInputStream); + } + Assert.IsTrue( + MessageFormatFactory.CreateInputStream(new MessageFormatOptions() { DefaultContentType = "application/vnd.google.protobuf" }, null, Stream.Null) + is CodedInputStream); + } + [TestMethod] + public void TestWriteProtoMimeTypes() + { + foreach (string type in ProtobufTypes) + { + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions(), type, Stream.Null) + is CodedOutputStream); + } + Assert.IsTrue( + MessageFormatFactory.CreateOutputStream(new MessageFormatOptions() { DefaultContentType = "application/vnd.google.protobuf" }, null, Stream.Null) + is CodedOutputStream); + } + [TestMethod] + public void TestMergeFromJsonType() + { + TestXmlMessage msg = Extensions.MergeFrom(new TestXmlMessage.Builder(), + new MessageFormatOptions(), "application/json", new MemoryStream(Encoding.UTF8.GetBytes( + Extensions.ToJson(TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build()) + ))) + .Build(); + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.Number); + } + [TestMethod] + public void TestMergeFromXmlType() + { + TestXmlMessage msg = Extensions.MergeFrom(new TestXmlMessage.Builder(), + new MessageFormatOptions(), "application/xml", new MemoryStream(Encoding.UTF8.GetBytes( + Extensions.ToXml(TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build()) + ))) + .Build(); + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.Number); + } + [TestMethod] + public void TestMergeFromProtoType() + { + TestXmlMessage msg = Extensions.MergeFrom(new TestXmlMessage.Builder(), + new MessageFormatOptions(), "application/vnd.google.protobuf", new MemoryStream( + TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build().ToByteArray() + )) + .Build(); + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.Number); + } + [TestMethod] + public void TestWriteToJsonType() + { + MemoryStream ms = new MemoryStream(); + Extensions.WriteTo(TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build(), + new MessageFormatOptions(), "application/json", ms); + + Assert.AreEqual(@"{""text"":""a"",""number"":1}", Encoding.UTF8.GetString(ms.ToArray(), 0, (int)ms.Length)); + } + [TestMethod] + public void TestWriteToXmlType() + { + MemoryStream ms = new MemoryStream(); + Extensions.WriteTo(TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build(), + new MessageFormatOptions(), "application/xml", ms); + + Assert.AreEqual("a1", Encoding.UTF8.GetString(ms.ToArray(), 0, (int)ms.Length)); + } + [TestMethod] + public void TestWriteToProtoType() + { + MemoryStream ms = new MemoryStream(); + Extensions.WriteTo(TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build(), + new MessageFormatOptions(), "application/vnd.google.protobuf", ms); + + byte[] bytes = TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build().ToByteArray(); + TestUtil.AssertBytesEqual(bytes, ms.ToArray()); + } + [TestMethod] + public void TestXmlReaderOptions() + { + MemoryStream ms = new MemoryStream(); + XmlFormatWriter.CreateInstance(ms) + .SetOptions(XmlWriterOptions.OutputNestedArrays) + .WriteMessage("my-root-node", TestXmlMessage.CreateBuilder().SetText("a").AddNumbers(1).AddNumbers(2).Build()); + ms.Position = 0; + + MessageFormatOptions options = new MessageFormatOptions() + { + XmlReaderOptions = XmlReaderOptions.ReadNestedArrays, + XmlReaderRootElementName = "my-root-node" + }; + + TestXmlMessage msg = Extensions.MergeFrom(new TestXmlMessage.Builder(), + options, "application/xml", ms) + .Build(); + + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.NumbersList[0]); + Assert.AreEqual(2, msg.NumbersList[1]); + + } + [TestMethod] + public void TestXmlWriterOptions() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder().SetText("a").AddNumbers(1).AddNumbers(2).Build(); + MessageFormatOptions options = new MessageFormatOptions() + { + XmlWriterOptions = XmlWriterOptions.OutputNestedArrays, + XmlWriterRootElementName = "root-node" + }; + + MemoryStream ms = new MemoryStream(); + Extensions.WriteTo(message, options, "application/xml", ms); + ms.Position = 0; + + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + XmlFormatReader.CreateInstance(ms) + .SetOptions(XmlReaderOptions.ReadNestedArrays) + .Merge("root-node", builder); + + Assert.AreEqual("a", builder.Text); + Assert.AreEqual(1, builder.NumbersList[0]); + Assert.AreEqual(2, builder.NumbersList[1]); + } + [TestMethod] + public void TestJsonFormatted() + { + MemoryStream ms = new MemoryStream(); + Extensions.WriteTo(TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build(), + new MessageFormatOptions() { FormattedOutput = true }, "application/json", ms); + + Assert.AreEqual("{\r\n \"text\": \"a\",\r\n \"number\": 1\r\n}", Encoding.UTF8.GetString(ms.ToArray(), 0, (int)ms.Length)); + } + [TestMethod] + public void TestXmlFormatted() + { + MemoryStream ms = new MemoryStream(); + Extensions.WriteTo(TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build(), + new MessageFormatOptions() { FormattedOutput = true }, "application/xml", ms); + + Assert.AreEqual("\r\n a\r\n 1\r\n", Encoding.UTF8.GetString(ms.ToArray(), 0, (int)ms.Length)); + } + + [TestMethod] + public void TestReadCustomMimeTypes() + { + var options = new MessageFormatOptions(); + //Remove existing mime-type mappings + options.MimeInputTypes.Clear(); + //Add our own + options.MimeInputTypes.Add("-custom-XML-mime-type-", XmlFormatReader.CreateInstance); + Assert.AreEqual(1, options.MimeInputTypes.Count); + + Stream xmlStream = new MemoryStream(Encoding.UTF8.GetBytes( + Extensions.ToXml(TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build()) + )); + + TestXmlMessage msg = Extensions.MergeFrom(new TestXmlMessage.Builder(), + options, "-custom-XML-mime-type-", xmlStream) + .Build(); + Assert.AreEqual("a", msg.Text); + Assert.AreEqual(1, msg.Number); + } + + [TestMethod] + public void TestWriteToCustomType() + { + var options = new MessageFormatOptions(); + //Remove existing mime-type mappings + options.MimeOutputTypes.Clear(); + //Add our own + options.MimeOutputTypes.Add("-custom-XML-mime-type-", XmlFormatWriter.CreateInstance); + + Assert.AreEqual(1, options.MimeOutputTypes.Count); + + MemoryStream ms = new MemoryStream(); + Extensions.WriteTo(TestXmlMessage.CreateBuilder().SetText("a").SetNumber(1).Build(), + options, "-custom-XML-mime-type-", ms); + + Assert.AreEqual("a1", Encoding.UTF8.GetString(ms.ToArray(), 0, (int)ms.Length)); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs new file mode 100644 index 00000000..8c81980b --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestCSharpOptionsProtoFile.cs @@ -0,0 +1,426 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestCSharpOptionsProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OptionsMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OptionsMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestCSharpOptionsProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ci1nb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfY3NoYXJwX29wdGlvbnMucHJv", + "dG8SEXByb3RvYnVmX3VuaXR0ZXN0GiRnb29nbGUvcHJvdG9idWYvY3NoYXJw", + "X29wdGlvbnMucHJvdG8iXgoOT3B0aW9uc01lc3NhZ2USDgoGbm9ybWFsGAEg", + "ASgJEhcKD29wdGlvbnNfbWVzc2FnZRgCIAEoCRIjCgpjdXN0b21pemVkGAMg", + "ASgJQg/CPgwKCkN1c3RvbU5hbWVCRsI+QwohR29vZ2xlLlByb3RvY29sQnVm", + "ZmVycy5UZXN0UHJvdG9zEh5Vbml0VGVzdENTaGFycE9wdGlvbnNQcm90b0Zp", + "bGU=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_OptionsMessage__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_OptionsMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OptionsMessage__Descriptor, + new string[] { "Normal", "OptionsMessage_", "CustomName", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OptionsMessage : pb::GeneratedMessage { + private OptionsMessage() { } + private static readonly OptionsMessage defaultInstance = new OptionsMessage().MakeReadOnly(); + private static readonly string[] _optionsMessageFieldNames = new string[] { "customized", "normal", "options_message" }; + private static readonly uint[] _optionsMessageFieldTags = new uint[] { 26, 10, 18 }; + public static OptionsMessage DefaultInstance { + get { return defaultInstance; } + } + + public override OptionsMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OptionsMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCSharpOptionsProtoFile.internal__static_protobuf_unittest_OptionsMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCSharpOptionsProtoFile.internal__static_protobuf_unittest_OptionsMessage__FieldAccessorTable; } + } + + public const int NormalFieldNumber = 1; + private bool hasNormal; + private string normal_ = ""; + public bool HasNormal { + get { return hasNormal; } + } + public string Normal { + get { return normal_; } + } + + public const int OptionsMessage_FieldNumber = 2; + private bool hasOptionsMessage_; + private string optionsMessage_ = ""; + public bool HasOptionsMessage_ { + get { return hasOptionsMessage_; } + } + public string OptionsMessage_ { + get { return optionsMessage_; } + } + + public const int CustomNameFieldNumber = 3; + private bool hasCustomName; + private string customized_ = ""; + public bool HasCustomName { + get { return hasCustomName; } + } + public string CustomName { + get { return customized_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _optionsMessageFieldNames; + if (hasNormal) { + output.WriteString(1, field_names[1], Normal); + } + if (hasOptionsMessage_) { + output.WriteString(2, field_names[2], OptionsMessage_); + } + if (hasCustomName) { + output.WriteString(3, field_names[0], CustomName); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasNormal) { + size += pb::CodedOutputStream.ComputeStringSize(1, Normal); + } + if (hasOptionsMessage_) { + size += pb::CodedOutputStream.ComputeStringSize(2, OptionsMessage_); + } + if (hasCustomName) { + size += pb::CodedOutputStream.ComputeStringSize(3, CustomName); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OptionsMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionsMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionsMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionsMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionsMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionsMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OptionsMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OptionsMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OptionsMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionsMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OptionsMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OptionsMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OptionsMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OptionsMessage result; + + private OptionsMessage PrepareBuilder() { + if (resultIsReadOnly) { + OptionsMessage original = result; + result = new OptionsMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OptionsMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OptionsMessage.Descriptor; } + } + + public override OptionsMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OptionsMessage.DefaultInstance; } + } + + public override OptionsMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OptionsMessage) { + return MergeFrom((OptionsMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OptionsMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OptionsMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasNormal) { + Normal = other.Normal; + } + if (other.HasOptionsMessage_) { + OptionsMessage_ = other.OptionsMessage_; + } + if (other.HasCustomName) { + CustomName = other.CustomName; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_optionsMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _optionsMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasNormal = input.ReadString(ref result.normal_); + break; + } + case 18: { + result.hasOptionsMessage_ = input.ReadString(ref result.optionsMessage_); + break; + } + case 26: { + result.hasCustomName = input.ReadString(ref result.customized_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasNormal { + get { return result.hasNormal; } + } + public string Normal { + get { return result.Normal; } + set { SetNormal(value); } + } + public Builder SetNormal(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasNormal = true; + result.normal_ = value; + return this; + } + public Builder ClearNormal() { + PrepareBuilder(); + result.hasNormal = false; + result.normal_ = ""; + return this; + } + + public bool HasOptionsMessage_ { + get { return result.hasOptionsMessage_; } + } + public string OptionsMessage_ { + get { return result.OptionsMessage_; } + set { SetOptionsMessage_(value); } + } + public Builder SetOptionsMessage_(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionsMessage_ = true; + result.optionsMessage_ = value; + return this; + } + public Builder ClearOptionsMessage_() { + PrepareBuilder(); + result.hasOptionsMessage_ = false; + result.optionsMessage_ = ""; + return this; + } + + public bool HasCustomName { + get { return result.hasCustomName; } + } + public string CustomName { + get { return result.CustomName; } + set { SetCustomName(value); } + } + public Builder SetCustomName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasCustomName = true; + result.customized_ = value; + return this; + } + public Builder ClearCustomName() { + PrepareBuilder(); + result.hasCustomName = false; + result.customized_ = ""; + return this; + } + } + static OptionsMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCSharpOptionsProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs new file mode 100644 index 00000000..b61cce78 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestCustomOptionsProtoFile.cs @@ -0,0 +1,6411 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestCustomOptionsProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.FileOpt1); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.MessageOpt1); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.FieldOpt1); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.FieldOpt2); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.EnumOpt1); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.EnumValueOpt1); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ServiceOpt1); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.MethodOpt1); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.BoolOpt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Int32Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Int64Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Uint32Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Uint64Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Sint32Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Sint64Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Fixed32Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Fixed64Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Sfixed32Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Sfixed64Opt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.FloatOpt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.DoubleOpt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.StringOpt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.BytesOpt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.EnumOpt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.MessageTypeOpt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Quux); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Corge); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Grault); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Garply); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ComplexOpt1); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ComplexOpt2); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ComplexOpt3); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ComplexOpt6); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Fileopt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Msgopt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Fieldopt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.EnumoptRenamed); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Enumvalopt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Serviceopt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Methodopt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.ComplexOpt4); + registry.Add(global::Google.ProtocolBuffers.TestProtos.AggregateMessageSetElement.MessageSetExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.Aggregate.Nested); + } + #endregion + #region Extensions + public const int FileOpt1FieldNumber = 7736974; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase FileOpt1; + public const int MessageOpt1FieldNumber = 7739036; + public static pb::GeneratedExtensionBase MessageOpt1; + public const int FieldOpt1FieldNumber = 7740936; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase FieldOpt1; + public const int FieldOpt2FieldNumber = 7753913; + public static pb::GeneratedExtensionBase FieldOpt2; + public const int EnumOpt1FieldNumber = 7753576; + public static pb::GeneratedExtensionBase EnumOpt1; + public const int EnumValueOpt1FieldNumber = 1560678; + public static pb::GeneratedExtensionBase EnumValueOpt1; + public const int ServiceOpt1FieldNumber = 7887650; + public static pb::GeneratedExtensionBase ServiceOpt1; + public const int MethodOpt1FieldNumber = 7890860; + public static pb::GeneratedExtensionBase MethodOpt1; + public const int BoolOptFieldNumber = 7706090; + public static pb::GeneratedExtensionBase BoolOpt; + public const int Int32OptFieldNumber = 7705709; + public static pb::GeneratedExtensionBase Int32Opt; + public const int Int64OptFieldNumber = 7705542; + public static pb::GeneratedExtensionBase Int64Opt; + public const int Uint32OptFieldNumber = 7704880; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase Uint32Opt; + public const int Uint64OptFieldNumber = 7702367; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase Uint64Opt; + public const int Sint32OptFieldNumber = 7701568; + public static pb::GeneratedExtensionBase Sint32Opt; + public const int Sint64OptFieldNumber = 7700863; + public static pb::GeneratedExtensionBase Sint64Opt; + public const int Fixed32OptFieldNumber = 7700307; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase Fixed32Opt; + public const int Fixed64OptFieldNumber = 7700194; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase Fixed64Opt; + public const int Sfixed32OptFieldNumber = 7698645; + public static pb::GeneratedExtensionBase Sfixed32Opt; + public const int Sfixed64OptFieldNumber = 7685475; + public static pb::GeneratedExtensionBase Sfixed64Opt; + public const int FloatOptFieldNumber = 7675390; + public static pb::GeneratedExtensionBase FloatOpt; + public const int DoubleOptFieldNumber = 7673293; + public static pb::GeneratedExtensionBase DoubleOpt; + public const int StringOptFieldNumber = 7673285; + public static pb::GeneratedExtensionBase StringOpt; + public const int BytesOptFieldNumber = 7673238; + public static pb::GeneratedExtensionBase BytesOpt; + public const int EnumOptFieldNumber = 7673233; + public static pb::GeneratedExtensionBase EnumOpt; + public const int MessageTypeOptFieldNumber = 7665967; + public static pb::GeneratedExtensionBase MessageTypeOpt; + public const int QuuxFieldNumber = 7663707; + public static pb::GeneratedExtensionBase Quux; + public const int CorgeFieldNumber = 7663442; + public static pb::GeneratedExtensionBase Corge; + public const int GraultFieldNumber = 7650927; + public static pb::GeneratedExtensionBase Grault; + public const int GarplyFieldNumber = 7649992; + public static pb::GeneratedExtensionBase Garply; + public const int ComplexOpt1FieldNumber = 7646756; + public static pb::GeneratedExtensionBase ComplexOpt1; + public const int ComplexOpt2FieldNumber = 7636949; + public static pb::GeneratedExtensionBase ComplexOpt2; + public const int ComplexOpt3FieldNumber = 7636463; + public static pb::GeneratedExtensionBase ComplexOpt3; + public const int ComplexOpt6FieldNumber = 7595468; + public static pb::GeneratedExtensionBase ComplexOpt6; + public const int FileoptFieldNumber = 15478479; + public static pb::GeneratedExtensionBase Fileopt; + public const int MsgoptFieldNumber = 15480088; + public static pb::GeneratedExtensionBase Msgopt; + public const int FieldoptFieldNumber = 15481374; + public static pb::GeneratedExtensionBase Fieldopt; + public const int EnumoptRenamedFieldNumber = 15483218; + public static pb::GeneratedExtensionBase EnumoptRenamed; + public const int EnumvaloptFieldNumber = 15486921; + public static pb::GeneratedExtensionBase Enumvalopt; + public const int ServiceoptFieldNumber = 15497145; + public static pb::GeneratedExtensionBase Serviceopt; + public const int MethodoptFieldNumber = 15512713; + public static pb::GeneratedExtensionBase Methodopt; + #endregion + + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMessageWithCustomOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMessageWithCustomOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_CustomOptionFooRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_CustomOptionFooRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_CustomOptionFooResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_CustomOptionFooResponse__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_DummyMessageContainingEnum__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_DummyMessageContainingEnum__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_DummyMessageInvalidAsOptionType__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_DummyMessageInvalidAsOptionType__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_CustomOptionMinIntegerValues__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_CustomOptionMinIntegerValues__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_CustomOptionMaxIntegerValues__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_CustomOptionMaxIntegerValues__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_CustomOptionOtherValues__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_CustomOptionOtherValues__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_SettingRealsFromPositiveInts__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_SettingRealsFromPositiveInts__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_SettingRealsFromNegativeInts__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_SettingRealsFromNegativeInts__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_ComplexOptionType1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ComplexOptionType1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_ComplexOptionType2__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ComplexOptionType2__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_ComplexOptionType2_ComplexOptionType4__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ComplexOptionType2_ComplexOptionType4__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_ComplexOptionType3__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ComplexOptionType3__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_ComplexOptionType3_ComplexOptionType5__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ComplexOptionType3_ComplexOptionType5__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_ComplexOpt6__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ComplexOpt6__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_VariousComplexOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_VariousComplexOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_AggregateMessageSet__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_AggregateMessageSet__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_AggregateMessageSetElement__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_AggregateMessageSetElement__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_Aggregate__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_Aggregate__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_AggregateMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_AggregateMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestCustomOptionsProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ci1nb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfY3VzdG9tX29wdGlvbnMucHJv", + "dG8SEXByb3RvYnVmX3VuaXR0ZXN0GiRnb29nbGUvcHJvdG9idWYvY3NoYXJw", + "X29wdGlvbnMucHJvdG8aIGdvb2dsZS9wcm90b2J1Zi9kZXNjcmlwdG9yLnBy", + "b3RvIo0BChxUZXN0TWVzc2FnZVdpdGhDdXN0b21PcHRpb25zEh4KBmZpZWxk", + "MRgBIAEoCUIOCAHB4MMdLeF1CgIAAAAiOwoGQW5FbnVtEg8KC0FORU5VTV9W", + "QUwxEAESFgoLQU5FTlVNX1ZBTDIQAhoFsIb6BXsaCMX2yR3r/P//OhAIAODp", + "wh3I//////////8BIhgKFkN1c3RvbU9wdGlvbkZvb1JlcXVlc3QiGQoXQ3Vz", + "dG9tT3B0aW9uRm9vUmVzcG9uc2UibQoaRHVtbXlNZXNzYWdlQ29udGFpbmlu", + "Z0VudW0iTwoMVGVzdEVudW1UeXBlEhoKFlRFU1RfT1BUSU9OX0VOVU1fVFlQ", + "RTEQFhIjChZURVNUX09QVElPTl9FTlVNX1RZUEUyEOn//////////wEiIQof", + "RHVtbXlNZXNzYWdlSW52YWxpZEFzT3B0aW9uVHlwZSKKAQocQ3VzdG9tT3B0", + "aW9uTWluSW50ZWdlclZhbHVlczpqmdaoHQAAAAAAAACArY2vHQAAAICR7q8d", + "AAAAAAAAAACd9a8dAAAAAPiXsB3///////////8BgMSwHf////8P+PWwHQCA", + "k7IdALC8sh2AgICAgICAgIAB6MayHYCAgID4/////wHQ3rIdACKRAQocQ3Vz", + "dG9tT3B0aW9uTWF4SW50ZWdlclZhbHVlczpxmdaoHf////////9/rY2vHf//", + "/3+R7q8d//////////+d9a8d//////iXsB3+//////////8BgMSwHf7///8P", + "+PWwHf///////////wGAk7Id/////w+wvLId//////////9/6MayHf////8H", + "0N6yHQEibgoXQ3VzdG9tT3B0aW9uT3RoZXJWYWx1ZXM6U4jZoh3p////////", + "//8BstmiHQtIZWxsbwBXb3JsZKrcoh0OSGVsbG8sICJXb3JsZCLp3KId+1mM", + "QsrA8z/136Md54dFQejGsh2c//////////8BIjQKHFNldHRpbmdSZWFsc0Zy", + "b21Qb3NpdGl2ZUludHM6FOncoh0AAAAAAEBjQPXfox0AAEBBIjQKHFNldHRp", + "bmdSZWFsc0Zyb21OZWdhdGl2ZUludHM6FOncoh0AAAAAAEBjwPXfox0AAEDB", + "IkcKEkNvbXBsZXhPcHRpb25UeXBlMRILCgNmb28YASABKAUSDAoEZm9vMhgC", + "IAEoBRIMCgRmb28zGAMgASgFKggIZBCAgICAAiLBAgoSQ29tcGxleE9wdGlv", + "blR5cGUyEjIKA2JhchgBIAEoCzIlLnByb3RvYnVmX3VuaXR0ZXN0LkNvbXBs", + "ZXhPcHRpb25UeXBlMRILCgNiYXoYAiABKAUSRgoEZnJlZBgDIAEoCzI4LnBy", + "b3RvYnVmX3VuaXR0ZXN0LkNvbXBsZXhPcHRpb25UeXBlMi5Db21wbGV4T3B0", + "aW9uVHlwZTQalwEKEkNvbXBsZXhPcHRpb25UeXBlNBINCgV3YWxkbxgBIAEo", + "BTJyCgxjb21wbGV4X29wdDQSHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9w", + "dGlvbnMYivXRAyABKAsyOC5wcm90b2J1Zl91bml0dGVzdC5Db21wbGV4T3B0", + "aW9uVHlwZTIuQ29tcGxleE9wdGlvblR5cGU0KggIZBCAgICAAiKcAQoSQ29t", + "cGxleE9wdGlvblR5cGUzEgsKA3F1eBgBIAEoBRJUChJjb21wbGV4b3B0aW9u", + "dHlwZTUYAiABKAoyOC5wcm90b2J1Zl91bml0dGVzdC5Db21wbGV4T3B0aW9u", + "VHlwZTMuQ29tcGxleE9wdGlvblR5cGU1GiMKEkNvbXBsZXhPcHRpb25UeXBl", + "NRINCgVwbHVnaBgDIAEoBSIfCgtDb21wbGV4T3B0NhIQCgV4eXp6eRjfv88D", + "IAEoBSLQAQoVVmFyaW91c0NvbXBsZXhPcHRpb25zOrYB49z8HPj9+xwY5Nz8", + "HNKojx0DCLMP+t6QHQIICfrekB0EExgWFKr9kB0DENsHqv2QHQb45pcdjgWq", + "/ZAdBQoDCOcFqv2QHQgKBtiFnh3PD6r9kB0KCgiS9Z0dAwjYD6r9kB0IwqyX", + "HQMI5QWq/ZAdC8Kslx0G2IWeHc4Pqv2QHQ3CrJcdCJL1nR0DCMkQqv2QHQUa", + "AwjBAqLilR0CCCqi4pUdBtiFnh3EAqLilR0IkvWdHQMI7AYiIwoTQWdncmVn", + "YXRlTWVzc2FnZVNldCoICAQQgICAgAI6AggBIqABChpBZ2dyZWdhdGVNZXNz", + "YWdlU2V0RWxlbWVudBIJCgFzGAEgASgJMncKFW1lc3NhZ2Vfc2V0X2V4dGVu", + "c2lvbhImLnByb3RvYnVmX3VuaXR0ZXN0LkFnZ3JlZ2F0ZU1lc3NhZ2VTZXQY", + "9uuuByABKAsyLS5wcm90b2J1Zl91bml0dGVzdC5BZ2dyZWdhdGVNZXNzYWdl", + "U2V0RWxlbWVudCL9AQoJQWdncmVnYXRlEgkKAWkYASABKAUSCQoBcxgCIAEo", + "CRIpCgNzdWIYAyABKAsyHC5wcm90b2J1Zl91bml0dGVzdC5BZ2dyZWdhdGUS", + "KgoEZmlsZRgEIAEoCzIcLmdvb2dsZS5wcm90b2J1Zi5GaWxlT3B0aW9ucxI0", + "CgRtc2V0GAUgASgLMiYucHJvdG9idWZfdW5pdHRlc3QuQWdncmVnYXRlTWVz", + "c2FnZVNldDJNCgZuZXN0ZWQSHC5nb29nbGUucHJvdG9idWYuRmlsZU9wdGlv", + "bnMYp9GwByABKAsyHC5wcm90b2J1Zl91bml0dGVzdC5BZ2dyZWdhdGUiWQoQ", + "QWdncmVnYXRlTWVzc2FnZRIpCglmaWVsZG5hbWUYASABKAVCFvKhhzsREg9G", + "aWVsZEFubm90YXRpb246GsLRhjsVCGUSEU1lc3NhZ2VBbm5vdGF0aW9uKjYK", + "Ck1ldGhvZE9wdDESEwoPTUVUSE9ET1BUMV9WQUwxEAESEwoPTUVUSE9ET1BU", + "MV9WQUwyEAIqTQoNQWdncmVnYXRlRW51bRIlCgVWQUxVRRABGhrK/Ik7FRIT", + "RW51bVZhbHVlQW5ub3RhdGlvbhoVkpWIOxASDkVudW1Bbm5vdGF0aW9uMo4B", + "ChxUZXN0U2VydmljZVdpdGhDdXN0b21PcHRpb25zEmMKA0ZvbxIpLnByb3Rv", + "YnVmX3VuaXR0ZXN0LkN1c3RvbU9wdGlvbkZvb1JlcXVlc3QaKi5wcm90b2J1", + "Zl91bml0dGVzdC5DdXN0b21PcHRpb25Gb29SZXNwb25zZSIF4PqMHgIaCZCy", + "ix7T24DLSTKZAQoQQWdncmVnYXRlU2VydmljZRJrCgZNZXRob2QSIy5wcm90", + "b2J1Zl91bml0dGVzdC5BZ2dyZWdhdGVNZXNzYWdlGiMucHJvdG9idWZfdW5p", + "dHRlc3QuQWdncmVnYXRlTWVzc2FnZSIXysiWOxISEE1ldGhvZEFubm90YXRp", + "b24aGMr7jjsTEhFTZXJ2aWNlQW5ub3RhdGlvbjoyCglmaWxlX29wdDESHC5n", + "b29nbGUucHJvdG9idWYuRmlsZU9wdGlvbnMYjp3YAyABKAQ6OAoMbWVzc2Fn", + "ZV9vcHQxEh8uZ29vZ2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25zGJyt2AMg", + "ASgFOjQKCmZpZWxkX29wdDESHS5nb29nbGUucHJvdG9idWYuRmllbGRPcHRp", + "b25zGIi82AMgASgGOjgKCmZpZWxkX29wdDISHS5nb29nbGUucHJvdG9idWYu", + "RmllbGRPcHRpb25zGLmh2QMgASgFOgI0MjoyCgllbnVtX29wdDESHC5nb29n", + "bGUucHJvdG9idWYuRW51bU9wdGlvbnMY6J7ZAyABKA86PAoPZW51bV92YWx1", + "ZV9vcHQxEiEuZ29vZ2xlLnByb3RvYnVmLkVudW1WYWx1ZU9wdGlvbnMY5qBf", + "IAEoBTo4CgxzZXJ2aWNlX29wdDESHy5nb29nbGUucHJvdG9idWYuU2Vydmlj", + "ZU9wdGlvbnMYorbhAyABKBI6VQoLbWV0aG9kX29wdDESHi5nb29nbGUucHJv", + "dG9idWYuTWV0aG9kT3B0aW9ucxisz+EDIAEoDjIdLnByb3RvYnVmX3VuaXR0", + "ZXN0Lk1ldGhvZE9wdDE6NAoIYm9vbF9vcHQSHy5nb29nbGUucHJvdG9idWYu", + "TWVzc2FnZU9wdGlvbnMY6qvWAyABKAg6NQoJaW50MzJfb3B0Eh8uZ29vZ2xl", + "LnByb3RvYnVmLk1lc3NhZ2VPcHRpb25zGO2o1gMgASgFOjUKCWludDY0X29w", + "dBIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjGp9YDIAEoAzo2", + "Cgp1aW50MzJfb3B0Eh8uZ29vZ2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25z", + "GLCi1gMgASgNOjYKCnVpbnQ2NF9vcHQSHy5nb29nbGUucHJvdG9idWYuTWVz", + "c2FnZU9wdGlvbnMY347WAyABKAQ6NgoKc2ludDMyX29wdBIfLmdvb2dsZS5w", + "cm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjAiNYDIAEoETo2CgpzaW50NjRfb3B0", + "Eh8uZ29vZ2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25zGP+C1gMgASgSOjcK", + "C2ZpeGVkMzJfb3B0Eh8uZ29vZ2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRpb25z", + "GNP+1QMgASgHOjcKC2ZpeGVkNjRfb3B0Eh8uZ29vZ2xlLnByb3RvYnVmLk1l", + "c3NhZ2VPcHRpb25zGOL91QMgASgGOjgKDHNmaXhlZDMyX29wdBIfLmdvb2ds", + "ZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjV8dUDIAEoDzo4CgxzZml4ZWQ2", + "NF9vcHQSHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMY44rVAyAB", + "KBA6NQoJZmxvYXRfb3B0Eh8uZ29vZ2xlLnByb3RvYnVmLk1lc3NhZ2VPcHRp", + "b25zGP671AMgASgCOjYKCmRvdWJsZV9vcHQSHy5nb29nbGUucHJvdG9idWYu", + "TWVzc2FnZU9wdGlvbnMYzavUAyABKAE6NgoKc3RyaW5nX29wdBIfLmdvb2ds", + "ZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxjFq9QDIAEoCTo1CglieXRlc19v", + "cHQSHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMYlqvUAyABKAw6", + "cAoIZW51bV9vcHQSHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlvbnMY", + "kavUAyABKA4yOi5wcm90b2J1Zl91bml0dGVzdC5EdW1teU1lc3NhZ2VDb250", + "YWluaW5nRW51bS5UZXN0RW51bVR5cGU6cAoQbWVzc2FnZV90eXBlX29wdBIf", + "Lmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxiv8tMDIAEoCzIyLnBy", + "b3RvYnVmX3VuaXR0ZXN0LkR1bW15TWVzc2FnZUludmFsaWRBc09wdGlvblR5", + "cGU6NgoEcXV1eBIlLnByb3RvYnVmX3VuaXR0ZXN0LkNvbXBsZXhPcHRpb25U", + "eXBlMRjb4NMDIAEoBTpeCgVjb3JnZRIlLnByb3RvYnVmX3VuaXR0ZXN0LkNv", + "bXBsZXhPcHRpb25UeXBlMRjS3tMDIAEoCzIlLnByb3RvYnVmX3VuaXR0ZXN0", + "LkNvbXBsZXhPcHRpb25UeXBlMzo4CgZncmF1bHQSJS5wcm90b2J1Zl91bml0", + "dGVzdC5Db21wbGV4T3B0aW9uVHlwZTIY7/zSAyABKAU6XwoGZ2FycGx5EiUu", + "cHJvdG9idWZfdW5pdHRlc3QuQ29tcGxleE9wdGlvblR5cGUyGMj10gMgASgL", + "MiUucHJvdG9idWZfdW5pdHRlc3QuQ29tcGxleE9wdGlvblR5cGUxOl8KDGNv", + "bXBsZXhfb3B0MRIfLmdvb2dsZS5wcm90b2J1Zi5NZXNzYWdlT3B0aW9ucxik", + "3NIDIAEoCzIlLnByb3RvYnVmX3VuaXR0ZXN0LkNvbXBsZXhPcHRpb25UeXBl", + "MTpfCgxjb21wbGV4X29wdDISHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9w", + "dGlvbnMY1Y/SAyABKAsyJS5wcm90b2J1Zl91bml0dGVzdC5Db21wbGV4T3B0", + "aW9uVHlwZTI6XwoMY29tcGxleF9vcHQzEh8uZ29vZ2xlLnByb3RvYnVmLk1l", + "c3NhZ2VPcHRpb25zGO+L0gMgASgLMiUucHJvdG9idWZfdW5pdHRlc3QuQ29t", + "cGxleE9wdGlvblR5cGUzOlcKC2NvbXBsZXhvcHQ2Eh8uZ29vZ2xlLnByb3Rv", + "YnVmLk1lc3NhZ2VPcHRpb25zGMzLzwMgASgKMh4ucHJvdG9idWZfdW5pdHRl", + "c3QuQ29tcGxleE9wdDY6TgoHZmlsZW9wdBIcLmdvb2dsZS5wcm90b2J1Zi5G", + "aWxlT3B0aW9ucxjP3bAHIAEoCzIcLnByb3RvYnVmX3VuaXR0ZXN0LkFnZ3Jl", + "Z2F0ZTpQCgZtc2dvcHQSHy5nb29nbGUucHJvdG9idWYuTWVzc2FnZU9wdGlv", + "bnMYmOqwByABKAsyHC5wcm90b2J1Zl91bml0dGVzdC5BZ2dyZWdhdGU6UAoI", + "ZmllbGRvcHQSHS5nb29nbGUucHJvdG9idWYuRmllbGRPcHRpb25zGJ70sAcg", + "ASgLMhwucHJvdG9idWZfdW5pdHRlc3QuQWdncmVnYXRlOlYKD2VudW1vcHRf", + "cmVuYW1lZBIcLmdvb2dsZS5wcm90b2J1Zi5FbnVtT3B0aW9ucxjSgrEHIAEo", + "CzIcLnByb3RvYnVmX3VuaXR0ZXN0LkFnZ3JlZ2F0ZTpWCgplbnVtdmFsb3B0", + "EiEuZ29vZ2xlLnByb3RvYnVmLkVudW1WYWx1ZU9wdGlvbnMYyZ+xByABKAsy", + "HC5wcm90b2J1Zl91bml0dGVzdC5BZ2dyZWdhdGU6VAoKc2VydmljZW9wdBIf", + "Lmdvb2dsZS5wcm90b2J1Zi5TZXJ2aWNlT3B0aW9ucxi577EHIAEoCzIcLnBy", + "b3RvYnVmX3VuaXR0ZXN0LkFnZ3JlZ2F0ZTpSCgltZXRob2RvcHQSHi5nb29n", + "bGUucHJvdG9idWYuTWV0aG9kT3B0aW9ucxiJ6bIHIAEoCzIcLnByb3RvYnVm", + "X3VuaXR0ZXN0LkFnZ3JlZ2F0ZULNAYABAYgBAZABAcI+QwohR29vZ2xlLlBy", + "b3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEh5Vbml0VGVzdEN1c3RvbU9wdGlv", + "bnNQcm90b0ZpbGXw6MEd6q3A5ST67IU7cAhkEg5GaWxlQW5ub3RhdGlvbhoW", + "EhROZXN0ZWRGaWxlQW5ub3RhdGlvbiIe+uyFOxkSF0ZpbGVFeHRlbnNpb25B", + "bm5vdGF0aW9uKiQLEPbrrgcaGwoZRW1iZWRkZWRNZXNzYWdlU2V0RWxlbWVu", + "dAw=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_TestMessageWithCustomOptions__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_TestMessageWithCustomOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMessageWithCustomOptions__Descriptor, + new string[] { "Field1", }); + internal__static_protobuf_unittest_CustomOptionFooRequest__Descriptor = Descriptor.MessageTypes[1]; + internal__static_protobuf_unittest_CustomOptionFooRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_CustomOptionFooRequest__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_CustomOptionFooResponse__Descriptor = Descriptor.MessageTypes[2]; + internal__static_protobuf_unittest_CustomOptionFooResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_CustomOptionFooResponse__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_DummyMessageContainingEnum__Descriptor = Descriptor.MessageTypes[3]; + internal__static_protobuf_unittest_DummyMessageContainingEnum__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_DummyMessageContainingEnum__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_DummyMessageInvalidAsOptionType__Descriptor = Descriptor.MessageTypes[4]; + internal__static_protobuf_unittest_DummyMessageInvalidAsOptionType__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_DummyMessageInvalidAsOptionType__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_CustomOptionMinIntegerValues__Descriptor = Descriptor.MessageTypes[5]; + internal__static_protobuf_unittest_CustomOptionMinIntegerValues__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_CustomOptionMinIntegerValues__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_CustomOptionMaxIntegerValues__Descriptor = Descriptor.MessageTypes[6]; + internal__static_protobuf_unittest_CustomOptionMaxIntegerValues__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_CustomOptionMaxIntegerValues__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_CustomOptionOtherValues__Descriptor = Descriptor.MessageTypes[7]; + internal__static_protobuf_unittest_CustomOptionOtherValues__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_CustomOptionOtherValues__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_SettingRealsFromPositiveInts__Descriptor = Descriptor.MessageTypes[8]; + internal__static_protobuf_unittest_SettingRealsFromPositiveInts__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_SettingRealsFromPositiveInts__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_SettingRealsFromNegativeInts__Descriptor = Descriptor.MessageTypes[9]; + internal__static_protobuf_unittest_SettingRealsFromNegativeInts__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_SettingRealsFromNegativeInts__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_ComplexOptionType1__Descriptor = Descriptor.MessageTypes[10]; + internal__static_protobuf_unittest_ComplexOptionType1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_ComplexOptionType1__Descriptor, + new string[] { "Foo", "Foo2", "Foo3", }); + internal__static_protobuf_unittest_ComplexOptionType2__Descriptor = Descriptor.MessageTypes[11]; + internal__static_protobuf_unittest_ComplexOptionType2__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_ComplexOptionType2__Descriptor, + new string[] { "Bar", "Baz", "Fred", }); + internal__static_protobuf_unittest_ComplexOptionType2_ComplexOptionType4__Descriptor = internal__static_protobuf_unittest_ComplexOptionType2__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_ComplexOptionType2_ComplexOptionType4__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_ComplexOptionType2_ComplexOptionType4__Descriptor, + new string[] { "Waldo", }); + global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.ComplexOpt4 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Descriptor.Extensions[0]); + internal__static_protobuf_unittest_ComplexOptionType3__Descriptor = Descriptor.MessageTypes[12]; + internal__static_protobuf_unittest_ComplexOptionType3__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_ComplexOptionType3__Descriptor, + new string[] { "Qux", "ComplexOptionType5", }); + internal__static_protobuf_unittest_ComplexOptionType3_ComplexOptionType5__Descriptor = internal__static_protobuf_unittest_ComplexOptionType3__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_ComplexOptionType3_ComplexOptionType5__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_ComplexOptionType3_ComplexOptionType5__Descriptor, + new string[] { "Plugh", }); + internal__static_protobuf_unittest_ComplexOpt6__Descriptor = Descriptor.MessageTypes[13]; + internal__static_protobuf_unittest_ComplexOpt6__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_ComplexOpt6__Descriptor, + new string[] { "Xyzzy", }); + internal__static_protobuf_unittest_VariousComplexOptions__Descriptor = Descriptor.MessageTypes[14]; + internal__static_protobuf_unittest_VariousComplexOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_VariousComplexOptions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_AggregateMessageSet__Descriptor = Descriptor.MessageTypes[15]; + internal__static_protobuf_unittest_AggregateMessageSet__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_AggregateMessageSet__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_AggregateMessageSetElement__Descriptor = Descriptor.MessageTypes[16]; + internal__static_protobuf_unittest_AggregateMessageSetElement__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_AggregateMessageSetElement__Descriptor, + new string[] { "S", }); + global::Google.ProtocolBuffers.TestProtos.AggregateMessageSetElement.MessageSetExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.AggregateMessageSetElement.Descriptor.Extensions[0]); + internal__static_protobuf_unittest_Aggregate__Descriptor = Descriptor.MessageTypes[17]; + internal__static_protobuf_unittest_Aggregate__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_Aggregate__Descriptor, + new string[] { "I", "S", "Sub", "File", "Mset", }); + global::Google.ProtocolBuffers.TestProtos.Aggregate.Nested = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.Aggregate.Descriptor.Extensions[0]); + internal__static_protobuf_unittest_AggregateMessage__Descriptor = Descriptor.MessageTypes[18]; + internal__static_protobuf_unittest_AggregateMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_AggregateMessage__Descriptor, + new string[] { "Fieldname", }); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.FileOpt1 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.MessageOpt1 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[1]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.FieldOpt1 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[2]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.FieldOpt2 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[3]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.EnumOpt1 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[4]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.EnumValueOpt1 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[5]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ServiceOpt1 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[6]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.MethodOpt1 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[7]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.BoolOpt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[8]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Int32Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[9]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Int64Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[10]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Uint32Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[11]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Uint64Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[12]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Sint32Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[13]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Sint64Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[14]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Fixed32Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[15]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Fixed64Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[16]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Sfixed32Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[17]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Sfixed64Opt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[18]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.FloatOpt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[19]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.DoubleOpt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[20]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.StringOpt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[21]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.BytesOpt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[22]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.EnumOpt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[23]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.MessageTypeOpt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[24]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Quux = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[25]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Corge = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[26]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Grault = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[27]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Garply = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[28]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ComplexOpt1 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[29]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ComplexOpt2 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[30]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ComplexOpt3 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[31]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.ComplexOpt6 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[32]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Fileopt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[33]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Msgopt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[34]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Fieldopt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[35]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.EnumoptRenamed = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[36]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Enumvalopt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[37]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Serviceopt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[38]); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Methodopt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor.Extensions[39]); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum MethodOpt1 { + METHODOPT1_VAL1 = 1, + METHODOPT1_VAL2 = 2, + } + + public enum AggregateEnum { + VALUE = 1, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMessageWithCustomOptions : pb::GeneratedMessage { + private TestMessageWithCustomOptions() { } + private static readonly TestMessageWithCustomOptions defaultInstance = new TestMessageWithCustomOptions().MakeReadOnly(); + private static readonly string[] _testMessageWithCustomOptionsFieldNames = new string[] { "field1" }; + private static readonly uint[] _testMessageWithCustomOptionsFieldTags = new uint[] { 10 }; + public static TestMessageWithCustomOptions DefaultInstance { + get { return defaultInstance; } + } + + public override TestMessageWithCustomOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMessageWithCustomOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_TestMessageWithCustomOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_TestMessageWithCustomOptions__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum AnEnum { + ANENUM_VAL1 = 1, + ANENUM_VAL2 = 2, + } + + } + #endregion + + public const int Field1FieldNumber = 1; + private bool hasField1; + private string field1_ = ""; + public bool HasField1 { + get { return hasField1; } + } + public string Field1 { + get { return field1_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMessageWithCustomOptionsFieldNames; + if (hasField1) { + output.WriteString(1, field_names[0], Field1); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField1) { + size += pb::CodedOutputStream.ComputeStringSize(1, Field1); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMessageWithCustomOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageWithCustomOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageWithCustomOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageWithCustomOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageWithCustomOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageWithCustomOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMessageWithCustomOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMessageWithCustomOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMessageWithCustomOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageWithCustomOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMessageWithCustomOptions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMessageWithCustomOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMessageWithCustomOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMessageWithCustomOptions result; + + private TestMessageWithCustomOptions PrepareBuilder() { + if (resultIsReadOnly) { + TestMessageWithCustomOptions original = result; + result = new TestMessageWithCustomOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMessageWithCustomOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageWithCustomOptions.Descriptor; } + } + + public override TestMessageWithCustomOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageWithCustomOptions.DefaultInstance; } + } + + public override TestMessageWithCustomOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMessageWithCustomOptions) { + return MergeFrom((TestMessageWithCustomOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMessageWithCustomOptions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageWithCustomOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField1) { + Field1 = other.Field1; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMessageWithCustomOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMessageWithCustomOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasField1 = input.ReadString(ref result.field1_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public string Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = ""; + return this; + } + } + static TestMessageWithCustomOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CustomOptionFooRequest : pb::GeneratedMessage { + private CustomOptionFooRequest() { } + private static readonly CustomOptionFooRequest defaultInstance = new CustomOptionFooRequest().MakeReadOnly(); + private static readonly string[] _customOptionFooRequestFieldNames = new string[] { }; + private static readonly uint[] _customOptionFooRequestFieldTags = new uint[] { }; + public static CustomOptionFooRequest DefaultInstance { + get { return defaultInstance; } + } + + public override CustomOptionFooRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CustomOptionFooRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionFooRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionFooRequest__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _customOptionFooRequestFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static CustomOptionFooRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionFooRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionFooRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionFooRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionFooRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionFooRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CustomOptionFooRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CustomOptionFooRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CustomOptionFooRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionFooRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CustomOptionFooRequest MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CustomOptionFooRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CustomOptionFooRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CustomOptionFooRequest result; + + private CustomOptionFooRequest PrepareBuilder() { + if (resultIsReadOnly) { + CustomOptionFooRequest original = result; + result = new CustomOptionFooRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CustomOptionFooRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest.Descriptor; } + } + + public override CustomOptionFooRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest.DefaultInstance; } + } + + public override CustomOptionFooRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CustomOptionFooRequest) { + return MergeFrom((CustomOptionFooRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CustomOptionFooRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_customOptionFooRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _customOptionFooRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static CustomOptionFooRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CustomOptionFooResponse : pb::GeneratedMessage { + private CustomOptionFooResponse() { } + private static readonly CustomOptionFooResponse defaultInstance = new CustomOptionFooResponse().MakeReadOnly(); + private static readonly string[] _customOptionFooResponseFieldNames = new string[] { }; + private static readonly uint[] _customOptionFooResponseFieldTags = new uint[] { }; + public static CustomOptionFooResponse DefaultInstance { + get { return defaultInstance; } + } + + public override CustomOptionFooResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CustomOptionFooResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionFooResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionFooResponse__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _customOptionFooResponseFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static CustomOptionFooResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionFooResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionFooResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionFooResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionFooResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionFooResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CustomOptionFooResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CustomOptionFooResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CustomOptionFooResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionFooResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CustomOptionFooResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CustomOptionFooResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CustomOptionFooResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CustomOptionFooResponse result; + + private CustomOptionFooResponse PrepareBuilder() { + if (resultIsReadOnly) { + CustomOptionFooResponse original = result; + result = new CustomOptionFooResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CustomOptionFooResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.Descriptor; } + } + + public override CustomOptionFooResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance; } + } + + public override CustomOptionFooResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CustomOptionFooResponse) { + return MergeFrom((CustomOptionFooResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CustomOptionFooResponse other) { + if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_customOptionFooResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _customOptionFooResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static CustomOptionFooResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class DummyMessageContainingEnum : pb::GeneratedMessage { + private DummyMessageContainingEnum() { } + private static readonly DummyMessageContainingEnum defaultInstance = new DummyMessageContainingEnum().MakeReadOnly(); + private static readonly string[] _dummyMessageContainingEnumFieldNames = new string[] { }; + private static readonly uint[] _dummyMessageContainingEnumFieldTags = new uint[] { }; + public static DummyMessageContainingEnum DefaultInstance { + get { return defaultInstance; } + } + + public override DummyMessageContainingEnum DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override DummyMessageContainingEnum ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_DummyMessageContainingEnum__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_DummyMessageContainingEnum__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum TestEnumType { + TEST_OPTION_ENUM_TYPE1 = 22, + TEST_OPTION_ENUM_TYPE2 = -23, + } + + } + #endregion + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _dummyMessageContainingEnumFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static DummyMessageContainingEnum ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DummyMessageContainingEnum ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DummyMessageContainingEnum ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DummyMessageContainingEnum ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DummyMessageContainingEnum ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DummyMessageContainingEnum ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DummyMessageContainingEnum ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DummyMessageContainingEnum ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DummyMessageContainingEnum ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DummyMessageContainingEnum ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private DummyMessageContainingEnum MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DummyMessageContainingEnum prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(DummyMessageContainingEnum cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private DummyMessageContainingEnum result; + + private DummyMessageContainingEnum PrepareBuilder() { + if (resultIsReadOnly) { + DummyMessageContainingEnum original = result; + result = new DummyMessageContainingEnum(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override DummyMessageContainingEnum MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.DummyMessageContainingEnum.Descriptor; } + } + + public override DummyMessageContainingEnum DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.DummyMessageContainingEnum.DefaultInstance; } + } + + public override DummyMessageContainingEnum BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DummyMessageContainingEnum) { + return MergeFrom((DummyMessageContainingEnum) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DummyMessageContainingEnum other) { + if (other == global::Google.ProtocolBuffers.TestProtos.DummyMessageContainingEnum.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_dummyMessageContainingEnumFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _dummyMessageContainingEnumFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static DummyMessageContainingEnum() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class DummyMessageInvalidAsOptionType : pb::GeneratedMessage { + private DummyMessageInvalidAsOptionType() { } + private static readonly DummyMessageInvalidAsOptionType defaultInstance = new DummyMessageInvalidAsOptionType().MakeReadOnly(); + private static readonly string[] _dummyMessageInvalidAsOptionTypeFieldNames = new string[] { }; + private static readonly uint[] _dummyMessageInvalidAsOptionTypeFieldTags = new uint[] { }; + public static DummyMessageInvalidAsOptionType DefaultInstance { + get { return defaultInstance; } + } + + public override DummyMessageInvalidAsOptionType DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override DummyMessageInvalidAsOptionType ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_DummyMessageInvalidAsOptionType__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_DummyMessageInvalidAsOptionType__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _dummyMessageInvalidAsOptionTypeFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static DummyMessageInvalidAsOptionType ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DummyMessageInvalidAsOptionType ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DummyMessageInvalidAsOptionType ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DummyMessageInvalidAsOptionType ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DummyMessageInvalidAsOptionType ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DummyMessageInvalidAsOptionType ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DummyMessageInvalidAsOptionType ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DummyMessageInvalidAsOptionType ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DummyMessageInvalidAsOptionType ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DummyMessageInvalidAsOptionType ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private DummyMessageInvalidAsOptionType MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DummyMessageInvalidAsOptionType prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(DummyMessageInvalidAsOptionType cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private DummyMessageInvalidAsOptionType result; + + private DummyMessageInvalidAsOptionType PrepareBuilder() { + if (resultIsReadOnly) { + DummyMessageInvalidAsOptionType original = result; + result = new DummyMessageInvalidAsOptionType(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override DummyMessageInvalidAsOptionType MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.DummyMessageInvalidAsOptionType.Descriptor; } + } + + public override DummyMessageInvalidAsOptionType DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.DummyMessageInvalidAsOptionType.DefaultInstance; } + } + + public override DummyMessageInvalidAsOptionType BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DummyMessageInvalidAsOptionType) { + return MergeFrom((DummyMessageInvalidAsOptionType) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DummyMessageInvalidAsOptionType other) { + if (other == global::Google.ProtocolBuffers.TestProtos.DummyMessageInvalidAsOptionType.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_dummyMessageInvalidAsOptionTypeFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _dummyMessageInvalidAsOptionTypeFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static DummyMessageInvalidAsOptionType() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CustomOptionMinIntegerValues : pb::GeneratedMessage { + private CustomOptionMinIntegerValues() { } + private static readonly CustomOptionMinIntegerValues defaultInstance = new CustomOptionMinIntegerValues().MakeReadOnly(); + private static readonly string[] _customOptionMinIntegerValuesFieldNames = new string[] { }; + private static readonly uint[] _customOptionMinIntegerValuesFieldTags = new uint[] { }; + public static CustomOptionMinIntegerValues DefaultInstance { + get { return defaultInstance; } + } + + public override CustomOptionMinIntegerValues DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CustomOptionMinIntegerValues ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionMinIntegerValues__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionMinIntegerValues__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _customOptionMinIntegerValuesFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static CustomOptionMinIntegerValues ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionMinIntegerValues ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionMinIntegerValues ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionMinIntegerValues ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionMinIntegerValues ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionMinIntegerValues ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CustomOptionMinIntegerValues ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CustomOptionMinIntegerValues ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CustomOptionMinIntegerValues ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionMinIntegerValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CustomOptionMinIntegerValues MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CustomOptionMinIntegerValues prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CustomOptionMinIntegerValues cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CustomOptionMinIntegerValues result; + + private CustomOptionMinIntegerValues PrepareBuilder() { + if (resultIsReadOnly) { + CustomOptionMinIntegerValues original = result; + result = new CustomOptionMinIntegerValues(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CustomOptionMinIntegerValues MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionMinIntegerValues.Descriptor; } + } + + public override CustomOptionMinIntegerValues DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionMinIntegerValues.DefaultInstance; } + } + + public override CustomOptionMinIntegerValues BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CustomOptionMinIntegerValues) { + return MergeFrom((CustomOptionMinIntegerValues) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CustomOptionMinIntegerValues other) { + if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionMinIntegerValues.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_customOptionMinIntegerValuesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _customOptionMinIntegerValuesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static CustomOptionMinIntegerValues() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CustomOptionMaxIntegerValues : pb::GeneratedMessage { + private CustomOptionMaxIntegerValues() { } + private static readonly CustomOptionMaxIntegerValues defaultInstance = new CustomOptionMaxIntegerValues().MakeReadOnly(); + private static readonly string[] _customOptionMaxIntegerValuesFieldNames = new string[] { }; + private static readonly uint[] _customOptionMaxIntegerValuesFieldTags = new uint[] { }; + public static CustomOptionMaxIntegerValues DefaultInstance { + get { return defaultInstance; } + } + + public override CustomOptionMaxIntegerValues DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CustomOptionMaxIntegerValues ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionMaxIntegerValues__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionMaxIntegerValues__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _customOptionMaxIntegerValuesFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static CustomOptionMaxIntegerValues ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionMaxIntegerValues ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionMaxIntegerValues ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionMaxIntegerValues ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionMaxIntegerValues ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionMaxIntegerValues ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CustomOptionMaxIntegerValues ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CustomOptionMaxIntegerValues ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CustomOptionMaxIntegerValues ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionMaxIntegerValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CustomOptionMaxIntegerValues MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CustomOptionMaxIntegerValues prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CustomOptionMaxIntegerValues cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CustomOptionMaxIntegerValues result; + + private CustomOptionMaxIntegerValues PrepareBuilder() { + if (resultIsReadOnly) { + CustomOptionMaxIntegerValues original = result; + result = new CustomOptionMaxIntegerValues(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CustomOptionMaxIntegerValues MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionMaxIntegerValues.Descriptor; } + } + + public override CustomOptionMaxIntegerValues DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionMaxIntegerValues.DefaultInstance; } + } + + public override CustomOptionMaxIntegerValues BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CustomOptionMaxIntegerValues) { + return MergeFrom((CustomOptionMaxIntegerValues) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CustomOptionMaxIntegerValues other) { + if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionMaxIntegerValues.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_customOptionMaxIntegerValuesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _customOptionMaxIntegerValuesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static CustomOptionMaxIntegerValues() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CustomOptionOtherValues : pb::GeneratedMessage { + private CustomOptionOtherValues() { } + private static readonly CustomOptionOtherValues defaultInstance = new CustomOptionOtherValues().MakeReadOnly(); + private static readonly string[] _customOptionOtherValuesFieldNames = new string[] { }; + private static readonly uint[] _customOptionOtherValuesFieldTags = new uint[] { }; + public static CustomOptionOtherValues DefaultInstance { + get { return defaultInstance; } + } + + public override CustomOptionOtherValues DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CustomOptionOtherValues ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionOtherValues__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_CustomOptionOtherValues__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _customOptionOtherValuesFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static CustomOptionOtherValues ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionOtherValues ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionOtherValues ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CustomOptionOtherValues ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CustomOptionOtherValues ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionOtherValues ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CustomOptionOtherValues ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CustomOptionOtherValues ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CustomOptionOtherValues ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CustomOptionOtherValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CustomOptionOtherValues MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CustomOptionOtherValues prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CustomOptionOtherValues cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CustomOptionOtherValues result; + + private CustomOptionOtherValues PrepareBuilder() { + if (resultIsReadOnly) { + CustomOptionOtherValues original = result; + result = new CustomOptionOtherValues(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CustomOptionOtherValues MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionOtherValues.Descriptor; } + } + + public override CustomOptionOtherValues DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.CustomOptionOtherValues.DefaultInstance; } + } + + public override CustomOptionOtherValues BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CustomOptionOtherValues) { + return MergeFrom((CustomOptionOtherValues) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CustomOptionOtherValues other) { + if (other == global::Google.ProtocolBuffers.TestProtos.CustomOptionOtherValues.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_customOptionOtherValuesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _customOptionOtherValuesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static CustomOptionOtherValues() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SettingRealsFromPositiveInts : pb::GeneratedMessage { + private SettingRealsFromPositiveInts() { } + private static readonly SettingRealsFromPositiveInts defaultInstance = new SettingRealsFromPositiveInts().MakeReadOnly(); + private static readonly string[] _settingRealsFromPositiveIntsFieldNames = new string[] { }; + private static readonly uint[] _settingRealsFromPositiveIntsFieldTags = new uint[] { }; + public static SettingRealsFromPositiveInts DefaultInstance { + get { return defaultInstance; } + } + + public override SettingRealsFromPositiveInts DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SettingRealsFromPositiveInts ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_SettingRealsFromPositiveInts__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_SettingRealsFromPositiveInts__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _settingRealsFromPositiveIntsFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SettingRealsFromPositiveInts ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SettingRealsFromPositiveInts ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SettingRealsFromPositiveInts ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SettingRealsFromPositiveInts ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SettingRealsFromPositiveInts ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SettingRealsFromPositiveInts ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SettingRealsFromPositiveInts ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SettingRealsFromPositiveInts ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SettingRealsFromPositiveInts ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SettingRealsFromPositiveInts ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SettingRealsFromPositiveInts MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SettingRealsFromPositiveInts prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SettingRealsFromPositiveInts cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SettingRealsFromPositiveInts result; + + private SettingRealsFromPositiveInts PrepareBuilder() { + if (resultIsReadOnly) { + SettingRealsFromPositiveInts original = result; + result = new SettingRealsFromPositiveInts(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SettingRealsFromPositiveInts MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SettingRealsFromPositiveInts.Descriptor; } + } + + public override SettingRealsFromPositiveInts DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SettingRealsFromPositiveInts.DefaultInstance; } + } + + public override SettingRealsFromPositiveInts BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SettingRealsFromPositiveInts) { + return MergeFrom((SettingRealsFromPositiveInts) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SettingRealsFromPositiveInts other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SettingRealsFromPositiveInts.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_settingRealsFromPositiveIntsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _settingRealsFromPositiveIntsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static SettingRealsFromPositiveInts() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SettingRealsFromNegativeInts : pb::GeneratedMessage { + private SettingRealsFromNegativeInts() { } + private static readonly SettingRealsFromNegativeInts defaultInstance = new SettingRealsFromNegativeInts().MakeReadOnly(); + private static readonly string[] _settingRealsFromNegativeIntsFieldNames = new string[] { }; + private static readonly uint[] _settingRealsFromNegativeIntsFieldTags = new uint[] { }; + public static SettingRealsFromNegativeInts DefaultInstance { + get { return defaultInstance; } + } + + public override SettingRealsFromNegativeInts DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SettingRealsFromNegativeInts ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_SettingRealsFromNegativeInts__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_SettingRealsFromNegativeInts__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _settingRealsFromNegativeIntsFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SettingRealsFromNegativeInts ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SettingRealsFromNegativeInts ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SettingRealsFromNegativeInts ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SettingRealsFromNegativeInts ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SettingRealsFromNegativeInts ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SettingRealsFromNegativeInts ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SettingRealsFromNegativeInts ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SettingRealsFromNegativeInts ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SettingRealsFromNegativeInts ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SettingRealsFromNegativeInts ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SettingRealsFromNegativeInts MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SettingRealsFromNegativeInts prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SettingRealsFromNegativeInts cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SettingRealsFromNegativeInts result; + + private SettingRealsFromNegativeInts PrepareBuilder() { + if (resultIsReadOnly) { + SettingRealsFromNegativeInts original = result; + result = new SettingRealsFromNegativeInts(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SettingRealsFromNegativeInts MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SettingRealsFromNegativeInts.Descriptor; } + } + + public override SettingRealsFromNegativeInts DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SettingRealsFromNegativeInts.DefaultInstance; } + } + + public override SettingRealsFromNegativeInts BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SettingRealsFromNegativeInts) { + return MergeFrom((SettingRealsFromNegativeInts) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SettingRealsFromNegativeInts other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SettingRealsFromNegativeInts.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_settingRealsFromNegativeIntsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _settingRealsFromNegativeIntsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static SettingRealsFromNegativeInts() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ComplexOptionType1 : pb::ExtendableMessage { + private ComplexOptionType1() { } + private static readonly ComplexOptionType1 defaultInstance = new ComplexOptionType1().MakeReadOnly(); + private static readonly string[] _complexOptionType1FieldNames = new string[] { "foo", "foo2", "foo3" }; + private static readonly uint[] _complexOptionType1FieldTags = new uint[] { 8, 16, 24 }; + public static ComplexOptionType1 DefaultInstance { + get { return defaultInstance; } + } + + public override ComplexOptionType1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ComplexOptionType1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType1__FieldAccessorTable; } + } + + public const int FooFieldNumber = 1; + private bool hasFoo; + private int foo_; + public bool HasFoo { + get { return hasFoo; } + } + public int Foo { + get { return foo_; } + } + + public const int Foo2FieldNumber = 2; + private bool hasFoo2; + private int foo2_; + public bool HasFoo2 { + get { return hasFoo2; } + } + public int Foo2 { + get { return foo2_; } + } + + public const int Foo3FieldNumber = 3; + private bool hasFoo3; + private int foo3_; + public bool HasFoo3 { + get { return hasFoo3; } + } + public int Foo3 { + get { return foo3_; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _complexOptionType1FieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasFoo) { + output.WriteInt32(1, field_names[0], Foo); + } + if (hasFoo2) { + output.WriteInt32(2, field_names[1], Foo2); + } + if (hasFoo3) { + output.WriteInt32(3, field_names[2], Foo3); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasFoo) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Foo); + } + if (hasFoo2) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Foo2); + } + if (hasFoo3) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Foo3); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ComplexOptionType1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ComplexOptionType1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ComplexOptionType1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ComplexOptionType1 MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ComplexOptionType1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ComplexOptionType1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ComplexOptionType1 result; + + private ComplexOptionType1 PrepareBuilder() { + if (resultIsReadOnly) { + ComplexOptionType1 original = result; + result = new ComplexOptionType1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ComplexOptionType1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.Descriptor; } + } + + public override ComplexOptionType1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance; } + } + + public override ComplexOptionType1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ComplexOptionType1) { + return MergeFrom((ComplexOptionType1) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ComplexOptionType1 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasFoo) { + Foo = other.Foo; + } + if (other.HasFoo2) { + Foo2 = other.Foo2; + } + if (other.HasFoo3) { + Foo3 = other.Foo3; + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_complexOptionType1FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _complexOptionType1FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasFoo = input.ReadInt32(ref result.foo_); + break; + } + case 16: { + result.hasFoo2 = input.ReadInt32(ref result.foo2_); + break; + } + case 24: { + result.hasFoo3 = input.ReadInt32(ref result.foo3_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasFoo { + get { return result.hasFoo; } + } + public int Foo { + get { return result.Foo; } + set { SetFoo(value); } + } + public Builder SetFoo(int value) { + PrepareBuilder(); + result.hasFoo = true; + result.foo_ = value; + return this; + } + public Builder ClearFoo() { + PrepareBuilder(); + result.hasFoo = false; + result.foo_ = 0; + return this; + } + + public bool HasFoo2 { + get { return result.hasFoo2; } + } + public int Foo2 { + get { return result.Foo2; } + set { SetFoo2(value); } + } + public Builder SetFoo2(int value) { + PrepareBuilder(); + result.hasFoo2 = true; + result.foo2_ = value; + return this; + } + public Builder ClearFoo2() { + PrepareBuilder(); + result.hasFoo2 = false; + result.foo2_ = 0; + return this; + } + + public bool HasFoo3 { + get { return result.hasFoo3; } + } + public int Foo3 { + get { return result.Foo3; } + set { SetFoo3(value); } + } + public Builder SetFoo3(int value) { + PrepareBuilder(); + result.hasFoo3 = true; + result.foo3_ = value; + return this; + } + public Builder ClearFoo3() { + PrepareBuilder(); + result.hasFoo3 = false; + result.foo3_ = 0; + return this; + } + } + static ComplexOptionType1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ComplexOptionType2 : pb::ExtendableMessage { + private ComplexOptionType2() { } + private static readonly ComplexOptionType2 defaultInstance = new ComplexOptionType2().MakeReadOnly(); + private static readonly string[] _complexOptionType2FieldNames = new string[] { "bar", "baz", "fred" }; + private static readonly uint[] _complexOptionType2FieldTags = new uint[] { 10, 16, 26 }; + public static ComplexOptionType2 DefaultInstance { + get { return defaultInstance; } + } + + public override ComplexOptionType2 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ComplexOptionType2 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType2__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType2__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ComplexOptionType4 : pb::GeneratedMessage { + private ComplexOptionType4() { } + private static readonly ComplexOptionType4 defaultInstance = new ComplexOptionType4().MakeReadOnly(); + private static readonly string[] _complexOptionType4FieldNames = new string[] { "waldo" }; + private static readonly uint[] _complexOptionType4FieldTags = new uint[] { 8 }; + public static ComplexOptionType4 DefaultInstance { + get { return defaultInstance; } + } + + public override ComplexOptionType4 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ComplexOptionType4 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType2_ComplexOptionType4__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType2_ComplexOptionType4__FieldAccessorTable; } + } + + public const int ComplexOpt4FieldNumber = 7633546; + public static pb::GeneratedExtensionBase ComplexOpt4; + public const int WaldoFieldNumber = 1; + private bool hasWaldo; + private int waldo_; + public bool HasWaldo { + get { return hasWaldo; } + } + public int Waldo { + get { return waldo_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _complexOptionType4FieldNames; + if (hasWaldo) { + output.WriteInt32(1, field_names[0], Waldo); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasWaldo) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Waldo); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ComplexOptionType4 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType4 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType4 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType4 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType4 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType4 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType4 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ComplexOptionType4 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ComplexOptionType4 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType4 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ComplexOptionType4 MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ComplexOptionType4 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ComplexOptionType4 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ComplexOptionType4 result; + + private ComplexOptionType4 PrepareBuilder() { + if (resultIsReadOnly) { + ComplexOptionType4 original = result; + result = new ComplexOptionType4(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ComplexOptionType4 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Descriptor; } + } + + public override ComplexOptionType4 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance; } + } + + public override ComplexOptionType4 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ComplexOptionType4) { + return MergeFrom((ComplexOptionType4) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ComplexOptionType4 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasWaldo) { + Waldo = other.Waldo; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_complexOptionType4FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _complexOptionType4FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasWaldo = input.ReadInt32(ref result.waldo_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasWaldo { + get { return result.hasWaldo; } + } + public int Waldo { + get { return result.Waldo; } + set { SetWaldo(value); } + } + public Builder SetWaldo(int value) { + PrepareBuilder(); + result.hasWaldo = true; + result.waldo_ = value; + return this; + } + public Builder ClearWaldo() { + PrepareBuilder(); + result.hasWaldo = false; + result.waldo_ = 0; + return this; + } + } + static ComplexOptionType4() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int BarFieldNumber = 1; + private bool hasBar; + private global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 bar_; + public bool HasBar { + get { return hasBar; } + } + public global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 Bar { + get { return bar_ ?? global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance; } + } + + public const int BazFieldNumber = 2; + private bool hasBaz; + private int baz_; + public bool HasBaz { + get { return hasBaz; } + } + public int Baz { + get { return baz_; } + } + + public const int FredFieldNumber = 3; + private bool hasFred; + private global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 fred_; + public bool HasFred { + get { return hasFred; } + } + public global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 Fred { + get { return fred_ ?? global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (HasFred) { + if (!Fred.IsInitialized) return false; + } + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _complexOptionType2FieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasBar) { + output.WriteMessage(1, field_names[0], Bar); + } + if (hasBaz) { + output.WriteInt32(2, field_names[1], Baz); + } + if (hasFred) { + output.WriteMessage(3, field_names[2], Fred); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasBar) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Bar); + } + if (hasBaz) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Baz); + } + if (hasFred) { + size += pb::CodedOutputStream.ComputeMessageSize(3, Fred); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ComplexOptionType2 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType2 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType2 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType2 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType2 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType2 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType2 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ComplexOptionType2 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ComplexOptionType2 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ComplexOptionType2 MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ComplexOptionType2 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ComplexOptionType2 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ComplexOptionType2 result; + + private ComplexOptionType2 PrepareBuilder() { + if (resultIsReadOnly) { + ComplexOptionType2 original = result; + result = new ComplexOptionType2(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ComplexOptionType2 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Descriptor; } + } + + public override ComplexOptionType2 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.DefaultInstance; } + } + + public override ComplexOptionType2 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ComplexOptionType2) { + return MergeFrom((ComplexOptionType2) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ComplexOptionType2 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasBar) { + MergeBar(other.Bar); + } + if (other.HasBaz) { + Baz = other.Baz; + } + if (other.HasFred) { + MergeFred(other.Fred); + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_complexOptionType2FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _complexOptionType2FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.CreateBuilder(); + if (result.hasBar) { + subBuilder.MergeFrom(Bar); + } + input.ReadMessage(subBuilder, extensionRegistry); + Bar = subBuilder.BuildPartial(); + break; + } + case 16: { + result.hasBaz = input.ReadInt32(ref result.baz_); + break; + } + case 26: { + global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.CreateBuilder(); + if (result.hasFred) { + subBuilder.MergeFrom(Fred); + } + input.ReadMessage(subBuilder, extensionRegistry); + Fred = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasBar { + get { return result.hasBar; } + } + public global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 Bar { + get { return result.Bar; } + set { SetBar(value); } + } + public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBar = true; + result.bar_ = value; + return this; + } + public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasBar = true; + result.bar_ = builderForValue.Build(); + return this; + } + public Builder MergeBar(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasBar && + result.bar_ != global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.DefaultInstance) { + result.bar_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType1.CreateBuilder(result.bar_).MergeFrom(value).BuildPartial(); + } else { + result.bar_ = value; + } + result.hasBar = true; + return this; + } + public Builder ClearBar() { + PrepareBuilder(); + result.hasBar = false; + result.bar_ = null; + return this; + } + + public bool HasBaz { + get { return result.hasBaz; } + } + public int Baz { + get { return result.Baz; } + set { SetBaz(value); } + } + public Builder SetBaz(int value) { + PrepareBuilder(); + result.hasBaz = true; + result.baz_ = value; + return this; + } + public Builder ClearBaz() { + PrepareBuilder(); + result.hasBaz = false; + result.baz_ = 0; + return this; + } + + public bool HasFred { + get { return result.hasFred; } + } + public global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 Fred { + get { return result.Fred; } + set { SetFred(value); } + } + public Builder SetFred(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasFred = true; + result.fred_ = value; + return this; + } + public Builder SetFred(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasFred = true; + result.fred_ = builderForValue.Build(); + return this; + } + public Builder MergeFred(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasFred && + result.fred_ != global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.DefaultInstance) { + result.fred_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType2.Types.ComplexOptionType4.CreateBuilder(result.fred_).MergeFrom(value).BuildPartial(); + } else { + result.fred_ = value; + } + result.hasFred = true; + return this; + } + public Builder ClearFred() { + PrepareBuilder(); + result.hasFred = false; + result.fred_ = null; + return this; + } + } + static ComplexOptionType2() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ComplexOptionType3 : pb::GeneratedMessage { + private ComplexOptionType3() { } + private static readonly ComplexOptionType3 defaultInstance = new ComplexOptionType3().MakeReadOnly(); + private static readonly string[] _complexOptionType3FieldNames = new string[] { "complexoptiontype5", "qux" }; + private static readonly uint[] _complexOptionType3FieldTags = new uint[] { 19, 8 }; + public static ComplexOptionType3 DefaultInstance { + get { return defaultInstance; } + } + + public override ComplexOptionType3 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ComplexOptionType3 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType3__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType3__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ComplexOptionType5 : pb::GeneratedMessage { + private ComplexOptionType5() { } + private static readonly ComplexOptionType5 defaultInstance = new ComplexOptionType5().MakeReadOnly(); + private static readonly string[] _complexOptionType5FieldNames = new string[] { "plugh" }; + private static readonly uint[] _complexOptionType5FieldTags = new uint[] { 24 }; + public static ComplexOptionType5 DefaultInstance { + get { return defaultInstance; } + } + + public override ComplexOptionType5 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ComplexOptionType5 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType3_ComplexOptionType5__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOptionType3_ComplexOptionType5__FieldAccessorTable; } + } + + public const int PlughFieldNumber = 3; + private bool hasPlugh; + private int plugh_; + public bool HasPlugh { + get { return hasPlugh; } + } + public int Plugh { + get { return plugh_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _complexOptionType5FieldNames; + if (hasPlugh) { + output.WriteInt32(3, field_names[0], Plugh); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPlugh) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Plugh); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ComplexOptionType5 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType5 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType5 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType5 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType5 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType5 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType5 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ComplexOptionType5 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ComplexOptionType5 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType5 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ComplexOptionType5 MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ComplexOptionType5 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ComplexOptionType5 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ComplexOptionType5 result; + + private ComplexOptionType5 PrepareBuilder() { + if (resultIsReadOnly) { + ComplexOptionType5 original = result; + result = new ComplexOptionType5(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ComplexOptionType5 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.Descriptor; } + } + + public override ComplexOptionType5 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance; } + } + + public override ComplexOptionType5 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ComplexOptionType5) { + return MergeFrom((ComplexOptionType5) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ComplexOptionType5 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasPlugh) { + Plugh = other.Plugh; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_complexOptionType5FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _complexOptionType5FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 24: { + result.hasPlugh = input.ReadInt32(ref result.plugh_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasPlugh { + get { return result.hasPlugh; } + } + public int Plugh { + get { return result.Plugh; } + set { SetPlugh(value); } + } + public Builder SetPlugh(int value) { + PrepareBuilder(); + result.hasPlugh = true; + result.plugh_ = value; + return this; + } + public Builder ClearPlugh() { + PrepareBuilder(); + result.hasPlugh = false; + result.plugh_ = 0; + return this; + } + } + static ComplexOptionType5() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int QuxFieldNumber = 1; + private bool hasQux; + private int qux_; + public bool HasQux { + get { return hasQux; } + } + public int Qux { + get { return qux_; } + } + + public const int ComplexOptionType5FieldNumber = 2; + private bool hasComplexOptionType5; + private global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 complexOptionType5_; + public bool HasComplexOptionType5 { + get { return hasComplexOptionType5; } + } + public global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 ComplexOptionType5 { + get { return complexOptionType5_ ?? global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _complexOptionType3FieldNames; + if (hasQux) { + output.WriteInt32(1, field_names[1], Qux); + } + if (hasComplexOptionType5) { + output.WriteGroup(2, field_names[0], ComplexOptionType5); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasQux) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Qux); + } + if (hasComplexOptionType5) { + size += pb::CodedOutputStream.ComputeGroupSize(2, ComplexOptionType5); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ComplexOptionType3 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType3 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType3 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOptionType3 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType3 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType3 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ComplexOptionType3 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ComplexOptionType3 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ComplexOptionType3 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOptionType3 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ComplexOptionType3 MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ComplexOptionType3 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ComplexOptionType3 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ComplexOptionType3 result; + + private ComplexOptionType3 PrepareBuilder() { + if (resultIsReadOnly) { + ComplexOptionType3 original = result; + result = new ComplexOptionType3(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ComplexOptionType3 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Descriptor; } + } + + public override ComplexOptionType3 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.DefaultInstance; } + } + + public override ComplexOptionType3 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ComplexOptionType3) { + return MergeFrom((ComplexOptionType3) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ComplexOptionType3 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasQux) { + Qux = other.Qux; + } + if (other.HasComplexOptionType5) { + MergeComplexOptionType5(other.ComplexOptionType5); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_complexOptionType3FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _complexOptionType3FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasQux = input.ReadInt32(ref result.qux_); + break; + } + case 19: { + global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.CreateBuilder(); + if (result.hasComplexOptionType5) { + subBuilder.MergeFrom(ComplexOptionType5); + } + input.ReadGroup(2, subBuilder, extensionRegistry); + ComplexOptionType5 = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasQux { + get { return result.hasQux; } + } + public int Qux { + get { return result.Qux; } + set { SetQux(value); } + } + public Builder SetQux(int value) { + PrepareBuilder(); + result.hasQux = true; + result.qux_ = value; + return this; + } + public Builder ClearQux() { + PrepareBuilder(); + result.hasQux = false; + result.qux_ = 0; + return this; + } + + public bool HasComplexOptionType5 { + get { return result.hasComplexOptionType5; } + } + public global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 ComplexOptionType5 { + get { return result.ComplexOptionType5; } + set { SetComplexOptionType5(value); } + } + public Builder SetComplexOptionType5(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasComplexOptionType5 = true; + result.complexOptionType5_ = value; + return this; + } + public Builder SetComplexOptionType5(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasComplexOptionType5 = true; + result.complexOptionType5_ = builderForValue.Build(); + return this; + } + public Builder MergeComplexOptionType5(global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasComplexOptionType5 && + result.complexOptionType5_ != global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.DefaultInstance) { + result.complexOptionType5_ = global::Google.ProtocolBuffers.TestProtos.ComplexOptionType3.Types.ComplexOptionType5.CreateBuilder(result.complexOptionType5_).MergeFrom(value).BuildPartial(); + } else { + result.complexOptionType5_ = value; + } + result.hasComplexOptionType5 = true; + return this; + } + public Builder ClearComplexOptionType5() { + PrepareBuilder(); + result.hasComplexOptionType5 = false; + result.complexOptionType5_ = null; + return this; + } + } + static ComplexOptionType3() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ComplexOpt6 : pb::GeneratedMessage { + private ComplexOpt6() { } + private static readonly ComplexOpt6 defaultInstance = new ComplexOpt6().MakeReadOnly(); + private static readonly string[] _complexOpt6FieldNames = new string[] { "xyzzy" }; + private static readonly uint[] _complexOpt6FieldTags = new uint[] { 60751608 }; + public static ComplexOpt6 DefaultInstance { + get { return defaultInstance; } + } + + public override ComplexOpt6 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ComplexOpt6 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOpt6__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_ComplexOpt6__FieldAccessorTable; } + } + + public const int XyzzyFieldNumber = 7593951; + private bool hasXyzzy; + private int xyzzy_; + public bool HasXyzzy { + get { return hasXyzzy; } + } + public int Xyzzy { + get { return xyzzy_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _complexOpt6FieldNames; + if (hasXyzzy) { + output.WriteInt32(7593951, field_names[0], Xyzzy); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasXyzzy) { + size += pb::CodedOutputStream.ComputeInt32Size(7593951, Xyzzy); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ComplexOpt6 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOpt6 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOpt6 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ComplexOpt6 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ComplexOpt6 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOpt6 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ComplexOpt6 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ComplexOpt6 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ComplexOpt6 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ComplexOpt6 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ComplexOpt6 MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ComplexOpt6 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ComplexOpt6 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ComplexOpt6 result; + + private ComplexOpt6 PrepareBuilder() { + if (resultIsReadOnly) { + ComplexOpt6 original = result; + result = new ComplexOpt6(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ComplexOpt6 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOpt6.Descriptor; } + } + + public override ComplexOpt6 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ComplexOpt6.DefaultInstance; } + } + + public override ComplexOpt6 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ComplexOpt6) { + return MergeFrom((ComplexOpt6) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ComplexOpt6 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ComplexOpt6.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasXyzzy) { + Xyzzy = other.Xyzzy; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_complexOpt6FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _complexOpt6FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 60751608: { + result.hasXyzzy = input.ReadInt32(ref result.xyzzy_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasXyzzy { + get { return result.hasXyzzy; } + } + public int Xyzzy { + get { return result.Xyzzy; } + set { SetXyzzy(value); } + } + public Builder SetXyzzy(int value) { + PrepareBuilder(); + result.hasXyzzy = true; + result.xyzzy_ = value; + return this; + } + public Builder ClearXyzzy() { + PrepareBuilder(); + result.hasXyzzy = false; + result.xyzzy_ = 0; + return this; + } + } + static ComplexOpt6() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class VariousComplexOptions : pb::GeneratedMessage { + private VariousComplexOptions() { } + private static readonly VariousComplexOptions defaultInstance = new VariousComplexOptions().MakeReadOnly(); + private static readonly string[] _variousComplexOptionsFieldNames = new string[] { }; + private static readonly uint[] _variousComplexOptionsFieldTags = new uint[] { }; + public static VariousComplexOptions DefaultInstance { + get { return defaultInstance; } + } + + public override VariousComplexOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override VariousComplexOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_VariousComplexOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_VariousComplexOptions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _variousComplexOptionsFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static VariousComplexOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static VariousComplexOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static VariousComplexOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static VariousComplexOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static VariousComplexOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static VariousComplexOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static VariousComplexOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static VariousComplexOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static VariousComplexOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static VariousComplexOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private VariousComplexOptions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(VariousComplexOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(VariousComplexOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private VariousComplexOptions result; + + private VariousComplexOptions PrepareBuilder() { + if (resultIsReadOnly) { + VariousComplexOptions original = result; + result = new VariousComplexOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override VariousComplexOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.VariousComplexOptions.Descriptor; } + } + + public override VariousComplexOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.VariousComplexOptions.DefaultInstance; } + } + + public override VariousComplexOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is VariousComplexOptions) { + return MergeFrom((VariousComplexOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(VariousComplexOptions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.VariousComplexOptions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_variousComplexOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _variousComplexOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static VariousComplexOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class AggregateMessageSet : pb::ExtendableMessage { + private AggregateMessageSet() { } + private static readonly AggregateMessageSet defaultInstance = new AggregateMessageSet().MakeReadOnly(); + private static readonly string[] _aggregateMessageSetFieldNames = new string[] { }; + private static readonly uint[] _aggregateMessageSetFieldTags = new uint[] { }; + public static AggregateMessageSet DefaultInstance { + get { return defaultInstance; } + } + + public override AggregateMessageSet DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override AggregateMessageSet ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_AggregateMessageSet__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_AggregateMessageSet__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _aggregateMessageSetFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteAsMessageSetTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSizeAsMessageSet; + memoizedSerializedSize = size; + return size; + } + public static AggregateMessageSet ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AggregateMessageSet ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AggregateMessageSet ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AggregateMessageSet ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AggregateMessageSet ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AggregateMessageSet ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static AggregateMessageSet ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static AggregateMessageSet ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static AggregateMessageSet ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AggregateMessageSet ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private AggregateMessageSet MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(AggregateMessageSet prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(AggregateMessageSet cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private AggregateMessageSet result; + + private AggregateMessageSet PrepareBuilder() { + if (resultIsReadOnly) { + AggregateMessageSet original = result; + result = new AggregateMessageSet(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override AggregateMessageSet MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet.Descriptor; } + } + + public override AggregateMessageSet DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet.DefaultInstance; } + } + + public override AggregateMessageSet BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is AggregateMessageSet) { + return MergeFrom((AggregateMessageSet) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(AggregateMessageSet other) { + if (other == global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_aggregateMessageSetFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _aggregateMessageSetFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static AggregateMessageSet() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class AggregateMessageSetElement : pb::GeneratedMessage { + private AggregateMessageSetElement() { } + private static readonly AggregateMessageSetElement defaultInstance = new AggregateMessageSetElement().MakeReadOnly(); + private static readonly string[] _aggregateMessageSetElementFieldNames = new string[] { "s" }; + private static readonly uint[] _aggregateMessageSetElementFieldTags = new uint[] { 10 }; + public static AggregateMessageSetElement DefaultInstance { + get { return defaultInstance; } + } + + public override AggregateMessageSetElement DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override AggregateMessageSetElement ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_AggregateMessageSetElement__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_AggregateMessageSetElement__FieldAccessorTable; } + } + + public const int MessageSetExtensionFieldNumber = 15447542; + public static pb::GeneratedExtensionBase MessageSetExtension; + public const int SFieldNumber = 1; + private bool hasS; + private string s_ = ""; + public bool HasS { + get { return hasS; } + } + public string S { + get { return s_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _aggregateMessageSetElementFieldNames; + if (hasS) { + output.WriteString(1, field_names[0], S); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasS) { + size += pb::CodedOutputStream.ComputeStringSize(1, S); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static AggregateMessageSetElement ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AggregateMessageSetElement ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AggregateMessageSetElement ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AggregateMessageSetElement ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AggregateMessageSetElement ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AggregateMessageSetElement ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static AggregateMessageSetElement ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static AggregateMessageSetElement ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static AggregateMessageSetElement ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AggregateMessageSetElement ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private AggregateMessageSetElement MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(AggregateMessageSetElement prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(AggregateMessageSetElement cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private AggregateMessageSetElement result; + + private AggregateMessageSetElement PrepareBuilder() { + if (resultIsReadOnly) { + AggregateMessageSetElement original = result; + result = new AggregateMessageSetElement(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override AggregateMessageSetElement MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.AggregateMessageSetElement.Descriptor; } + } + + public override AggregateMessageSetElement DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.AggregateMessageSetElement.DefaultInstance; } + } + + public override AggregateMessageSetElement BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is AggregateMessageSetElement) { + return MergeFrom((AggregateMessageSetElement) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(AggregateMessageSetElement other) { + if (other == global::Google.ProtocolBuffers.TestProtos.AggregateMessageSetElement.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasS) { + S = other.S; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_aggregateMessageSetElementFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _aggregateMessageSetElementFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasS = input.ReadString(ref result.s_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasS { + get { return result.hasS; } + } + public string S { + get { return result.S; } + set { SetS(value); } + } + public Builder SetS(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasS = true; + result.s_ = value; + return this; + } + public Builder ClearS() { + PrepareBuilder(); + result.hasS = false; + result.s_ = ""; + return this; + } + } + static AggregateMessageSetElement() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Aggregate : pb::GeneratedMessage { + private Aggregate() { } + private static readonly Aggregate defaultInstance = new Aggregate().MakeReadOnly(); + private static readonly string[] _aggregateFieldNames = new string[] { "file", "i", "mset", "s", "sub" }; + private static readonly uint[] _aggregateFieldTags = new uint[] { 34, 8, 42, 18, 26 }; + public static Aggregate DefaultInstance { + get { return defaultInstance; } + } + + public override Aggregate DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Aggregate ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_Aggregate__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_Aggregate__FieldAccessorTable; } + } + + public const int NestedFieldNumber = 15476903; + public static pb::GeneratedExtensionBase Nested; + public const int IFieldNumber = 1; + private bool hasI; + private int i_; + public bool HasI { + get { return hasI; } + } + public int I { + get { return i_; } + } + + public const int SFieldNumber = 2; + private bool hasS; + private string s_ = ""; + public bool HasS { + get { return hasS; } + } + public string S { + get { return s_; } + } + + public const int SubFieldNumber = 3; + private bool hasSub; + private global::Google.ProtocolBuffers.TestProtos.Aggregate sub_; + public bool HasSub { + get { return hasSub; } + } + public global::Google.ProtocolBuffers.TestProtos.Aggregate Sub { + get { return sub_ ?? global::Google.ProtocolBuffers.TestProtos.Aggregate.DefaultInstance; } + } + + public const int FileFieldNumber = 4; + private bool hasFile; + private global::Google.ProtocolBuffers.DescriptorProtos.FileOptions file_; + public bool HasFile { + get { return hasFile; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions File { + get { return file_ ?? global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance; } + } + + public const int MsetFieldNumber = 5; + private bool hasMset; + private global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet mset_; + public bool HasMset { + get { return hasMset; } + } + public global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet Mset { + get { return mset_ ?? global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (HasSub) { + if (!Sub.IsInitialized) return false; + } + if (HasFile) { + if (!File.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _aggregateFieldNames; + if (hasI) { + output.WriteInt32(1, field_names[1], I); + } + if (hasS) { + output.WriteString(2, field_names[3], S); + } + if (hasSub) { + output.WriteMessage(3, field_names[4], Sub); + } + if (hasFile) { + output.WriteMessage(4, field_names[0], File); + } + if (hasMset) { + output.WriteMessage(5, field_names[2], Mset); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasI) { + size += pb::CodedOutputStream.ComputeInt32Size(1, I); + } + if (hasS) { + size += pb::CodedOutputStream.ComputeStringSize(2, S); + } + if (hasSub) { + size += pb::CodedOutputStream.ComputeMessageSize(3, Sub); + } + if (hasFile) { + size += pb::CodedOutputStream.ComputeMessageSize(4, File); + } + if (hasMset) { + size += pb::CodedOutputStream.ComputeMessageSize(5, Mset); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Aggregate ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Aggregate ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Aggregate ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Aggregate ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Aggregate ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Aggregate ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Aggregate ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Aggregate ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Aggregate ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Aggregate ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Aggregate MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Aggregate prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Aggregate cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Aggregate result; + + private Aggregate PrepareBuilder() { + if (resultIsReadOnly) { + Aggregate original = result; + result = new Aggregate(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Aggregate MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.Aggregate.Descriptor; } + } + + public override Aggregate DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.Aggregate.DefaultInstance; } + } + + public override Aggregate BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Aggregate) { + return MergeFrom((Aggregate) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Aggregate other) { + if (other == global::Google.ProtocolBuffers.TestProtos.Aggregate.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasI) { + I = other.I; + } + if (other.HasS) { + S = other.S; + } + if (other.HasSub) { + MergeSub(other.Sub); + } + if (other.HasFile) { + MergeFile(other.File); + } + if (other.HasMset) { + MergeMset(other.Mset); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_aggregateFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _aggregateFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasI = input.ReadInt32(ref result.i_); + break; + } + case 18: { + result.hasS = input.ReadString(ref result.s_); + break; + } + case 26: { + global::Google.ProtocolBuffers.TestProtos.Aggregate.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.Aggregate.CreateBuilder(); + if (result.hasSub) { + subBuilder.MergeFrom(Sub); + } + input.ReadMessage(subBuilder, extensionRegistry); + Sub = subBuilder.BuildPartial(); + break; + } + case 34: { + global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.CreateBuilder(); + if (result.hasFile) { + subBuilder.MergeFrom(File); + } + input.ReadMessage(subBuilder, extensionRegistry); + File = subBuilder.BuildPartial(); + break; + } + case 42: { + global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet.CreateBuilder(); + if (result.hasMset) { + subBuilder.MergeFrom(Mset); + } + input.ReadMessage(subBuilder, extensionRegistry); + Mset = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasI { + get { return result.hasI; } + } + public int I { + get { return result.I; } + set { SetI(value); } + } + public Builder SetI(int value) { + PrepareBuilder(); + result.hasI = true; + result.i_ = value; + return this; + } + public Builder ClearI() { + PrepareBuilder(); + result.hasI = false; + result.i_ = 0; + return this; + } + + public bool HasS { + get { return result.hasS; } + } + public string S { + get { return result.S; } + set { SetS(value); } + } + public Builder SetS(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasS = true; + result.s_ = value; + return this; + } + public Builder ClearS() { + PrepareBuilder(); + result.hasS = false; + result.s_ = ""; + return this; + } + + public bool HasSub { + get { return result.hasSub; } + } + public global::Google.ProtocolBuffers.TestProtos.Aggregate Sub { + get { return result.Sub; } + set { SetSub(value); } + } + public Builder SetSub(global::Google.ProtocolBuffers.TestProtos.Aggregate value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasSub = true; + result.sub_ = value; + return this; + } + public Builder SetSub(global::Google.ProtocolBuffers.TestProtos.Aggregate.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasSub = true; + result.sub_ = builderForValue.Build(); + return this; + } + public Builder MergeSub(global::Google.ProtocolBuffers.TestProtos.Aggregate value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasSub && + result.sub_ != global::Google.ProtocolBuffers.TestProtos.Aggregate.DefaultInstance) { + result.sub_ = global::Google.ProtocolBuffers.TestProtos.Aggregate.CreateBuilder(result.sub_).MergeFrom(value).BuildPartial(); + } else { + result.sub_ = value; + } + result.hasSub = true; + return this; + } + public Builder ClearSub() { + PrepareBuilder(); + result.hasSub = false; + result.sub_ = null; + return this; + } + + public bool HasFile { + get { return result.hasFile; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions File { + get { return result.File; } + set { SetFile(value); } + } + public Builder SetFile(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasFile = true; + result.file_ = value; + return this; + } + public Builder SetFile(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasFile = true; + result.file_ = builderForValue.Build(); + return this; + } + public Builder MergeFile(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasFile && + result.file_ != global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance) { + result.file_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.CreateBuilder(result.file_).MergeFrom(value).BuildPartial(); + } else { + result.file_ = value; + } + result.hasFile = true; + return this; + } + public Builder ClearFile() { + PrepareBuilder(); + result.hasFile = false; + result.file_ = null; + return this; + } + + public bool HasMset { + get { return result.hasMset; } + } + public global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet Mset { + get { return result.Mset; } + set { SetMset(value); } + } + public Builder SetMset(global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMset = true; + result.mset_ = value; + return this; + } + public Builder SetMset(global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMset = true; + result.mset_ = builderForValue.Build(); + return this; + } + public Builder MergeMset(global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMset && + result.mset_ != global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet.DefaultInstance) { + result.mset_ = global::Google.ProtocolBuffers.TestProtos.AggregateMessageSet.CreateBuilder(result.mset_).MergeFrom(value).BuildPartial(); + } else { + result.mset_ = value; + } + result.hasMset = true; + return this; + } + public Builder ClearMset() { + PrepareBuilder(); + result.hasMset = false; + result.mset_ = null; + return this; + } + } + static Aggregate() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class AggregateMessage : pb::GeneratedMessage { + private AggregateMessage() { } + private static readonly AggregateMessage defaultInstance = new AggregateMessage().MakeReadOnly(); + private static readonly string[] _aggregateMessageFieldNames = new string[] { "fieldname" }; + private static readonly uint[] _aggregateMessageFieldTags = new uint[] { 8 }; + public static AggregateMessage DefaultInstance { + get { return defaultInstance; } + } + + public override AggregateMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override AggregateMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_AggregateMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.internal__static_protobuf_unittest_AggregateMessage__FieldAccessorTable; } + } + + public const int FieldnameFieldNumber = 1; + private bool hasFieldname; + private int fieldname_; + public bool HasFieldname { + get { return hasFieldname; } + } + public int Fieldname { + get { return fieldname_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _aggregateMessageFieldNames; + if (hasFieldname) { + output.WriteInt32(1, field_names[0], Fieldname); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasFieldname) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Fieldname); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static AggregateMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AggregateMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AggregateMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AggregateMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AggregateMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AggregateMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static AggregateMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static AggregateMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static AggregateMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AggregateMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private AggregateMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(AggregateMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(AggregateMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private AggregateMessage result; + + private AggregateMessage PrepareBuilder() { + if (resultIsReadOnly) { + AggregateMessage original = result; + result = new AggregateMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override AggregateMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.AggregateMessage.Descriptor; } + } + + public override AggregateMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.AggregateMessage.DefaultInstance; } + } + + public override AggregateMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is AggregateMessage) { + return MergeFrom((AggregateMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(AggregateMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.AggregateMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasFieldname) { + Fieldname = other.Fieldname; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_aggregateMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _aggregateMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasFieldname = input.ReadInt32(ref result.fieldname_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasFieldname { + get { return result.hasFieldname; } + } + public int Fieldname { + get { return result.Fieldname; } + set { SetFieldname(value); } + } + public Builder SetFieldname(int value) { + PrepareBuilder(); + result.hasFieldname = true; + result.fieldname_ = value; + return this; + } + public Builder ClearFieldname() { + PrepareBuilder(); + result.hasFieldname = false; + result.fieldname_ = 0; + return this; + } + } + static AggregateMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, null); + } + } + + #endregion + + #region Services + /* + * Service generation is now disabled by default, use the following option to enable: + * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + */ + /* + * Service generation is now disabled by default, use the following option to enable: + * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + */ + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs new file mode 100644 index 00000000..131b1343 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestEmbedOptimizeForProtoFile.cs @@ -0,0 +1,442 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestEmbedOptimizeForProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestEmbedOptimizedForSize__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestEmbedOptimizeForProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CjFnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfZW1iZWRfb3B0aW1pemVfZm9y", + "LnByb3RvEhFwcm90b2J1Zl91bml0dGVzdBokZ29vZ2xlL3Byb3RvYnVmL2Nz", + "aGFycF9vcHRpb25zLnByb3RvGitnb29nbGUvcHJvdG9idWYvdW5pdHRlc3Rf", + "b3B0aW1pemVfZm9yLnByb3RvIqEBChlUZXN0RW1iZWRPcHRpbWl6ZWRGb3JT", + "aXplEkEKEG9wdGlvbmFsX21lc3NhZ2UYASABKAsyJy5wcm90b2J1Zl91bml0", + "dGVzdC5UZXN0T3B0aW1pemVkRm9yU2l6ZRJBChByZXBlYXRlZF9tZXNzYWdl", + "GAIgAygLMicucHJvdG9idWZfdW5pdHRlc3QuVGVzdE9wdGltaXplZEZvclNp", + "emVCS0gBwj5GCiFHb29nbGUuUHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90b3MS", + "IVVuaXRUZXN0RW1iZWRPcHRpbWl6ZUZvclByb3RvRmlsZQ==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_TestEmbedOptimizedForSize__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor, + new string[] { "OptionalMessage", "RepeatedMessage", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestEmbedOptimizedForSize : pb::GeneratedMessage { + private TestEmbedOptimizedForSize() { } + private static readonly TestEmbedOptimizedForSize defaultInstance = new TestEmbedOptimizedForSize().MakeReadOnly(); + private static readonly string[] _testEmbedOptimizedForSizeFieldNames = new string[] { "optional_message", "repeated_message" }; + private static readonly uint[] _testEmbedOptimizedForSizeFieldTags = new uint[] { 10, 18 }; + public static TestEmbedOptimizedForSize DefaultInstance { + get { return defaultInstance; } + } + + public override TestEmbedOptimizedForSize DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestEmbedOptimizedForSize ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestEmbedOptimizeForProtoFile.internal__static_protobuf_unittest_TestEmbedOptimizedForSize__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestEmbedOptimizeForProtoFile.internal__static_protobuf_unittest_TestEmbedOptimizedForSize__FieldAccessorTable; } + } + + public const int OptionalMessageFieldNumber = 1; + private bool hasOptionalMessage; + private global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize optionalMessage_; + public bool HasOptionalMessage { + get { return hasOptionalMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize OptionalMessage { + get { return optionalMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance; } + } + + public const int RepeatedMessageFieldNumber = 2; + private pbc::PopsicleList repeatedMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedMessageList { + get { return repeatedMessage_; } + } + public int RepeatedMessageCount { + get { return repeatedMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize GetRepeatedMessage(int index) { + return repeatedMessage_[index]; + } + + public override bool IsInitialized { + get { + if (HasOptionalMessage) { + if (!OptionalMessage.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testEmbedOptimizedForSizeFieldNames; + if (hasOptionalMessage) { + output.WriteMessage(1, field_names[0], OptionalMessage); + } + if (repeatedMessage_.Count > 0) { + output.WriteMessageArray(2, field_names[1], repeatedMessage_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalMessage); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize element in RepeatedMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestEmbedOptimizedForSize ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmbedOptimizedForSize ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmbedOptimizedForSize ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmbedOptimizedForSize ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmbedOptimizedForSize ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmbedOptimizedForSize ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestEmbedOptimizedForSize ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestEmbedOptimizedForSize ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestEmbedOptimizedForSize ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmbedOptimizedForSize ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestEmbedOptimizedForSize MakeReadOnly() { + repeatedMessage_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestEmbedOptimizedForSize prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestEmbedOptimizedForSize cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestEmbedOptimizedForSize result; + + private TestEmbedOptimizedForSize PrepareBuilder() { + if (resultIsReadOnly) { + TestEmbedOptimizedForSize original = result; + result = new TestEmbedOptimizedForSize(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestEmbedOptimizedForSize MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.Descriptor; } + } + + public override TestEmbedOptimizedForSize DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.DefaultInstance; } + } + + public override TestEmbedOptimizedForSize BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestEmbedOptimizedForSize) { + return MergeFrom((TestEmbedOptimizedForSize) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestEmbedOptimizedForSize other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestEmbedOptimizedForSize.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalMessage) { + MergeOptionalMessage(other.OptionalMessage); + } + if (other.repeatedMessage_.Count != 0) { + result.repeatedMessage_.Add(other.repeatedMessage_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testEmbedOptimizedForSizeFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testEmbedOptimizedForSizeFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder(); + if (result.hasOptionalMessage) { + subBuilder.MergeFrom(OptionalMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalMessage = subBuilder.BuildPartial(); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.repeatedMessage_, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalMessage { + get { return result.hasOptionalMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize OptionalMessage { + get { return result.OptionalMessage; } + set { SetOptionalMessage(value); } + } + public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalMessage = true; + result.optionalMessage_ = value; + return this; + } + public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalMessage = true; + result.optionalMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalMessage && + result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance) { + result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalMessage_ = value; + } + result.hasOptionalMessage = true; + return this; + } + public Builder ClearOptionalMessage() { + PrepareBuilder(); + result.hasOptionalMessage = false; + result.optionalMessage_ = null; + return this; + } + + public pbc::IPopsicleList RepeatedMessageList { + get { return PrepareBuilder().repeatedMessage_; } + } + public int RepeatedMessageCount { + get { return result.RepeatedMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize GetRepeatedMessage(int index) { + return result.GetRepeatedMessage(index); + } + public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessage_[index] = value; + return this; + } + public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessage_.Add(value); + return this; + } + public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedMessage_.Add(values); + return this; + } + public Builder ClearRepeatedMessage() { + PrepareBuilder(); + result.repeatedMessage_.Clear(); + return this; + } + } + static TestEmbedOptimizedForSize() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestEmbedOptimizeForProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs new file mode 100644 index 00000000..a0f10344 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestEmptyProtoFile.cs @@ -0,0 +1,50 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestEmptyProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestEmptyProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiRnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfZW1wdHkucHJvdG8aJGdvb2ds", + "ZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90b0I+wj47CiFHb29nbGUu", + "UHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90b3MSFlVuaXRUZXN0RW1wdHlQcm90", + "b0ZpbGU=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs new file mode 100644 index 00000000..438f4aa3 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasIssuesProtoFile.cs @@ -0,0 +1,3443 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace UnitTest.Issues.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestExtrasIssuesProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_unittest_issues_A__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_A__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_B__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_B__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_AB__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_AB__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_NumberField__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_NumberField__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_MyMessageAReferenceB__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_MyMessageAReferenceB__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_MyMessageBReferenceA__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_MyMessageBReferenceA__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_NegativeEnumMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_DeprecatedChild__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_issues_ItemField__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_issues_ItemField__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestExtrasIssuesProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChxleHRlc3QvdW5pdHRlc3RfaXNzdWVzLnByb3RvEg91bml0dGVzdF9pc3N1", + "ZXMaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90byIPCgFB", + "EgoKAl9BGAEgASgFIg8KAUISCgoCQl8YASABKAUiEQoCQUISCwoDYV9iGAEg", + "ASgFIhoKC051bWJlckZpZWxkEgsKA18wMRgBIAEoBSJMChRNeU1lc3NhZ2VB", + "UmVmZXJlbmNlQhI0CgV2YWx1ZRgBIAIoCzIlLnVuaXR0ZXN0X2lzc3Vlcy5N", + "eU1lc3NhZ2VCUmVmZXJlbmNlQSJMChRNeU1lc3NhZ2VCUmVmZXJlbmNlQRI0", + "CgV2YWx1ZRgBIAIoCzIlLnVuaXR0ZXN0X2lzc3Vlcy5NeU1lc3NhZ2VBUmVm", + "ZXJlbmNlQiKsAQoTTmVnYXRpdmVFbnVtTWVzc2FnZRIsCgV2YWx1ZRgBIAEo", + "DjIdLnVuaXR0ZXN0X2lzc3Vlcy5OZWdhdGl2ZUVudW0SLQoGdmFsdWVzGAIg", + "AygOMh0udW5pdHRlc3RfaXNzdWVzLk5lZ2F0aXZlRW51bRI4Cg1wYWNrZWRf", + "dmFsdWVzGAMgAygOMh0udW5pdHRlc3RfaXNzdWVzLk5lZ2F0aXZlRW51bUIC", + "EAEiEQoPRGVwcmVjYXRlZENoaWxkIrkCChdEZXByZWNhdGVkRmllbGRzTWVz", + "c2FnZRIaCg5QcmltaXRpdmVWYWx1ZRgBIAEoBUICGAESGgoOUHJpbWl0aXZl", + "QXJyYXkYAiADKAVCAhgBEjoKDE1lc3NhZ2VWYWx1ZRgDIAEoCzIgLnVuaXR0", + "ZXN0X2lzc3Vlcy5EZXByZWNhdGVkQ2hpbGRCAhgBEjoKDE1lc3NhZ2VBcnJh", + "eRgEIAMoCzIgLnVuaXR0ZXN0X2lzc3Vlcy5EZXByZWNhdGVkQ2hpbGRCAhgB", + "EjYKCUVudW1WYWx1ZRgFIAEoDjIfLnVuaXR0ZXN0X2lzc3Vlcy5EZXByZWNh", + "dGVkRW51bUICGAESNgoJRW51bUFycmF5GAYgAygOMh8udW5pdHRlc3RfaXNz", + "dWVzLkRlcHJlY2F0ZWRFbnVtQgIYASIZCglJdGVtRmllbGQSDAoEaXRlbRgB", + "IAEoBSpHCgxOZWdhdGl2ZUVudW0SFgoJRml2ZUJlbG93EPv//////////wES", + "FQoITWludXNPbmUQ////////////ARIICgRaZXJvEAAqGQoORGVwcmVjYXRl", + "ZEVudW0SBwoDb25lEAFCQEgBwj47ChpVbml0VGVzdC5Jc3N1ZXMuVGVzdFBy", + "b3RvcxIdVW5pdFRlc3RFeHRyYXNJc3N1ZXNQcm90b0ZpbGU=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_unittest_issues_A__Descriptor = Descriptor.MessageTypes[0]; + internal__static_unittest_issues_A__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_A__Descriptor, + new string[] { "A_", }); + internal__static_unittest_issues_B__Descriptor = Descriptor.MessageTypes[1]; + internal__static_unittest_issues_B__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_B__Descriptor, + new string[] { "B_", }); + internal__static_unittest_issues_AB__Descriptor = Descriptor.MessageTypes[2]; + internal__static_unittest_issues_AB__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_AB__Descriptor, + new string[] { "AB_", }); + internal__static_unittest_issues_NumberField__Descriptor = Descriptor.MessageTypes[3]; + internal__static_unittest_issues_NumberField__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_NumberField__Descriptor, + new string[] { "_01", }); + internal__static_unittest_issues_MyMessageAReferenceB__Descriptor = Descriptor.MessageTypes[4]; + internal__static_unittest_issues_MyMessageAReferenceB__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_MyMessageAReferenceB__Descriptor, + new string[] { "Value", }); + internal__static_unittest_issues_MyMessageBReferenceA__Descriptor = Descriptor.MessageTypes[5]; + internal__static_unittest_issues_MyMessageBReferenceA__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_MyMessageBReferenceA__Descriptor, + new string[] { "Value", }); + internal__static_unittest_issues_NegativeEnumMessage__Descriptor = Descriptor.MessageTypes[6]; + internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_NegativeEnumMessage__Descriptor, + new string[] { "Value", "Values", "PackedValues", }); + internal__static_unittest_issues_DeprecatedChild__Descriptor = Descriptor.MessageTypes[7]; + internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_DeprecatedChild__Descriptor, + new string[] { }); + internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor = Descriptor.MessageTypes[8]; + internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor, + new string[] { "PrimitiveValue", "PrimitiveArray", "MessageValue", "MessageArray", "EnumValue", "EnumArray", }); + internal__static_unittest_issues_ItemField__Descriptor = Descriptor.MessageTypes[9]; + internal__static_unittest_issues_ItemField__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_issues_ItemField__Descriptor, + new string[] { "Item", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum NegativeEnum { + FiveBelow = -5, + MinusOne = -1, + Zero = 0, + } + + public enum DeprecatedEnum { + one = 1, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class A : pb::GeneratedMessage { + private A() { } + private static readonly A defaultInstance = new A().MakeReadOnly(); + private static readonly string[] _aFieldNames = new string[] { "_A" }; + private static readonly uint[] _aFieldTags = new uint[] { 8 }; + public static A DefaultInstance { + get { return defaultInstance; } + } + + public override A DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override A ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_A__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_A__FieldAccessorTable; } + } + + public const int A_FieldNumber = 1; + private bool hasA_; + private int a_; + public bool HasA_ { + get { return hasA_; } + } + public int A_ { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _aFieldNames; + if (hasA_) { + output.WriteInt32(1, field_names[0], A_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA_) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A_); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static A ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static A ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static A ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static A ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static A ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static A ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static A ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static A ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static A ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static A ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private A MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(A prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(A cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private A result; + + private A PrepareBuilder() { + if (resultIsReadOnly) { + A original = result; + result = new A(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override A MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.A.Descriptor; } + } + + public override A DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.A.DefaultInstance; } + } + + public override A BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is A) { + return MergeFrom((A) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(A other) { + if (other == global::UnitTest.Issues.TestProtos.A.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA_) { + A_ = other.A_; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_aFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _aFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA_ = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA_ { + get { return result.hasA_; } + } + public int A_ { + get { return result.A_; } + set { SetA_(value); } + } + public Builder SetA_(int value) { + PrepareBuilder(); + result.hasA_ = true; + result.a_ = value; + return this; + } + public Builder ClearA_() { + PrepareBuilder(); + result.hasA_ = false; + result.a_ = 0; + return this; + } + } + static A() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class B : pb::GeneratedMessage { + private B() { } + private static readonly B defaultInstance = new B().MakeReadOnly(); + private static readonly string[] _bFieldNames = new string[] { "B_" }; + private static readonly uint[] _bFieldTags = new uint[] { 8 }; + public static B DefaultInstance { + get { return defaultInstance; } + } + + public override B DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override B ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_B__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_B__FieldAccessorTable; } + } + + public const int B_FieldNumber = 1; + private bool hasB_; + private int b_; + public bool HasB_ { + get { return hasB_; } + } + public int B_ { + get { return b_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _bFieldNames; + if (hasB_) { + output.WriteInt32(1, field_names[0], B_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasB_) { + size += pb::CodedOutputStream.ComputeInt32Size(1, B_); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static B ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static B ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static B ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static B ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static B ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static B ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static B ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static B ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static B ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static B ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private B MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(B prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(B cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private B result; + + private B PrepareBuilder() { + if (resultIsReadOnly) { + B original = result; + result = new B(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override B MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.B.Descriptor; } + } + + public override B DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.B.DefaultInstance; } + } + + public override B BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is B) { + return MergeFrom((B) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(B other) { + if (other == global::UnitTest.Issues.TestProtos.B.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasB_) { + B_ = other.B_; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_bFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _bFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasB_ = input.ReadInt32(ref result.b_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasB_ { + get { return result.hasB_; } + } + public int B_ { + get { return result.B_; } + set { SetB_(value); } + } + public Builder SetB_(int value) { + PrepareBuilder(); + result.hasB_ = true; + result.b_ = value; + return this; + } + public Builder ClearB_() { + PrepareBuilder(); + result.hasB_ = false; + result.b_ = 0; + return this; + } + } + static B() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class AB : pb::GeneratedMessage { + private AB() { } + private static readonly AB defaultInstance = new AB().MakeReadOnly(); + private static readonly string[] _aBFieldNames = new string[] { "a_b" }; + private static readonly uint[] _aBFieldTags = new uint[] { 8 }; + public static AB DefaultInstance { + get { return defaultInstance; } + } + + public override AB DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override AB ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_AB__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_AB__FieldAccessorTable; } + } + + public const int AB_FieldNumber = 1; + private bool hasAB_; + private int aB_; + public bool HasAB_ { + get { return hasAB_; } + } + public int AB_ { + get { return aB_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _aBFieldNames; + if (hasAB_) { + output.WriteInt32(1, field_names[0], AB_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasAB_) { + size += pb::CodedOutputStream.ComputeInt32Size(1, AB_); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static AB ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AB ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AB ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static AB ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static AB ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AB ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static AB ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static AB ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static AB ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static AB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private AB MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(AB prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(AB cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private AB result; + + private AB PrepareBuilder() { + if (resultIsReadOnly) { + AB original = result; + result = new AB(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override AB MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.AB.Descriptor; } + } + + public override AB DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.AB.DefaultInstance; } + } + + public override AB BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is AB) { + return MergeFrom((AB) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(AB other) { + if (other == global::UnitTest.Issues.TestProtos.AB.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasAB_) { + AB_ = other.AB_; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_aBFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _aBFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasAB_ = input.ReadInt32(ref result.aB_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasAB_ { + get { return result.hasAB_; } + } + public int AB_ { + get { return result.AB_; } + set { SetAB_(value); } + } + public Builder SetAB_(int value) { + PrepareBuilder(); + result.hasAB_ = true; + result.aB_ = value; + return this; + } + public Builder ClearAB_() { + PrepareBuilder(); + result.hasAB_ = false; + result.aB_ = 0; + return this; + } + } + static AB() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NumberField : pb::GeneratedMessage { + private NumberField() { } + private static readonly NumberField defaultInstance = new NumberField().MakeReadOnly(); + private static readonly string[] _numberFieldFieldNames = new string[] { "_01" }; + private static readonly uint[] _numberFieldFieldTags = new uint[] { 8 }; + public static NumberField DefaultInstance { + get { return defaultInstance; } + } + + public override NumberField DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NumberField ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_NumberField__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_NumberField__FieldAccessorTable; } + } + + [global::System.CLSCompliant(false)] + public const int _01FieldNumber = 1; + private bool has_01; + private int _01_; + public bool Has_01 { + get { return has_01; } + } + [global::System.CLSCompliant(false)] + public int _01 { + get { return _01_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _numberFieldFieldNames; + if (has_01) { + output.WriteInt32(1, field_names[0], _01); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (has_01) { + size += pb::CodedOutputStream.ComputeInt32Size(1, _01); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static NumberField ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NumberField ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NumberField ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NumberField ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NumberField ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NumberField ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NumberField ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NumberField ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NumberField ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NumberField ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NumberField MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NumberField prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NumberField cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NumberField result; + + private NumberField PrepareBuilder() { + if (resultIsReadOnly) { + NumberField original = result; + result = new NumberField(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NumberField MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.NumberField.Descriptor; } + } + + public override NumberField DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.NumberField.DefaultInstance; } + } + + public override NumberField BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NumberField) { + return MergeFrom((NumberField) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NumberField other) { + if (other == global::UnitTest.Issues.TestProtos.NumberField.DefaultInstance) return this; + PrepareBuilder(); + if (other.Has_01) { + _01 = other._01; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_numberFieldFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _numberFieldFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.has_01 = input.ReadInt32(ref result._01_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool Has_01 { + get { return result.has_01; } + } + [global::System.CLSCompliant(false)] + public int _01 { + get { return result._01; } + set { Set_01(value); } + } + [global::System.CLSCompliant(false)] + public Builder Set_01(int value) { + PrepareBuilder(); + result.has_01 = true; + result._01_ = value; + return this; + } + public Builder Clear_01() { + PrepareBuilder(); + result.has_01 = false; + result._01_ = 0; + return this; + } + } + static NumberField() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class MyMessageAReferenceB : pb::GeneratedMessage { + private MyMessageAReferenceB() { } + private static readonly MyMessageAReferenceB defaultInstance = new MyMessageAReferenceB().MakeReadOnly(); + private static readonly string[] _myMessageAReferenceBFieldNames = new string[] { "value" }; + private static readonly uint[] _myMessageAReferenceBFieldTags = new uint[] { 10 }; + public static MyMessageAReferenceB DefaultInstance { + get { return defaultInstance; } + } + + public override MyMessageAReferenceB DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override MyMessageAReferenceB ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_MyMessageAReferenceB__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_MyMessageAReferenceB__FieldAccessorTable; } + } + + public const int ValueFieldNumber = 1; + private bool hasValue; + private global::UnitTest.Issues.TestProtos.MyMessageBReferenceA value_; + public bool HasValue { + get { return hasValue; } + } + public global::UnitTest.Issues.TestProtos.MyMessageBReferenceA Value { + get { return value_ ?? global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (!hasValue) return false; + if (!Value.IsInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _myMessageAReferenceBFieldNames; + if (hasValue) { + output.WriteMessage(1, field_names[0], Value); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasValue) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Value); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static MyMessageAReferenceB ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static MyMessageAReferenceB ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static MyMessageAReferenceB ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MyMessageAReferenceB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private MyMessageAReferenceB MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(MyMessageAReferenceB prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(MyMessageAReferenceB cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private MyMessageAReferenceB result; + + private MyMessageAReferenceB PrepareBuilder() { + if (resultIsReadOnly) { + MyMessageAReferenceB original = result; + result = new MyMessageAReferenceB(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override MyMessageAReferenceB MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.Descriptor; } + } + + public override MyMessageAReferenceB DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.DefaultInstance; } + } + + public override MyMessageAReferenceB BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is MyMessageAReferenceB) { + return MergeFrom((MyMessageAReferenceB) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(MyMessageAReferenceB other) { + if (other == global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasValue) { + MergeValue(other.Value); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_myMessageAReferenceBFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _myMessageAReferenceBFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.Builder subBuilder = global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.CreateBuilder(); + if (result.hasValue) { + subBuilder.MergeFrom(Value); + } + input.ReadMessage(subBuilder, extensionRegistry); + Value = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasValue { + get { return result.hasValue; } + } + public global::UnitTest.Issues.TestProtos.MyMessageBReferenceA Value { + get { return result.Value; } + set { SetValue(value); } + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.MyMessageBReferenceA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = value; + return this; + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = builderForValue.Build(); + return this; + } + public Builder MergeValue(global::UnitTest.Issues.TestProtos.MyMessageBReferenceA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasValue && + result.value_ != global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.DefaultInstance) { + result.value_ = global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.CreateBuilder(result.value_).MergeFrom(value).BuildPartial(); + } else { + result.value_ = value; + } + result.hasValue = true; + return this; + } + public Builder ClearValue() { + PrepareBuilder(); + result.hasValue = false; + result.value_ = null; + return this; + } + } + static MyMessageAReferenceB() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class MyMessageBReferenceA : pb::GeneratedMessage { + private MyMessageBReferenceA() { } + private static readonly MyMessageBReferenceA defaultInstance = new MyMessageBReferenceA().MakeReadOnly(); + private static readonly string[] _myMessageBReferenceAFieldNames = new string[] { "value" }; + private static readonly uint[] _myMessageBReferenceAFieldTags = new uint[] { 10 }; + public static MyMessageBReferenceA DefaultInstance { + get { return defaultInstance; } + } + + public override MyMessageBReferenceA DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override MyMessageBReferenceA ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_MyMessageBReferenceA__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_MyMessageBReferenceA__FieldAccessorTable; } + } + + public const int ValueFieldNumber = 1; + private bool hasValue; + private global::UnitTest.Issues.TestProtos.MyMessageAReferenceB value_; + public bool HasValue { + get { return hasValue; } + } + public global::UnitTest.Issues.TestProtos.MyMessageAReferenceB Value { + get { return value_ ?? global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (!hasValue) return false; + if (!Value.IsInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _myMessageBReferenceAFieldNames; + if (hasValue) { + output.WriteMessage(1, field_names[0], Value); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasValue) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Value); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static MyMessageBReferenceA ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static MyMessageBReferenceA ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static MyMessageBReferenceA ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MyMessageBReferenceA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private MyMessageBReferenceA MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(MyMessageBReferenceA prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(MyMessageBReferenceA cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private MyMessageBReferenceA result; + + private MyMessageBReferenceA PrepareBuilder() { + if (resultIsReadOnly) { + MyMessageBReferenceA original = result; + result = new MyMessageBReferenceA(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override MyMessageBReferenceA MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.Descriptor; } + } + + public override MyMessageBReferenceA DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.DefaultInstance; } + } + + public override MyMessageBReferenceA BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is MyMessageBReferenceA) { + return MergeFrom((MyMessageBReferenceA) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(MyMessageBReferenceA other) { + if (other == global::UnitTest.Issues.TestProtos.MyMessageBReferenceA.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasValue) { + MergeValue(other.Value); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_myMessageBReferenceAFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _myMessageBReferenceAFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.Builder subBuilder = global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.CreateBuilder(); + if (result.hasValue) { + subBuilder.MergeFrom(Value); + } + input.ReadMessage(subBuilder, extensionRegistry); + Value = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasValue { + get { return result.hasValue; } + } + public global::UnitTest.Issues.TestProtos.MyMessageAReferenceB Value { + get { return result.Value; } + set { SetValue(value); } + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.MyMessageAReferenceB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = value; + return this; + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = builderForValue.Build(); + return this; + } + public Builder MergeValue(global::UnitTest.Issues.TestProtos.MyMessageAReferenceB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasValue && + result.value_ != global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.DefaultInstance) { + result.value_ = global::UnitTest.Issues.TestProtos.MyMessageAReferenceB.CreateBuilder(result.value_).MergeFrom(value).BuildPartial(); + } else { + result.value_ = value; + } + result.hasValue = true; + return this; + } + public Builder ClearValue() { + PrepareBuilder(); + result.hasValue = false; + result.value_ = null; + return this; + } + } + static MyMessageBReferenceA() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NegativeEnumMessage : pb::GeneratedMessage { + private NegativeEnumMessage() { } + private static readonly NegativeEnumMessage defaultInstance = new NegativeEnumMessage().MakeReadOnly(); + private static readonly string[] _negativeEnumMessageFieldNames = new string[] { "packed_values", "value", "values" }; + private static readonly uint[] _negativeEnumMessageFieldTags = new uint[] { 26, 8, 16 }; + public static NegativeEnumMessage DefaultInstance { + get { return defaultInstance; } + } + + public override NegativeEnumMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NegativeEnumMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_NegativeEnumMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_NegativeEnumMessage__FieldAccessorTable; } + } + + public const int ValueFieldNumber = 1; + private bool hasValue; + private global::UnitTest.Issues.TestProtos.NegativeEnum value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.FiveBelow; + public bool HasValue { + get { return hasValue; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum Value { + get { return value_; } + } + + public const int ValuesFieldNumber = 2; + private pbc::PopsicleList values_ = new pbc::PopsicleList(); + public scg::IList ValuesList { + get { return pbc::Lists.AsReadOnly(values_); } + } + public int ValuesCount { + get { return values_.Count; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum GetValues(int index) { + return values_[index]; + } + + public const int PackedValuesFieldNumber = 3; + private int packedValuesMemoizedSerializedSize; + private pbc::PopsicleList packedValues_ = new pbc::PopsicleList(); + public scg::IList PackedValuesList { + get { return pbc::Lists.AsReadOnly(packedValues_); } + } + public int PackedValuesCount { + get { return packedValues_.Count; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum GetPackedValues(int index) { + return packedValues_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _negativeEnumMessageFieldNames; + if (hasValue) { + output.WriteEnum(1, field_names[1], (int) Value, Value); + } + if (values_.Count > 0) { + output.WriteEnumArray(2, field_names[2], values_); + } + if (packedValues_.Count > 0) { + output.WritePackedEnumArray(3, field_names[0], packedValuesMemoizedSerializedSize, packedValues_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasValue) { + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) Value); + } + { + int dataSize = 0; + if (values_.Count > 0) { + foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in values_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1 * values_.Count; + } + } + { + int dataSize = 0; + if (packedValues_.Count > 0) { + foreach (global::UnitTest.Issues.TestProtos.NegativeEnum element in packedValues_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + packedValuesMemoizedSerializedSize = dataSize; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static NegativeEnumMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NegativeEnumMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NegativeEnumMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NegativeEnumMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NegativeEnumMessage MakeReadOnly() { + values_.MakeReadOnly(); + packedValues_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NegativeEnumMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NegativeEnumMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NegativeEnumMessage result; + + private NegativeEnumMessage PrepareBuilder() { + if (resultIsReadOnly) { + NegativeEnumMessage original = result; + result = new NegativeEnumMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NegativeEnumMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.NegativeEnumMessage.Descriptor; } + } + + public override NegativeEnumMessage DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.NegativeEnumMessage.DefaultInstance; } + } + + public override NegativeEnumMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NegativeEnumMessage) { + return MergeFrom((NegativeEnumMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NegativeEnumMessage other) { + if (other == global::UnitTest.Issues.TestProtos.NegativeEnumMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasValue) { + Value = other.Value; + } + if (other.values_.Count != 0) { + result.values_.Add(other.values_); + } + if (other.packedValues_.Count != 0) { + result.packedValues_.Add(other.packedValues_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_negativeEnumMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _negativeEnumMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + object unknown; + if(input.ReadEnum(ref result.value_, out unknown)) { + result.hasValue = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(1, (ulong)(int)unknown); + } + break; + } + case 18: + case 16: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.values_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(2, (ulong)(int)rawValue); + } + break; + } + case 26: + case 24: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.packedValues_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(3, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasValue { + get { return result.hasValue; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum Value { + get { return result.Value; } + set { SetValue(value); } + } + public Builder SetValue(global::UnitTest.Issues.TestProtos.NegativeEnum value) { + PrepareBuilder(); + result.hasValue = true; + result.value_ = value; + return this; + } + public Builder ClearValue() { + PrepareBuilder(); + result.hasValue = false; + result.value_ = global::UnitTest.Issues.TestProtos.NegativeEnum.FiveBelow; + return this; + } + + public pbc::IPopsicleList ValuesList { + get { return PrepareBuilder().values_; } + } + public int ValuesCount { + get { return result.ValuesCount; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum GetValues(int index) { + return result.GetValues(index); + } + public Builder SetValues(int index, global::UnitTest.Issues.TestProtos.NegativeEnum value) { + PrepareBuilder(); + result.values_[index] = value; + return this; + } + public Builder AddValues(global::UnitTest.Issues.TestProtos.NegativeEnum value) { + PrepareBuilder(); + result.values_.Add(value); + return this; + } + public Builder AddRangeValues(scg::IEnumerable values) { + PrepareBuilder(); + result.values_.Add(values); + return this; + } + public Builder ClearValues() { + PrepareBuilder(); + result.values_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedValuesList { + get { return PrepareBuilder().packedValues_; } + } + public int PackedValuesCount { + get { return result.PackedValuesCount; } + } + public global::UnitTest.Issues.TestProtos.NegativeEnum GetPackedValues(int index) { + return result.GetPackedValues(index); + } + public Builder SetPackedValues(int index, global::UnitTest.Issues.TestProtos.NegativeEnum value) { + PrepareBuilder(); + result.packedValues_[index] = value; + return this; + } + public Builder AddPackedValues(global::UnitTest.Issues.TestProtos.NegativeEnum value) { + PrepareBuilder(); + result.packedValues_.Add(value); + return this; + } + public Builder AddRangePackedValues(scg::IEnumerable values) { + PrepareBuilder(); + result.packedValues_.Add(values); + return this; + } + public Builder ClearPackedValues() { + PrepareBuilder(); + result.packedValues_.Clear(); + return this; + } + } + static NegativeEnumMessage() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class DeprecatedChild : pb::GeneratedMessage { + private DeprecatedChild() { } + private static readonly DeprecatedChild defaultInstance = new DeprecatedChild().MakeReadOnly(); + private static readonly string[] _deprecatedChildFieldNames = new string[] { }; + private static readonly uint[] _deprecatedChildFieldTags = new uint[] { }; + public static DeprecatedChild DefaultInstance { + get { return defaultInstance; } + } + + public override DeprecatedChild DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override DeprecatedChild ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_DeprecatedChild__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_DeprecatedChild__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _deprecatedChildFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static DeprecatedChild ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DeprecatedChild ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DeprecatedChild ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DeprecatedChild ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DeprecatedChild ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private DeprecatedChild MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DeprecatedChild prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(DeprecatedChild cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private DeprecatedChild result; + + private DeprecatedChild PrepareBuilder() { + if (resultIsReadOnly) { + DeprecatedChild original = result; + result = new DeprecatedChild(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override DeprecatedChild MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.DeprecatedChild.Descriptor; } + } + + public override DeprecatedChild DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance; } + } + + public override DeprecatedChild BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DeprecatedChild) { + return MergeFrom((DeprecatedChild) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DeprecatedChild other) { + if (other == global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_deprecatedChildFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _deprecatedChildFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static DeprecatedChild() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class DeprecatedFieldsMessage : pb::GeneratedMessage { + private DeprecatedFieldsMessage() { } + private static readonly DeprecatedFieldsMessage defaultInstance = new DeprecatedFieldsMessage().MakeReadOnly(); + private static readonly string[] _deprecatedFieldsMessageFieldNames = new string[] { "EnumArray", "EnumValue", "MessageArray", "MessageValue", "PrimitiveArray", "PrimitiveValue" }; + private static readonly uint[] _deprecatedFieldsMessageFieldTags = new uint[] { 48, 40, 34, 26, 16, 8 }; + public static DeprecatedFieldsMessage DefaultInstance { + get { return defaultInstance; } + } + + public override DeprecatedFieldsMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override DeprecatedFieldsMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_DeprecatedFieldsMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_DeprecatedFieldsMessage__FieldAccessorTable; } + } + + public const int PrimitiveValueFieldNumber = 1; + private bool hasPrimitiveValue; + private int primitiveValue_; + [global::System.ObsoleteAttribute()] + public bool HasPrimitiveValue { + get { return hasPrimitiveValue; } + } + [global::System.ObsoleteAttribute()] + public int PrimitiveValue { + get { return primitiveValue_; } + } + + public const int PrimitiveArrayFieldNumber = 2; + private pbc::PopsicleList primitiveArray_ = new pbc::PopsicleList(); + [global::System.ObsoleteAttribute()] + public scg::IList PrimitiveArrayList { + get { return pbc::Lists.AsReadOnly(primitiveArray_); } + } + [global::System.ObsoleteAttribute()] + public int PrimitiveArrayCount { + get { return primitiveArray_.Count; } + } + [global::System.ObsoleteAttribute()] + public int GetPrimitiveArray(int index) { + return primitiveArray_[index]; + } + + public const int MessageValueFieldNumber = 3; + private bool hasMessageValue; + private global::UnitTest.Issues.TestProtos.DeprecatedChild messageValue_; + [global::System.ObsoleteAttribute()] + public bool HasMessageValue { + get { return hasMessageValue; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedChild MessageValue { + get { return messageValue_ ?? global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance; } + } + + public const int MessageArrayFieldNumber = 4; + private pbc::PopsicleList messageArray_ = new pbc::PopsicleList(); + [global::System.ObsoleteAttribute()] + public scg::IList MessageArrayList { + get { return messageArray_; } + } + [global::System.ObsoleteAttribute()] + public int MessageArrayCount { + get { return messageArray_.Count; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedChild GetMessageArray(int index) { + return messageArray_[index]; + } + + public const int EnumValueFieldNumber = 5; + private bool hasEnumValue; + private global::UnitTest.Issues.TestProtos.DeprecatedEnum enumValue_ = global::UnitTest.Issues.TestProtos.DeprecatedEnum.one; + [global::System.ObsoleteAttribute()] + public bool HasEnumValue { + get { return hasEnumValue; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedEnum EnumValue { + get { return enumValue_; } + } + + public const int EnumArrayFieldNumber = 6; + private pbc::PopsicleList enumArray_ = new pbc::PopsicleList(); + [global::System.ObsoleteAttribute()] + public scg::IList EnumArrayList { + get { return pbc::Lists.AsReadOnly(enumArray_); } + } + [global::System.ObsoleteAttribute()] + public int EnumArrayCount { + get { return enumArray_.Count; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedEnum GetEnumArray(int index) { + return enumArray_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _deprecatedFieldsMessageFieldNames; + if (hasPrimitiveValue) { + output.WriteInt32(1, field_names[5], PrimitiveValue); + } + if (primitiveArray_.Count > 0) { + output.WriteInt32Array(2, field_names[4], primitiveArray_); + } + if (hasMessageValue) { + output.WriteMessage(3, field_names[3], MessageValue); + } + if (messageArray_.Count > 0) { + output.WriteMessageArray(4, field_names[2], messageArray_); + } + if (hasEnumValue) { + output.WriteEnum(5, field_names[1], (int) EnumValue, EnumValue); + } + if (enumArray_.Count > 0) { + output.WriteEnumArray(6, field_names[0], enumArray_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPrimitiveValue) { + size += pb::CodedOutputStream.ComputeInt32Size(1, PrimitiveValue); + } + { + int dataSize = 0; + foreach (int element in PrimitiveArrayList) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * primitiveArray_.Count; + } + if (hasMessageValue) { + size += pb::CodedOutputStream.ComputeMessageSize(3, MessageValue); + } + foreach (global::UnitTest.Issues.TestProtos.DeprecatedChild element in MessageArrayList) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } + if (hasEnumValue) { + size += pb::CodedOutputStream.ComputeEnumSize(5, (int) EnumValue); + } + { + int dataSize = 0; + if (enumArray_.Count > 0) { + foreach (global::UnitTest.Issues.TestProtos.DeprecatedEnum element in enumArray_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1 * enumArray_.Count; + } + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static DeprecatedFieldsMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DeprecatedFieldsMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private DeprecatedFieldsMessage MakeReadOnly() { + primitiveArray_.MakeReadOnly(); + messageArray_.MakeReadOnly(); + enumArray_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DeprecatedFieldsMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(DeprecatedFieldsMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private DeprecatedFieldsMessage result; + + private DeprecatedFieldsMessage PrepareBuilder() { + if (resultIsReadOnly) { + DeprecatedFieldsMessage original = result; + result = new DeprecatedFieldsMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override DeprecatedFieldsMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.Descriptor; } + } + + public override DeprecatedFieldsMessage DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.DefaultInstance; } + } + + public override DeprecatedFieldsMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DeprecatedFieldsMessage) { + return MergeFrom((DeprecatedFieldsMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DeprecatedFieldsMessage other) { + if (other == global::UnitTest.Issues.TestProtos.DeprecatedFieldsMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasPrimitiveValue) { + PrimitiveValue = other.PrimitiveValue; + } + if (other.primitiveArray_.Count != 0) { + result.primitiveArray_.Add(other.primitiveArray_); + } + if (other.HasMessageValue) { + MergeMessageValue(other.MessageValue); + } + if (other.messageArray_.Count != 0) { + result.messageArray_.Add(other.messageArray_); + } + if (other.HasEnumValue) { + EnumValue = other.EnumValue; + } + if (other.enumArray_.Count != 0) { + result.enumArray_.Add(other.enumArray_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_deprecatedFieldsMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _deprecatedFieldsMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasPrimitiveValue = input.ReadInt32(ref result.primitiveValue_); + break; + } + case 18: + case 16: { + input.ReadInt32Array(tag, field_name, result.primitiveArray_); + break; + } + case 26: { + global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder subBuilder = global::UnitTest.Issues.TestProtos.DeprecatedChild.CreateBuilder(); + if (result.hasMessageValue) { + subBuilder.MergeFrom(MessageValue); + } + input.ReadMessage(subBuilder, extensionRegistry); + MessageValue = subBuilder.BuildPartial(); + break; + } + case 34: { + input.ReadMessageArray(tag, field_name, result.messageArray_, global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance, extensionRegistry); + break; + } + case 40: { + object unknown; + if(input.ReadEnum(ref result.enumValue_, out unknown)) { + result.hasEnumValue = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(5, (ulong)(int)unknown); + } + break; + } + case 50: + case 48: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.enumArray_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(6, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + [global::System.ObsoleteAttribute()] + public bool HasPrimitiveValue { + get { return result.hasPrimitiveValue; } + } + [global::System.ObsoleteAttribute()] + public int PrimitiveValue { + get { return result.PrimitiveValue; } + set { SetPrimitiveValue(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetPrimitiveValue(int value) { + PrepareBuilder(); + result.hasPrimitiveValue = true; + result.primitiveValue_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearPrimitiveValue() { + PrepareBuilder(); + result.hasPrimitiveValue = false; + result.primitiveValue_ = 0; + return this; + } + + [global::System.ObsoleteAttribute()] + public pbc::IPopsicleList PrimitiveArrayList { + get { return PrepareBuilder().primitiveArray_; } + } + [global::System.ObsoleteAttribute()] + public int PrimitiveArrayCount { + get { return result.PrimitiveArrayCount; } + } + [global::System.ObsoleteAttribute()] + public int GetPrimitiveArray(int index) { + return result.GetPrimitiveArray(index); + } + [global::System.ObsoleteAttribute()] + public Builder SetPrimitiveArray(int index, int value) { + PrepareBuilder(); + result.primitiveArray_[index] = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddPrimitiveArray(int value) { + PrepareBuilder(); + result.primitiveArray_.Add(value); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddRangePrimitiveArray(scg::IEnumerable values) { + PrepareBuilder(); + result.primitiveArray_.Add(values); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearPrimitiveArray() { + PrepareBuilder(); + result.primitiveArray_.Clear(); + return this; + } + + [global::System.ObsoleteAttribute()] + public bool HasMessageValue { + get { return result.hasMessageValue; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedChild MessageValue { + get { return result.MessageValue; } + set { SetMessageValue(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetMessageValue(global::UnitTest.Issues.TestProtos.DeprecatedChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessageValue = true; + result.messageValue_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder SetMessageValue(global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMessageValue = true; + result.messageValue_ = builderForValue.Build(); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder MergeMessageValue(global::UnitTest.Issues.TestProtos.DeprecatedChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMessageValue && + result.messageValue_ != global::UnitTest.Issues.TestProtos.DeprecatedChild.DefaultInstance) { + result.messageValue_ = global::UnitTest.Issues.TestProtos.DeprecatedChild.CreateBuilder(result.messageValue_).MergeFrom(value).BuildPartial(); + } else { + result.messageValue_ = value; + } + result.hasMessageValue = true; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearMessageValue() { + PrepareBuilder(); + result.hasMessageValue = false; + result.messageValue_ = null; + return this; + } + + [global::System.ObsoleteAttribute()] + public pbc::IPopsicleList MessageArrayList { + get { return PrepareBuilder().messageArray_; } + } + [global::System.ObsoleteAttribute()] + public int MessageArrayCount { + get { return result.MessageArrayCount; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedChild GetMessageArray(int index) { + return result.GetMessageArray(index); + } + [global::System.ObsoleteAttribute()] + public Builder SetMessageArray(int index, global::UnitTest.Issues.TestProtos.DeprecatedChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.messageArray_[index] = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder SetMessageArray(int index, global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.messageArray_[index] = builderForValue.Build(); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddMessageArray(global::UnitTest.Issues.TestProtos.DeprecatedChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.messageArray_.Add(value); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddMessageArray(global::UnitTest.Issues.TestProtos.DeprecatedChild.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.messageArray_.Add(builderForValue.Build()); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddRangeMessageArray(scg::IEnumerable values) { + PrepareBuilder(); + result.messageArray_.Add(values); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearMessageArray() { + PrepareBuilder(); + result.messageArray_.Clear(); + return this; + } + + [global::System.ObsoleteAttribute()] + public bool HasEnumValue { + get { return result.hasEnumValue; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedEnum EnumValue { + get { return result.EnumValue; } + set { SetEnumValue(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetEnumValue(global::UnitTest.Issues.TestProtos.DeprecatedEnum value) { + PrepareBuilder(); + result.hasEnumValue = true; + result.enumValue_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearEnumValue() { + PrepareBuilder(); + result.hasEnumValue = false; + result.enumValue_ = global::UnitTest.Issues.TestProtos.DeprecatedEnum.one; + return this; + } + + [global::System.ObsoleteAttribute()] + public pbc::IPopsicleList EnumArrayList { + get { return PrepareBuilder().enumArray_; } + } + [global::System.ObsoleteAttribute()] + public int EnumArrayCount { + get { return result.EnumArrayCount; } + } + [global::System.ObsoleteAttribute()] + public global::UnitTest.Issues.TestProtos.DeprecatedEnum GetEnumArray(int index) { + return result.GetEnumArray(index); + } + [global::System.ObsoleteAttribute()] + public Builder SetEnumArray(int index, global::UnitTest.Issues.TestProtos.DeprecatedEnum value) { + PrepareBuilder(); + result.enumArray_[index] = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddEnumArray(global::UnitTest.Issues.TestProtos.DeprecatedEnum value) { + PrepareBuilder(); + result.enumArray_.Add(value); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder AddRangeEnumArray(scg::IEnumerable values) { + PrepareBuilder(); + result.enumArray_.Add(values); + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearEnumArray() { + PrepareBuilder(); + result.enumArray_.Clear(); + return this; + } + } + static DeprecatedFieldsMessage() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ItemField : pb::GeneratedMessage { + private ItemField() { } + private static readonly ItemField defaultInstance = new ItemField().MakeReadOnly(); + private static readonly string[] _itemFieldFieldNames = new string[] { "item" }; + private static readonly uint[] _itemFieldFieldTags = new uint[] { 8 }; + public static ItemField DefaultInstance { + get { return defaultInstance; } + } + + public override ItemField DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ItemField ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_ItemField__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.internal__static_unittest_issues_ItemField__FieldAccessorTable; } + } + + public const int ItemFieldNumber = 1; + private bool hasItem; + private int item_; + public bool HasItem { + get { return hasItem; } + } + public int Item { + get { return item_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _itemFieldFieldNames; + if (hasItem) { + output.WriteInt32(1, field_names[0], Item); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasItem) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Item); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ItemField ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ItemField ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ItemField ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ItemField ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ItemField ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ItemField ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ItemField ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ItemField ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ItemField ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ItemField ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ItemField MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ItemField prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ItemField cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ItemField result; + + private ItemField PrepareBuilder() { + if (resultIsReadOnly) { + ItemField original = result; + result = new ItemField(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ItemField MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::UnitTest.Issues.TestProtos.ItemField.Descriptor; } + } + + public override ItemField DefaultInstanceForType { + get { return global::UnitTest.Issues.TestProtos.ItemField.DefaultInstance; } + } + + public override ItemField BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ItemField) { + return MergeFrom((ItemField) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ItemField other) { + if (other == global::UnitTest.Issues.TestProtos.ItemField.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasItem) { + Item = other.Item; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_itemFieldFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _itemFieldFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasItem = input.ReadInt32(ref result.item_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasItem { + get { return result.hasItem; } + } + public int Item { + get { return result.Item; } + set { SetItem(value); } + } + public Builder SetItem(int value) { + PrepareBuilder(); + result.hasItem = true; + result.item_ = value; + return this; + } + public Builder ClearItem() { + PrepareBuilder(); + result.hasItem = false; + result.item_ = 0; + return this; + } + } + static ItemField() { + object.ReferenceEquals(global::UnitTest.Issues.TestProtos.UnitTestExtrasIssuesProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasProtoFile.cs new file mode 100644 index 00000000..4877c601 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestExtrasProtoFile.cs @@ -0,0 +1,401 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestExtrasProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedEnumExtension); + } + #endregion + #region Extensions + public const int UnpackedInt32ExtensionFieldNumber = 90; + public static pb::GeneratedExtensionBase> UnpackedInt32Extension; + public const int UnpackedInt64ExtensionFieldNumber = 91; + public static pb::GeneratedExtensionBase> UnpackedInt64Extension; + public const int UnpackedUint32ExtensionFieldNumber = 92; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> UnpackedUint32Extension; + public const int UnpackedUint64ExtensionFieldNumber = 93; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> UnpackedUint64Extension; + public const int UnpackedSint32ExtensionFieldNumber = 94; + public static pb::GeneratedExtensionBase> UnpackedSint32Extension; + public const int UnpackedSint64ExtensionFieldNumber = 95; + public static pb::GeneratedExtensionBase> UnpackedSint64Extension; + public const int UnpackedFixed32ExtensionFieldNumber = 96; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> UnpackedFixed32Extension; + public const int UnpackedFixed64ExtensionFieldNumber = 97; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> UnpackedFixed64Extension; + public const int UnpackedSfixed32ExtensionFieldNumber = 98; + public static pb::GeneratedExtensionBase> UnpackedSfixed32Extension; + public const int UnpackedSfixed64ExtensionFieldNumber = 99; + public static pb::GeneratedExtensionBase> UnpackedSfixed64Extension; + public const int UnpackedFloatExtensionFieldNumber = 100; + public static pb::GeneratedExtensionBase> UnpackedFloatExtension; + public const int UnpackedDoubleExtensionFieldNumber = 101; + public static pb::GeneratedExtensionBase> UnpackedDoubleExtension; + public const int UnpackedBoolExtensionFieldNumber = 102; + public static pb::GeneratedExtensionBase> UnpackedBoolExtension; + public const int UnpackedEnumExtensionFieldNumber = 103; + public static pb::GeneratedExtensionBase> UnpackedEnumExtension; + #endregion + + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestUnpackedExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestUnpackedExtensions__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestExtrasProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChxleHRlc3QvdW5pdHRlc3RfZXh0cmFzLnByb3RvEhdwcm90b2J1Zl91bml0", + "dGVzdF9leHRyYRokZ29vZ2xlL3Byb3RvYnVmL2NzaGFycF9vcHRpb25zLnBy", + "b3RvIiIKFlRlc3RVbnBhY2tlZEV4dGVuc2lvbnMqCAgBEICAgIACKlIKHVVu", + "cGFja2VkRXh0ZW5zaW9uc0ZvcmVpZ25FbnVtEg8KC0ZPUkVJR05fRk9PEAQS", + "DwoLRk9SRUlHTl9CQVIQBRIPCgtGT1JFSUdOX0JBWhAGOlEKGHVucGFja2Vk", + "X2ludDMyX2V4dGVuc2lvbhIvLnByb3RvYnVmX3VuaXR0ZXN0X2V4dHJhLlRl", + "c3RVbnBhY2tlZEV4dGVuc2lvbnMYWiADKAU6UQoYdW5wYWNrZWRfaW50NjRf", + "ZXh0ZW5zaW9uEi8ucHJvdG9idWZfdW5pdHRlc3RfZXh0cmEuVGVzdFVucGFj", + "a2VkRXh0ZW5zaW9ucxhbIAMoAzpSChl1bnBhY2tlZF91aW50MzJfZXh0ZW5z", + "aW9uEi8ucHJvdG9idWZfdW5pdHRlc3RfZXh0cmEuVGVzdFVucGFja2VkRXh0", + "ZW5zaW9ucxhcIAMoDTpSChl1bnBhY2tlZF91aW50NjRfZXh0ZW5zaW9uEi8u", + "cHJvdG9idWZfdW5pdHRlc3RfZXh0cmEuVGVzdFVucGFja2VkRXh0ZW5zaW9u", + "cxhdIAMoBDpSChl1bnBhY2tlZF9zaW50MzJfZXh0ZW5zaW9uEi8ucHJvdG9i", + "dWZfdW5pdHRlc3RfZXh0cmEuVGVzdFVucGFja2VkRXh0ZW5zaW9ucxheIAMo", + "ETpSChl1bnBhY2tlZF9zaW50NjRfZXh0ZW5zaW9uEi8ucHJvdG9idWZfdW5p", + "dHRlc3RfZXh0cmEuVGVzdFVucGFja2VkRXh0ZW5zaW9ucxhfIAMoEjpTChp1", + "bnBhY2tlZF9maXhlZDMyX2V4dGVuc2lvbhIvLnByb3RvYnVmX3VuaXR0ZXN0", + "X2V4dHJhLlRlc3RVbnBhY2tlZEV4dGVuc2lvbnMYYCADKAc6UwoadW5wYWNr", + "ZWRfZml4ZWQ2NF9leHRlbnNpb24SLy5wcm90b2J1Zl91bml0dGVzdF9leHRy", + "YS5UZXN0VW5wYWNrZWRFeHRlbnNpb25zGGEgAygGOlQKG3VucGFja2VkX3Nm", + "aXhlZDMyX2V4dGVuc2lvbhIvLnByb3RvYnVmX3VuaXR0ZXN0X2V4dHJhLlRl", + "c3RVbnBhY2tlZEV4dGVuc2lvbnMYYiADKA86VAobdW5wYWNrZWRfc2ZpeGVk", + "NjRfZXh0ZW5zaW9uEi8ucHJvdG9idWZfdW5pdHRlc3RfZXh0cmEuVGVzdFVu", + "cGFja2VkRXh0ZW5zaW9ucxhjIAMoEDpRChh1bnBhY2tlZF9mbG9hdF9leHRl", + "bnNpb24SLy5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0VW5wYWNrZWRF", + "eHRlbnNpb25zGGQgAygCOlIKGXVucGFja2VkX2RvdWJsZV9leHRlbnNpb24S", + "Ly5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0VW5wYWNrZWRFeHRlbnNp", + "b25zGGUgAygBOlAKF3VucGFja2VkX2Jvb2xfZXh0ZW5zaW9uEi8ucHJvdG9i", + "dWZfdW5pdHRlc3RfZXh0cmEuVGVzdFVucGFja2VkRXh0ZW5zaW9ucxhmIAMo", + "CDqIAQoXdW5wYWNrZWRfZW51bV9leHRlbnNpb24SLy5wcm90b2J1Zl91bml0", + "dGVzdF9leHRyYS5UZXN0VW5wYWNrZWRFeHRlbnNpb25zGGcgAygOMjYucHJv", + "dG9idWZfdW5pdHRlc3RfZXh0cmEuVW5wYWNrZWRFeHRlbnNpb25zRm9yZWln", + "bkVudW1CVgoTY29tLmdvb2dsZS5wcm90b2J1ZsI+PgohR29vZ2xlLlByb3Rv", + "Y29sQnVmZmVycy5UZXN0UHJvdG9zEhdVbml0VGVzdEV4dHJhc1Byb3RvRmls", + "ZUgB")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_extra_TestUnpackedExtensions__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_extra_TestUnpackedExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestUnpackedExtensions__Descriptor, + new string[] { }); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedInt32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedInt64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[1]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedUint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[2]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedUint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[3]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedSint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[4]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedSint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[5]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedFixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[6]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedFixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[7]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedSfixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[8]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedSfixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[9]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedFloatExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[10]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedDoubleExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[11]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedBoolExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[12]); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.UnpackedEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor.Extensions[13]); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum UnpackedExtensionsForeignEnum { + FOREIGN_FOO = 4, + FOREIGN_BAR = 5, + FOREIGN_BAZ = 6, + } + + #endregion + + #region Messages + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestUnpackedExtensions : pb::ExtendableMessage { + private TestUnpackedExtensions() { } + private static readonly TestUnpackedExtensions defaultInstance = new TestUnpackedExtensions().MakeReadOnly(); + private static readonly string[] _testUnpackedExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testUnpackedExtensionsFieldTags = new uint[] { }; + public static TestUnpackedExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestUnpackedExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestUnpackedExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.internal__static_protobuf_unittest_extra_TestUnpackedExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.internal__static_protobuf_unittest_extra_TestUnpackedExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testUnpackedExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestUnpackedExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestUnpackedExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestUnpackedExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestUnpackedExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestUnpackedExtensions prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestUnpackedExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestUnpackedExtensions result; + + private TestUnpackedExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestUnpackedExtensions original = result; + result = new TestUnpackedExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestUnpackedExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensions.Descriptor; } + } + + public override TestUnpackedExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensions.DefaultInstance; } + } + + public override TestUnpackedExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestUnpackedExtensions) { + return MergeFrom((TestUnpackedExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestUnpackedExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testUnpackedExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testUnpackedExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestUnpackedExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs new file mode 100644 index 00000000..15b7e08c --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestGenericServices.cs @@ -0,0 +1,260 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestGenericServices { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestGenericServices() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiZleHRlc3QvdW5pdHRlc3RfZ2VuZXJpY19zZXJ2aWNlcy5wcm90bxIRcHJv", + "dG9idWZfdW5pdHRlc3QaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9u", + "cy5wcm90bxoeZ29vZ2xlL3Byb3RvYnVmL3VuaXR0ZXN0LnByb3RvGi1nb29n", + "bGUvcHJvdG9idWYvdW5pdHRlc3RfY3VzdG9tX29wdGlvbnMucHJvdG8yoAEK", + "ElRlc3RHZW5lcmljU2VydmljZRJECgNGb28SHS5wcm90b2J1Zl91bml0dGVz", + "dC5Gb29SZXF1ZXN0Gh4ucHJvdG9idWZfdW5pdHRlc3QuRm9vUmVzcG9uc2US", + "RAoDQmFyEh0ucHJvdG9idWZfdW5pdHRlc3QuQmFyUmVxdWVzdBoeLnByb3Rv", + "YnVmX3VuaXR0ZXN0LkJhclJlc3BvbnNlMpUBCiNUZXN0R2VuZXJpY1NlcnZp", + "Y2VXaXRoQ3VzdG9tT3B0aW9ucxJjCgNGb28SKS5wcm90b2J1Zl91bml0dGVz", + "dC5DdXN0b21PcHRpb25Gb29SZXF1ZXN0GioucHJvdG9idWZfdW5pdHRlc3Qu", + "Q3VzdG9tT3B0aW9uRm9vUmVzcG9uc2UiBeD6jB4CGgmQsose09uAy0lCREgB", + "wj4/CiFHb29nbGUuUHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90b3MSF1VuaXRU", + "ZXN0R2VuZXJpY1NlcnZpY2VziA4B")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, + global::Google.ProtocolBuffers.TestProtos.UnitTestCustomOptionsProtoFile.Descriptor, + }, assigner); + } + #endregion + + } + #region Services + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public abstract class TestGenericService : pb::IService { + public abstract void Foo( + pb::IRpcController controller, + global::Google.ProtocolBuffers.TestProtos.FooRequest request, + global::System.Action done); + public abstract void Bar( + pb::IRpcController controller, + global::Google.ProtocolBuffers.TestProtos.BarRequest request, + global::System.Action done); + + public static pbd::ServiceDescriptor Descriptor { + get { return UnitTestGenericServices.Descriptor.Services[0]; } + } + public pbd::ServiceDescriptor DescriptorForType { + get { return Descriptor; } + } + + public void CallMethod( + pbd::MethodDescriptor method, + pb::IRpcController controller, + pb::IMessage request, + global::System.Action done) { + if (method.Service != Descriptor) { + throw new global::System.ArgumentException( + "Service.CallMethod() given method descriptor for wrong service type."); + } + switch(method.Index) { + case 0: + this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.FooRequest) request, + pb::RpcUtil.SpecializeCallback( + done)); + return; + case 1: + this.Bar(controller, (global::Google.ProtocolBuffers.TestProtos.BarRequest) request, + pb::RpcUtil.SpecializeCallback( + done)); + return; + default: + throw new global::System.InvalidOperationException("Can't get here."); + } + } + + public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) { + if (method.Service != Descriptor) { + throw new global::System.ArgumentException( + "Service.GetRequestPrototype() given method descriptor for wrong service type."); + } + switch(method.Index) { + case 0: + return global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance; + case 1: + return global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance; + default: + throw new global::System.InvalidOperationException("Can't get here."); + } + } + + public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) { + if (method.Service != Descriptor) { + throw new global::System.ArgumentException( + "Service.GetResponsePrototype() given method descriptor for wrong service type."); + } + switch(method.Index) { + case 0: + return global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance; + case 1: + return global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance; + default: + throw new global::System.InvalidOperationException("Can't get here."); + } + } + + public static Stub CreateStub(pb::IRpcChannel channel) { + return new Stub(channel); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public class Stub : global::Google.ProtocolBuffers.TestProtos.TestGenericService { + internal Stub(pb::IRpcChannel channel) { + this.channel = channel; + } + + private readonly pb::IRpcChannel channel; + + public pb::IRpcChannel Channel { + get { return channel; } + } + + public override void Foo( + pb::IRpcController controller, + global::Google.ProtocolBuffers.TestProtos.FooRequest request, + global::System.Action done) { + channel.CallMethod(Descriptor.Methods[0], + controller, request, global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance, + pb::RpcUtil.GeneralizeCallback(done, global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance)); + } + + public override void Bar( + pb::IRpcController controller, + global::Google.ProtocolBuffers.TestProtos.BarRequest request, + global::System.Action done) { + channel.CallMethod(Descriptor.Methods[1], + controller, request, global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance, + pb::RpcUtil.GeneralizeCallback(done, global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance)); + } + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public abstract class TestGenericServiceWithCustomOptions : pb::IService { + public abstract void Foo( + pb::IRpcController controller, + global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest request, + global::System.Action done); + + public static pbd::ServiceDescriptor Descriptor { + get { return UnitTestGenericServices.Descriptor.Services[1]; } + } + public pbd::ServiceDescriptor DescriptorForType { + get { return Descriptor; } + } + + public void CallMethod( + pbd::MethodDescriptor method, + pb::IRpcController controller, + pb::IMessage request, + global::System.Action done) { + if (method.Service != Descriptor) { + throw new global::System.ArgumentException( + "Service.CallMethod() given method descriptor for wrong service type."); + } + switch(method.Index) { + case 0: + this.Foo(controller, (global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest) request, + pb::RpcUtil.SpecializeCallback( + done)); + return; + default: + throw new global::System.InvalidOperationException("Can't get here."); + } + } + + public pb::IMessage GetRequestPrototype(pbd::MethodDescriptor method) { + if (method.Service != Descriptor) { + throw new global::System.ArgumentException( + "Service.GetRequestPrototype() given method descriptor for wrong service type."); + } + switch(method.Index) { + case 0: + return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest.DefaultInstance; + default: + throw new global::System.InvalidOperationException("Can't get here."); + } + } + + public pb::IMessage GetResponsePrototype(pbd::MethodDescriptor method) { + if (method.Service != Descriptor) { + throw new global::System.ArgumentException( + "Service.GetResponsePrototype() given method descriptor for wrong service type."); + } + switch(method.Index) { + case 0: + return global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance; + default: + throw new global::System.InvalidOperationException("Can't get here."); + } + } + + public static Stub CreateStub(pb::IRpcChannel channel) { + return new Stub(channel); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public class Stub : global::Google.ProtocolBuffers.TestProtos.TestGenericServiceWithCustomOptions { + internal Stub(pb::IRpcChannel channel) { + this.channel = channel; + } + + private readonly pb::IRpcChannel channel; + + public pb::IRpcChannel Channel { + get { return channel; } + } + + public override void Foo( + pb::IRpcController controller, + global::Google.ProtocolBuffers.TestProtos.CustomOptionFooRequest request, + global::System.Action done) { + channel.CallMethod(Descriptor.Methods[0], + controller, request, global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance, + pb::RpcUtil.GeneralizeCallback(done, global::Google.ProtocolBuffers.TestProtos.CustomOptionFooResponse.DefaultInstance)); + } + } + } + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs new file mode 100644 index 00000000..6def8d5d --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSizeProtoFile.cs @@ -0,0 +1,4573 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestGoogleSizeProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_unittest_google_size_SizeMessage1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_size_SizeMessage1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_google_size_SizeMessage1SubMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_size_SizeMessage1SubMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_google_size_SizeMessage2__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_size_SizeMessage2__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_google_size_SizeMessage2_Group1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_size_SizeMessage2_Group1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_google_size_SizeMessage2GroupedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_size_SizeMessage2GroupedMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestGoogleSizeProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch1nb29nbGUvdGVzdC9nb29nbGVfc2l6ZS5wcm90bxIUdW5pdHRlc3RfZ29v", + "Z2xlX3NpemUaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90", + "byKABwoMU2l6ZU1lc3NhZ2UxEg4KBmZpZWxkMRgBIAIoCRIOCgZmaWVsZDkY", + "CSABKAkSDwoHZmllbGQxOBgSIAEoCRIWCgdmaWVsZDgwGFAgASgIOgVmYWxz", + "ZRIVCgdmaWVsZDgxGFEgASgIOgR0cnVlEg4KBmZpZWxkMhgCIAIoBRIOCgZm", + "aWVsZDMYAyACKAUSEQoIZmllbGQyODAYmAIgASgFEhEKBmZpZWxkNhgGIAEo", + "BToBMBIPCgdmaWVsZDIyGBYgASgDEg4KBmZpZWxkNBgEIAEoCRIOCgZmaWVs", + "ZDUYBSADKAYSFgoHZmllbGQ1ORg7IAEoCDoFZmFsc2USDgoGZmllbGQ3GAcg", + "ASgJEg8KB2ZpZWxkMTYYECABKAUSFAoIZmllbGQxMzAYggEgASgFOgEwEhUK", + "B2ZpZWxkMTIYDCABKAg6BHRydWUSFQoHZmllbGQxNxgRIAEoCDoEdHJ1ZRIV", + "CgdmaWVsZDEzGA0gASgIOgR0cnVlEhUKB2ZpZWxkMTQYDiABKAg6BHRydWUS", + "EwoIZmllbGQxMDQYaCABKAU6ATASEwoIZmllbGQxMDAYZCABKAU6ATASEwoI", + "ZmllbGQxMDEYZSABKAU6ATASEAoIZmllbGQxMDIYZiABKAkSEAoIZmllbGQx", + "MDMYZyABKAkSEgoHZmllbGQyORgdIAEoBToBMBIWCgdmaWVsZDMwGB4gASgI", + "OgVmYWxzZRITCgdmaWVsZDYwGDwgASgFOgItMRIVCghmaWVsZDI3MRiPAiAB", + "KAU6Ai0xEhUKCGZpZWxkMjcyGJACIAEoBToCLTESEQoIZmllbGQxNTAYlgEg", + "ASgFEhIKB2ZpZWxkMjMYFyABKAU6ATASFgoHZmllbGQyNBgYIAEoCDoFZmFs", + "c2USEgoHZmllbGQyNRgZIAEoBToBMBI9CgdmaWVsZDE1GA8gASgLMiwudW5p", + "dHRlc3RfZ29vZ2xlX3NpemUuU2l6ZU1lc3NhZ2UxU3ViTWVzc2FnZRIPCgdm", + "aWVsZDc4GE4gASgIEhIKB2ZpZWxkNjcYQyABKAU6ATASDwoHZmllbGQ2OBhE", + "IAEoBRIUCghmaWVsZDEyOBiAASABKAU6ATASKAoIZmllbGQxMjkYgQEgASgJ", + "OhV4eHh4eHh4eHh4eHh4eHh4eHh4eHgSFAoIZmllbGQxMzEYgwEgASgFOgEw", + "IqEDChZTaXplTWVzc2FnZTFTdWJNZXNzYWdlEhEKBmZpZWxkMRgBIAEoBToB", + "MBIRCgZmaWVsZDIYAiABKAU6ATASEQoGZmllbGQzGAMgASgFOgEwEg8KB2Zp", + "ZWxkMTUYDyABKAkSFQoHZmllbGQxMhgMIAEoCDoEdHJ1ZRIPCgdmaWVsZDEz", + "GA0gASgDEg8KB2ZpZWxkMTQYDiABKAMSDwoHZmllbGQxNhgQIAEoBRISCgdm", + "aWVsZDE5GBMgASgFOgEyEhUKB2ZpZWxkMjAYFCABKAg6BHRydWUSFQoHZmll", + "bGQyOBgcIAEoCDoEdHJ1ZRIPCgdmaWVsZDIxGBUgASgGEg8KB2ZpZWxkMjIY", + "FiABKAUSFgoHZmllbGQyMxgXIAEoCDoFZmFsc2USGAoIZmllbGQyMDYYzgEg", + "ASgIOgVmYWxzZRIRCghmaWVsZDIwMxjLASABKAcSEQoIZmllbGQyMDQYzAEg", + "ASgFEhEKCGZpZWxkMjA1GM0BIAEoCRIRCghmaWVsZDIwNxjPASABKAQSEQoI", + "ZmllbGQzMDAYrAIgASgEItsHCgxTaXplTWVzc2FnZTISDgoGZmllbGQxGAEg", + "ASgJEg4KBmZpZWxkMxgDIAEoAxIOCgZmaWVsZDQYBCABKAMSDwoHZmllbGQz", + "MBgeIAEoAxIWCgdmaWVsZDc1GEsgASgIOgVmYWxzZRIOCgZmaWVsZDYYBiAB", + "KAkSDgoGZmllbGQyGAIgASgMEhIKB2ZpZWxkMjEYFSABKAU6ATASDwoHZmll", + "bGQ3MRhHIAEoBRIPCgdmaWVsZDI1GBkgASgCEhMKCGZpZWxkMTA5GG0gASgF", + "OgEwEhQKCGZpZWxkMjEwGNIBIAEoBToBMBIUCghmaWVsZDIxMRjTASABKAU6", + "ATASFAoIZmllbGQyMTIY1AEgASgFOgEwEhQKCGZpZWxkMjEzGNUBIAEoBToB", + "MBIUCghmaWVsZDIxNhjYASABKAU6ATASFAoIZmllbGQyMTcY2QEgASgFOgEw", + "EhQKCGZpZWxkMjE4GNoBIAEoBToBMBIUCghmaWVsZDIyMBjcASABKAU6ATAS", + "FAoIZmllbGQyMjEY3QEgASgFOgEwEhQKCGZpZWxkMjIyGN4BIAEoAjoBMBIP", + "CgdmaWVsZDYzGD8gASgFEjkKBmdyb3VwMRgKIAMoCjIpLnVuaXR0ZXN0X2dv", + "b2dsZV9zaXplLlNpemVNZXNzYWdlMi5Hcm91cDESEQoIZmllbGQxMjgYgAEg", + "AygJEhEKCGZpZWxkMTMxGIMBIAEoAxIQCghmaWVsZDEyNxh/IAMoCRIRCghm", + "aWVsZDEyORiBASABKAUSEQoIZmllbGQxMzAYggEgAygDEhgKCGZpZWxkMjA1", + "GM0BIAEoCDoFZmFsc2USGAoIZmllbGQyMDYYzgEgASgIOgVmYWxzZRrMAgoG", + "R3JvdXAxEg8KB2ZpZWxkMTEYCyACKAISDwoHZmllbGQyNhgaIAEoAhIPCgdm", + "aWVsZDEyGAwgASgJEg8KB2ZpZWxkMTMYDSABKAkSDwoHZmllbGQxNBgOIAMo", + "CRIPCgdmaWVsZDE1GA8gAigEEg4KBmZpZWxkNRgFIAEoBRIPCgdmaWVsZDI3", + "GBsgASgJEg8KB2ZpZWxkMjgYHCABKAUSDwoHZmllbGQyORgdIAEoCRIPCgdm", + "aWVsZDE2GBAgASgJEg8KB2ZpZWxkMjIYFiADKAkSDwoHZmllbGQ3MxhJIAMo", + "BRISCgdmaWVsZDIwGBQgASgFOgEwEg8KB2ZpZWxkMjQYGCABKAkSQQoHZmll", + "bGQzMRgfIAEoCzIwLnVuaXR0ZXN0X2dvb2dsZV9zaXplLlNpemVNZXNzYWdl", + "Mkdyb3VwZWRNZXNzYWdlIt4BChpTaXplTWVzc2FnZTJHcm91cGVkTWVzc2Fn", + "ZRIOCgZmaWVsZDEYASABKAISDgoGZmllbGQyGAIgASgCEhEKBmZpZWxkMxgD", + "IAEoAjoBMBIOCgZmaWVsZDQYBCABKAgSDgoGZmllbGQ1GAUgASgIEhQKBmZp", + "ZWxkNhgGIAEoCDoEdHJ1ZRIVCgZmaWVsZDcYByABKAg6BWZhbHNlEg4KBmZp", + "ZWxkOBgIIAEoAhIOCgZmaWVsZDkYCSABKAgSDwoHZmllbGQxMBgKIAEoAhIP", + "CgdmaWVsZDExGAsgASgDQlFCCkdvb2dsZVNpemVIAsI+QAohR29vZ2xlLlBy", + "b3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEhtVbml0VGVzdEdvb2dsZVNpemVQ", + "cm90b0ZpbGU=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_unittest_google_size_SizeMessage1__Descriptor = Descriptor.MessageTypes[0]; + internal__static_unittest_google_size_SizeMessage1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_size_SizeMessage1__Descriptor, + new string[] { "Field1", "Field9", "Field18", "Field80", "Field81", "Field2", "Field3", "Field280", "Field6", "Field22", "Field4", "Field5", "Field59", "Field7", "Field16", "Field130", "Field12", "Field17", "Field13", "Field14", "Field104", "Field100", "Field101", "Field102", "Field103", "Field29", "Field30", "Field60", "Field271", "Field272", "Field150", "Field23", "Field24", "Field25", "Field15", "Field78", "Field67", "Field68", "Field128", "Field129", "Field131", }); + internal__static_unittest_google_size_SizeMessage1SubMessage__Descriptor = Descriptor.MessageTypes[1]; + internal__static_unittest_google_size_SizeMessage1SubMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_size_SizeMessage1SubMessage__Descriptor, + new string[] { "Field1", "Field2", "Field3", "Field15", "Field12", "Field13", "Field14", "Field16", "Field19", "Field20", "Field28", "Field21", "Field22", "Field23", "Field206", "Field203", "Field204", "Field205", "Field207", "Field300", }); + internal__static_unittest_google_size_SizeMessage2__Descriptor = Descriptor.MessageTypes[2]; + internal__static_unittest_google_size_SizeMessage2__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_size_SizeMessage2__Descriptor, + new string[] { "Field1", "Field3", "Field4", "Field30", "Field75", "Field6", "Field2", "Field21", "Field71", "Field25", "Field109", "Field210", "Field211", "Field212", "Field213", "Field216", "Field217", "Field218", "Field220", "Field221", "Field222", "Field63", "Group1", "Field128", "Field131", "Field127", "Field129", "Field130", "Field205", "Field206", }); + internal__static_unittest_google_size_SizeMessage2_Group1__Descriptor = internal__static_unittest_google_size_SizeMessage2__Descriptor.NestedTypes[0]; + internal__static_unittest_google_size_SizeMessage2_Group1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_size_SizeMessage2_Group1__Descriptor, + new string[] { "Field11", "Field26", "Field12", "Field13", "Field14", "Field15", "Field5", "Field27", "Field28", "Field29", "Field16", "Field22", "Field73", "Field20", "Field24", "Field31", }); + internal__static_unittest_google_size_SizeMessage2GroupedMessage__Descriptor = Descriptor.MessageTypes[3]; + internal__static_unittest_google_size_SizeMessage2GroupedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_size_SizeMessage2GroupedMessage__Descriptor, + new string[] { "Field1", "Field2", "Field3", "Field4", "Field5", "Field6", "Field7", "Field8", "Field9", "Field10", "Field11", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SizeMessage1 : pb::GeneratedMessage { + private SizeMessage1() { } + private static readonly SizeMessage1 defaultInstance = new SizeMessage1().MakeReadOnly(); + public static SizeMessage1 DefaultInstance { + get { return defaultInstance; } + } + + public override SizeMessage1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SizeMessage1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage1__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private string field1_ = ""; + public bool HasField1 { + get { return hasField1; } + } + public string Field1 { + get { return field1_; } + } + + public const int Field9FieldNumber = 9; + private bool hasField9; + private string field9_ = ""; + public bool HasField9 { + get { return hasField9; } + } + public string Field9 { + get { return field9_; } + } + + public const int Field18FieldNumber = 18; + private bool hasField18; + private string field18_ = ""; + public bool HasField18 { + get { return hasField18; } + } + public string Field18 { + get { return field18_; } + } + + public const int Field80FieldNumber = 80; + private bool hasField80; + private bool field80_; + public bool HasField80 { + get { return hasField80; } + } + public bool Field80 { + get { return field80_; } + } + + public const int Field81FieldNumber = 81; + private bool hasField81; + private bool field81_ = true; + public bool HasField81 { + get { return hasField81; } + } + public bool Field81 { + get { return field81_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private int field2_; + public bool HasField2 { + get { return hasField2; } + } + public int Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private int field3_; + public bool HasField3 { + get { return hasField3; } + } + public int Field3 { + get { return field3_; } + } + + public const int Field280FieldNumber = 280; + private bool hasField280; + private int field280_; + public bool HasField280 { + get { return hasField280; } + } + public int Field280 { + get { return field280_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private int field6_; + public bool HasField6 { + get { return hasField6; } + } + public int Field6 { + get { return field6_; } + } + + public const int Field22FieldNumber = 22; + private bool hasField22; + private long field22_; + public bool HasField22 { + get { return hasField22; } + } + public long Field22 { + get { return field22_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private string field4_ = ""; + public bool HasField4 { + get { return hasField4; } + } + public string Field4 { + get { return field4_; } + } + + public const int Field5FieldNumber = 5; + private pbc::PopsicleList field5_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList Field5List { + get { return pbc::Lists.AsReadOnly(field5_); } + } + public int Field5Count { + get { return field5_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetField5(int index) { + return field5_[index]; + } + + public const int Field59FieldNumber = 59; + private bool hasField59; + private bool field59_; + public bool HasField59 { + get { return hasField59; } + } + public bool Field59 { + get { return field59_; } + } + + public const int Field7FieldNumber = 7; + private bool hasField7; + private string field7_ = ""; + public bool HasField7 { + get { return hasField7; } + } + public string Field7 { + get { return field7_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private int field16_; + public bool HasField16 { + get { return hasField16; } + } + public int Field16 { + get { return field16_; } + } + + public const int Field130FieldNumber = 130; + private bool hasField130; + private int field130_; + public bool HasField130 { + get { return hasField130; } + } + public int Field130 { + get { return field130_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private bool field12_ = true; + public bool HasField12 { + get { return hasField12; } + } + public bool Field12 { + get { return field12_; } + } + + public const int Field17FieldNumber = 17; + private bool hasField17; + private bool field17_ = true; + public bool HasField17 { + get { return hasField17; } + } + public bool Field17 { + get { return field17_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private bool field13_ = true; + public bool HasField13 { + get { return hasField13; } + } + public bool Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private bool hasField14; + private bool field14_ = true; + public bool HasField14 { + get { return hasField14; } + } + public bool Field14 { + get { return field14_; } + } + + public const int Field104FieldNumber = 104; + private bool hasField104; + private int field104_; + public bool HasField104 { + get { return hasField104; } + } + public int Field104 { + get { return field104_; } + } + + public const int Field100FieldNumber = 100; + private bool hasField100; + private int field100_; + public bool HasField100 { + get { return hasField100; } + } + public int Field100 { + get { return field100_; } + } + + public const int Field101FieldNumber = 101; + private bool hasField101; + private int field101_; + public bool HasField101 { + get { return hasField101; } + } + public int Field101 { + get { return field101_; } + } + + public const int Field102FieldNumber = 102; + private bool hasField102; + private string field102_ = ""; + public bool HasField102 { + get { return hasField102; } + } + public string Field102 { + get { return field102_; } + } + + public const int Field103FieldNumber = 103; + private bool hasField103; + private string field103_ = ""; + public bool HasField103 { + get { return hasField103; } + } + public string Field103 { + get { return field103_; } + } + + public const int Field29FieldNumber = 29; + private bool hasField29; + private int field29_; + public bool HasField29 { + get { return hasField29; } + } + public int Field29 { + get { return field29_; } + } + + public const int Field30FieldNumber = 30; + private bool hasField30; + private bool field30_; + public bool HasField30 { + get { return hasField30; } + } + public bool Field30 { + get { return field30_; } + } + + public const int Field60FieldNumber = 60; + private bool hasField60; + private int field60_ = -1; + public bool HasField60 { + get { return hasField60; } + } + public int Field60 { + get { return field60_; } + } + + public const int Field271FieldNumber = 271; + private bool hasField271; + private int field271_ = -1; + public bool HasField271 { + get { return hasField271; } + } + public int Field271 { + get { return field271_; } + } + + public const int Field272FieldNumber = 272; + private bool hasField272; + private int field272_ = -1; + public bool HasField272 { + get { return hasField272; } + } + public int Field272 { + get { return field272_; } + } + + public const int Field150FieldNumber = 150; + private bool hasField150; + private int field150_; + public bool HasField150 { + get { return hasField150; } + } + public int Field150 { + get { return field150_; } + } + + public const int Field23FieldNumber = 23; + private bool hasField23; + private int field23_; + public bool HasField23 { + get { return hasField23; } + } + public int Field23 { + get { return field23_; } + } + + public const int Field24FieldNumber = 24; + private bool hasField24; + private bool field24_; + public bool HasField24 { + get { return hasField24; } + } + public bool Field24 { + get { return field24_; } + } + + public const int Field25FieldNumber = 25; + private bool hasField25; + private int field25_; + public bool HasField25 { + get { return hasField25; } + } + public int Field25 { + get { return field25_; } + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage field15_; + public bool HasField15 { + get { return hasField15; } + } + public global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage Field15 { + get { return field15_ ?? global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.DefaultInstance; } + } + + public const int Field78FieldNumber = 78; + private bool hasField78; + private bool field78_; + public bool HasField78 { + get { return hasField78; } + } + public bool Field78 { + get { return field78_; } + } + + public const int Field67FieldNumber = 67; + private bool hasField67; + private int field67_; + public bool HasField67 { + get { return hasField67; } + } + public int Field67 { + get { return field67_; } + } + + public const int Field68FieldNumber = 68; + private bool hasField68; + private int field68_; + public bool HasField68 { + get { return hasField68; } + } + public int Field68 { + get { return field68_; } + } + + public const int Field128FieldNumber = 128; + private bool hasField128; + private int field128_; + public bool HasField128 { + get { return hasField128; } + } + public int Field128 { + get { return field128_; } + } + + public const int Field129FieldNumber = 129; + private bool hasField129; + private string field129_ = "xxxxxxxxxxxxxxxxxxxxx"; + public bool HasField129 { + get { return hasField129; } + } + public string Field129 { + get { return field129_; } + } + + public const int Field131FieldNumber = 131; + private bool hasField131; + private int field131_; + public bool HasField131 { + get { return hasField131; } + } + public int Field131 { + get { return field131_; } + } + + public static SizeMessage1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SizeMessage1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SizeMessage1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SizeMessage1 MakeReadOnly() { + field5_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SizeMessage1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SizeMessage1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SizeMessage1 result; + + private SizeMessage1 PrepareBuilder() { + if (resultIsReadOnly) { + SizeMessage1 original = result; + result = new SizeMessage1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SizeMessage1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage1.Descriptor; } + } + + public override SizeMessage1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage1.DefaultInstance; } + } + + public override SizeMessage1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public string Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = ""; + return this; + } + + public bool HasField9 { + get { return result.hasField9; } + } + public string Field9 { + get { return result.Field9; } + set { SetField9(value); } + } + public Builder SetField9(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField9 = true; + result.field9_ = value; + return this; + } + public Builder ClearField9() { + PrepareBuilder(); + result.hasField9 = false; + result.field9_ = ""; + return this; + } + + public bool HasField18 { + get { return result.hasField18; } + } + public string Field18 { + get { return result.Field18; } + set { SetField18(value); } + } + public Builder SetField18(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField18 = true; + result.field18_ = value; + return this; + } + public Builder ClearField18() { + PrepareBuilder(); + result.hasField18 = false; + result.field18_ = ""; + return this; + } + + public bool HasField80 { + get { return result.hasField80; } + } + public bool Field80 { + get { return result.Field80; } + set { SetField80(value); } + } + public Builder SetField80(bool value) { + PrepareBuilder(); + result.hasField80 = true; + result.field80_ = value; + return this; + } + public Builder ClearField80() { + PrepareBuilder(); + result.hasField80 = false; + result.field80_ = false; + return this; + } + + public bool HasField81 { + get { return result.hasField81; } + } + public bool Field81 { + get { return result.Field81; } + set { SetField81(value); } + } + public Builder SetField81(bool value) { + PrepareBuilder(); + result.hasField81 = true; + result.field81_ = value; + return this; + } + public Builder ClearField81() { + PrepareBuilder(); + result.hasField81 = false; + result.field81_ = true; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public int Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(int value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public int Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(int value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0; + return this; + } + + public bool HasField280 { + get { return result.hasField280; } + } + public int Field280 { + get { return result.Field280; } + set { SetField280(value); } + } + public Builder SetField280(int value) { + PrepareBuilder(); + result.hasField280 = true; + result.field280_ = value; + return this; + } + public Builder ClearField280() { + PrepareBuilder(); + result.hasField280 = false; + result.field280_ = 0; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public int Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(int value) { + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = 0; + return this; + } + + public bool HasField22 { + get { return result.hasField22; } + } + public long Field22 { + get { return result.Field22; } + set { SetField22(value); } + } + public Builder SetField22(long value) { + PrepareBuilder(); + result.hasField22 = true; + result.field22_ = value; + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.hasField22 = false; + result.field22_ = 0L; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public string Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = ""; + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList Field5List { + get { return PrepareBuilder().field5_; } + } + public int Field5Count { + get { return result.Field5Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetField5(int index) { + return result.GetField5(index); + } + [global::System.CLSCompliant(false)] + public Builder SetField5(int index, ulong value) { + PrepareBuilder(); + result.field5_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddField5(ulong value) { + PrepareBuilder(); + result.field5_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeField5(scg::IEnumerable values) { + PrepareBuilder(); + result.field5_.Add(values); + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.field5_.Clear(); + return this; + } + + public bool HasField59 { + get { return result.hasField59; } + } + public bool Field59 { + get { return result.Field59; } + set { SetField59(value); } + } + public Builder SetField59(bool value) { + PrepareBuilder(); + result.hasField59 = true; + result.field59_ = value; + return this; + } + public Builder ClearField59() { + PrepareBuilder(); + result.hasField59 = false; + result.field59_ = false; + return this; + } + + public bool HasField7 { + get { return result.hasField7; } + } + public string Field7 { + get { return result.Field7; } + set { SetField7(value); } + } + public Builder SetField7(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField7 = true; + result.field7_ = value; + return this; + } + public Builder ClearField7() { + PrepareBuilder(); + result.hasField7 = false; + result.field7_ = ""; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public int Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(int value) { + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = 0; + return this; + } + + public bool HasField130 { + get { return result.hasField130; } + } + public int Field130 { + get { return result.Field130; } + set { SetField130(value); } + } + public Builder SetField130(int value) { + PrepareBuilder(); + result.hasField130 = true; + result.field130_ = value; + return this; + } + public Builder ClearField130() { + PrepareBuilder(); + result.hasField130 = false; + result.field130_ = 0; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public bool Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(bool value) { + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = true; + return this; + } + + public bool HasField17 { + get { return result.hasField17; } + } + public bool Field17 { + get { return result.Field17; } + set { SetField17(value); } + } + public Builder SetField17(bool value) { + PrepareBuilder(); + result.hasField17 = true; + result.field17_ = value; + return this; + } + public Builder ClearField17() { + PrepareBuilder(); + result.hasField17 = false; + result.field17_ = true; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public bool Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(bool value) { + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = true; + return this; + } + + public bool HasField14 { + get { return result.hasField14; } + } + public bool Field14 { + get { return result.Field14; } + set { SetField14(value); } + } + public Builder SetField14(bool value) { + PrepareBuilder(); + result.hasField14 = true; + result.field14_ = value; + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.hasField14 = false; + result.field14_ = true; + return this; + } + + public bool HasField104 { + get { return result.hasField104; } + } + public int Field104 { + get { return result.Field104; } + set { SetField104(value); } + } + public Builder SetField104(int value) { + PrepareBuilder(); + result.hasField104 = true; + result.field104_ = value; + return this; + } + public Builder ClearField104() { + PrepareBuilder(); + result.hasField104 = false; + result.field104_ = 0; + return this; + } + + public bool HasField100 { + get { return result.hasField100; } + } + public int Field100 { + get { return result.Field100; } + set { SetField100(value); } + } + public Builder SetField100(int value) { + PrepareBuilder(); + result.hasField100 = true; + result.field100_ = value; + return this; + } + public Builder ClearField100() { + PrepareBuilder(); + result.hasField100 = false; + result.field100_ = 0; + return this; + } + + public bool HasField101 { + get { return result.hasField101; } + } + public int Field101 { + get { return result.Field101; } + set { SetField101(value); } + } + public Builder SetField101(int value) { + PrepareBuilder(); + result.hasField101 = true; + result.field101_ = value; + return this; + } + public Builder ClearField101() { + PrepareBuilder(); + result.hasField101 = false; + result.field101_ = 0; + return this; + } + + public bool HasField102 { + get { return result.hasField102; } + } + public string Field102 { + get { return result.Field102; } + set { SetField102(value); } + } + public Builder SetField102(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField102 = true; + result.field102_ = value; + return this; + } + public Builder ClearField102() { + PrepareBuilder(); + result.hasField102 = false; + result.field102_ = ""; + return this; + } + + public bool HasField103 { + get { return result.hasField103; } + } + public string Field103 { + get { return result.Field103; } + set { SetField103(value); } + } + public Builder SetField103(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField103 = true; + result.field103_ = value; + return this; + } + public Builder ClearField103() { + PrepareBuilder(); + result.hasField103 = false; + result.field103_ = ""; + return this; + } + + public bool HasField29 { + get { return result.hasField29; } + } + public int Field29 { + get { return result.Field29; } + set { SetField29(value); } + } + public Builder SetField29(int value) { + PrepareBuilder(); + result.hasField29 = true; + result.field29_ = value; + return this; + } + public Builder ClearField29() { + PrepareBuilder(); + result.hasField29 = false; + result.field29_ = 0; + return this; + } + + public bool HasField30 { + get { return result.hasField30; } + } + public bool Field30 { + get { return result.Field30; } + set { SetField30(value); } + } + public Builder SetField30(bool value) { + PrepareBuilder(); + result.hasField30 = true; + result.field30_ = value; + return this; + } + public Builder ClearField30() { + PrepareBuilder(); + result.hasField30 = false; + result.field30_ = false; + return this; + } + + public bool HasField60 { + get { return result.hasField60; } + } + public int Field60 { + get { return result.Field60; } + set { SetField60(value); } + } + public Builder SetField60(int value) { + PrepareBuilder(); + result.hasField60 = true; + result.field60_ = value; + return this; + } + public Builder ClearField60() { + PrepareBuilder(); + result.hasField60 = false; + result.field60_ = -1; + return this; + } + + public bool HasField271 { + get { return result.hasField271; } + } + public int Field271 { + get { return result.Field271; } + set { SetField271(value); } + } + public Builder SetField271(int value) { + PrepareBuilder(); + result.hasField271 = true; + result.field271_ = value; + return this; + } + public Builder ClearField271() { + PrepareBuilder(); + result.hasField271 = false; + result.field271_ = -1; + return this; + } + + public bool HasField272 { + get { return result.hasField272; } + } + public int Field272 { + get { return result.Field272; } + set { SetField272(value); } + } + public Builder SetField272(int value) { + PrepareBuilder(); + result.hasField272 = true; + result.field272_ = value; + return this; + } + public Builder ClearField272() { + PrepareBuilder(); + result.hasField272 = false; + result.field272_ = -1; + return this; + } + + public bool HasField150 { + get { return result.hasField150; } + } + public int Field150 { + get { return result.Field150; } + set { SetField150(value); } + } + public Builder SetField150(int value) { + PrepareBuilder(); + result.hasField150 = true; + result.field150_ = value; + return this; + } + public Builder ClearField150() { + PrepareBuilder(); + result.hasField150 = false; + result.field150_ = 0; + return this; + } + + public bool HasField23 { + get { return result.hasField23; } + } + public int Field23 { + get { return result.Field23; } + set { SetField23(value); } + } + public Builder SetField23(int value) { + PrepareBuilder(); + result.hasField23 = true; + result.field23_ = value; + return this; + } + public Builder ClearField23() { + PrepareBuilder(); + result.hasField23 = false; + result.field23_ = 0; + return this; + } + + public bool HasField24 { + get { return result.hasField24; } + } + public bool Field24 { + get { return result.Field24; } + set { SetField24(value); } + } + public Builder SetField24(bool value) { + PrepareBuilder(); + result.hasField24 = true; + result.field24_ = value; + return this; + } + public Builder ClearField24() { + PrepareBuilder(); + result.hasField24 = false; + result.field24_ = false; + return this; + } + + public bool HasField25 { + get { return result.hasField25; } + } + public int Field25 { + get { return result.Field25; } + set { SetField25(value); } + } + public Builder SetField25(int value) { + PrepareBuilder(); + result.hasField25 = true; + result.field25_ = value; + return this; + } + public Builder ClearField25() { + PrepareBuilder(); + result.hasField25 = false; + result.field25_ = 0; + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + public global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + public Builder SetField15(global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder SetField15(global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = builderForValue.Build(); + return this; + } + public Builder MergeField15(global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasField15 && + result.field15_ != global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.DefaultInstance) { + result.field15_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.CreateBuilder(result.field15_).MergeFrom(value).BuildPartial(); + } else { + result.field15_ = value; + } + result.hasField15 = true; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = null; + return this; + } + + public bool HasField78 { + get { return result.hasField78; } + } + public bool Field78 { + get { return result.Field78; } + set { SetField78(value); } + } + public Builder SetField78(bool value) { + PrepareBuilder(); + result.hasField78 = true; + result.field78_ = value; + return this; + } + public Builder ClearField78() { + PrepareBuilder(); + result.hasField78 = false; + result.field78_ = false; + return this; + } + + public bool HasField67 { + get { return result.hasField67; } + } + public int Field67 { + get { return result.Field67; } + set { SetField67(value); } + } + public Builder SetField67(int value) { + PrepareBuilder(); + result.hasField67 = true; + result.field67_ = value; + return this; + } + public Builder ClearField67() { + PrepareBuilder(); + result.hasField67 = false; + result.field67_ = 0; + return this; + } + + public bool HasField68 { + get { return result.hasField68; } + } + public int Field68 { + get { return result.Field68; } + set { SetField68(value); } + } + public Builder SetField68(int value) { + PrepareBuilder(); + result.hasField68 = true; + result.field68_ = value; + return this; + } + public Builder ClearField68() { + PrepareBuilder(); + result.hasField68 = false; + result.field68_ = 0; + return this; + } + + public bool HasField128 { + get { return result.hasField128; } + } + public int Field128 { + get { return result.Field128; } + set { SetField128(value); } + } + public Builder SetField128(int value) { + PrepareBuilder(); + result.hasField128 = true; + result.field128_ = value; + return this; + } + public Builder ClearField128() { + PrepareBuilder(); + result.hasField128 = false; + result.field128_ = 0; + return this; + } + + public bool HasField129 { + get { return result.hasField129; } + } + public string Field129 { + get { return result.Field129; } + set { SetField129(value); } + } + public Builder SetField129(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField129 = true; + result.field129_ = value; + return this; + } + public Builder ClearField129() { + PrepareBuilder(); + result.hasField129 = false; + result.field129_ = "xxxxxxxxxxxxxxxxxxxxx"; + return this; + } + + public bool HasField131 { + get { return result.hasField131; } + } + public int Field131 { + get { return result.Field131; } + set { SetField131(value); } + } + public Builder SetField131(int value) { + PrepareBuilder(); + result.hasField131 = true; + result.field131_ = value; + return this; + } + public Builder ClearField131() { + PrepareBuilder(); + result.hasField131 = false; + result.field131_ = 0; + return this; + } + } + static SizeMessage1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SizeMessage1SubMessage : pb::GeneratedMessage { + private SizeMessage1SubMessage() { } + private static readonly SizeMessage1SubMessage defaultInstance = new SizeMessage1SubMessage().MakeReadOnly(); + public static SizeMessage1SubMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SizeMessage1SubMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SizeMessage1SubMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage1SubMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage1SubMessage__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private int field1_; + public bool HasField1 { + get { return hasField1; } + } + public int Field1 { + get { return field1_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private int field2_; + public bool HasField2 { + get { return hasField2; } + } + public int Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private int field3_; + public bool HasField3 { + get { return hasField3; } + } + public int Field3 { + get { return field3_; } + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private string field15_ = ""; + public bool HasField15 { + get { return hasField15; } + } + public string Field15 { + get { return field15_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private bool field12_ = true; + public bool HasField12 { + get { return hasField12; } + } + public bool Field12 { + get { return field12_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private long field13_; + public bool HasField13 { + get { return hasField13; } + } + public long Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private bool hasField14; + private long field14_; + public bool HasField14 { + get { return hasField14; } + } + public long Field14 { + get { return field14_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private int field16_; + public bool HasField16 { + get { return hasField16; } + } + public int Field16 { + get { return field16_; } + } + + public const int Field19FieldNumber = 19; + private bool hasField19; + private int field19_ = 2; + public bool HasField19 { + get { return hasField19; } + } + public int Field19 { + get { return field19_; } + } + + public const int Field20FieldNumber = 20; + private bool hasField20; + private bool field20_ = true; + public bool HasField20 { + get { return hasField20; } + } + public bool Field20 { + get { return field20_; } + } + + public const int Field28FieldNumber = 28; + private bool hasField28; + private bool field28_ = true; + public bool HasField28 { + get { return hasField28; } + } + public bool Field28 { + get { return field28_; } + } + + public const int Field21FieldNumber = 21; + private bool hasField21; + private ulong field21_; + public bool HasField21 { + get { return hasField21; } + } + [global::System.CLSCompliant(false)] + public ulong Field21 { + get { return field21_; } + } + + public const int Field22FieldNumber = 22; + private bool hasField22; + private int field22_; + public bool HasField22 { + get { return hasField22; } + } + public int Field22 { + get { return field22_; } + } + + public const int Field23FieldNumber = 23; + private bool hasField23; + private bool field23_; + public bool HasField23 { + get { return hasField23; } + } + public bool Field23 { + get { return field23_; } + } + + public const int Field206FieldNumber = 206; + private bool hasField206; + private bool field206_; + public bool HasField206 { + get { return hasField206; } + } + public bool Field206 { + get { return field206_; } + } + + public const int Field203FieldNumber = 203; + private bool hasField203; + private uint field203_; + public bool HasField203 { + get { return hasField203; } + } + [global::System.CLSCompliant(false)] + public uint Field203 { + get { return field203_; } + } + + public const int Field204FieldNumber = 204; + private bool hasField204; + private int field204_; + public bool HasField204 { + get { return hasField204; } + } + public int Field204 { + get { return field204_; } + } + + public const int Field205FieldNumber = 205; + private bool hasField205; + private string field205_ = ""; + public bool HasField205 { + get { return hasField205; } + } + public string Field205 { + get { return field205_; } + } + + public const int Field207FieldNumber = 207; + private bool hasField207; + private ulong field207_; + public bool HasField207 { + get { return hasField207; } + } + [global::System.CLSCompliant(false)] + public ulong Field207 { + get { return field207_; } + } + + public const int Field300FieldNumber = 300; + private bool hasField300; + private ulong field300_; + public bool HasField300 { + get { return hasField300; } + } + [global::System.CLSCompliant(false)] + public ulong Field300 { + get { return field300_; } + } + + public static SizeMessage1SubMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SizeMessage1SubMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage1SubMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SizeMessage1SubMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SizeMessage1SubMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SizeMessage1SubMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SizeMessage1SubMessage result; + + private SizeMessage1SubMessage PrepareBuilder() { + if (resultIsReadOnly) { + SizeMessage1SubMessage original = result; + result = new SizeMessage1SubMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SizeMessage1SubMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.Descriptor; } + } + + public override SizeMessage1SubMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage1SubMessage.DefaultInstance; } + } + + public override SizeMessage1SubMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public int Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(int value) { + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = 0; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public int Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(int value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public int Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(int value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0; + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + public string Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + public Builder SetField15(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = ""; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public bool Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(bool value) { + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = true; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public long Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(long value) { + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = 0L; + return this; + } + + public bool HasField14 { + get { return result.hasField14; } + } + public long Field14 { + get { return result.Field14; } + set { SetField14(value); } + } + public Builder SetField14(long value) { + PrepareBuilder(); + result.hasField14 = true; + result.field14_ = value; + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.hasField14 = false; + result.field14_ = 0L; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public int Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(int value) { + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = 0; + return this; + } + + public bool HasField19 { + get { return result.hasField19; } + } + public int Field19 { + get { return result.Field19; } + set { SetField19(value); } + } + public Builder SetField19(int value) { + PrepareBuilder(); + result.hasField19 = true; + result.field19_ = value; + return this; + } + public Builder ClearField19() { + PrepareBuilder(); + result.hasField19 = false; + result.field19_ = 2; + return this; + } + + public bool HasField20 { + get { return result.hasField20; } + } + public bool Field20 { + get { return result.Field20; } + set { SetField20(value); } + } + public Builder SetField20(bool value) { + PrepareBuilder(); + result.hasField20 = true; + result.field20_ = value; + return this; + } + public Builder ClearField20() { + PrepareBuilder(); + result.hasField20 = false; + result.field20_ = true; + return this; + } + + public bool HasField28 { + get { return result.hasField28; } + } + public bool Field28 { + get { return result.Field28; } + set { SetField28(value); } + } + public Builder SetField28(bool value) { + PrepareBuilder(); + result.hasField28 = true; + result.field28_ = value; + return this; + } + public Builder ClearField28() { + PrepareBuilder(); + result.hasField28 = false; + result.field28_ = true; + return this; + } + + public bool HasField21 { + get { return result.hasField21; } + } + [global::System.CLSCompliant(false)] + public ulong Field21 { + get { return result.Field21; } + set { SetField21(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField21(ulong value) { + PrepareBuilder(); + result.hasField21 = true; + result.field21_ = value; + return this; + } + public Builder ClearField21() { + PrepareBuilder(); + result.hasField21 = false; + result.field21_ = 0; + return this; + } + + public bool HasField22 { + get { return result.hasField22; } + } + public int Field22 { + get { return result.Field22; } + set { SetField22(value); } + } + public Builder SetField22(int value) { + PrepareBuilder(); + result.hasField22 = true; + result.field22_ = value; + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.hasField22 = false; + result.field22_ = 0; + return this; + } + + public bool HasField23 { + get { return result.hasField23; } + } + public bool Field23 { + get { return result.Field23; } + set { SetField23(value); } + } + public Builder SetField23(bool value) { + PrepareBuilder(); + result.hasField23 = true; + result.field23_ = value; + return this; + } + public Builder ClearField23() { + PrepareBuilder(); + result.hasField23 = false; + result.field23_ = false; + return this; + } + + public bool HasField206 { + get { return result.hasField206; } + } + public bool Field206 { + get { return result.Field206; } + set { SetField206(value); } + } + public Builder SetField206(bool value) { + PrepareBuilder(); + result.hasField206 = true; + result.field206_ = value; + return this; + } + public Builder ClearField206() { + PrepareBuilder(); + result.hasField206 = false; + result.field206_ = false; + return this; + } + + public bool HasField203 { + get { return result.hasField203; } + } + [global::System.CLSCompliant(false)] + public uint Field203 { + get { return result.Field203; } + set { SetField203(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField203(uint value) { + PrepareBuilder(); + result.hasField203 = true; + result.field203_ = value; + return this; + } + public Builder ClearField203() { + PrepareBuilder(); + result.hasField203 = false; + result.field203_ = 0; + return this; + } + + public bool HasField204 { + get { return result.hasField204; } + } + public int Field204 { + get { return result.Field204; } + set { SetField204(value); } + } + public Builder SetField204(int value) { + PrepareBuilder(); + result.hasField204 = true; + result.field204_ = value; + return this; + } + public Builder ClearField204() { + PrepareBuilder(); + result.hasField204 = false; + result.field204_ = 0; + return this; + } + + public bool HasField205 { + get { return result.hasField205; } + } + public string Field205 { + get { return result.Field205; } + set { SetField205(value); } + } + public Builder SetField205(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField205 = true; + result.field205_ = value; + return this; + } + public Builder ClearField205() { + PrepareBuilder(); + result.hasField205 = false; + result.field205_ = ""; + return this; + } + + public bool HasField207 { + get { return result.hasField207; } + } + [global::System.CLSCompliant(false)] + public ulong Field207 { + get { return result.Field207; } + set { SetField207(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField207(ulong value) { + PrepareBuilder(); + result.hasField207 = true; + result.field207_ = value; + return this; + } + public Builder ClearField207() { + PrepareBuilder(); + result.hasField207 = false; + result.field207_ = 0UL; + return this; + } + + public bool HasField300 { + get { return result.hasField300; } + } + [global::System.CLSCompliant(false)] + public ulong Field300 { + get { return result.Field300; } + set { SetField300(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField300(ulong value) { + PrepareBuilder(); + result.hasField300 = true; + result.field300_ = value; + return this; + } + public Builder ClearField300() { + PrepareBuilder(); + result.hasField300 = false; + result.field300_ = 0UL; + return this; + } + } + static SizeMessage1SubMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SizeMessage2 : pb::GeneratedMessage { + private SizeMessage2() { } + private static readonly SizeMessage2 defaultInstance = new SizeMessage2().MakeReadOnly(); + public static SizeMessage2 DefaultInstance { + get { return defaultInstance; } + } + + public override SizeMessage2 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SizeMessage2 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage2__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage2__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Group1 : pb::GeneratedMessage { + private Group1() { } + private static readonly Group1 defaultInstance = new Group1().MakeReadOnly(); + public static Group1 DefaultInstance { + get { return defaultInstance; } + } + + public override Group1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Group1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage2_Group1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage2_Group1__FieldAccessorTable; } + } + + public const int Field11FieldNumber = 11; + private bool hasField11; + private float field11_; + public bool HasField11 { + get { return hasField11; } + } + public float Field11 { + get { return field11_; } + } + + public const int Field26FieldNumber = 26; + private bool hasField26; + private float field26_; + public bool HasField26 { + get { return hasField26; } + } + public float Field26 { + get { return field26_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private string field12_ = ""; + public bool HasField12 { + get { return hasField12; } + } + public string Field12 { + get { return field12_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private string field13_ = ""; + public bool HasField13 { + get { return hasField13; } + } + public string Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private pbc::PopsicleList field14_ = new pbc::PopsicleList(); + public scg::IList Field14List { + get { return pbc::Lists.AsReadOnly(field14_); } + } + public int Field14Count { + get { return field14_.Count; } + } + public string GetField14(int index) { + return field14_[index]; + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private ulong field15_; + public bool HasField15 { + get { return hasField15; } + } + [global::System.CLSCompliant(false)] + public ulong Field15 { + get { return field15_; } + } + + public const int Field5FieldNumber = 5; + private bool hasField5; + private int field5_; + public bool HasField5 { + get { return hasField5; } + } + public int Field5 { + get { return field5_; } + } + + public const int Field27FieldNumber = 27; + private bool hasField27; + private string field27_ = ""; + public bool HasField27 { + get { return hasField27; } + } + public string Field27 { + get { return field27_; } + } + + public const int Field28FieldNumber = 28; + private bool hasField28; + private int field28_; + public bool HasField28 { + get { return hasField28; } + } + public int Field28 { + get { return field28_; } + } + + public const int Field29FieldNumber = 29; + private bool hasField29; + private string field29_ = ""; + public bool HasField29 { + get { return hasField29; } + } + public string Field29 { + get { return field29_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private string field16_ = ""; + public bool HasField16 { + get { return hasField16; } + } + public string Field16 { + get { return field16_; } + } + + public const int Field22FieldNumber = 22; + private pbc::PopsicleList field22_ = new pbc::PopsicleList(); + public scg::IList Field22List { + get { return pbc::Lists.AsReadOnly(field22_); } + } + public int Field22Count { + get { return field22_.Count; } + } + public string GetField22(int index) { + return field22_[index]; + } + + public const int Field73FieldNumber = 73; + private pbc::PopsicleList field73_ = new pbc::PopsicleList(); + public scg::IList Field73List { + get { return pbc::Lists.AsReadOnly(field73_); } + } + public int Field73Count { + get { return field73_.Count; } + } + public int GetField73(int index) { + return field73_[index]; + } + + public const int Field20FieldNumber = 20; + private bool hasField20; + private int field20_; + public bool HasField20 { + get { return hasField20; } + } + public int Field20 { + get { return field20_; } + } + + public const int Field24FieldNumber = 24; + private bool hasField24; + private string field24_ = ""; + public bool HasField24 { + get { return hasField24; } + } + public string Field24 { + get { return field24_; } + } + + public const int Field31FieldNumber = 31; + private bool hasField31; + private global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage field31_; + public bool HasField31 { + get { return hasField31; } + } + public global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage Field31 { + get { return field31_ ?? global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.DefaultInstance; } + } + + public static Group1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Group1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Group1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Group1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Group1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Group1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Group1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Group1 MakeReadOnly() { + field14_.MakeReadOnly(); + field22_.MakeReadOnly(); + field73_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Group1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Group1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Group1 result; + + private Group1 PrepareBuilder() { + if (resultIsReadOnly) { + Group1 original = result; + result = new Group1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Group1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1.Descriptor; } + } + + public override Group1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1.DefaultInstance; } + } + + public override Group1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField11 { + get { return result.hasField11; } + } + public float Field11 { + get { return result.Field11; } + set { SetField11(value); } + } + public Builder SetField11(float value) { + PrepareBuilder(); + result.hasField11 = true; + result.field11_ = value; + return this; + } + public Builder ClearField11() { + PrepareBuilder(); + result.hasField11 = false; + result.field11_ = 0F; + return this; + } + + public bool HasField26 { + get { return result.hasField26; } + } + public float Field26 { + get { return result.Field26; } + set { SetField26(value); } + } + public Builder SetField26(float value) { + PrepareBuilder(); + result.hasField26 = true; + result.field26_ = value; + return this; + } + public Builder ClearField26() { + PrepareBuilder(); + result.hasField26 = false; + result.field26_ = 0F; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public string Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = ""; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public string Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = ""; + return this; + } + + public pbc::IPopsicleList Field14List { + get { return PrepareBuilder().field14_; } + } + public int Field14Count { + get { return result.Field14Count; } + } + public string GetField14(int index) { + return result.GetField14(index); + } + public Builder SetField14(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field14_[index] = value; + return this; + } + public Builder AddField14(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field14_.Add(value); + return this; + } + public Builder AddRangeField14(scg::IEnumerable values) { + PrepareBuilder(); + result.field14_.Add(values); + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.field14_.Clear(); + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + [global::System.CLSCompliant(false)] + public ulong Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField15(ulong value) { + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = 0UL; + return this; + } + + public bool HasField5 { + get { return result.hasField5; } + } + public int Field5 { + get { return result.Field5; } + set { SetField5(value); } + } + public Builder SetField5(int value) { + PrepareBuilder(); + result.hasField5 = true; + result.field5_ = value; + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.hasField5 = false; + result.field5_ = 0; + return this; + } + + public bool HasField27 { + get { return result.hasField27; } + } + public string Field27 { + get { return result.Field27; } + set { SetField27(value); } + } + public Builder SetField27(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField27 = true; + result.field27_ = value; + return this; + } + public Builder ClearField27() { + PrepareBuilder(); + result.hasField27 = false; + result.field27_ = ""; + return this; + } + + public bool HasField28 { + get { return result.hasField28; } + } + public int Field28 { + get { return result.Field28; } + set { SetField28(value); } + } + public Builder SetField28(int value) { + PrepareBuilder(); + result.hasField28 = true; + result.field28_ = value; + return this; + } + public Builder ClearField28() { + PrepareBuilder(); + result.hasField28 = false; + result.field28_ = 0; + return this; + } + + public bool HasField29 { + get { return result.hasField29; } + } + public string Field29 { + get { return result.Field29; } + set { SetField29(value); } + } + public Builder SetField29(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField29 = true; + result.field29_ = value; + return this; + } + public Builder ClearField29() { + PrepareBuilder(); + result.hasField29 = false; + result.field29_ = ""; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public string Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = ""; + return this; + } + + public pbc::IPopsicleList Field22List { + get { return PrepareBuilder().field22_; } + } + public int Field22Count { + get { return result.Field22Count; } + } + public string GetField22(int index) { + return result.GetField22(index); + } + public Builder SetField22(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field22_[index] = value; + return this; + } + public Builder AddField22(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field22_.Add(value); + return this; + } + public Builder AddRangeField22(scg::IEnumerable values) { + PrepareBuilder(); + result.field22_.Add(values); + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.field22_.Clear(); + return this; + } + + public pbc::IPopsicleList Field73List { + get { return PrepareBuilder().field73_; } + } + public int Field73Count { + get { return result.Field73Count; } + } + public int GetField73(int index) { + return result.GetField73(index); + } + public Builder SetField73(int index, int value) { + PrepareBuilder(); + result.field73_[index] = value; + return this; + } + public Builder AddField73(int value) { + PrepareBuilder(); + result.field73_.Add(value); + return this; + } + public Builder AddRangeField73(scg::IEnumerable values) { + PrepareBuilder(); + result.field73_.Add(values); + return this; + } + public Builder ClearField73() { + PrepareBuilder(); + result.field73_.Clear(); + return this; + } + + public bool HasField20 { + get { return result.hasField20; } + } + public int Field20 { + get { return result.Field20; } + set { SetField20(value); } + } + public Builder SetField20(int value) { + PrepareBuilder(); + result.hasField20 = true; + result.field20_ = value; + return this; + } + public Builder ClearField20() { + PrepareBuilder(); + result.hasField20 = false; + result.field20_ = 0; + return this; + } + + public bool HasField24 { + get { return result.hasField24; } + } + public string Field24 { + get { return result.Field24; } + set { SetField24(value); } + } + public Builder SetField24(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField24 = true; + result.field24_ = value; + return this; + } + public Builder ClearField24() { + PrepareBuilder(); + result.hasField24 = false; + result.field24_ = ""; + return this; + } + + public bool HasField31 { + get { return result.hasField31; } + } + public global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage Field31 { + get { return result.Field31; } + set { SetField31(value); } + } + public Builder SetField31(global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField31 = true; + result.field31_ = value; + return this; + } + public Builder SetField31(global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasField31 = true; + result.field31_ = builderForValue.Build(); + return this; + } + public Builder MergeField31(global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasField31 && + result.field31_ != global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.DefaultInstance) { + result.field31_ = global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.CreateBuilder(result.field31_).MergeFrom(value).BuildPartial(); + } else { + result.field31_ = value; + } + result.hasField31 = true; + return this; + } + public Builder ClearField31() { + PrepareBuilder(); + result.hasField31 = false; + result.field31_ = null; + return this; + } + } + static Group1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int Field1FieldNumber = 1; + private bool hasField1; + private string field1_ = ""; + public bool HasField1 { + get { return hasField1; } + } + public string Field1 { + get { return field1_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private long field3_; + public bool HasField3 { + get { return hasField3; } + } + public long Field3 { + get { return field3_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private long field4_; + public bool HasField4 { + get { return hasField4; } + } + public long Field4 { + get { return field4_; } + } + + public const int Field30FieldNumber = 30; + private bool hasField30; + private long field30_; + public bool HasField30 { + get { return hasField30; } + } + public long Field30 { + get { return field30_; } + } + + public const int Field75FieldNumber = 75; + private bool hasField75; + private bool field75_; + public bool HasField75 { + get { return hasField75; } + } + public bool Field75 { + get { return field75_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private string field6_ = ""; + public bool HasField6 { + get { return hasField6; } + } + public string Field6 { + get { return field6_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private pb::ByteString field2_ = pb::ByteString.Empty; + public bool HasField2 { + get { return hasField2; } + } + public pb::ByteString Field2 { + get { return field2_; } + } + + public const int Field21FieldNumber = 21; + private bool hasField21; + private int field21_; + public bool HasField21 { + get { return hasField21; } + } + public int Field21 { + get { return field21_; } + } + + public const int Field71FieldNumber = 71; + private bool hasField71; + private int field71_; + public bool HasField71 { + get { return hasField71; } + } + public int Field71 { + get { return field71_; } + } + + public const int Field25FieldNumber = 25; + private bool hasField25; + private float field25_; + public bool HasField25 { + get { return hasField25; } + } + public float Field25 { + get { return field25_; } + } + + public const int Field109FieldNumber = 109; + private bool hasField109; + private int field109_; + public bool HasField109 { + get { return hasField109; } + } + public int Field109 { + get { return field109_; } + } + + public const int Field210FieldNumber = 210; + private bool hasField210; + private int field210_; + public bool HasField210 { + get { return hasField210; } + } + public int Field210 { + get { return field210_; } + } + + public const int Field211FieldNumber = 211; + private bool hasField211; + private int field211_; + public bool HasField211 { + get { return hasField211; } + } + public int Field211 { + get { return field211_; } + } + + public const int Field212FieldNumber = 212; + private bool hasField212; + private int field212_; + public bool HasField212 { + get { return hasField212; } + } + public int Field212 { + get { return field212_; } + } + + public const int Field213FieldNumber = 213; + private bool hasField213; + private int field213_; + public bool HasField213 { + get { return hasField213; } + } + public int Field213 { + get { return field213_; } + } + + public const int Field216FieldNumber = 216; + private bool hasField216; + private int field216_; + public bool HasField216 { + get { return hasField216; } + } + public int Field216 { + get { return field216_; } + } + + public const int Field217FieldNumber = 217; + private bool hasField217; + private int field217_; + public bool HasField217 { + get { return hasField217; } + } + public int Field217 { + get { return field217_; } + } + + public const int Field218FieldNumber = 218; + private bool hasField218; + private int field218_; + public bool HasField218 { + get { return hasField218; } + } + public int Field218 { + get { return field218_; } + } + + public const int Field220FieldNumber = 220; + private bool hasField220; + private int field220_; + public bool HasField220 { + get { return hasField220; } + } + public int Field220 { + get { return field220_; } + } + + public const int Field221FieldNumber = 221; + private bool hasField221; + private int field221_; + public bool HasField221 { + get { return hasField221; } + } + public int Field221 { + get { return field221_; } + } + + public const int Field222FieldNumber = 222; + private bool hasField222; + private float field222_; + public bool HasField222 { + get { return hasField222; } + } + public float Field222 { + get { return field222_; } + } + + public const int Field63FieldNumber = 63; + private bool hasField63; + private int field63_; + public bool HasField63 { + get { return hasField63; } + } + public int Field63 { + get { return field63_; } + } + + public const int Group1FieldNumber = 10; + private pbc::PopsicleList group1_ = new pbc::PopsicleList(); + public scg::IList Group1List { + get { return group1_; } + } + public int Group1Count { + get { return group1_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1 GetGroup1(int index) { + return group1_[index]; + } + + public const int Field128FieldNumber = 128; + private pbc::PopsicleList field128_ = new pbc::PopsicleList(); + public scg::IList Field128List { + get { return pbc::Lists.AsReadOnly(field128_); } + } + public int Field128Count { + get { return field128_.Count; } + } + public string GetField128(int index) { + return field128_[index]; + } + + public const int Field131FieldNumber = 131; + private bool hasField131; + private long field131_; + public bool HasField131 { + get { return hasField131; } + } + public long Field131 { + get { return field131_; } + } + + public const int Field127FieldNumber = 127; + private pbc::PopsicleList field127_ = new pbc::PopsicleList(); + public scg::IList Field127List { + get { return pbc::Lists.AsReadOnly(field127_); } + } + public int Field127Count { + get { return field127_.Count; } + } + public string GetField127(int index) { + return field127_[index]; + } + + public const int Field129FieldNumber = 129; + private bool hasField129; + private int field129_; + public bool HasField129 { + get { return hasField129; } + } + public int Field129 { + get { return field129_; } + } + + public const int Field130FieldNumber = 130; + private pbc::PopsicleList field130_ = new pbc::PopsicleList(); + public scg::IList Field130List { + get { return pbc::Lists.AsReadOnly(field130_); } + } + public int Field130Count { + get { return field130_.Count; } + } + public long GetField130(int index) { + return field130_[index]; + } + + public const int Field205FieldNumber = 205; + private bool hasField205; + private bool field205_; + public bool HasField205 { + get { return hasField205; } + } + public bool Field205 { + get { return field205_; } + } + + public const int Field206FieldNumber = 206; + private bool hasField206; + private bool field206_; + public bool HasField206 { + get { return hasField206; } + } + public bool Field206 { + get { return field206_; } + } + + public static SizeMessage2 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SizeMessage2 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SizeMessage2 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SizeMessage2 MakeReadOnly() { + group1_.MakeReadOnly(); + field128_.MakeReadOnly(); + field127_.MakeReadOnly(); + field130_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SizeMessage2 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SizeMessage2 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SizeMessage2 result; + + private SizeMessage2 PrepareBuilder() { + if (resultIsReadOnly) { + SizeMessage2 original = result; + result = new SizeMessage2(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SizeMessage2 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Descriptor; } + } + + public override SizeMessage2 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage2.DefaultInstance; } + } + + public override SizeMessage2 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public string Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = ""; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public long Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(long value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0L; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public long Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(long value) { + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = 0L; + return this; + } + + public bool HasField30 { + get { return result.hasField30; } + } + public long Field30 { + get { return result.Field30; } + set { SetField30(value); } + } + public Builder SetField30(long value) { + PrepareBuilder(); + result.hasField30 = true; + result.field30_ = value; + return this; + } + public Builder ClearField30() { + PrepareBuilder(); + result.hasField30 = false; + result.field30_ = 0L; + return this; + } + + public bool HasField75 { + get { return result.hasField75; } + } + public bool Field75 { + get { return result.Field75; } + set { SetField75(value); } + } + public Builder SetField75(bool value) { + PrepareBuilder(); + result.hasField75 = true; + result.field75_ = value; + return this; + } + public Builder ClearField75() { + PrepareBuilder(); + result.hasField75 = false; + result.field75_ = false; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public string Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = ""; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public pb::ByteString Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = pb::ByteString.Empty; + return this; + } + + public bool HasField21 { + get { return result.hasField21; } + } + public int Field21 { + get { return result.Field21; } + set { SetField21(value); } + } + public Builder SetField21(int value) { + PrepareBuilder(); + result.hasField21 = true; + result.field21_ = value; + return this; + } + public Builder ClearField21() { + PrepareBuilder(); + result.hasField21 = false; + result.field21_ = 0; + return this; + } + + public bool HasField71 { + get { return result.hasField71; } + } + public int Field71 { + get { return result.Field71; } + set { SetField71(value); } + } + public Builder SetField71(int value) { + PrepareBuilder(); + result.hasField71 = true; + result.field71_ = value; + return this; + } + public Builder ClearField71() { + PrepareBuilder(); + result.hasField71 = false; + result.field71_ = 0; + return this; + } + + public bool HasField25 { + get { return result.hasField25; } + } + public float Field25 { + get { return result.Field25; } + set { SetField25(value); } + } + public Builder SetField25(float value) { + PrepareBuilder(); + result.hasField25 = true; + result.field25_ = value; + return this; + } + public Builder ClearField25() { + PrepareBuilder(); + result.hasField25 = false; + result.field25_ = 0F; + return this; + } + + public bool HasField109 { + get { return result.hasField109; } + } + public int Field109 { + get { return result.Field109; } + set { SetField109(value); } + } + public Builder SetField109(int value) { + PrepareBuilder(); + result.hasField109 = true; + result.field109_ = value; + return this; + } + public Builder ClearField109() { + PrepareBuilder(); + result.hasField109 = false; + result.field109_ = 0; + return this; + } + + public bool HasField210 { + get { return result.hasField210; } + } + public int Field210 { + get { return result.Field210; } + set { SetField210(value); } + } + public Builder SetField210(int value) { + PrepareBuilder(); + result.hasField210 = true; + result.field210_ = value; + return this; + } + public Builder ClearField210() { + PrepareBuilder(); + result.hasField210 = false; + result.field210_ = 0; + return this; + } + + public bool HasField211 { + get { return result.hasField211; } + } + public int Field211 { + get { return result.Field211; } + set { SetField211(value); } + } + public Builder SetField211(int value) { + PrepareBuilder(); + result.hasField211 = true; + result.field211_ = value; + return this; + } + public Builder ClearField211() { + PrepareBuilder(); + result.hasField211 = false; + result.field211_ = 0; + return this; + } + + public bool HasField212 { + get { return result.hasField212; } + } + public int Field212 { + get { return result.Field212; } + set { SetField212(value); } + } + public Builder SetField212(int value) { + PrepareBuilder(); + result.hasField212 = true; + result.field212_ = value; + return this; + } + public Builder ClearField212() { + PrepareBuilder(); + result.hasField212 = false; + result.field212_ = 0; + return this; + } + + public bool HasField213 { + get { return result.hasField213; } + } + public int Field213 { + get { return result.Field213; } + set { SetField213(value); } + } + public Builder SetField213(int value) { + PrepareBuilder(); + result.hasField213 = true; + result.field213_ = value; + return this; + } + public Builder ClearField213() { + PrepareBuilder(); + result.hasField213 = false; + result.field213_ = 0; + return this; + } + + public bool HasField216 { + get { return result.hasField216; } + } + public int Field216 { + get { return result.Field216; } + set { SetField216(value); } + } + public Builder SetField216(int value) { + PrepareBuilder(); + result.hasField216 = true; + result.field216_ = value; + return this; + } + public Builder ClearField216() { + PrepareBuilder(); + result.hasField216 = false; + result.field216_ = 0; + return this; + } + + public bool HasField217 { + get { return result.hasField217; } + } + public int Field217 { + get { return result.Field217; } + set { SetField217(value); } + } + public Builder SetField217(int value) { + PrepareBuilder(); + result.hasField217 = true; + result.field217_ = value; + return this; + } + public Builder ClearField217() { + PrepareBuilder(); + result.hasField217 = false; + result.field217_ = 0; + return this; + } + + public bool HasField218 { + get { return result.hasField218; } + } + public int Field218 { + get { return result.Field218; } + set { SetField218(value); } + } + public Builder SetField218(int value) { + PrepareBuilder(); + result.hasField218 = true; + result.field218_ = value; + return this; + } + public Builder ClearField218() { + PrepareBuilder(); + result.hasField218 = false; + result.field218_ = 0; + return this; + } + + public bool HasField220 { + get { return result.hasField220; } + } + public int Field220 { + get { return result.Field220; } + set { SetField220(value); } + } + public Builder SetField220(int value) { + PrepareBuilder(); + result.hasField220 = true; + result.field220_ = value; + return this; + } + public Builder ClearField220() { + PrepareBuilder(); + result.hasField220 = false; + result.field220_ = 0; + return this; + } + + public bool HasField221 { + get { return result.hasField221; } + } + public int Field221 { + get { return result.Field221; } + set { SetField221(value); } + } + public Builder SetField221(int value) { + PrepareBuilder(); + result.hasField221 = true; + result.field221_ = value; + return this; + } + public Builder ClearField221() { + PrepareBuilder(); + result.hasField221 = false; + result.field221_ = 0; + return this; + } + + public bool HasField222 { + get { return result.hasField222; } + } + public float Field222 { + get { return result.Field222; } + set { SetField222(value); } + } + public Builder SetField222(float value) { + PrepareBuilder(); + result.hasField222 = true; + result.field222_ = value; + return this; + } + public Builder ClearField222() { + PrepareBuilder(); + result.hasField222 = false; + result.field222_ = 0F; + return this; + } + + public bool HasField63 { + get { return result.hasField63; } + } + public int Field63 { + get { return result.Field63; } + set { SetField63(value); } + } + public Builder SetField63(int value) { + PrepareBuilder(); + result.hasField63 = true; + result.field63_ = value; + return this; + } + public Builder ClearField63() { + PrepareBuilder(); + result.hasField63 = false; + result.field63_ = 0; + return this; + } + + public pbc::IPopsicleList Group1List { + get { return PrepareBuilder().group1_; } + } + public int Group1Count { + get { return result.Group1Count; } + } + public global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1 GetGroup1(int index) { + return result.GetGroup1(index); + } + public Builder SetGroup1(int index, global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.group1_[index] = value; + return this; + } + public Builder SetGroup1(int index, global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.group1_[index] = builderForValue.Build(); + return this; + } + public Builder AddGroup1(global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.group1_.Add(value); + return this; + } + public Builder AddGroup1(global::Google.ProtocolBuffers.TestProtos.SizeMessage2.Types.Group1.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.group1_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeGroup1(scg::IEnumerable values) { + PrepareBuilder(); + result.group1_.Add(values); + return this; + } + public Builder ClearGroup1() { + PrepareBuilder(); + result.group1_.Clear(); + return this; + } + + public pbc::IPopsicleList Field128List { + get { return PrepareBuilder().field128_; } + } + public int Field128Count { + get { return result.Field128Count; } + } + public string GetField128(int index) { + return result.GetField128(index); + } + public Builder SetField128(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field128_[index] = value; + return this; + } + public Builder AddField128(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field128_.Add(value); + return this; + } + public Builder AddRangeField128(scg::IEnumerable values) { + PrepareBuilder(); + result.field128_.Add(values); + return this; + } + public Builder ClearField128() { + PrepareBuilder(); + result.field128_.Clear(); + return this; + } + + public bool HasField131 { + get { return result.hasField131; } + } + public long Field131 { + get { return result.Field131; } + set { SetField131(value); } + } + public Builder SetField131(long value) { + PrepareBuilder(); + result.hasField131 = true; + result.field131_ = value; + return this; + } + public Builder ClearField131() { + PrepareBuilder(); + result.hasField131 = false; + result.field131_ = 0L; + return this; + } + + public pbc::IPopsicleList Field127List { + get { return PrepareBuilder().field127_; } + } + public int Field127Count { + get { return result.Field127Count; } + } + public string GetField127(int index) { + return result.GetField127(index); + } + public Builder SetField127(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field127_[index] = value; + return this; + } + public Builder AddField127(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field127_.Add(value); + return this; + } + public Builder AddRangeField127(scg::IEnumerable values) { + PrepareBuilder(); + result.field127_.Add(values); + return this; + } + public Builder ClearField127() { + PrepareBuilder(); + result.field127_.Clear(); + return this; + } + + public bool HasField129 { + get { return result.hasField129; } + } + public int Field129 { + get { return result.Field129; } + set { SetField129(value); } + } + public Builder SetField129(int value) { + PrepareBuilder(); + result.hasField129 = true; + result.field129_ = value; + return this; + } + public Builder ClearField129() { + PrepareBuilder(); + result.hasField129 = false; + result.field129_ = 0; + return this; + } + + public pbc::IPopsicleList Field130List { + get { return PrepareBuilder().field130_; } + } + public int Field130Count { + get { return result.Field130Count; } + } + public long GetField130(int index) { + return result.GetField130(index); + } + public Builder SetField130(int index, long value) { + PrepareBuilder(); + result.field130_[index] = value; + return this; + } + public Builder AddField130(long value) { + PrepareBuilder(); + result.field130_.Add(value); + return this; + } + public Builder AddRangeField130(scg::IEnumerable values) { + PrepareBuilder(); + result.field130_.Add(values); + return this; + } + public Builder ClearField130() { + PrepareBuilder(); + result.field130_.Clear(); + return this; + } + + public bool HasField205 { + get { return result.hasField205; } + } + public bool Field205 { + get { return result.Field205; } + set { SetField205(value); } + } + public Builder SetField205(bool value) { + PrepareBuilder(); + result.hasField205 = true; + result.field205_ = value; + return this; + } + public Builder ClearField205() { + PrepareBuilder(); + result.hasField205 = false; + result.field205_ = false; + return this; + } + + public bool HasField206 { + get { return result.hasField206; } + } + public bool Field206 { + get { return result.Field206; } + set { SetField206(value); } + } + public Builder SetField206(bool value) { + PrepareBuilder(); + result.hasField206 = true; + result.field206_ = value; + return this; + } + public Builder ClearField206() { + PrepareBuilder(); + result.hasField206 = false; + result.field206_ = false; + return this; + } + } + static SizeMessage2() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SizeMessage2GroupedMessage : pb::GeneratedMessage { + private SizeMessage2GroupedMessage() { } + private static readonly SizeMessage2GroupedMessage defaultInstance = new SizeMessage2GroupedMessage().MakeReadOnly(); + public static SizeMessage2GroupedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SizeMessage2GroupedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SizeMessage2GroupedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage2GroupedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.internal__static_unittest_google_size_SizeMessage2GroupedMessage__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private float field1_; + public bool HasField1 { + get { return hasField1; } + } + public float Field1 { + get { return field1_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private float field2_; + public bool HasField2 { + get { return hasField2; } + } + public float Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private float field3_; + public bool HasField3 { + get { return hasField3; } + } + public float Field3 { + get { return field3_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private bool field4_; + public bool HasField4 { + get { return hasField4; } + } + public bool Field4 { + get { return field4_; } + } + + public const int Field5FieldNumber = 5; + private bool hasField5; + private bool field5_; + public bool HasField5 { + get { return hasField5; } + } + public bool Field5 { + get { return field5_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private bool field6_ = true; + public bool HasField6 { + get { return hasField6; } + } + public bool Field6 { + get { return field6_; } + } + + public const int Field7FieldNumber = 7; + private bool hasField7; + private bool field7_; + public bool HasField7 { + get { return hasField7; } + } + public bool Field7 { + get { return field7_; } + } + + public const int Field8FieldNumber = 8; + private bool hasField8; + private float field8_; + public bool HasField8 { + get { return hasField8; } + } + public float Field8 { + get { return field8_; } + } + + public const int Field9FieldNumber = 9; + private bool hasField9; + private bool field9_; + public bool HasField9 { + get { return hasField9; } + } + public bool Field9 { + get { return field9_; } + } + + public const int Field10FieldNumber = 10; + private bool hasField10; + private float field10_; + public bool HasField10 { + get { return hasField10; } + } + public float Field10 { + get { return field10_; } + } + + public const int Field11FieldNumber = 11; + private bool hasField11; + private long field11_; + public bool HasField11 { + get { return hasField11; } + } + public long Field11 { + get { return field11_; } + } + + public static SizeMessage2GroupedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SizeMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SizeMessage2GroupedMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SizeMessage2GroupedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SizeMessage2GroupedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SizeMessage2GroupedMessage result; + + private SizeMessage2GroupedMessage PrepareBuilder() { + if (resultIsReadOnly) { + SizeMessage2GroupedMessage original = result; + result = new SizeMessage2GroupedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SizeMessage2GroupedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.Descriptor; } + } + + public override SizeMessage2GroupedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SizeMessage2GroupedMessage.DefaultInstance; } + } + + public override SizeMessage2GroupedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public float Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(float value) { + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = 0F; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public float Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(float value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0F; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public float Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(float value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0F; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public bool Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(bool value) { + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = false; + return this; + } + + public bool HasField5 { + get { return result.hasField5; } + } + public bool Field5 { + get { return result.Field5; } + set { SetField5(value); } + } + public Builder SetField5(bool value) { + PrepareBuilder(); + result.hasField5 = true; + result.field5_ = value; + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.hasField5 = false; + result.field5_ = false; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public bool Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(bool value) { + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = true; + return this; + } + + public bool HasField7 { + get { return result.hasField7; } + } + public bool Field7 { + get { return result.Field7; } + set { SetField7(value); } + } + public Builder SetField7(bool value) { + PrepareBuilder(); + result.hasField7 = true; + result.field7_ = value; + return this; + } + public Builder ClearField7() { + PrepareBuilder(); + result.hasField7 = false; + result.field7_ = false; + return this; + } + + public bool HasField8 { + get { return result.hasField8; } + } + public float Field8 { + get { return result.Field8; } + set { SetField8(value); } + } + public Builder SetField8(float value) { + PrepareBuilder(); + result.hasField8 = true; + result.field8_ = value; + return this; + } + public Builder ClearField8() { + PrepareBuilder(); + result.hasField8 = false; + result.field8_ = 0F; + return this; + } + + public bool HasField9 { + get { return result.hasField9; } + } + public bool Field9 { + get { return result.Field9; } + set { SetField9(value); } + } + public Builder SetField9(bool value) { + PrepareBuilder(); + result.hasField9 = true; + result.field9_ = value; + return this; + } + public Builder ClearField9() { + PrepareBuilder(); + result.hasField9 = false; + result.field9_ = false; + return this; + } + + public bool HasField10 { + get { return result.hasField10; } + } + public float Field10 { + get { return result.Field10; } + set { SetField10(value); } + } + public Builder SetField10(float value) { + PrepareBuilder(); + result.hasField10 = true; + result.field10_ = value; + return this; + } + public Builder ClearField10() { + PrepareBuilder(); + result.hasField10 = false; + result.field10_ = 0F; + return this; + } + + public bool HasField11 { + get { return result.hasField11; } + } + public long Field11 { + get { return result.Field11; } + set { SetField11(value); } + } + public Builder SetField11(long value) { + PrepareBuilder(); + result.hasField11 = true; + result.field11_ = value; + return this; + } + public Builder ClearField11() { + PrepareBuilder(); + result.hasField11 = false; + result.field11_ = 0L; + return this; + } + } + static SizeMessage2GroupedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSizeProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs new file mode 100644 index 00000000..ffa0e445 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestGoogleSpeedProtoFile.cs @@ -0,0 +1,6638 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestGoogleSpeedProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_unittest_google_speed_SpeedMessage1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_speed_SpeedMessage1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_google_speed_SpeedMessage1SubMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_speed_SpeedMessage1SubMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_google_speed_SpeedMessage2__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_speed_SpeedMessage2__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_google_speed_SpeedMessage2_Group1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_speed_SpeedMessage2_Group1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_unittest_google_speed_SpeedMessage2GroupedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_unittest_google_speed_SpeedMessage2GroupedMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestGoogleSpeedProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch5nb29nbGUvdGVzdC9nb29nbGVfc3BlZWQucHJvdG8SFXVuaXR0ZXN0X2dv", + "b2dsZV9zcGVlZBokZ29vZ2xlL3Byb3RvYnVmL2NzaGFycF9vcHRpb25zLnBy", + "b3RvIoMHCg1TcGVlZE1lc3NhZ2UxEg4KBmZpZWxkMRgBIAIoCRIOCgZmaWVs", + "ZDkYCSABKAkSDwoHZmllbGQxOBgSIAEoCRIWCgdmaWVsZDgwGFAgASgIOgVm", + "YWxzZRIVCgdmaWVsZDgxGFEgASgIOgR0cnVlEg4KBmZpZWxkMhgCIAIoBRIO", + "CgZmaWVsZDMYAyACKAUSEQoIZmllbGQyODAYmAIgASgFEhEKBmZpZWxkNhgG", + "IAEoBToBMBIPCgdmaWVsZDIyGBYgASgDEg4KBmZpZWxkNBgEIAEoCRIOCgZm", + "aWVsZDUYBSADKAYSFgoHZmllbGQ1ORg7IAEoCDoFZmFsc2USDgoGZmllbGQ3", + "GAcgASgJEg8KB2ZpZWxkMTYYECABKAUSFAoIZmllbGQxMzAYggEgASgFOgEw", + "EhUKB2ZpZWxkMTIYDCABKAg6BHRydWUSFQoHZmllbGQxNxgRIAEoCDoEdHJ1", + "ZRIVCgdmaWVsZDEzGA0gASgIOgR0cnVlEhUKB2ZpZWxkMTQYDiABKAg6BHRy", + "dWUSEwoIZmllbGQxMDQYaCABKAU6ATASEwoIZmllbGQxMDAYZCABKAU6ATAS", + "EwoIZmllbGQxMDEYZSABKAU6ATASEAoIZmllbGQxMDIYZiABKAkSEAoIZmll", + "bGQxMDMYZyABKAkSEgoHZmllbGQyORgdIAEoBToBMBIWCgdmaWVsZDMwGB4g", + "ASgIOgVmYWxzZRITCgdmaWVsZDYwGDwgASgFOgItMRIVCghmaWVsZDI3MRiP", + "AiABKAU6Ai0xEhUKCGZpZWxkMjcyGJACIAEoBToCLTESEQoIZmllbGQxNTAY", + "lgEgASgFEhIKB2ZpZWxkMjMYFyABKAU6ATASFgoHZmllbGQyNBgYIAEoCDoF", + "ZmFsc2USEgoHZmllbGQyNRgZIAEoBToBMBI/CgdmaWVsZDE1GA8gASgLMi4u", + "dW5pdHRlc3RfZ29vZ2xlX3NwZWVkLlNwZWVkTWVzc2FnZTFTdWJNZXNzYWdl", + "Eg8KB2ZpZWxkNzgYTiABKAgSEgoHZmllbGQ2NxhDIAEoBToBMBIPCgdmaWVs", + "ZDY4GEQgASgFEhQKCGZpZWxkMTI4GIABIAEoBToBMBIoCghmaWVsZDEyORiB", + "ASABKAk6FXh4eHh4eHh4eHh4eHh4eHh4eHh4eBIUCghmaWVsZDEzMRiDASAB", + "KAU6ATAiogMKF1NwZWVkTWVzc2FnZTFTdWJNZXNzYWdlEhEKBmZpZWxkMRgB", + "IAEoBToBMBIRCgZmaWVsZDIYAiABKAU6ATASEQoGZmllbGQzGAMgASgFOgEw", + "Eg8KB2ZpZWxkMTUYDyABKAkSFQoHZmllbGQxMhgMIAEoCDoEdHJ1ZRIPCgdm", + "aWVsZDEzGA0gASgDEg8KB2ZpZWxkMTQYDiABKAMSDwoHZmllbGQxNhgQIAEo", + "BRISCgdmaWVsZDE5GBMgASgFOgEyEhUKB2ZpZWxkMjAYFCABKAg6BHRydWUS", + "FQoHZmllbGQyOBgcIAEoCDoEdHJ1ZRIPCgdmaWVsZDIxGBUgASgGEg8KB2Zp", + "ZWxkMjIYFiABKAUSFgoHZmllbGQyMxgXIAEoCDoFZmFsc2USGAoIZmllbGQy", + "MDYYzgEgASgIOgVmYWxzZRIRCghmaWVsZDIwMxjLASABKAcSEQoIZmllbGQy", + "MDQYzAEgASgFEhEKCGZpZWxkMjA1GM0BIAEoCRIRCghmaWVsZDIwNxjPASAB", + "KAQSEQoIZmllbGQzMDAYrAIgASgEIuAHCg1TcGVlZE1lc3NhZ2UyEg4KBmZp", + "ZWxkMRgBIAEoCRIOCgZmaWVsZDMYAyABKAMSDgoGZmllbGQ0GAQgASgDEg8K", + "B2ZpZWxkMzAYHiABKAMSFgoHZmllbGQ3NRhLIAEoCDoFZmFsc2USDgoGZmll", + "bGQ2GAYgASgJEg4KBmZpZWxkMhgCIAEoDBISCgdmaWVsZDIxGBUgASgFOgEw", + "Eg8KB2ZpZWxkNzEYRyABKAUSDwoHZmllbGQyNRgZIAEoAhITCghmaWVsZDEw", + "ORhtIAEoBToBMBIUCghmaWVsZDIxMBjSASABKAU6ATASFAoIZmllbGQyMTEY", + "0wEgASgFOgEwEhQKCGZpZWxkMjEyGNQBIAEoBToBMBIUCghmaWVsZDIxMxjV", + "ASABKAU6ATASFAoIZmllbGQyMTYY2AEgASgFOgEwEhQKCGZpZWxkMjE3GNkB", + "IAEoBToBMBIUCghmaWVsZDIxOBjaASABKAU6ATASFAoIZmllbGQyMjAY3AEg", + "ASgFOgEwEhQKCGZpZWxkMjIxGN0BIAEoBToBMBIUCghmaWVsZDIyMhjeASAB", + "KAI6ATASDwoHZmllbGQ2Mxg/IAEoBRI7CgZncm91cDEYCiADKAoyKy51bml0", + "dGVzdF9nb29nbGVfc3BlZWQuU3BlZWRNZXNzYWdlMi5Hcm91cDESEQoIZmll", + "bGQxMjgYgAEgAygJEhEKCGZpZWxkMTMxGIMBIAEoAxIQCghmaWVsZDEyNxh/", + "IAMoCRIRCghmaWVsZDEyORiBASABKAUSEQoIZmllbGQxMzAYggEgAygDEhgK", + "CGZpZWxkMjA1GM0BIAEoCDoFZmFsc2USGAoIZmllbGQyMDYYzgEgASgIOgVm", + "YWxzZRrOAgoGR3JvdXAxEg8KB2ZpZWxkMTEYCyACKAISDwoHZmllbGQyNhga", + "IAEoAhIPCgdmaWVsZDEyGAwgASgJEg8KB2ZpZWxkMTMYDSABKAkSDwoHZmll", + "bGQxNBgOIAMoCRIPCgdmaWVsZDE1GA8gAigEEg4KBmZpZWxkNRgFIAEoBRIP", + "CgdmaWVsZDI3GBsgASgJEg8KB2ZpZWxkMjgYHCABKAUSDwoHZmllbGQyORgd", + "IAEoCRIPCgdmaWVsZDE2GBAgASgJEg8KB2ZpZWxkMjIYFiADKAkSDwoHZmll", + "bGQ3MxhJIAMoBRISCgdmaWVsZDIwGBQgASgFOgEwEg8KB2ZpZWxkMjQYGCAB", + "KAkSQwoHZmllbGQzMRgfIAEoCzIyLnVuaXR0ZXN0X2dvb2dsZV9zcGVlZC5T", + "cGVlZE1lc3NhZ2UyR3JvdXBlZE1lc3NhZ2Ui3wEKG1NwZWVkTWVzc2FnZTJH", + "cm91cGVkTWVzc2FnZRIOCgZmaWVsZDEYASABKAISDgoGZmllbGQyGAIgASgC", + "EhEKBmZpZWxkMxgDIAEoAjoBMBIOCgZmaWVsZDQYBCABKAgSDgoGZmllbGQ1", + "GAUgASgIEhQKBmZpZWxkNhgGIAEoCDoEdHJ1ZRIVCgZmaWVsZDcYByABKAg6", + "BWZhbHNlEg4KBmZpZWxkOBgIIAEoAhIOCgZmaWVsZDkYCSABKAgSDwoHZmll", + "bGQxMBgKIAEoAhIPCgdmaWVsZDExGAsgASgDQlNCC0dvb2dsZVNwZWVkSAHC", + "PkEKIUdvb2dsZS5Qcm90b2NvbEJ1ZmZlcnMuVGVzdFByb3RvcxIcVW5pdFRl", + "c3RHb29nbGVTcGVlZFByb3RvRmlsZQ==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_unittest_google_speed_SpeedMessage1__Descriptor = Descriptor.MessageTypes[0]; + internal__static_unittest_google_speed_SpeedMessage1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_speed_SpeedMessage1__Descriptor, + new string[] { "Field1", "Field9", "Field18", "Field80", "Field81", "Field2", "Field3", "Field280", "Field6", "Field22", "Field4", "Field5", "Field59", "Field7", "Field16", "Field130", "Field12", "Field17", "Field13", "Field14", "Field104", "Field100", "Field101", "Field102", "Field103", "Field29", "Field30", "Field60", "Field271", "Field272", "Field150", "Field23", "Field24", "Field25", "Field15", "Field78", "Field67", "Field68", "Field128", "Field129", "Field131", }); + internal__static_unittest_google_speed_SpeedMessage1SubMessage__Descriptor = Descriptor.MessageTypes[1]; + internal__static_unittest_google_speed_SpeedMessage1SubMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_speed_SpeedMessage1SubMessage__Descriptor, + new string[] { "Field1", "Field2", "Field3", "Field15", "Field12", "Field13", "Field14", "Field16", "Field19", "Field20", "Field28", "Field21", "Field22", "Field23", "Field206", "Field203", "Field204", "Field205", "Field207", "Field300", }); + internal__static_unittest_google_speed_SpeedMessage2__Descriptor = Descriptor.MessageTypes[2]; + internal__static_unittest_google_speed_SpeedMessage2__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_speed_SpeedMessage2__Descriptor, + new string[] { "Field1", "Field3", "Field4", "Field30", "Field75", "Field6", "Field2", "Field21", "Field71", "Field25", "Field109", "Field210", "Field211", "Field212", "Field213", "Field216", "Field217", "Field218", "Field220", "Field221", "Field222", "Field63", "Group1", "Field128", "Field131", "Field127", "Field129", "Field130", "Field205", "Field206", }); + internal__static_unittest_google_speed_SpeedMessage2_Group1__Descriptor = internal__static_unittest_google_speed_SpeedMessage2__Descriptor.NestedTypes[0]; + internal__static_unittest_google_speed_SpeedMessage2_Group1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_speed_SpeedMessage2_Group1__Descriptor, + new string[] { "Field11", "Field26", "Field12", "Field13", "Field14", "Field15", "Field5", "Field27", "Field28", "Field29", "Field16", "Field22", "Field73", "Field20", "Field24", "Field31", }); + internal__static_unittest_google_speed_SpeedMessage2GroupedMessage__Descriptor = Descriptor.MessageTypes[3]; + internal__static_unittest_google_speed_SpeedMessage2GroupedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_unittest_google_speed_SpeedMessage2GroupedMessage__Descriptor, + new string[] { "Field1", "Field2", "Field3", "Field4", "Field5", "Field6", "Field7", "Field8", "Field9", "Field10", "Field11", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SpeedMessage1 : pb::GeneratedMessage { + private SpeedMessage1() { } + private static readonly SpeedMessage1 defaultInstance = new SpeedMessage1().MakeReadOnly(); + private static readonly string[] _speedMessage1FieldNames = new string[] { "field1", "field100", "field101", "field102", "field103", "field104", "field12", "field128", "field129", "field13", "field130", "field131", "field14", "field15", "field150", "field16", "field17", "field18", "field2", "field22", "field23", "field24", "field25", "field271", "field272", "field280", "field29", "field3", "field30", "field4", "field5", "field59", "field6", "field60", "field67", "field68", "field7", "field78", "field80", "field81", "field9" }; + private static readonly uint[] _speedMessage1FieldTags = new uint[] { 10, 800, 808, 818, 826, 832, 96, 1024, 1034, 104, 1040, 1048, 112, 122, 1200, 128, 136, 146, 16, 176, 184, 192, 200, 2168, 2176, 2240, 232, 24, 240, 34, 41, 472, 48, 480, 536, 544, 58, 624, 640, 648, 74 }; + public static SpeedMessage1 DefaultInstance { + get { return defaultInstance; } + } + + public override SpeedMessage1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SpeedMessage1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage1__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private string field1_ = ""; + public bool HasField1 { + get { return hasField1; } + } + public string Field1 { + get { return field1_; } + } + + public const int Field9FieldNumber = 9; + private bool hasField9; + private string field9_ = ""; + public bool HasField9 { + get { return hasField9; } + } + public string Field9 { + get { return field9_; } + } + + public const int Field18FieldNumber = 18; + private bool hasField18; + private string field18_ = ""; + public bool HasField18 { + get { return hasField18; } + } + public string Field18 { + get { return field18_; } + } + + public const int Field80FieldNumber = 80; + private bool hasField80; + private bool field80_; + public bool HasField80 { + get { return hasField80; } + } + public bool Field80 { + get { return field80_; } + } + + public const int Field81FieldNumber = 81; + private bool hasField81; + private bool field81_ = true; + public bool HasField81 { + get { return hasField81; } + } + public bool Field81 { + get { return field81_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private int field2_; + public bool HasField2 { + get { return hasField2; } + } + public int Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private int field3_; + public bool HasField3 { + get { return hasField3; } + } + public int Field3 { + get { return field3_; } + } + + public const int Field280FieldNumber = 280; + private bool hasField280; + private int field280_; + public bool HasField280 { + get { return hasField280; } + } + public int Field280 { + get { return field280_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private int field6_; + public bool HasField6 { + get { return hasField6; } + } + public int Field6 { + get { return field6_; } + } + + public const int Field22FieldNumber = 22; + private bool hasField22; + private long field22_; + public bool HasField22 { + get { return hasField22; } + } + public long Field22 { + get { return field22_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private string field4_ = ""; + public bool HasField4 { + get { return hasField4; } + } + public string Field4 { + get { return field4_; } + } + + public const int Field5FieldNumber = 5; + private pbc::PopsicleList field5_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList Field5List { + get { return pbc::Lists.AsReadOnly(field5_); } + } + public int Field5Count { + get { return field5_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetField5(int index) { + return field5_[index]; + } + + public const int Field59FieldNumber = 59; + private bool hasField59; + private bool field59_; + public bool HasField59 { + get { return hasField59; } + } + public bool Field59 { + get { return field59_; } + } + + public const int Field7FieldNumber = 7; + private bool hasField7; + private string field7_ = ""; + public bool HasField7 { + get { return hasField7; } + } + public string Field7 { + get { return field7_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private int field16_; + public bool HasField16 { + get { return hasField16; } + } + public int Field16 { + get { return field16_; } + } + + public const int Field130FieldNumber = 130; + private bool hasField130; + private int field130_; + public bool HasField130 { + get { return hasField130; } + } + public int Field130 { + get { return field130_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private bool field12_ = true; + public bool HasField12 { + get { return hasField12; } + } + public bool Field12 { + get { return field12_; } + } + + public const int Field17FieldNumber = 17; + private bool hasField17; + private bool field17_ = true; + public bool HasField17 { + get { return hasField17; } + } + public bool Field17 { + get { return field17_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private bool field13_ = true; + public bool HasField13 { + get { return hasField13; } + } + public bool Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private bool hasField14; + private bool field14_ = true; + public bool HasField14 { + get { return hasField14; } + } + public bool Field14 { + get { return field14_; } + } + + public const int Field104FieldNumber = 104; + private bool hasField104; + private int field104_; + public bool HasField104 { + get { return hasField104; } + } + public int Field104 { + get { return field104_; } + } + + public const int Field100FieldNumber = 100; + private bool hasField100; + private int field100_; + public bool HasField100 { + get { return hasField100; } + } + public int Field100 { + get { return field100_; } + } + + public const int Field101FieldNumber = 101; + private bool hasField101; + private int field101_; + public bool HasField101 { + get { return hasField101; } + } + public int Field101 { + get { return field101_; } + } + + public const int Field102FieldNumber = 102; + private bool hasField102; + private string field102_ = ""; + public bool HasField102 { + get { return hasField102; } + } + public string Field102 { + get { return field102_; } + } + + public const int Field103FieldNumber = 103; + private bool hasField103; + private string field103_ = ""; + public bool HasField103 { + get { return hasField103; } + } + public string Field103 { + get { return field103_; } + } + + public const int Field29FieldNumber = 29; + private bool hasField29; + private int field29_; + public bool HasField29 { + get { return hasField29; } + } + public int Field29 { + get { return field29_; } + } + + public const int Field30FieldNumber = 30; + private bool hasField30; + private bool field30_; + public bool HasField30 { + get { return hasField30; } + } + public bool Field30 { + get { return field30_; } + } + + public const int Field60FieldNumber = 60; + private bool hasField60; + private int field60_ = -1; + public bool HasField60 { + get { return hasField60; } + } + public int Field60 { + get { return field60_; } + } + + public const int Field271FieldNumber = 271; + private bool hasField271; + private int field271_ = -1; + public bool HasField271 { + get { return hasField271; } + } + public int Field271 { + get { return field271_; } + } + + public const int Field272FieldNumber = 272; + private bool hasField272; + private int field272_ = -1; + public bool HasField272 { + get { return hasField272; } + } + public int Field272 { + get { return field272_; } + } + + public const int Field150FieldNumber = 150; + private bool hasField150; + private int field150_; + public bool HasField150 { + get { return hasField150; } + } + public int Field150 { + get { return field150_; } + } + + public const int Field23FieldNumber = 23; + private bool hasField23; + private int field23_; + public bool HasField23 { + get { return hasField23; } + } + public int Field23 { + get { return field23_; } + } + + public const int Field24FieldNumber = 24; + private bool hasField24; + private bool field24_; + public bool HasField24 { + get { return hasField24; } + } + public bool Field24 { + get { return field24_; } + } + + public const int Field25FieldNumber = 25; + private bool hasField25; + private int field25_; + public bool HasField25 { + get { return hasField25; } + } + public int Field25 { + get { return field25_; } + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage field15_; + public bool HasField15 { + get { return hasField15; } + } + public global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage Field15 { + get { return field15_ ?? global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance; } + } + + public const int Field78FieldNumber = 78; + private bool hasField78; + private bool field78_; + public bool HasField78 { + get { return hasField78; } + } + public bool Field78 { + get { return field78_; } + } + + public const int Field67FieldNumber = 67; + private bool hasField67; + private int field67_; + public bool HasField67 { + get { return hasField67; } + } + public int Field67 { + get { return field67_; } + } + + public const int Field68FieldNumber = 68; + private bool hasField68; + private int field68_; + public bool HasField68 { + get { return hasField68; } + } + public int Field68 { + get { return field68_; } + } + + public const int Field128FieldNumber = 128; + private bool hasField128; + private int field128_; + public bool HasField128 { + get { return hasField128; } + } + public int Field128 { + get { return field128_; } + } + + public const int Field129FieldNumber = 129; + private bool hasField129; + private string field129_ = "xxxxxxxxxxxxxxxxxxxxx"; + public bool HasField129 { + get { return hasField129; } + } + public string Field129 { + get { return field129_; } + } + + public const int Field131FieldNumber = 131; + private bool hasField131; + private int field131_; + public bool HasField131 { + get { return hasField131; } + } + public int Field131 { + get { return field131_; } + } + + public override bool IsInitialized { + get { + if (!hasField1) return false; + if (!hasField2) return false; + if (!hasField3) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _speedMessage1FieldNames; + if (hasField1) { + output.WriteString(1, field_names[0], Field1); + } + if (hasField2) { + output.WriteInt32(2, field_names[18], Field2); + } + if (hasField3) { + output.WriteInt32(3, field_names[27], Field3); + } + if (hasField4) { + output.WriteString(4, field_names[29], Field4); + } + if (field5_.Count > 0) { + output.WriteFixed64Array(5, field_names[30], field5_); + } + if (hasField6) { + output.WriteInt32(6, field_names[32], Field6); + } + if (hasField7) { + output.WriteString(7, field_names[36], Field7); + } + if (hasField9) { + output.WriteString(9, field_names[40], Field9); + } + if (hasField12) { + output.WriteBool(12, field_names[6], Field12); + } + if (hasField13) { + output.WriteBool(13, field_names[9], Field13); + } + if (hasField14) { + output.WriteBool(14, field_names[12], Field14); + } + if (hasField15) { + output.WriteMessage(15, field_names[13], Field15); + } + if (hasField16) { + output.WriteInt32(16, field_names[15], Field16); + } + if (hasField17) { + output.WriteBool(17, field_names[16], Field17); + } + if (hasField18) { + output.WriteString(18, field_names[17], Field18); + } + if (hasField22) { + output.WriteInt64(22, field_names[19], Field22); + } + if (hasField23) { + output.WriteInt32(23, field_names[20], Field23); + } + if (hasField24) { + output.WriteBool(24, field_names[21], Field24); + } + if (hasField25) { + output.WriteInt32(25, field_names[22], Field25); + } + if (hasField29) { + output.WriteInt32(29, field_names[26], Field29); + } + if (hasField30) { + output.WriteBool(30, field_names[28], Field30); + } + if (hasField59) { + output.WriteBool(59, field_names[31], Field59); + } + if (hasField60) { + output.WriteInt32(60, field_names[33], Field60); + } + if (hasField67) { + output.WriteInt32(67, field_names[34], Field67); + } + if (hasField68) { + output.WriteInt32(68, field_names[35], Field68); + } + if (hasField78) { + output.WriteBool(78, field_names[37], Field78); + } + if (hasField80) { + output.WriteBool(80, field_names[38], Field80); + } + if (hasField81) { + output.WriteBool(81, field_names[39], Field81); + } + if (hasField100) { + output.WriteInt32(100, field_names[1], Field100); + } + if (hasField101) { + output.WriteInt32(101, field_names[2], Field101); + } + if (hasField102) { + output.WriteString(102, field_names[3], Field102); + } + if (hasField103) { + output.WriteString(103, field_names[4], Field103); + } + if (hasField104) { + output.WriteInt32(104, field_names[5], Field104); + } + if (hasField128) { + output.WriteInt32(128, field_names[7], Field128); + } + if (hasField129) { + output.WriteString(129, field_names[8], Field129); + } + if (hasField130) { + output.WriteInt32(130, field_names[10], Field130); + } + if (hasField131) { + output.WriteInt32(131, field_names[11], Field131); + } + if (hasField150) { + output.WriteInt32(150, field_names[14], Field150); + } + if (hasField271) { + output.WriteInt32(271, field_names[23], Field271); + } + if (hasField272) { + output.WriteInt32(272, field_names[24], Field272); + } + if (hasField280) { + output.WriteInt32(280, field_names[25], Field280); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField1) { + size += pb::CodedOutputStream.ComputeStringSize(1, Field1); + } + if (hasField9) { + size += pb::CodedOutputStream.ComputeStringSize(9, Field9); + } + if (hasField18) { + size += pb::CodedOutputStream.ComputeStringSize(18, Field18); + } + if (hasField80) { + size += pb::CodedOutputStream.ComputeBoolSize(80, Field80); + } + if (hasField81) { + size += pb::CodedOutputStream.ComputeBoolSize(81, Field81); + } + if (hasField2) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Field2); + } + if (hasField3) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Field3); + } + if (hasField280) { + size += pb::CodedOutputStream.ComputeInt32Size(280, Field280); + } + if (hasField6) { + size += pb::CodedOutputStream.ComputeInt32Size(6, Field6); + } + if (hasField22) { + size += pb::CodedOutputStream.ComputeInt64Size(22, Field22); + } + if (hasField4) { + size += pb::CodedOutputStream.ComputeStringSize(4, Field4); + } + { + int dataSize = 0; + dataSize = 8 * field5_.Count; + size += dataSize; + size += 1 * field5_.Count; + } + if (hasField59) { + size += pb::CodedOutputStream.ComputeBoolSize(59, Field59); + } + if (hasField7) { + size += pb::CodedOutputStream.ComputeStringSize(7, Field7); + } + if (hasField16) { + size += pb::CodedOutputStream.ComputeInt32Size(16, Field16); + } + if (hasField130) { + size += pb::CodedOutputStream.ComputeInt32Size(130, Field130); + } + if (hasField12) { + size += pb::CodedOutputStream.ComputeBoolSize(12, Field12); + } + if (hasField17) { + size += pb::CodedOutputStream.ComputeBoolSize(17, Field17); + } + if (hasField13) { + size += pb::CodedOutputStream.ComputeBoolSize(13, Field13); + } + if (hasField14) { + size += pb::CodedOutputStream.ComputeBoolSize(14, Field14); + } + if (hasField104) { + size += pb::CodedOutputStream.ComputeInt32Size(104, Field104); + } + if (hasField100) { + size += pb::CodedOutputStream.ComputeInt32Size(100, Field100); + } + if (hasField101) { + size += pb::CodedOutputStream.ComputeInt32Size(101, Field101); + } + if (hasField102) { + size += pb::CodedOutputStream.ComputeStringSize(102, Field102); + } + if (hasField103) { + size += pb::CodedOutputStream.ComputeStringSize(103, Field103); + } + if (hasField29) { + size += pb::CodedOutputStream.ComputeInt32Size(29, Field29); + } + if (hasField30) { + size += pb::CodedOutputStream.ComputeBoolSize(30, Field30); + } + if (hasField60) { + size += pb::CodedOutputStream.ComputeInt32Size(60, Field60); + } + if (hasField271) { + size += pb::CodedOutputStream.ComputeInt32Size(271, Field271); + } + if (hasField272) { + size += pb::CodedOutputStream.ComputeInt32Size(272, Field272); + } + if (hasField150) { + size += pb::CodedOutputStream.ComputeInt32Size(150, Field150); + } + if (hasField23) { + size += pb::CodedOutputStream.ComputeInt32Size(23, Field23); + } + if (hasField24) { + size += pb::CodedOutputStream.ComputeBoolSize(24, Field24); + } + if (hasField25) { + size += pb::CodedOutputStream.ComputeInt32Size(25, Field25); + } + if (hasField15) { + size += pb::CodedOutputStream.ComputeMessageSize(15, Field15); + } + if (hasField78) { + size += pb::CodedOutputStream.ComputeBoolSize(78, Field78); + } + if (hasField67) { + size += pb::CodedOutputStream.ComputeInt32Size(67, Field67); + } + if (hasField68) { + size += pb::CodedOutputStream.ComputeInt32Size(68, Field68); + } + if (hasField128) { + size += pb::CodedOutputStream.ComputeInt32Size(128, Field128); + } + if (hasField129) { + size += pb::CodedOutputStream.ComputeStringSize(129, Field129); + } + if (hasField131) { + size += pb::CodedOutputStream.ComputeInt32Size(131, Field131); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SpeedMessage1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SpeedMessage1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SpeedMessage1 MakeReadOnly() { + field5_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SpeedMessage1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SpeedMessage1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SpeedMessage1 result; + + private SpeedMessage1 PrepareBuilder() { + if (resultIsReadOnly) { + SpeedMessage1 original = result; + result = new SpeedMessage1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SpeedMessage1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage1.Descriptor; } + } + + public override SpeedMessage1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage1.DefaultInstance; } + } + + public override SpeedMessage1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SpeedMessage1) { + return MergeFrom((SpeedMessage1) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SpeedMessage1 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage1.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField1) { + Field1 = other.Field1; + } + if (other.HasField9) { + Field9 = other.Field9; + } + if (other.HasField18) { + Field18 = other.Field18; + } + if (other.HasField80) { + Field80 = other.Field80; + } + if (other.HasField81) { + Field81 = other.Field81; + } + if (other.HasField2) { + Field2 = other.Field2; + } + if (other.HasField3) { + Field3 = other.Field3; + } + if (other.HasField280) { + Field280 = other.Field280; + } + if (other.HasField6) { + Field6 = other.Field6; + } + if (other.HasField22) { + Field22 = other.Field22; + } + if (other.HasField4) { + Field4 = other.Field4; + } + if (other.field5_.Count != 0) { + result.field5_.Add(other.field5_); + } + if (other.HasField59) { + Field59 = other.Field59; + } + if (other.HasField7) { + Field7 = other.Field7; + } + if (other.HasField16) { + Field16 = other.Field16; + } + if (other.HasField130) { + Field130 = other.Field130; + } + if (other.HasField12) { + Field12 = other.Field12; + } + if (other.HasField17) { + Field17 = other.Field17; + } + if (other.HasField13) { + Field13 = other.Field13; + } + if (other.HasField14) { + Field14 = other.Field14; + } + if (other.HasField104) { + Field104 = other.Field104; + } + if (other.HasField100) { + Field100 = other.Field100; + } + if (other.HasField101) { + Field101 = other.Field101; + } + if (other.HasField102) { + Field102 = other.Field102; + } + if (other.HasField103) { + Field103 = other.Field103; + } + if (other.HasField29) { + Field29 = other.Field29; + } + if (other.HasField30) { + Field30 = other.Field30; + } + if (other.HasField60) { + Field60 = other.Field60; + } + if (other.HasField271) { + Field271 = other.Field271; + } + if (other.HasField272) { + Field272 = other.Field272; + } + if (other.HasField150) { + Field150 = other.Field150; + } + if (other.HasField23) { + Field23 = other.Field23; + } + if (other.HasField24) { + Field24 = other.Field24; + } + if (other.HasField25) { + Field25 = other.Field25; + } + if (other.HasField15) { + MergeField15(other.Field15); + } + if (other.HasField78) { + Field78 = other.Field78; + } + if (other.HasField67) { + Field67 = other.Field67; + } + if (other.HasField68) { + Field68 = other.Field68; + } + if (other.HasField128) { + Field128 = other.Field128; + } + if (other.HasField129) { + Field129 = other.Field129; + } + if (other.HasField131) { + Field131 = other.Field131; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_speedMessage1FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _speedMessage1FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasField1 = input.ReadString(ref result.field1_); + break; + } + case 16: { + result.hasField2 = input.ReadInt32(ref result.field2_); + break; + } + case 24: { + result.hasField3 = input.ReadInt32(ref result.field3_); + break; + } + case 34: { + result.hasField4 = input.ReadString(ref result.field4_); + break; + } + case 42: + case 41: { + input.ReadFixed64Array(tag, field_name, result.field5_); + break; + } + case 48: { + result.hasField6 = input.ReadInt32(ref result.field6_); + break; + } + case 58: { + result.hasField7 = input.ReadString(ref result.field7_); + break; + } + case 74: { + result.hasField9 = input.ReadString(ref result.field9_); + break; + } + case 96: { + result.hasField12 = input.ReadBool(ref result.field12_); + break; + } + case 104: { + result.hasField13 = input.ReadBool(ref result.field13_); + break; + } + case 112: { + result.hasField14 = input.ReadBool(ref result.field14_); + break; + } + case 122: { + global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.CreateBuilder(); + if (result.hasField15) { + subBuilder.MergeFrom(Field15); + } + input.ReadMessage(subBuilder, extensionRegistry); + Field15 = subBuilder.BuildPartial(); + break; + } + case 128: { + result.hasField16 = input.ReadInt32(ref result.field16_); + break; + } + case 136: { + result.hasField17 = input.ReadBool(ref result.field17_); + break; + } + case 146: { + result.hasField18 = input.ReadString(ref result.field18_); + break; + } + case 176: { + result.hasField22 = input.ReadInt64(ref result.field22_); + break; + } + case 184: { + result.hasField23 = input.ReadInt32(ref result.field23_); + break; + } + case 192: { + result.hasField24 = input.ReadBool(ref result.field24_); + break; + } + case 200: { + result.hasField25 = input.ReadInt32(ref result.field25_); + break; + } + case 232: { + result.hasField29 = input.ReadInt32(ref result.field29_); + break; + } + case 240: { + result.hasField30 = input.ReadBool(ref result.field30_); + break; + } + case 472: { + result.hasField59 = input.ReadBool(ref result.field59_); + break; + } + case 480: { + result.hasField60 = input.ReadInt32(ref result.field60_); + break; + } + case 536: { + result.hasField67 = input.ReadInt32(ref result.field67_); + break; + } + case 544: { + result.hasField68 = input.ReadInt32(ref result.field68_); + break; + } + case 624: { + result.hasField78 = input.ReadBool(ref result.field78_); + break; + } + case 640: { + result.hasField80 = input.ReadBool(ref result.field80_); + break; + } + case 648: { + result.hasField81 = input.ReadBool(ref result.field81_); + break; + } + case 800: { + result.hasField100 = input.ReadInt32(ref result.field100_); + break; + } + case 808: { + result.hasField101 = input.ReadInt32(ref result.field101_); + break; + } + case 818: { + result.hasField102 = input.ReadString(ref result.field102_); + break; + } + case 826: { + result.hasField103 = input.ReadString(ref result.field103_); + break; + } + case 832: { + result.hasField104 = input.ReadInt32(ref result.field104_); + break; + } + case 1024: { + result.hasField128 = input.ReadInt32(ref result.field128_); + break; + } + case 1034: { + result.hasField129 = input.ReadString(ref result.field129_); + break; + } + case 1040: { + result.hasField130 = input.ReadInt32(ref result.field130_); + break; + } + case 1048: { + result.hasField131 = input.ReadInt32(ref result.field131_); + break; + } + case 1200: { + result.hasField150 = input.ReadInt32(ref result.field150_); + break; + } + case 2168: { + result.hasField271 = input.ReadInt32(ref result.field271_); + break; + } + case 2176: { + result.hasField272 = input.ReadInt32(ref result.field272_); + break; + } + case 2240: { + result.hasField280 = input.ReadInt32(ref result.field280_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public string Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = ""; + return this; + } + + public bool HasField9 { + get { return result.hasField9; } + } + public string Field9 { + get { return result.Field9; } + set { SetField9(value); } + } + public Builder SetField9(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField9 = true; + result.field9_ = value; + return this; + } + public Builder ClearField9() { + PrepareBuilder(); + result.hasField9 = false; + result.field9_ = ""; + return this; + } + + public bool HasField18 { + get { return result.hasField18; } + } + public string Field18 { + get { return result.Field18; } + set { SetField18(value); } + } + public Builder SetField18(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField18 = true; + result.field18_ = value; + return this; + } + public Builder ClearField18() { + PrepareBuilder(); + result.hasField18 = false; + result.field18_ = ""; + return this; + } + + public bool HasField80 { + get { return result.hasField80; } + } + public bool Field80 { + get { return result.Field80; } + set { SetField80(value); } + } + public Builder SetField80(bool value) { + PrepareBuilder(); + result.hasField80 = true; + result.field80_ = value; + return this; + } + public Builder ClearField80() { + PrepareBuilder(); + result.hasField80 = false; + result.field80_ = false; + return this; + } + + public bool HasField81 { + get { return result.hasField81; } + } + public bool Field81 { + get { return result.Field81; } + set { SetField81(value); } + } + public Builder SetField81(bool value) { + PrepareBuilder(); + result.hasField81 = true; + result.field81_ = value; + return this; + } + public Builder ClearField81() { + PrepareBuilder(); + result.hasField81 = false; + result.field81_ = true; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public int Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(int value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public int Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(int value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0; + return this; + } + + public bool HasField280 { + get { return result.hasField280; } + } + public int Field280 { + get { return result.Field280; } + set { SetField280(value); } + } + public Builder SetField280(int value) { + PrepareBuilder(); + result.hasField280 = true; + result.field280_ = value; + return this; + } + public Builder ClearField280() { + PrepareBuilder(); + result.hasField280 = false; + result.field280_ = 0; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public int Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(int value) { + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = 0; + return this; + } + + public bool HasField22 { + get { return result.hasField22; } + } + public long Field22 { + get { return result.Field22; } + set { SetField22(value); } + } + public Builder SetField22(long value) { + PrepareBuilder(); + result.hasField22 = true; + result.field22_ = value; + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.hasField22 = false; + result.field22_ = 0L; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public string Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = ""; + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList Field5List { + get { return PrepareBuilder().field5_; } + } + public int Field5Count { + get { return result.Field5Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetField5(int index) { + return result.GetField5(index); + } + [global::System.CLSCompliant(false)] + public Builder SetField5(int index, ulong value) { + PrepareBuilder(); + result.field5_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddField5(ulong value) { + PrepareBuilder(); + result.field5_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeField5(scg::IEnumerable values) { + PrepareBuilder(); + result.field5_.Add(values); + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.field5_.Clear(); + return this; + } + + public bool HasField59 { + get { return result.hasField59; } + } + public bool Field59 { + get { return result.Field59; } + set { SetField59(value); } + } + public Builder SetField59(bool value) { + PrepareBuilder(); + result.hasField59 = true; + result.field59_ = value; + return this; + } + public Builder ClearField59() { + PrepareBuilder(); + result.hasField59 = false; + result.field59_ = false; + return this; + } + + public bool HasField7 { + get { return result.hasField7; } + } + public string Field7 { + get { return result.Field7; } + set { SetField7(value); } + } + public Builder SetField7(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField7 = true; + result.field7_ = value; + return this; + } + public Builder ClearField7() { + PrepareBuilder(); + result.hasField7 = false; + result.field7_ = ""; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public int Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(int value) { + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = 0; + return this; + } + + public bool HasField130 { + get { return result.hasField130; } + } + public int Field130 { + get { return result.Field130; } + set { SetField130(value); } + } + public Builder SetField130(int value) { + PrepareBuilder(); + result.hasField130 = true; + result.field130_ = value; + return this; + } + public Builder ClearField130() { + PrepareBuilder(); + result.hasField130 = false; + result.field130_ = 0; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public bool Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(bool value) { + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = true; + return this; + } + + public bool HasField17 { + get { return result.hasField17; } + } + public bool Field17 { + get { return result.Field17; } + set { SetField17(value); } + } + public Builder SetField17(bool value) { + PrepareBuilder(); + result.hasField17 = true; + result.field17_ = value; + return this; + } + public Builder ClearField17() { + PrepareBuilder(); + result.hasField17 = false; + result.field17_ = true; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public bool Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(bool value) { + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = true; + return this; + } + + public bool HasField14 { + get { return result.hasField14; } + } + public bool Field14 { + get { return result.Field14; } + set { SetField14(value); } + } + public Builder SetField14(bool value) { + PrepareBuilder(); + result.hasField14 = true; + result.field14_ = value; + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.hasField14 = false; + result.field14_ = true; + return this; + } + + public bool HasField104 { + get { return result.hasField104; } + } + public int Field104 { + get { return result.Field104; } + set { SetField104(value); } + } + public Builder SetField104(int value) { + PrepareBuilder(); + result.hasField104 = true; + result.field104_ = value; + return this; + } + public Builder ClearField104() { + PrepareBuilder(); + result.hasField104 = false; + result.field104_ = 0; + return this; + } + + public bool HasField100 { + get { return result.hasField100; } + } + public int Field100 { + get { return result.Field100; } + set { SetField100(value); } + } + public Builder SetField100(int value) { + PrepareBuilder(); + result.hasField100 = true; + result.field100_ = value; + return this; + } + public Builder ClearField100() { + PrepareBuilder(); + result.hasField100 = false; + result.field100_ = 0; + return this; + } + + public bool HasField101 { + get { return result.hasField101; } + } + public int Field101 { + get { return result.Field101; } + set { SetField101(value); } + } + public Builder SetField101(int value) { + PrepareBuilder(); + result.hasField101 = true; + result.field101_ = value; + return this; + } + public Builder ClearField101() { + PrepareBuilder(); + result.hasField101 = false; + result.field101_ = 0; + return this; + } + + public bool HasField102 { + get { return result.hasField102; } + } + public string Field102 { + get { return result.Field102; } + set { SetField102(value); } + } + public Builder SetField102(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField102 = true; + result.field102_ = value; + return this; + } + public Builder ClearField102() { + PrepareBuilder(); + result.hasField102 = false; + result.field102_ = ""; + return this; + } + + public bool HasField103 { + get { return result.hasField103; } + } + public string Field103 { + get { return result.Field103; } + set { SetField103(value); } + } + public Builder SetField103(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField103 = true; + result.field103_ = value; + return this; + } + public Builder ClearField103() { + PrepareBuilder(); + result.hasField103 = false; + result.field103_ = ""; + return this; + } + + public bool HasField29 { + get { return result.hasField29; } + } + public int Field29 { + get { return result.Field29; } + set { SetField29(value); } + } + public Builder SetField29(int value) { + PrepareBuilder(); + result.hasField29 = true; + result.field29_ = value; + return this; + } + public Builder ClearField29() { + PrepareBuilder(); + result.hasField29 = false; + result.field29_ = 0; + return this; + } + + public bool HasField30 { + get { return result.hasField30; } + } + public bool Field30 { + get { return result.Field30; } + set { SetField30(value); } + } + public Builder SetField30(bool value) { + PrepareBuilder(); + result.hasField30 = true; + result.field30_ = value; + return this; + } + public Builder ClearField30() { + PrepareBuilder(); + result.hasField30 = false; + result.field30_ = false; + return this; + } + + public bool HasField60 { + get { return result.hasField60; } + } + public int Field60 { + get { return result.Field60; } + set { SetField60(value); } + } + public Builder SetField60(int value) { + PrepareBuilder(); + result.hasField60 = true; + result.field60_ = value; + return this; + } + public Builder ClearField60() { + PrepareBuilder(); + result.hasField60 = false; + result.field60_ = -1; + return this; + } + + public bool HasField271 { + get { return result.hasField271; } + } + public int Field271 { + get { return result.Field271; } + set { SetField271(value); } + } + public Builder SetField271(int value) { + PrepareBuilder(); + result.hasField271 = true; + result.field271_ = value; + return this; + } + public Builder ClearField271() { + PrepareBuilder(); + result.hasField271 = false; + result.field271_ = -1; + return this; + } + + public bool HasField272 { + get { return result.hasField272; } + } + public int Field272 { + get { return result.Field272; } + set { SetField272(value); } + } + public Builder SetField272(int value) { + PrepareBuilder(); + result.hasField272 = true; + result.field272_ = value; + return this; + } + public Builder ClearField272() { + PrepareBuilder(); + result.hasField272 = false; + result.field272_ = -1; + return this; + } + + public bool HasField150 { + get { return result.hasField150; } + } + public int Field150 { + get { return result.Field150; } + set { SetField150(value); } + } + public Builder SetField150(int value) { + PrepareBuilder(); + result.hasField150 = true; + result.field150_ = value; + return this; + } + public Builder ClearField150() { + PrepareBuilder(); + result.hasField150 = false; + result.field150_ = 0; + return this; + } + + public bool HasField23 { + get { return result.hasField23; } + } + public int Field23 { + get { return result.Field23; } + set { SetField23(value); } + } + public Builder SetField23(int value) { + PrepareBuilder(); + result.hasField23 = true; + result.field23_ = value; + return this; + } + public Builder ClearField23() { + PrepareBuilder(); + result.hasField23 = false; + result.field23_ = 0; + return this; + } + + public bool HasField24 { + get { return result.hasField24; } + } + public bool Field24 { + get { return result.Field24; } + set { SetField24(value); } + } + public Builder SetField24(bool value) { + PrepareBuilder(); + result.hasField24 = true; + result.field24_ = value; + return this; + } + public Builder ClearField24() { + PrepareBuilder(); + result.hasField24 = false; + result.field24_ = false; + return this; + } + + public bool HasField25 { + get { return result.hasField25; } + } + public int Field25 { + get { return result.Field25; } + set { SetField25(value); } + } + public Builder SetField25(int value) { + PrepareBuilder(); + result.hasField25 = true; + result.field25_ = value; + return this; + } + public Builder ClearField25() { + PrepareBuilder(); + result.hasField25 = false; + result.field25_ = 0; + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + public global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + public Builder SetField15(global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder SetField15(global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = builderForValue.Build(); + return this; + } + public Builder MergeField15(global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasField15 && + result.field15_ != global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance) { + result.field15_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.CreateBuilder(result.field15_).MergeFrom(value).BuildPartial(); + } else { + result.field15_ = value; + } + result.hasField15 = true; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = null; + return this; + } + + public bool HasField78 { + get { return result.hasField78; } + } + public bool Field78 { + get { return result.Field78; } + set { SetField78(value); } + } + public Builder SetField78(bool value) { + PrepareBuilder(); + result.hasField78 = true; + result.field78_ = value; + return this; + } + public Builder ClearField78() { + PrepareBuilder(); + result.hasField78 = false; + result.field78_ = false; + return this; + } + + public bool HasField67 { + get { return result.hasField67; } + } + public int Field67 { + get { return result.Field67; } + set { SetField67(value); } + } + public Builder SetField67(int value) { + PrepareBuilder(); + result.hasField67 = true; + result.field67_ = value; + return this; + } + public Builder ClearField67() { + PrepareBuilder(); + result.hasField67 = false; + result.field67_ = 0; + return this; + } + + public bool HasField68 { + get { return result.hasField68; } + } + public int Field68 { + get { return result.Field68; } + set { SetField68(value); } + } + public Builder SetField68(int value) { + PrepareBuilder(); + result.hasField68 = true; + result.field68_ = value; + return this; + } + public Builder ClearField68() { + PrepareBuilder(); + result.hasField68 = false; + result.field68_ = 0; + return this; + } + + public bool HasField128 { + get { return result.hasField128; } + } + public int Field128 { + get { return result.Field128; } + set { SetField128(value); } + } + public Builder SetField128(int value) { + PrepareBuilder(); + result.hasField128 = true; + result.field128_ = value; + return this; + } + public Builder ClearField128() { + PrepareBuilder(); + result.hasField128 = false; + result.field128_ = 0; + return this; + } + + public bool HasField129 { + get { return result.hasField129; } + } + public string Field129 { + get { return result.Field129; } + set { SetField129(value); } + } + public Builder SetField129(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField129 = true; + result.field129_ = value; + return this; + } + public Builder ClearField129() { + PrepareBuilder(); + result.hasField129 = false; + result.field129_ = "xxxxxxxxxxxxxxxxxxxxx"; + return this; + } + + public bool HasField131 { + get { return result.hasField131; } + } + public int Field131 { + get { return result.Field131; } + set { SetField131(value); } + } + public Builder SetField131(int value) { + PrepareBuilder(); + result.hasField131 = true; + result.field131_ = value; + return this; + } + public Builder ClearField131() { + PrepareBuilder(); + result.hasField131 = false; + result.field131_ = 0; + return this; + } + } + static SpeedMessage1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SpeedMessage1SubMessage : pb::GeneratedMessage { + private SpeedMessage1SubMessage() { } + private static readonly SpeedMessage1SubMessage defaultInstance = new SpeedMessage1SubMessage().MakeReadOnly(); + private static readonly string[] _speedMessage1SubMessageFieldNames = new string[] { "field1", "field12", "field13", "field14", "field15", "field16", "field19", "field2", "field20", "field203", "field204", "field205", "field206", "field207", "field21", "field22", "field23", "field28", "field3", "field300" }; + private static readonly uint[] _speedMessage1SubMessageFieldTags = new uint[] { 8, 96, 104, 112, 122, 128, 152, 16, 160, 1629, 1632, 1642, 1648, 1656, 169, 176, 184, 224, 24, 2400 }; + public static SpeedMessage1SubMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SpeedMessage1SubMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SpeedMessage1SubMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage1SubMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage1SubMessage__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private int field1_; + public bool HasField1 { + get { return hasField1; } + } + public int Field1 { + get { return field1_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private int field2_; + public bool HasField2 { + get { return hasField2; } + } + public int Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private int field3_; + public bool HasField3 { + get { return hasField3; } + } + public int Field3 { + get { return field3_; } + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private string field15_ = ""; + public bool HasField15 { + get { return hasField15; } + } + public string Field15 { + get { return field15_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private bool field12_ = true; + public bool HasField12 { + get { return hasField12; } + } + public bool Field12 { + get { return field12_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private long field13_; + public bool HasField13 { + get { return hasField13; } + } + public long Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private bool hasField14; + private long field14_; + public bool HasField14 { + get { return hasField14; } + } + public long Field14 { + get { return field14_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private int field16_; + public bool HasField16 { + get { return hasField16; } + } + public int Field16 { + get { return field16_; } + } + + public const int Field19FieldNumber = 19; + private bool hasField19; + private int field19_ = 2; + public bool HasField19 { + get { return hasField19; } + } + public int Field19 { + get { return field19_; } + } + + public const int Field20FieldNumber = 20; + private bool hasField20; + private bool field20_ = true; + public bool HasField20 { + get { return hasField20; } + } + public bool Field20 { + get { return field20_; } + } + + public const int Field28FieldNumber = 28; + private bool hasField28; + private bool field28_ = true; + public bool HasField28 { + get { return hasField28; } + } + public bool Field28 { + get { return field28_; } + } + + public const int Field21FieldNumber = 21; + private bool hasField21; + private ulong field21_; + public bool HasField21 { + get { return hasField21; } + } + [global::System.CLSCompliant(false)] + public ulong Field21 { + get { return field21_; } + } + + public const int Field22FieldNumber = 22; + private bool hasField22; + private int field22_; + public bool HasField22 { + get { return hasField22; } + } + public int Field22 { + get { return field22_; } + } + + public const int Field23FieldNumber = 23; + private bool hasField23; + private bool field23_; + public bool HasField23 { + get { return hasField23; } + } + public bool Field23 { + get { return field23_; } + } + + public const int Field206FieldNumber = 206; + private bool hasField206; + private bool field206_; + public bool HasField206 { + get { return hasField206; } + } + public bool Field206 { + get { return field206_; } + } + + public const int Field203FieldNumber = 203; + private bool hasField203; + private uint field203_; + public bool HasField203 { + get { return hasField203; } + } + [global::System.CLSCompliant(false)] + public uint Field203 { + get { return field203_; } + } + + public const int Field204FieldNumber = 204; + private bool hasField204; + private int field204_; + public bool HasField204 { + get { return hasField204; } + } + public int Field204 { + get { return field204_; } + } + + public const int Field205FieldNumber = 205; + private bool hasField205; + private string field205_ = ""; + public bool HasField205 { + get { return hasField205; } + } + public string Field205 { + get { return field205_; } + } + + public const int Field207FieldNumber = 207; + private bool hasField207; + private ulong field207_; + public bool HasField207 { + get { return hasField207; } + } + [global::System.CLSCompliant(false)] + public ulong Field207 { + get { return field207_; } + } + + public const int Field300FieldNumber = 300; + private bool hasField300; + private ulong field300_; + public bool HasField300 { + get { return hasField300; } + } + [global::System.CLSCompliant(false)] + public ulong Field300 { + get { return field300_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _speedMessage1SubMessageFieldNames; + if (hasField1) { + output.WriteInt32(1, field_names[0], Field1); + } + if (hasField2) { + output.WriteInt32(2, field_names[7], Field2); + } + if (hasField3) { + output.WriteInt32(3, field_names[18], Field3); + } + if (hasField12) { + output.WriteBool(12, field_names[1], Field12); + } + if (hasField13) { + output.WriteInt64(13, field_names[2], Field13); + } + if (hasField14) { + output.WriteInt64(14, field_names[3], Field14); + } + if (hasField15) { + output.WriteString(15, field_names[4], Field15); + } + if (hasField16) { + output.WriteInt32(16, field_names[5], Field16); + } + if (hasField19) { + output.WriteInt32(19, field_names[6], Field19); + } + if (hasField20) { + output.WriteBool(20, field_names[8], Field20); + } + if (hasField21) { + output.WriteFixed64(21, field_names[14], Field21); + } + if (hasField22) { + output.WriteInt32(22, field_names[15], Field22); + } + if (hasField23) { + output.WriteBool(23, field_names[16], Field23); + } + if (hasField28) { + output.WriteBool(28, field_names[17], Field28); + } + if (hasField203) { + output.WriteFixed32(203, field_names[9], Field203); + } + if (hasField204) { + output.WriteInt32(204, field_names[10], Field204); + } + if (hasField205) { + output.WriteString(205, field_names[11], Field205); + } + if (hasField206) { + output.WriteBool(206, field_names[12], Field206); + } + if (hasField207) { + output.WriteUInt64(207, field_names[13], Field207); + } + if (hasField300) { + output.WriteUInt64(300, field_names[19], Field300); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField1) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Field1); + } + if (hasField2) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Field2); + } + if (hasField3) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Field3); + } + if (hasField15) { + size += pb::CodedOutputStream.ComputeStringSize(15, Field15); + } + if (hasField12) { + size += pb::CodedOutputStream.ComputeBoolSize(12, Field12); + } + if (hasField13) { + size += pb::CodedOutputStream.ComputeInt64Size(13, Field13); + } + if (hasField14) { + size += pb::CodedOutputStream.ComputeInt64Size(14, Field14); + } + if (hasField16) { + size += pb::CodedOutputStream.ComputeInt32Size(16, Field16); + } + if (hasField19) { + size += pb::CodedOutputStream.ComputeInt32Size(19, Field19); + } + if (hasField20) { + size += pb::CodedOutputStream.ComputeBoolSize(20, Field20); + } + if (hasField28) { + size += pb::CodedOutputStream.ComputeBoolSize(28, Field28); + } + if (hasField21) { + size += pb::CodedOutputStream.ComputeFixed64Size(21, Field21); + } + if (hasField22) { + size += pb::CodedOutputStream.ComputeInt32Size(22, Field22); + } + if (hasField23) { + size += pb::CodedOutputStream.ComputeBoolSize(23, Field23); + } + if (hasField206) { + size += pb::CodedOutputStream.ComputeBoolSize(206, Field206); + } + if (hasField203) { + size += pb::CodedOutputStream.ComputeFixed32Size(203, Field203); + } + if (hasField204) { + size += pb::CodedOutputStream.ComputeInt32Size(204, Field204); + } + if (hasField205) { + size += pb::CodedOutputStream.ComputeStringSize(205, Field205); + } + if (hasField207) { + size += pb::CodedOutputStream.ComputeUInt64Size(207, Field207); + } + if (hasField300) { + size += pb::CodedOutputStream.ComputeUInt64Size(300, Field300); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SpeedMessage1SubMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage1SubMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SpeedMessage1SubMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SpeedMessage1SubMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SpeedMessage1SubMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SpeedMessage1SubMessage result; + + private SpeedMessage1SubMessage PrepareBuilder() { + if (resultIsReadOnly) { + SpeedMessage1SubMessage original = result; + result = new SpeedMessage1SubMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SpeedMessage1SubMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.Descriptor; } + } + + public override SpeedMessage1SubMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance; } + } + + public override SpeedMessage1SubMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SpeedMessage1SubMessage) { + return MergeFrom((SpeedMessage1SubMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SpeedMessage1SubMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage1SubMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField1) { + Field1 = other.Field1; + } + if (other.HasField2) { + Field2 = other.Field2; + } + if (other.HasField3) { + Field3 = other.Field3; + } + if (other.HasField15) { + Field15 = other.Field15; + } + if (other.HasField12) { + Field12 = other.Field12; + } + if (other.HasField13) { + Field13 = other.Field13; + } + if (other.HasField14) { + Field14 = other.Field14; + } + if (other.HasField16) { + Field16 = other.Field16; + } + if (other.HasField19) { + Field19 = other.Field19; + } + if (other.HasField20) { + Field20 = other.Field20; + } + if (other.HasField28) { + Field28 = other.Field28; + } + if (other.HasField21) { + Field21 = other.Field21; + } + if (other.HasField22) { + Field22 = other.Field22; + } + if (other.HasField23) { + Field23 = other.Field23; + } + if (other.HasField206) { + Field206 = other.Field206; + } + if (other.HasField203) { + Field203 = other.Field203; + } + if (other.HasField204) { + Field204 = other.Field204; + } + if (other.HasField205) { + Field205 = other.Field205; + } + if (other.HasField207) { + Field207 = other.Field207; + } + if (other.HasField300) { + Field300 = other.Field300; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_speedMessage1SubMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _speedMessage1SubMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasField1 = input.ReadInt32(ref result.field1_); + break; + } + case 16: { + result.hasField2 = input.ReadInt32(ref result.field2_); + break; + } + case 24: { + result.hasField3 = input.ReadInt32(ref result.field3_); + break; + } + case 96: { + result.hasField12 = input.ReadBool(ref result.field12_); + break; + } + case 104: { + result.hasField13 = input.ReadInt64(ref result.field13_); + break; + } + case 112: { + result.hasField14 = input.ReadInt64(ref result.field14_); + break; + } + case 122: { + result.hasField15 = input.ReadString(ref result.field15_); + break; + } + case 128: { + result.hasField16 = input.ReadInt32(ref result.field16_); + break; + } + case 152: { + result.hasField19 = input.ReadInt32(ref result.field19_); + break; + } + case 160: { + result.hasField20 = input.ReadBool(ref result.field20_); + break; + } + case 169: { + result.hasField21 = input.ReadFixed64(ref result.field21_); + break; + } + case 176: { + result.hasField22 = input.ReadInt32(ref result.field22_); + break; + } + case 184: { + result.hasField23 = input.ReadBool(ref result.field23_); + break; + } + case 224: { + result.hasField28 = input.ReadBool(ref result.field28_); + break; + } + case 1629: { + result.hasField203 = input.ReadFixed32(ref result.field203_); + break; + } + case 1632: { + result.hasField204 = input.ReadInt32(ref result.field204_); + break; + } + case 1642: { + result.hasField205 = input.ReadString(ref result.field205_); + break; + } + case 1648: { + result.hasField206 = input.ReadBool(ref result.field206_); + break; + } + case 1656: { + result.hasField207 = input.ReadUInt64(ref result.field207_); + break; + } + case 2400: { + result.hasField300 = input.ReadUInt64(ref result.field300_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public int Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(int value) { + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = 0; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public int Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(int value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public int Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(int value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0; + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + public string Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + public Builder SetField15(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = ""; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public bool Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(bool value) { + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = true; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public long Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(long value) { + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = 0L; + return this; + } + + public bool HasField14 { + get { return result.hasField14; } + } + public long Field14 { + get { return result.Field14; } + set { SetField14(value); } + } + public Builder SetField14(long value) { + PrepareBuilder(); + result.hasField14 = true; + result.field14_ = value; + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.hasField14 = false; + result.field14_ = 0L; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public int Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(int value) { + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = 0; + return this; + } + + public bool HasField19 { + get { return result.hasField19; } + } + public int Field19 { + get { return result.Field19; } + set { SetField19(value); } + } + public Builder SetField19(int value) { + PrepareBuilder(); + result.hasField19 = true; + result.field19_ = value; + return this; + } + public Builder ClearField19() { + PrepareBuilder(); + result.hasField19 = false; + result.field19_ = 2; + return this; + } + + public bool HasField20 { + get { return result.hasField20; } + } + public bool Field20 { + get { return result.Field20; } + set { SetField20(value); } + } + public Builder SetField20(bool value) { + PrepareBuilder(); + result.hasField20 = true; + result.field20_ = value; + return this; + } + public Builder ClearField20() { + PrepareBuilder(); + result.hasField20 = false; + result.field20_ = true; + return this; + } + + public bool HasField28 { + get { return result.hasField28; } + } + public bool Field28 { + get { return result.Field28; } + set { SetField28(value); } + } + public Builder SetField28(bool value) { + PrepareBuilder(); + result.hasField28 = true; + result.field28_ = value; + return this; + } + public Builder ClearField28() { + PrepareBuilder(); + result.hasField28 = false; + result.field28_ = true; + return this; + } + + public bool HasField21 { + get { return result.hasField21; } + } + [global::System.CLSCompliant(false)] + public ulong Field21 { + get { return result.Field21; } + set { SetField21(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField21(ulong value) { + PrepareBuilder(); + result.hasField21 = true; + result.field21_ = value; + return this; + } + public Builder ClearField21() { + PrepareBuilder(); + result.hasField21 = false; + result.field21_ = 0; + return this; + } + + public bool HasField22 { + get { return result.hasField22; } + } + public int Field22 { + get { return result.Field22; } + set { SetField22(value); } + } + public Builder SetField22(int value) { + PrepareBuilder(); + result.hasField22 = true; + result.field22_ = value; + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.hasField22 = false; + result.field22_ = 0; + return this; + } + + public bool HasField23 { + get { return result.hasField23; } + } + public bool Field23 { + get { return result.Field23; } + set { SetField23(value); } + } + public Builder SetField23(bool value) { + PrepareBuilder(); + result.hasField23 = true; + result.field23_ = value; + return this; + } + public Builder ClearField23() { + PrepareBuilder(); + result.hasField23 = false; + result.field23_ = false; + return this; + } + + public bool HasField206 { + get { return result.hasField206; } + } + public bool Field206 { + get { return result.Field206; } + set { SetField206(value); } + } + public Builder SetField206(bool value) { + PrepareBuilder(); + result.hasField206 = true; + result.field206_ = value; + return this; + } + public Builder ClearField206() { + PrepareBuilder(); + result.hasField206 = false; + result.field206_ = false; + return this; + } + + public bool HasField203 { + get { return result.hasField203; } + } + [global::System.CLSCompliant(false)] + public uint Field203 { + get { return result.Field203; } + set { SetField203(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField203(uint value) { + PrepareBuilder(); + result.hasField203 = true; + result.field203_ = value; + return this; + } + public Builder ClearField203() { + PrepareBuilder(); + result.hasField203 = false; + result.field203_ = 0; + return this; + } + + public bool HasField204 { + get { return result.hasField204; } + } + public int Field204 { + get { return result.Field204; } + set { SetField204(value); } + } + public Builder SetField204(int value) { + PrepareBuilder(); + result.hasField204 = true; + result.field204_ = value; + return this; + } + public Builder ClearField204() { + PrepareBuilder(); + result.hasField204 = false; + result.field204_ = 0; + return this; + } + + public bool HasField205 { + get { return result.hasField205; } + } + public string Field205 { + get { return result.Field205; } + set { SetField205(value); } + } + public Builder SetField205(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField205 = true; + result.field205_ = value; + return this; + } + public Builder ClearField205() { + PrepareBuilder(); + result.hasField205 = false; + result.field205_ = ""; + return this; + } + + public bool HasField207 { + get { return result.hasField207; } + } + [global::System.CLSCompliant(false)] + public ulong Field207 { + get { return result.Field207; } + set { SetField207(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField207(ulong value) { + PrepareBuilder(); + result.hasField207 = true; + result.field207_ = value; + return this; + } + public Builder ClearField207() { + PrepareBuilder(); + result.hasField207 = false; + result.field207_ = 0UL; + return this; + } + + public bool HasField300 { + get { return result.hasField300; } + } + [global::System.CLSCompliant(false)] + public ulong Field300 { + get { return result.Field300; } + set { SetField300(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField300(ulong value) { + PrepareBuilder(); + result.hasField300 = true; + result.field300_ = value; + return this; + } + public Builder ClearField300() { + PrepareBuilder(); + result.hasField300 = false; + result.field300_ = 0UL; + return this; + } + } + static SpeedMessage1SubMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SpeedMessage2 : pb::GeneratedMessage { + private SpeedMessage2() { } + private static readonly SpeedMessage2 defaultInstance = new SpeedMessage2().MakeReadOnly(); + private static readonly string[] _speedMessage2FieldNames = new string[] { "field1", "field109", "field127", "field128", "field129", "field130", "field131", "field2", "field205", "field206", "field21", "field210", "field211", "field212", "field213", "field216", "field217", "field218", "field220", "field221", "field222", "field25", "field3", "field30", "field4", "field6", "field63", "field71", "field75", "group1" }; + private static readonly uint[] _speedMessage2FieldTags = new uint[] { 10, 872, 1018, 1026, 1032, 1040, 1048, 18, 1640, 1648, 168, 1680, 1688, 1696, 1704, 1728, 1736, 1744, 1760, 1768, 1781, 205, 24, 240, 32, 50, 504, 568, 600, 83 }; + public static SpeedMessage2 DefaultInstance { + get { return defaultInstance; } + } + + public override SpeedMessage2 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SpeedMessage2 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage2__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage2__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Group1 : pb::GeneratedMessage { + private Group1() { } + private static readonly Group1 defaultInstance = new Group1().MakeReadOnly(); + private static readonly string[] _group1FieldNames = new string[] { "field11", "field12", "field13", "field14", "field15", "field16", "field20", "field22", "field24", "field26", "field27", "field28", "field29", "field31", "field5", "field73" }; + private static readonly uint[] _group1FieldTags = new uint[] { 93, 98, 106, 114, 120, 130, 160, 178, 194, 213, 218, 224, 234, 250, 40, 584 }; + public static Group1 DefaultInstance { + get { return defaultInstance; } + } + + public override Group1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Group1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage2_Group1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage2_Group1__FieldAccessorTable; } + } + + public const int Field11FieldNumber = 11; + private bool hasField11; + private float field11_; + public bool HasField11 { + get { return hasField11; } + } + public float Field11 { + get { return field11_; } + } + + public const int Field26FieldNumber = 26; + private bool hasField26; + private float field26_; + public bool HasField26 { + get { return hasField26; } + } + public float Field26 { + get { return field26_; } + } + + public const int Field12FieldNumber = 12; + private bool hasField12; + private string field12_ = ""; + public bool HasField12 { + get { return hasField12; } + } + public string Field12 { + get { return field12_; } + } + + public const int Field13FieldNumber = 13; + private bool hasField13; + private string field13_ = ""; + public bool HasField13 { + get { return hasField13; } + } + public string Field13 { + get { return field13_; } + } + + public const int Field14FieldNumber = 14; + private pbc::PopsicleList field14_ = new pbc::PopsicleList(); + public scg::IList Field14List { + get { return pbc::Lists.AsReadOnly(field14_); } + } + public int Field14Count { + get { return field14_.Count; } + } + public string GetField14(int index) { + return field14_[index]; + } + + public const int Field15FieldNumber = 15; + private bool hasField15; + private ulong field15_; + public bool HasField15 { + get { return hasField15; } + } + [global::System.CLSCompliant(false)] + public ulong Field15 { + get { return field15_; } + } + + public const int Field5FieldNumber = 5; + private bool hasField5; + private int field5_; + public bool HasField5 { + get { return hasField5; } + } + public int Field5 { + get { return field5_; } + } + + public const int Field27FieldNumber = 27; + private bool hasField27; + private string field27_ = ""; + public bool HasField27 { + get { return hasField27; } + } + public string Field27 { + get { return field27_; } + } + + public const int Field28FieldNumber = 28; + private bool hasField28; + private int field28_; + public bool HasField28 { + get { return hasField28; } + } + public int Field28 { + get { return field28_; } + } + + public const int Field29FieldNumber = 29; + private bool hasField29; + private string field29_ = ""; + public bool HasField29 { + get { return hasField29; } + } + public string Field29 { + get { return field29_; } + } + + public const int Field16FieldNumber = 16; + private bool hasField16; + private string field16_ = ""; + public bool HasField16 { + get { return hasField16; } + } + public string Field16 { + get { return field16_; } + } + + public const int Field22FieldNumber = 22; + private pbc::PopsicleList field22_ = new pbc::PopsicleList(); + public scg::IList Field22List { + get { return pbc::Lists.AsReadOnly(field22_); } + } + public int Field22Count { + get { return field22_.Count; } + } + public string GetField22(int index) { + return field22_[index]; + } + + public const int Field73FieldNumber = 73; + private pbc::PopsicleList field73_ = new pbc::PopsicleList(); + public scg::IList Field73List { + get { return pbc::Lists.AsReadOnly(field73_); } + } + public int Field73Count { + get { return field73_.Count; } + } + public int GetField73(int index) { + return field73_[index]; + } + + public const int Field20FieldNumber = 20; + private bool hasField20; + private int field20_; + public bool HasField20 { + get { return hasField20; } + } + public int Field20 { + get { return field20_; } + } + + public const int Field24FieldNumber = 24; + private bool hasField24; + private string field24_ = ""; + public bool HasField24 { + get { return hasField24; } + } + public string Field24 { + get { return field24_; } + } + + public const int Field31FieldNumber = 31; + private bool hasField31; + private global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage field31_; + public bool HasField31 { + get { return hasField31; } + } + public global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage Field31 { + get { return field31_ ?? global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (!hasField11) return false; + if (!hasField15) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _group1FieldNames; + if (hasField5) { + output.WriteInt32(5, field_names[14], Field5); + } + if (hasField11) { + output.WriteFloat(11, field_names[0], Field11); + } + if (hasField12) { + output.WriteString(12, field_names[1], Field12); + } + if (hasField13) { + output.WriteString(13, field_names[2], Field13); + } + if (field14_.Count > 0) { + output.WriteStringArray(14, field_names[3], field14_); + } + if (hasField15) { + output.WriteUInt64(15, field_names[4], Field15); + } + if (hasField16) { + output.WriteString(16, field_names[5], Field16); + } + if (hasField20) { + output.WriteInt32(20, field_names[6], Field20); + } + if (field22_.Count > 0) { + output.WriteStringArray(22, field_names[7], field22_); + } + if (hasField24) { + output.WriteString(24, field_names[8], Field24); + } + if (hasField26) { + output.WriteFloat(26, field_names[9], Field26); + } + if (hasField27) { + output.WriteString(27, field_names[10], Field27); + } + if (hasField28) { + output.WriteInt32(28, field_names[11], Field28); + } + if (hasField29) { + output.WriteString(29, field_names[12], Field29); + } + if (hasField31) { + output.WriteMessage(31, field_names[13], Field31); + } + if (field73_.Count > 0) { + output.WriteInt32Array(73, field_names[15], field73_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField11) { + size += pb::CodedOutputStream.ComputeFloatSize(11, Field11); + } + if (hasField26) { + size += pb::CodedOutputStream.ComputeFloatSize(26, Field26); + } + if (hasField12) { + size += pb::CodedOutputStream.ComputeStringSize(12, Field12); + } + if (hasField13) { + size += pb::CodedOutputStream.ComputeStringSize(13, Field13); + } + { + int dataSize = 0; + foreach (string element in Field14List) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * field14_.Count; + } + if (hasField15) { + size += pb::CodedOutputStream.ComputeUInt64Size(15, Field15); + } + if (hasField5) { + size += pb::CodedOutputStream.ComputeInt32Size(5, Field5); + } + if (hasField27) { + size += pb::CodedOutputStream.ComputeStringSize(27, Field27); + } + if (hasField28) { + size += pb::CodedOutputStream.ComputeInt32Size(28, Field28); + } + if (hasField29) { + size += pb::CodedOutputStream.ComputeStringSize(29, Field29); + } + if (hasField16) { + size += pb::CodedOutputStream.ComputeStringSize(16, Field16); + } + { + int dataSize = 0; + foreach (string element in Field22List) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * field22_.Count; + } + { + int dataSize = 0; + foreach (int element in Field73List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * field73_.Count; + } + if (hasField20) { + size += pb::CodedOutputStream.ComputeInt32Size(20, Field20); + } + if (hasField24) { + size += pb::CodedOutputStream.ComputeStringSize(24, Field24); + } + if (hasField31) { + size += pb::CodedOutputStream.ComputeMessageSize(31, Field31); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Group1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Group1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Group1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Group1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Group1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Group1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Group1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Group1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Group1 MakeReadOnly() { + field14_.MakeReadOnly(); + field22_.MakeReadOnly(); + field73_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Group1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Group1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Group1 result; + + private Group1 PrepareBuilder() { + if (resultIsReadOnly) { + Group1 original = result; + result = new Group1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Group1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1.Descriptor; } + } + + public override Group1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1.DefaultInstance; } + } + + public override Group1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Group1) { + return MergeFrom((Group1) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Group1 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField11) { + Field11 = other.Field11; + } + if (other.HasField26) { + Field26 = other.Field26; + } + if (other.HasField12) { + Field12 = other.Field12; + } + if (other.HasField13) { + Field13 = other.Field13; + } + if (other.field14_.Count != 0) { + result.field14_.Add(other.field14_); + } + if (other.HasField15) { + Field15 = other.Field15; + } + if (other.HasField5) { + Field5 = other.Field5; + } + if (other.HasField27) { + Field27 = other.Field27; + } + if (other.HasField28) { + Field28 = other.Field28; + } + if (other.HasField29) { + Field29 = other.Field29; + } + if (other.HasField16) { + Field16 = other.Field16; + } + if (other.field22_.Count != 0) { + result.field22_.Add(other.field22_); + } + if (other.field73_.Count != 0) { + result.field73_.Add(other.field73_); + } + if (other.HasField20) { + Field20 = other.Field20; + } + if (other.HasField24) { + Field24 = other.Field24; + } + if (other.HasField31) { + MergeField31(other.Field31); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_group1FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _group1FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 40: { + result.hasField5 = input.ReadInt32(ref result.field5_); + break; + } + case 93: { + result.hasField11 = input.ReadFloat(ref result.field11_); + break; + } + case 98: { + result.hasField12 = input.ReadString(ref result.field12_); + break; + } + case 106: { + result.hasField13 = input.ReadString(ref result.field13_); + break; + } + case 114: { + input.ReadStringArray(tag, field_name, result.field14_); + break; + } + case 120: { + result.hasField15 = input.ReadUInt64(ref result.field15_); + break; + } + case 130: { + result.hasField16 = input.ReadString(ref result.field16_); + break; + } + case 160: { + result.hasField20 = input.ReadInt32(ref result.field20_); + break; + } + case 178: { + input.ReadStringArray(tag, field_name, result.field22_); + break; + } + case 194: { + result.hasField24 = input.ReadString(ref result.field24_); + break; + } + case 213: { + result.hasField26 = input.ReadFloat(ref result.field26_); + break; + } + case 218: { + result.hasField27 = input.ReadString(ref result.field27_); + break; + } + case 224: { + result.hasField28 = input.ReadInt32(ref result.field28_); + break; + } + case 234: { + result.hasField29 = input.ReadString(ref result.field29_); + break; + } + case 250: { + global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.CreateBuilder(); + if (result.hasField31) { + subBuilder.MergeFrom(Field31); + } + input.ReadMessage(subBuilder, extensionRegistry); + Field31 = subBuilder.BuildPartial(); + break; + } + case 586: + case 584: { + input.ReadInt32Array(tag, field_name, result.field73_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField11 { + get { return result.hasField11; } + } + public float Field11 { + get { return result.Field11; } + set { SetField11(value); } + } + public Builder SetField11(float value) { + PrepareBuilder(); + result.hasField11 = true; + result.field11_ = value; + return this; + } + public Builder ClearField11() { + PrepareBuilder(); + result.hasField11 = false; + result.field11_ = 0F; + return this; + } + + public bool HasField26 { + get { return result.hasField26; } + } + public float Field26 { + get { return result.Field26; } + set { SetField26(value); } + } + public Builder SetField26(float value) { + PrepareBuilder(); + result.hasField26 = true; + result.field26_ = value; + return this; + } + public Builder ClearField26() { + PrepareBuilder(); + result.hasField26 = false; + result.field26_ = 0F; + return this; + } + + public bool HasField12 { + get { return result.hasField12; } + } + public string Field12 { + get { return result.Field12; } + set { SetField12(value); } + } + public Builder SetField12(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField12 = true; + result.field12_ = value; + return this; + } + public Builder ClearField12() { + PrepareBuilder(); + result.hasField12 = false; + result.field12_ = ""; + return this; + } + + public bool HasField13 { + get { return result.hasField13; } + } + public string Field13 { + get { return result.Field13; } + set { SetField13(value); } + } + public Builder SetField13(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField13 = true; + result.field13_ = value; + return this; + } + public Builder ClearField13() { + PrepareBuilder(); + result.hasField13 = false; + result.field13_ = ""; + return this; + } + + public pbc::IPopsicleList Field14List { + get { return PrepareBuilder().field14_; } + } + public int Field14Count { + get { return result.Field14Count; } + } + public string GetField14(int index) { + return result.GetField14(index); + } + public Builder SetField14(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field14_[index] = value; + return this; + } + public Builder AddField14(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field14_.Add(value); + return this; + } + public Builder AddRangeField14(scg::IEnumerable values) { + PrepareBuilder(); + result.field14_.Add(values); + return this; + } + public Builder ClearField14() { + PrepareBuilder(); + result.field14_.Clear(); + return this; + } + + public bool HasField15 { + get { return result.hasField15; } + } + [global::System.CLSCompliant(false)] + public ulong Field15 { + get { return result.Field15; } + set { SetField15(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetField15(ulong value) { + PrepareBuilder(); + result.hasField15 = true; + result.field15_ = value; + return this; + } + public Builder ClearField15() { + PrepareBuilder(); + result.hasField15 = false; + result.field15_ = 0UL; + return this; + } + + public bool HasField5 { + get { return result.hasField5; } + } + public int Field5 { + get { return result.Field5; } + set { SetField5(value); } + } + public Builder SetField5(int value) { + PrepareBuilder(); + result.hasField5 = true; + result.field5_ = value; + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.hasField5 = false; + result.field5_ = 0; + return this; + } + + public bool HasField27 { + get { return result.hasField27; } + } + public string Field27 { + get { return result.Field27; } + set { SetField27(value); } + } + public Builder SetField27(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField27 = true; + result.field27_ = value; + return this; + } + public Builder ClearField27() { + PrepareBuilder(); + result.hasField27 = false; + result.field27_ = ""; + return this; + } + + public bool HasField28 { + get { return result.hasField28; } + } + public int Field28 { + get { return result.Field28; } + set { SetField28(value); } + } + public Builder SetField28(int value) { + PrepareBuilder(); + result.hasField28 = true; + result.field28_ = value; + return this; + } + public Builder ClearField28() { + PrepareBuilder(); + result.hasField28 = false; + result.field28_ = 0; + return this; + } + + public bool HasField29 { + get { return result.hasField29; } + } + public string Field29 { + get { return result.Field29; } + set { SetField29(value); } + } + public Builder SetField29(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField29 = true; + result.field29_ = value; + return this; + } + public Builder ClearField29() { + PrepareBuilder(); + result.hasField29 = false; + result.field29_ = ""; + return this; + } + + public bool HasField16 { + get { return result.hasField16; } + } + public string Field16 { + get { return result.Field16; } + set { SetField16(value); } + } + public Builder SetField16(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField16 = true; + result.field16_ = value; + return this; + } + public Builder ClearField16() { + PrepareBuilder(); + result.hasField16 = false; + result.field16_ = ""; + return this; + } + + public pbc::IPopsicleList Field22List { + get { return PrepareBuilder().field22_; } + } + public int Field22Count { + get { return result.Field22Count; } + } + public string GetField22(int index) { + return result.GetField22(index); + } + public Builder SetField22(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field22_[index] = value; + return this; + } + public Builder AddField22(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field22_.Add(value); + return this; + } + public Builder AddRangeField22(scg::IEnumerable values) { + PrepareBuilder(); + result.field22_.Add(values); + return this; + } + public Builder ClearField22() { + PrepareBuilder(); + result.field22_.Clear(); + return this; + } + + public pbc::IPopsicleList Field73List { + get { return PrepareBuilder().field73_; } + } + public int Field73Count { + get { return result.Field73Count; } + } + public int GetField73(int index) { + return result.GetField73(index); + } + public Builder SetField73(int index, int value) { + PrepareBuilder(); + result.field73_[index] = value; + return this; + } + public Builder AddField73(int value) { + PrepareBuilder(); + result.field73_.Add(value); + return this; + } + public Builder AddRangeField73(scg::IEnumerable values) { + PrepareBuilder(); + result.field73_.Add(values); + return this; + } + public Builder ClearField73() { + PrepareBuilder(); + result.field73_.Clear(); + return this; + } + + public bool HasField20 { + get { return result.hasField20; } + } + public int Field20 { + get { return result.Field20; } + set { SetField20(value); } + } + public Builder SetField20(int value) { + PrepareBuilder(); + result.hasField20 = true; + result.field20_ = value; + return this; + } + public Builder ClearField20() { + PrepareBuilder(); + result.hasField20 = false; + result.field20_ = 0; + return this; + } + + public bool HasField24 { + get { return result.hasField24; } + } + public string Field24 { + get { return result.Field24; } + set { SetField24(value); } + } + public Builder SetField24(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField24 = true; + result.field24_ = value; + return this; + } + public Builder ClearField24() { + PrepareBuilder(); + result.hasField24 = false; + result.field24_ = ""; + return this; + } + + public bool HasField31 { + get { return result.hasField31; } + } + public global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage Field31 { + get { return result.Field31; } + set { SetField31(value); } + } + public Builder SetField31(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField31 = true; + result.field31_ = value; + return this; + } + public Builder SetField31(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasField31 = true; + result.field31_ = builderForValue.Build(); + return this; + } + public Builder MergeField31(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasField31 && + result.field31_ != global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance) { + result.field31_ = global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.CreateBuilder(result.field31_).MergeFrom(value).BuildPartial(); + } else { + result.field31_ = value; + } + result.hasField31 = true; + return this; + } + public Builder ClearField31() { + PrepareBuilder(); + result.hasField31 = false; + result.field31_ = null; + return this; + } + } + static Group1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int Field1FieldNumber = 1; + private bool hasField1; + private string field1_ = ""; + public bool HasField1 { + get { return hasField1; } + } + public string Field1 { + get { return field1_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private long field3_; + public bool HasField3 { + get { return hasField3; } + } + public long Field3 { + get { return field3_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private long field4_; + public bool HasField4 { + get { return hasField4; } + } + public long Field4 { + get { return field4_; } + } + + public const int Field30FieldNumber = 30; + private bool hasField30; + private long field30_; + public bool HasField30 { + get { return hasField30; } + } + public long Field30 { + get { return field30_; } + } + + public const int Field75FieldNumber = 75; + private bool hasField75; + private bool field75_; + public bool HasField75 { + get { return hasField75; } + } + public bool Field75 { + get { return field75_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private string field6_ = ""; + public bool HasField6 { + get { return hasField6; } + } + public string Field6 { + get { return field6_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private pb::ByteString field2_ = pb::ByteString.Empty; + public bool HasField2 { + get { return hasField2; } + } + public pb::ByteString Field2 { + get { return field2_; } + } + + public const int Field21FieldNumber = 21; + private bool hasField21; + private int field21_; + public bool HasField21 { + get { return hasField21; } + } + public int Field21 { + get { return field21_; } + } + + public const int Field71FieldNumber = 71; + private bool hasField71; + private int field71_; + public bool HasField71 { + get { return hasField71; } + } + public int Field71 { + get { return field71_; } + } + + public const int Field25FieldNumber = 25; + private bool hasField25; + private float field25_; + public bool HasField25 { + get { return hasField25; } + } + public float Field25 { + get { return field25_; } + } + + public const int Field109FieldNumber = 109; + private bool hasField109; + private int field109_; + public bool HasField109 { + get { return hasField109; } + } + public int Field109 { + get { return field109_; } + } + + public const int Field210FieldNumber = 210; + private bool hasField210; + private int field210_; + public bool HasField210 { + get { return hasField210; } + } + public int Field210 { + get { return field210_; } + } + + public const int Field211FieldNumber = 211; + private bool hasField211; + private int field211_; + public bool HasField211 { + get { return hasField211; } + } + public int Field211 { + get { return field211_; } + } + + public const int Field212FieldNumber = 212; + private bool hasField212; + private int field212_; + public bool HasField212 { + get { return hasField212; } + } + public int Field212 { + get { return field212_; } + } + + public const int Field213FieldNumber = 213; + private bool hasField213; + private int field213_; + public bool HasField213 { + get { return hasField213; } + } + public int Field213 { + get { return field213_; } + } + + public const int Field216FieldNumber = 216; + private bool hasField216; + private int field216_; + public bool HasField216 { + get { return hasField216; } + } + public int Field216 { + get { return field216_; } + } + + public const int Field217FieldNumber = 217; + private bool hasField217; + private int field217_; + public bool HasField217 { + get { return hasField217; } + } + public int Field217 { + get { return field217_; } + } + + public const int Field218FieldNumber = 218; + private bool hasField218; + private int field218_; + public bool HasField218 { + get { return hasField218; } + } + public int Field218 { + get { return field218_; } + } + + public const int Field220FieldNumber = 220; + private bool hasField220; + private int field220_; + public bool HasField220 { + get { return hasField220; } + } + public int Field220 { + get { return field220_; } + } + + public const int Field221FieldNumber = 221; + private bool hasField221; + private int field221_; + public bool HasField221 { + get { return hasField221; } + } + public int Field221 { + get { return field221_; } + } + + public const int Field222FieldNumber = 222; + private bool hasField222; + private float field222_; + public bool HasField222 { + get { return hasField222; } + } + public float Field222 { + get { return field222_; } + } + + public const int Field63FieldNumber = 63; + private bool hasField63; + private int field63_; + public bool HasField63 { + get { return hasField63; } + } + public int Field63 { + get { return field63_; } + } + + public const int Group1FieldNumber = 10; + private pbc::PopsicleList group1_ = new pbc::PopsicleList(); + public scg::IList Group1List { + get { return group1_; } + } + public int Group1Count { + get { return group1_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1 GetGroup1(int index) { + return group1_[index]; + } + + public const int Field128FieldNumber = 128; + private pbc::PopsicleList field128_ = new pbc::PopsicleList(); + public scg::IList Field128List { + get { return pbc::Lists.AsReadOnly(field128_); } + } + public int Field128Count { + get { return field128_.Count; } + } + public string GetField128(int index) { + return field128_[index]; + } + + public const int Field131FieldNumber = 131; + private bool hasField131; + private long field131_; + public bool HasField131 { + get { return hasField131; } + } + public long Field131 { + get { return field131_; } + } + + public const int Field127FieldNumber = 127; + private pbc::PopsicleList field127_ = new pbc::PopsicleList(); + public scg::IList Field127List { + get { return pbc::Lists.AsReadOnly(field127_); } + } + public int Field127Count { + get { return field127_.Count; } + } + public string GetField127(int index) { + return field127_[index]; + } + + public const int Field129FieldNumber = 129; + private bool hasField129; + private int field129_; + public bool HasField129 { + get { return hasField129; } + } + public int Field129 { + get { return field129_; } + } + + public const int Field130FieldNumber = 130; + private pbc::PopsicleList field130_ = new pbc::PopsicleList(); + public scg::IList Field130List { + get { return pbc::Lists.AsReadOnly(field130_); } + } + public int Field130Count { + get { return field130_.Count; } + } + public long GetField130(int index) { + return field130_[index]; + } + + public const int Field205FieldNumber = 205; + private bool hasField205; + private bool field205_; + public bool HasField205 { + get { return hasField205; } + } + public bool Field205 { + get { return field205_; } + } + + public const int Field206FieldNumber = 206; + private bool hasField206; + private bool field206_; + public bool HasField206 { + get { return hasField206; } + } + public bool Field206 { + get { return field206_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _speedMessage2FieldNames; + if (hasField1) { + output.WriteString(1, field_names[0], Field1); + } + if (hasField2) { + output.WriteBytes(2, field_names[7], Field2); + } + if (hasField3) { + output.WriteInt64(3, field_names[22], Field3); + } + if (hasField4) { + output.WriteInt64(4, field_names[24], Field4); + } + if (hasField6) { + output.WriteString(6, field_names[25], Field6); + } + if (group1_.Count > 0) { + output.WriteGroupArray(10, field_names[29], group1_); + } + if (hasField21) { + output.WriteInt32(21, field_names[10], Field21); + } + if (hasField25) { + output.WriteFloat(25, field_names[21], Field25); + } + if (hasField30) { + output.WriteInt64(30, field_names[23], Field30); + } + if (hasField63) { + output.WriteInt32(63, field_names[26], Field63); + } + if (hasField71) { + output.WriteInt32(71, field_names[27], Field71); + } + if (hasField75) { + output.WriteBool(75, field_names[28], Field75); + } + if (hasField109) { + output.WriteInt32(109, field_names[1], Field109); + } + if (field127_.Count > 0) { + output.WriteStringArray(127, field_names[2], field127_); + } + if (field128_.Count > 0) { + output.WriteStringArray(128, field_names[3], field128_); + } + if (hasField129) { + output.WriteInt32(129, field_names[4], Field129); + } + if (field130_.Count > 0) { + output.WriteInt64Array(130, field_names[5], field130_); + } + if (hasField131) { + output.WriteInt64(131, field_names[6], Field131); + } + if (hasField205) { + output.WriteBool(205, field_names[8], Field205); + } + if (hasField206) { + output.WriteBool(206, field_names[9], Field206); + } + if (hasField210) { + output.WriteInt32(210, field_names[11], Field210); + } + if (hasField211) { + output.WriteInt32(211, field_names[12], Field211); + } + if (hasField212) { + output.WriteInt32(212, field_names[13], Field212); + } + if (hasField213) { + output.WriteInt32(213, field_names[14], Field213); + } + if (hasField216) { + output.WriteInt32(216, field_names[15], Field216); + } + if (hasField217) { + output.WriteInt32(217, field_names[16], Field217); + } + if (hasField218) { + output.WriteInt32(218, field_names[17], Field218); + } + if (hasField220) { + output.WriteInt32(220, field_names[18], Field220); + } + if (hasField221) { + output.WriteInt32(221, field_names[19], Field221); + } + if (hasField222) { + output.WriteFloat(222, field_names[20], Field222); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField1) { + size += pb::CodedOutputStream.ComputeStringSize(1, Field1); + } + if (hasField3) { + size += pb::CodedOutputStream.ComputeInt64Size(3, Field3); + } + if (hasField4) { + size += pb::CodedOutputStream.ComputeInt64Size(4, Field4); + } + if (hasField30) { + size += pb::CodedOutputStream.ComputeInt64Size(30, Field30); + } + if (hasField75) { + size += pb::CodedOutputStream.ComputeBoolSize(75, Field75); + } + if (hasField6) { + size += pb::CodedOutputStream.ComputeStringSize(6, Field6); + } + if (hasField2) { + size += pb::CodedOutputStream.ComputeBytesSize(2, Field2); + } + if (hasField21) { + size += pb::CodedOutputStream.ComputeInt32Size(21, Field21); + } + if (hasField71) { + size += pb::CodedOutputStream.ComputeInt32Size(71, Field71); + } + if (hasField25) { + size += pb::CodedOutputStream.ComputeFloatSize(25, Field25); + } + if (hasField109) { + size += pb::CodedOutputStream.ComputeInt32Size(109, Field109); + } + if (hasField210) { + size += pb::CodedOutputStream.ComputeInt32Size(210, Field210); + } + if (hasField211) { + size += pb::CodedOutputStream.ComputeInt32Size(211, Field211); + } + if (hasField212) { + size += pb::CodedOutputStream.ComputeInt32Size(212, Field212); + } + if (hasField213) { + size += pb::CodedOutputStream.ComputeInt32Size(213, Field213); + } + if (hasField216) { + size += pb::CodedOutputStream.ComputeInt32Size(216, Field216); + } + if (hasField217) { + size += pb::CodedOutputStream.ComputeInt32Size(217, Field217); + } + if (hasField218) { + size += pb::CodedOutputStream.ComputeInt32Size(218, Field218); + } + if (hasField220) { + size += pb::CodedOutputStream.ComputeInt32Size(220, Field220); + } + if (hasField221) { + size += pb::CodedOutputStream.ComputeInt32Size(221, Field221); + } + if (hasField222) { + size += pb::CodedOutputStream.ComputeFloatSize(222, Field222); + } + if (hasField63) { + size += pb::CodedOutputStream.ComputeInt32Size(63, Field63); + } + foreach (global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1 element in Group1List) { + size += pb::CodedOutputStream.ComputeGroupSize(10, element); + } + { + int dataSize = 0; + foreach (string element in Field128List) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * field128_.Count; + } + if (hasField131) { + size += pb::CodedOutputStream.ComputeInt64Size(131, Field131); + } + { + int dataSize = 0; + foreach (string element in Field127List) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * field127_.Count; + } + if (hasField129) { + size += pb::CodedOutputStream.ComputeInt32Size(129, Field129); + } + { + int dataSize = 0; + foreach (long element in Field130List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * field130_.Count; + } + if (hasField205) { + size += pb::CodedOutputStream.ComputeBoolSize(205, Field205); + } + if (hasField206) { + size += pb::CodedOutputStream.ComputeBoolSize(206, Field206); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SpeedMessage2 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SpeedMessage2 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SpeedMessage2 MakeReadOnly() { + group1_.MakeReadOnly(); + field128_.MakeReadOnly(); + field127_.MakeReadOnly(); + field130_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SpeedMessage2 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SpeedMessage2 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SpeedMessage2 result; + + private SpeedMessage2 PrepareBuilder() { + if (resultIsReadOnly) { + SpeedMessage2 original = result; + result = new SpeedMessage2(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SpeedMessage2 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Descriptor; } + } + + public override SpeedMessage2 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.DefaultInstance; } + } + + public override SpeedMessage2 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SpeedMessage2) { + return MergeFrom((SpeedMessage2) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SpeedMessage2 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField1) { + Field1 = other.Field1; + } + if (other.HasField3) { + Field3 = other.Field3; + } + if (other.HasField4) { + Field4 = other.Field4; + } + if (other.HasField30) { + Field30 = other.Field30; + } + if (other.HasField75) { + Field75 = other.Field75; + } + if (other.HasField6) { + Field6 = other.Field6; + } + if (other.HasField2) { + Field2 = other.Field2; + } + if (other.HasField21) { + Field21 = other.Field21; + } + if (other.HasField71) { + Field71 = other.Field71; + } + if (other.HasField25) { + Field25 = other.Field25; + } + if (other.HasField109) { + Field109 = other.Field109; + } + if (other.HasField210) { + Field210 = other.Field210; + } + if (other.HasField211) { + Field211 = other.Field211; + } + if (other.HasField212) { + Field212 = other.Field212; + } + if (other.HasField213) { + Field213 = other.Field213; + } + if (other.HasField216) { + Field216 = other.Field216; + } + if (other.HasField217) { + Field217 = other.Field217; + } + if (other.HasField218) { + Field218 = other.Field218; + } + if (other.HasField220) { + Field220 = other.Field220; + } + if (other.HasField221) { + Field221 = other.Field221; + } + if (other.HasField222) { + Field222 = other.Field222; + } + if (other.HasField63) { + Field63 = other.Field63; + } + if (other.group1_.Count != 0) { + result.group1_.Add(other.group1_); + } + if (other.field128_.Count != 0) { + result.field128_.Add(other.field128_); + } + if (other.HasField131) { + Field131 = other.Field131; + } + if (other.field127_.Count != 0) { + result.field127_.Add(other.field127_); + } + if (other.HasField129) { + Field129 = other.Field129; + } + if (other.field130_.Count != 0) { + result.field130_.Add(other.field130_); + } + if (other.HasField205) { + Field205 = other.Field205; + } + if (other.HasField206) { + Field206 = other.Field206; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_speedMessage2FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _speedMessage2FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasField1 = input.ReadString(ref result.field1_); + break; + } + case 18: { + result.hasField2 = input.ReadBytes(ref result.field2_); + break; + } + case 24: { + result.hasField3 = input.ReadInt64(ref result.field3_); + break; + } + case 32: { + result.hasField4 = input.ReadInt64(ref result.field4_); + break; + } + case 50: { + result.hasField6 = input.ReadString(ref result.field6_); + break; + } + case 83: { + input.ReadGroupArray(tag, field_name, result.group1_, global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1.DefaultInstance, extensionRegistry); + break; + } + case 168: { + result.hasField21 = input.ReadInt32(ref result.field21_); + break; + } + case 205: { + result.hasField25 = input.ReadFloat(ref result.field25_); + break; + } + case 240: { + result.hasField30 = input.ReadInt64(ref result.field30_); + break; + } + case 504: { + result.hasField63 = input.ReadInt32(ref result.field63_); + break; + } + case 568: { + result.hasField71 = input.ReadInt32(ref result.field71_); + break; + } + case 600: { + result.hasField75 = input.ReadBool(ref result.field75_); + break; + } + case 872: { + result.hasField109 = input.ReadInt32(ref result.field109_); + break; + } + case 1018: { + input.ReadStringArray(tag, field_name, result.field127_); + break; + } + case 1026: { + input.ReadStringArray(tag, field_name, result.field128_); + break; + } + case 1032: { + result.hasField129 = input.ReadInt32(ref result.field129_); + break; + } + case 1042: + case 1040: { + input.ReadInt64Array(tag, field_name, result.field130_); + break; + } + case 1048: { + result.hasField131 = input.ReadInt64(ref result.field131_); + break; + } + case 1640: { + result.hasField205 = input.ReadBool(ref result.field205_); + break; + } + case 1648: { + result.hasField206 = input.ReadBool(ref result.field206_); + break; + } + case 1680: { + result.hasField210 = input.ReadInt32(ref result.field210_); + break; + } + case 1688: { + result.hasField211 = input.ReadInt32(ref result.field211_); + break; + } + case 1696: { + result.hasField212 = input.ReadInt32(ref result.field212_); + break; + } + case 1704: { + result.hasField213 = input.ReadInt32(ref result.field213_); + break; + } + case 1728: { + result.hasField216 = input.ReadInt32(ref result.field216_); + break; + } + case 1736: { + result.hasField217 = input.ReadInt32(ref result.field217_); + break; + } + case 1744: { + result.hasField218 = input.ReadInt32(ref result.field218_); + break; + } + case 1760: { + result.hasField220 = input.ReadInt32(ref result.field220_); + break; + } + case 1768: { + result.hasField221 = input.ReadInt32(ref result.field221_); + break; + } + case 1781: { + result.hasField222 = input.ReadFloat(ref result.field222_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public string Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = ""; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public long Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(long value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0L; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public long Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(long value) { + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = 0L; + return this; + } + + public bool HasField30 { + get { return result.hasField30; } + } + public long Field30 { + get { return result.Field30; } + set { SetField30(value); } + } + public Builder SetField30(long value) { + PrepareBuilder(); + result.hasField30 = true; + result.field30_ = value; + return this; + } + public Builder ClearField30() { + PrepareBuilder(); + result.hasField30 = false; + result.field30_ = 0L; + return this; + } + + public bool HasField75 { + get { return result.hasField75; } + } + public bool Field75 { + get { return result.Field75; } + set { SetField75(value); } + } + public Builder SetField75(bool value) { + PrepareBuilder(); + result.hasField75 = true; + result.field75_ = value; + return this; + } + public Builder ClearField75() { + PrepareBuilder(); + result.hasField75 = false; + result.field75_ = false; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public string Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = ""; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public pb::ByteString Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = pb::ByteString.Empty; + return this; + } + + public bool HasField21 { + get { return result.hasField21; } + } + public int Field21 { + get { return result.Field21; } + set { SetField21(value); } + } + public Builder SetField21(int value) { + PrepareBuilder(); + result.hasField21 = true; + result.field21_ = value; + return this; + } + public Builder ClearField21() { + PrepareBuilder(); + result.hasField21 = false; + result.field21_ = 0; + return this; + } + + public bool HasField71 { + get { return result.hasField71; } + } + public int Field71 { + get { return result.Field71; } + set { SetField71(value); } + } + public Builder SetField71(int value) { + PrepareBuilder(); + result.hasField71 = true; + result.field71_ = value; + return this; + } + public Builder ClearField71() { + PrepareBuilder(); + result.hasField71 = false; + result.field71_ = 0; + return this; + } + + public bool HasField25 { + get { return result.hasField25; } + } + public float Field25 { + get { return result.Field25; } + set { SetField25(value); } + } + public Builder SetField25(float value) { + PrepareBuilder(); + result.hasField25 = true; + result.field25_ = value; + return this; + } + public Builder ClearField25() { + PrepareBuilder(); + result.hasField25 = false; + result.field25_ = 0F; + return this; + } + + public bool HasField109 { + get { return result.hasField109; } + } + public int Field109 { + get { return result.Field109; } + set { SetField109(value); } + } + public Builder SetField109(int value) { + PrepareBuilder(); + result.hasField109 = true; + result.field109_ = value; + return this; + } + public Builder ClearField109() { + PrepareBuilder(); + result.hasField109 = false; + result.field109_ = 0; + return this; + } + + public bool HasField210 { + get { return result.hasField210; } + } + public int Field210 { + get { return result.Field210; } + set { SetField210(value); } + } + public Builder SetField210(int value) { + PrepareBuilder(); + result.hasField210 = true; + result.field210_ = value; + return this; + } + public Builder ClearField210() { + PrepareBuilder(); + result.hasField210 = false; + result.field210_ = 0; + return this; + } + + public bool HasField211 { + get { return result.hasField211; } + } + public int Field211 { + get { return result.Field211; } + set { SetField211(value); } + } + public Builder SetField211(int value) { + PrepareBuilder(); + result.hasField211 = true; + result.field211_ = value; + return this; + } + public Builder ClearField211() { + PrepareBuilder(); + result.hasField211 = false; + result.field211_ = 0; + return this; + } + + public bool HasField212 { + get { return result.hasField212; } + } + public int Field212 { + get { return result.Field212; } + set { SetField212(value); } + } + public Builder SetField212(int value) { + PrepareBuilder(); + result.hasField212 = true; + result.field212_ = value; + return this; + } + public Builder ClearField212() { + PrepareBuilder(); + result.hasField212 = false; + result.field212_ = 0; + return this; + } + + public bool HasField213 { + get { return result.hasField213; } + } + public int Field213 { + get { return result.Field213; } + set { SetField213(value); } + } + public Builder SetField213(int value) { + PrepareBuilder(); + result.hasField213 = true; + result.field213_ = value; + return this; + } + public Builder ClearField213() { + PrepareBuilder(); + result.hasField213 = false; + result.field213_ = 0; + return this; + } + + public bool HasField216 { + get { return result.hasField216; } + } + public int Field216 { + get { return result.Field216; } + set { SetField216(value); } + } + public Builder SetField216(int value) { + PrepareBuilder(); + result.hasField216 = true; + result.field216_ = value; + return this; + } + public Builder ClearField216() { + PrepareBuilder(); + result.hasField216 = false; + result.field216_ = 0; + return this; + } + + public bool HasField217 { + get { return result.hasField217; } + } + public int Field217 { + get { return result.Field217; } + set { SetField217(value); } + } + public Builder SetField217(int value) { + PrepareBuilder(); + result.hasField217 = true; + result.field217_ = value; + return this; + } + public Builder ClearField217() { + PrepareBuilder(); + result.hasField217 = false; + result.field217_ = 0; + return this; + } + + public bool HasField218 { + get { return result.hasField218; } + } + public int Field218 { + get { return result.Field218; } + set { SetField218(value); } + } + public Builder SetField218(int value) { + PrepareBuilder(); + result.hasField218 = true; + result.field218_ = value; + return this; + } + public Builder ClearField218() { + PrepareBuilder(); + result.hasField218 = false; + result.field218_ = 0; + return this; + } + + public bool HasField220 { + get { return result.hasField220; } + } + public int Field220 { + get { return result.Field220; } + set { SetField220(value); } + } + public Builder SetField220(int value) { + PrepareBuilder(); + result.hasField220 = true; + result.field220_ = value; + return this; + } + public Builder ClearField220() { + PrepareBuilder(); + result.hasField220 = false; + result.field220_ = 0; + return this; + } + + public bool HasField221 { + get { return result.hasField221; } + } + public int Field221 { + get { return result.Field221; } + set { SetField221(value); } + } + public Builder SetField221(int value) { + PrepareBuilder(); + result.hasField221 = true; + result.field221_ = value; + return this; + } + public Builder ClearField221() { + PrepareBuilder(); + result.hasField221 = false; + result.field221_ = 0; + return this; + } + + public bool HasField222 { + get { return result.hasField222; } + } + public float Field222 { + get { return result.Field222; } + set { SetField222(value); } + } + public Builder SetField222(float value) { + PrepareBuilder(); + result.hasField222 = true; + result.field222_ = value; + return this; + } + public Builder ClearField222() { + PrepareBuilder(); + result.hasField222 = false; + result.field222_ = 0F; + return this; + } + + public bool HasField63 { + get { return result.hasField63; } + } + public int Field63 { + get { return result.Field63; } + set { SetField63(value); } + } + public Builder SetField63(int value) { + PrepareBuilder(); + result.hasField63 = true; + result.field63_ = value; + return this; + } + public Builder ClearField63() { + PrepareBuilder(); + result.hasField63 = false; + result.field63_ = 0; + return this; + } + + public pbc::IPopsicleList Group1List { + get { return PrepareBuilder().group1_; } + } + public int Group1Count { + get { return result.Group1Count; } + } + public global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1 GetGroup1(int index) { + return result.GetGroup1(index); + } + public Builder SetGroup1(int index, global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.group1_[index] = value; + return this; + } + public Builder SetGroup1(int index, global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.group1_[index] = builderForValue.Build(); + return this; + } + public Builder AddGroup1(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1 value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.group1_.Add(value); + return this; + } + public Builder AddGroup1(global::Google.ProtocolBuffers.TestProtos.SpeedMessage2.Types.Group1.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.group1_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeGroup1(scg::IEnumerable values) { + PrepareBuilder(); + result.group1_.Add(values); + return this; + } + public Builder ClearGroup1() { + PrepareBuilder(); + result.group1_.Clear(); + return this; + } + + public pbc::IPopsicleList Field128List { + get { return PrepareBuilder().field128_; } + } + public int Field128Count { + get { return result.Field128Count; } + } + public string GetField128(int index) { + return result.GetField128(index); + } + public Builder SetField128(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field128_[index] = value; + return this; + } + public Builder AddField128(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field128_.Add(value); + return this; + } + public Builder AddRangeField128(scg::IEnumerable values) { + PrepareBuilder(); + result.field128_.Add(values); + return this; + } + public Builder ClearField128() { + PrepareBuilder(); + result.field128_.Clear(); + return this; + } + + public bool HasField131 { + get { return result.hasField131; } + } + public long Field131 { + get { return result.Field131; } + set { SetField131(value); } + } + public Builder SetField131(long value) { + PrepareBuilder(); + result.hasField131 = true; + result.field131_ = value; + return this; + } + public Builder ClearField131() { + PrepareBuilder(); + result.hasField131 = false; + result.field131_ = 0L; + return this; + } + + public pbc::IPopsicleList Field127List { + get { return PrepareBuilder().field127_; } + } + public int Field127Count { + get { return result.Field127Count; } + } + public string GetField127(int index) { + return result.GetField127(index); + } + public Builder SetField127(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field127_[index] = value; + return this; + } + public Builder AddField127(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field127_.Add(value); + return this; + } + public Builder AddRangeField127(scg::IEnumerable values) { + PrepareBuilder(); + result.field127_.Add(values); + return this; + } + public Builder ClearField127() { + PrepareBuilder(); + result.field127_.Clear(); + return this; + } + + public bool HasField129 { + get { return result.hasField129; } + } + public int Field129 { + get { return result.Field129; } + set { SetField129(value); } + } + public Builder SetField129(int value) { + PrepareBuilder(); + result.hasField129 = true; + result.field129_ = value; + return this; + } + public Builder ClearField129() { + PrepareBuilder(); + result.hasField129 = false; + result.field129_ = 0; + return this; + } + + public pbc::IPopsicleList Field130List { + get { return PrepareBuilder().field130_; } + } + public int Field130Count { + get { return result.Field130Count; } + } + public long GetField130(int index) { + return result.GetField130(index); + } + public Builder SetField130(int index, long value) { + PrepareBuilder(); + result.field130_[index] = value; + return this; + } + public Builder AddField130(long value) { + PrepareBuilder(); + result.field130_.Add(value); + return this; + } + public Builder AddRangeField130(scg::IEnumerable values) { + PrepareBuilder(); + result.field130_.Add(values); + return this; + } + public Builder ClearField130() { + PrepareBuilder(); + result.field130_.Clear(); + return this; + } + + public bool HasField205 { + get { return result.hasField205; } + } + public bool Field205 { + get { return result.Field205; } + set { SetField205(value); } + } + public Builder SetField205(bool value) { + PrepareBuilder(); + result.hasField205 = true; + result.field205_ = value; + return this; + } + public Builder ClearField205() { + PrepareBuilder(); + result.hasField205 = false; + result.field205_ = false; + return this; + } + + public bool HasField206 { + get { return result.hasField206; } + } + public bool Field206 { + get { return result.Field206; } + set { SetField206(value); } + } + public Builder SetField206(bool value) { + PrepareBuilder(); + result.hasField206 = true; + result.field206_ = value; + return this; + } + public Builder ClearField206() { + PrepareBuilder(); + result.hasField206 = false; + result.field206_ = false; + return this; + } + } + static SpeedMessage2() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SpeedMessage2GroupedMessage : pb::GeneratedMessage { + private SpeedMessage2GroupedMessage() { } + private static readonly SpeedMessage2GroupedMessage defaultInstance = new SpeedMessage2GroupedMessage().MakeReadOnly(); + private static readonly string[] _speedMessage2GroupedMessageFieldNames = new string[] { "field1", "field10", "field11", "field2", "field3", "field4", "field5", "field6", "field7", "field8", "field9" }; + private static readonly uint[] _speedMessage2GroupedMessageFieldTags = new uint[] { 13, 85, 88, 21, 29, 32, 40, 48, 56, 69, 72 }; + public static SpeedMessage2GroupedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SpeedMessage2GroupedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SpeedMessage2GroupedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage2GroupedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.internal__static_unittest_google_speed_SpeedMessage2GroupedMessage__FieldAccessorTable; } + } + + public const int Field1FieldNumber = 1; + private bool hasField1; + private float field1_; + public bool HasField1 { + get { return hasField1; } + } + public float Field1 { + get { return field1_; } + } + + public const int Field2FieldNumber = 2; + private bool hasField2; + private float field2_; + public bool HasField2 { + get { return hasField2; } + } + public float Field2 { + get { return field2_; } + } + + public const int Field3FieldNumber = 3; + private bool hasField3; + private float field3_; + public bool HasField3 { + get { return hasField3; } + } + public float Field3 { + get { return field3_; } + } + + public const int Field4FieldNumber = 4; + private bool hasField4; + private bool field4_; + public bool HasField4 { + get { return hasField4; } + } + public bool Field4 { + get { return field4_; } + } + + public const int Field5FieldNumber = 5; + private bool hasField5; + private bool field5_; + public bool HasField5 { + get { return hasField5; } + } + public bool Field5 { + get { return field5_; } + } + + public const int Field6FieldNumber = 6; + private bool hasField6; + private bool field6_ = true; + public bool HasField6 { + get { return hasField6; } + } + public bool Field6 { + get { return field6_; } + } + + public const int Field7FieldNumber = 7; + private bool hasField7; + private bool field7_; + public bool HasField7 { + get { return hasField7; } + } + public bool Field7 { + get { return field7_; } + } + + public const int Field8FieldNumber = 8; + private bool hasField8; + private float field8_; + public bool HasField8 { + get { return hasField8; } + } + public float Field8 { + get { return field8_; } + } + + public const int Field9FieldNumber = 9; + private bool hasField9; + private bool field9_; + public bool HasField9 { + get { return hasField9; } + } + public bool Field9 { + get { return field9_; } + } + + public const int Field10FieldNumber = 10; + private bool hasField10; + private float field10_; + public bool HasField10 { + get { return hasField10; } + } + public float Field10 { + get { return field10_; } + } + + public const int Field11FieldNumber = 11; + private bool hasField11; + private long field11_; + public bool HasField11 { + get { return hasField11; } + } + public long Field11 { + get { return field11_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _speedMessage2GroupedMessageFieldNames; + if (hasField1) { + output.WriteFloat(1, field_names[0], Field1); + } + if (hasField2) { + output.WriteFloat(2, field_names[3], Field2); + } + if (hasField3) { + output.WriteFloat(3, field_names[4], Field3); + } + if (hasField4) { + output.WriteBool(4, field_names[5], Field4); + } + if (hasField5) { + output.WriteBool(5, field_names[6], Field5); + } + if (hasField6) { + output.WriteBool(6, field_names[7], Field6); + } + if (hasField7) { + output.WriteBool(7, field_names[8], Field7); + } + if (hasField8) { + output.WriteFloat(8, field_names[9], Field8); + } + if (hasField9) { + output.WriteBool(9, field_names[10], Field9); + } + if (hasField10) { + output.WriteFloat(10, field_names[1], Field10); + } + if (hasField11) { + output.WriteInt64(11, field_names[2], Field11); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasField1) { + size += pb::CodedOutputStream.ComputeFloatSize(1, Field1); + } + if (hasField2) { + size += pb::CodedOutputStream.ComputeFloatSize(2, Field2); + } + if (hasField3) { + size += pb::CodedOutputStream.ComputeFloatSize(3, Field3); + } + if (hasField4) { + size += pb::CodedOutputStream.ComputeBoolSize(4, Field4); + } + if (hasField5) { + size += pb::CodedOutputStream.ComputeBoolSize(5, Field5); + } + if (hasField6) { + size += pb::CodedOutputStream.ComputeBoolSize(6, Field6); + } + if (hasField7) { + size += pb::CodedOutputStream.ComputeBoolSize(7, Field7); + } + if (hasField8) { + size += pb::CodedOutputStream.ComputeFloatSize(8, Field8); + } + if (hasField9) { + size += pb::CodedOutputStream.ComputeBoolSize(9, Field9); + } + if (hasField10) { + size += pb::CodedOutputStream.ComputeFloatSize(10, Field10); + } + if (hasField11) { + size += pb::CodedOutputStream.ComputeInt64Size(11, Field11); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SpeedMessage2GroupedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SpeedMessage2GroupedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SpeedMessage2GroupedMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SpeedMessage2GroupedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SpeedMessage2GroupedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SpeedMessage2GroupedMessage result; + + private SpeedMessage2GroupedMessage PrepareBuilder() { + if (resultIsReadOnly) { + SpeedMessage2GroupedMessage original = result; + result = new SpeedMessage2GroupedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SpeedMessage2GroupedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.Descriptor; } + } + + public override SpeedMessage2GroupedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance; } + } + + public override SpeedMessage2GroupedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SpeedMessage2GroupedMessage) { + return MergeFrom((SpeedMessage2GroupedMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SpeedMessage2GroupedMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SpeedMessage2GroupedMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasField1) { + Field1 = other.Field1; + } + if (other.HasField2) { + Field2 = other.Field2; + } + if (other.HasField3) { + Field3 = other.Field3; + } + if (other.HasField4) { + Field4 = other.Field4; + } + if (other.HasField5) { + Field5 = other.Field5; + } + if (other.HasField6) { + Field6 = other.Field6; + } + if (other.HasField7) { + Field7 = other.Field7; + } + if (other.HasField8) { + Field8 = other.Field8; + } + if (other.HasField9) { + Field9 = other.Field9; + } + if (other.HasField10) { + Field10 = other.Field10; + } + if (other.HasField11) { + Field11 = other.Field11; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_speedMessage2GroupedMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _speedMessage2GroupedMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 13: { + result.hasField1 = input.ReadFloat(ref result.field1_); + break; + } + case 21: { + result.hasField2 = input.ReadFloat(ref result.field2_); + break; + } + case 29: { + result.hasField3 = input.ReadFloat(ref result.field3_); + break; + } + case 32: { + result.hasField4 = input.ReadBool(ref result.field4_); + break; + } + case 40: { + result.hasField5 = input.ReadBool(ref result.field5_); + break; + } + case 48: { + result.hasField6 = input.ReadBool(ref result.field6_); + break; + } + case 56: { + result.hasField7 = input.ReadBool(ref result.field7_); + break; + } + case 69: { + result.hasField8 = input.ReadFloat(ref result.field8_); + break; + } + case 72: { + result.hasField9 = input.ReadBool(ref result.field9_); + break; + } + case 85: { + result.hasField10 = input.ReadFloat(ref result.field10_); + break; + } + case 88: { + result.hasField11 = input.ReadInt64(ref result.field11_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasField1 { + get { return result.hasField1; } + } + public float Field1 { + get { return result.Field1; } + set { SetField1(value); } + } + public Builder SetField1(float value) { + PrepareBuilder(); + result.hasField1 = true; + result.field1_ = value; + return this; + } + public Builder ClearField1() { + PrepareBuilder(); + result.hasField1 = false; + result.field1_ = 0F; + return this; + } + + public bool HasField2 { + get { return result.hasField2; } + } + public float Field2 { + get { return result.Field2; } + set { SetField2(value); } + } + public Builder SetField2(float value) { + PrepareBuilder(); + result.hasField2 = true; + result.field2_ = value; + return this; + } + public Builder ClearField2() { + PrepareBuilder(); + result.hasField2 = false; + result.field2_ = 0F; + return this; + } + + public bool HasField3 { + get { return result.hasField3; } + } + public float Field3 { + get { return result.Field3; } + set { SetField3(value); } + } + public Builder SetField3(float value) { + PrepareBuilder(); + result.hasField3 = true; + result.field3_ = value; + return this; + } + public Builder ClearField3() { + PrepareBuilder(); + result.hasField3 = false; + result.field3_ = 0F; + return this; + } + + public bool HasField4 { + get { return result.hasField4; } + } + public bool Field4 { + get { return result.Field4; } + set { SetField4(value); } + } + public Builder SetField4(bool value) { + PrepareBuilder(); + result.hasField4 = true; + result.field4_ = value; + return this; + } + public Builder ClearField4() { + PrepareBuilder(); + result.hasField4 = false; + result.field4_ = false; + return this; + } + + public bool HasField5 { + get { return result.hasField5; } + } + public bool Field5 { + get { return result.Field5; } + set { SetField5(value); } + } + public Builder SetField5(bool value) { + PrepareBuilder(); + result.hasField5 = true; + result.field5_ = value; + return this; + } + public Builder ClearField5() { + PrepareBuilder(); + result.hasField5 = false; + result.field5_ = false; + return this; + } + + public bool HasField6 { + get { return result.hasField6; } + } + public bool Field6 { + get { return result.Field6; } + set { SetField6(value); } + } + public Builder SetField6(bool value) { + PrepareBuilder(); + result.hasField6 = true; + result.field6_ = value; + return this; + } + public Builder ClearField6() { + PrepareBuilder(); + result.hasField6 = false; + result.field6_ = true; + return this; + } + + public bool HasField7 { + get { return result.hasField7; } + } + public bool Field7 { + get { return result.Field7; } + set { SetField7(value); } + } + public Builder SetField7(bool value) { + PrepareBuilder(); + result.hasField7 = true; + result.field7_ = value; + return this; + } + public Builder ClearField7() { + PrepareBuilder(); + result.hasField7 = false; + result.field7_ = false; + return this; + } + + public bool HasField8 { + get { return result.hasField8; } + } + public float Field8 { + get { return result.Field8; } + set { SetField8(value); } + } + public Builder SetField8(float value) { + PrepareBuilder(); + result.hasField8 = true; + result.field8_ = value; + return this; + } + public Builder ClearField8() { + PrepareBuilder(); + result.hasField8 = false; + result.field8_ = 0F; + return this; + } + + public bool HasField9 { + get { return result.hasField9; } + } + public bool Field9 { + get { return result.Field9; } + set { SetField9(value); } + } + public Builder SetField9(bool value) { + PrepareBuilder(); + result.hasField9 = true; + result.field9_ = value; + return this; + } + public Builder ClearField9() { + PrepareBuilder(); + result.hasField9 = false; + result.field9_ = false; + return this; + } + + public bool HasField10 { + get { return result.hasField10; } + } + public float Field10 { + get { return result.Field10; } + set { SetField10(value); } + } + public Builder SetField10(float value) { + PrepareBuilder(); + result.hasField10 = true; + result.field10_ = value; + return this; + } + public Builder ClearField10() { + PrepareBuilder(); + result.hasField10 = false; + result.field10_ = 0F; + return this; + } + + public bool HasField11 { + get { return result.hasField11; } + } + public long Field11 { + get { return result.Field11; } + set { SetField11(value); } + } + public Builder SetField11(long value) { + PrepareBuilder(); + result.hasField11 = true; + result.field11_ = value; + return this; + } + public Builder ClearField11() { + PrepareBuilder(); + result.hasField11 = false; + result.field11_ = 0L; + return this; + } + } + static SpeedMessage2GroupedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestGoogleSpeedProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs new file mode 100644 index 00000000..fe1f408f --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -0,0 +1,308 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestImportLiteProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + #endregion + #region Extensions + internal static readonly object Descriptor; + static UnitTestImportLiteProtoFile() { + Descriptor = null; + } + #endregion + + } + #region Enums + public enum ImportEnumLite { + IMPORT_LITE_FOO = 7, + IMPORT_LITE_BAR = 8, + IMPORT_LITE_BAZ = 9, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { + private ImportMessageLite() { } + private static readonly ImportMessageLite defaultInstance = new ImportMessageLite().MakeReadOnly(); + private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; + private static readonly uint[] _importMessageLiteFieldTags = new uint[] { 8 }; + public static ImportMessageLite DefaultInstance { + get { return defaultInstance; } + } + + public override ImportMessageLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ImportMessageLite ThisMessage { + get { return this; } + } + + public const int DFieldNumber = 1; + private bool hasD; + private int d_; + public bool HasD { + get { return hasD; } + } + public int D { + get { return d_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _importMessageLiteFieldNames; + if (hasD) { + output.WriteInt32(1, field_names[0], D); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasD) { + size += pb::CodedOutputStream.ComputeInt32Size(1, D); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasD) hash ^= d_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + ImportMessageLite other = obj as ImportMessageLite; + if (other == null) return false; + if (hasD != other.hasD || (hasD && !d_.Equals(other.d_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("d", hasD, d_, writer); + } + #endregion + + public static ImportMessageLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ImportMessageLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ImportMessageLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ImportMessageLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ImportMessageLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ImportMessageLite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ImportMessageLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ImportMessageLite result; + + private ImportMessageLite PrepareBuilder() { + if (resultIsReadOnly) { + ImportMessageLite original = result; + result = new ImportMessageLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ImportMessageLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override ImportMessageLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; } + } + + public override ImportMessageLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is ImportMessageLite) { + return MergeFrom((ImportMessageLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ImportMessageLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasD) { + D = other.D; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_importMessageLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _importMessageLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasD = input.ReadInt32(ref result.d_); + break; + } + } + } + + return this; + } + + + public bool HasD { + get { return result.hasD; } + } + public int D { + get { return result.D; } + set { SetD(value); } + } + public Builder SetD(int value) { + PrepareBuilder(); + result.hasD = true; + result.d_ = value; + return this; + } + public Builder ClearD() { + PrepareBuilder(); + result.hasD = false; + result.d_ = 0; + return this; + } + } + static ImportMessageLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestImportLiteProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs new file mode 100644 index 00000000..4cae2b8b --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestImportProtoFile.cs @@ -0,0 +1,346 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestImportProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_import_ImportMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestImportProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0LnByb3RvEhhwcm90", + "b2J1Zl91bml0dGVzdF9pbXBvcnQaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBf", + "b3B0aW9ucy5wcm90byIaCg1JbXBvcnRNZXNzYWdlEgkKAWQYASABKAUqPAoK", + "SW1wb3J0RW51bRIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JBUhAIEg4K", + "CklNUE9SVF9CQVoQCUJbChhjb20uZ29vZ2xlLnByb3RvYnVmLnRlc3RIAcI+", + "PAohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEhdVbml0VGVz", + "dEltcG9ydFByb3RvRmlsZQ==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_import_ImportMessage__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_import_ImportMessage__Descriptor, + new string[] { "D", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum ImportEnum { + IMPORT_FOO = 7, + IMPORT_BAR = 8, + IMPORT_BAZ = 9, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ImportMessage : pb::GeneratedMessage { + private ImportMessage() { } + private static readonly ImportMessage defaultInstance = new ImportMessage().MakeReadOnly(); + private static readonly string[] _importMessageFieldNames = new string[] { "d" }; + private static readonly uint[] _importMessageFieldTags = new uint[] { 8 }; + public static ImportMessage DefaultInstance { + get { return defaultInstance; } + } + + public override ImportMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ImportMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; } + } + + public const int DFieldNumber = 1; + private bool hasD; + private int d_; + public bool HasD { + get { return hasD; } + } + public int D { + get { return d_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _importMessageFieldNames; + if (hasD) { + output.WriteInt32(1, field_names[0], D); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasD) { + size += pb::CodedOutputStream.ComputeInt32Size(1, D); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ImportMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ImportMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ImportMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ImportMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ImportMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ImportMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ImportMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ImportMessage result; + + private ImportMessage PrepareBuilder() { + if (resultIsReadOnly) { + ImportMessage original = result; + result = new ImportMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ImportMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.Descriptor; } + } + + public override ImportMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } + } + + public override ImportMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ImportMessage) { + return MergeFrom((ImportMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ImportMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasD) { + D = other.D; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_importMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _importMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasD = input.ReadInt32(ref result.d_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasD { + get { return result.hasD; } + } + public int D { + get { return result.D; } + set { SetD(value); } + } + public Builder SetD(int value) { + PrepareBuilder(); + result.hasD = true; + result.d_ = value; + return this; + } + public Builder ClearD() { + PrepareBuilder(); + result.hasD = false; + result.d_ = 0; + return this; + } + } + static ImportMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs new file mode 100644 index 00000000..7a2875c8 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestMessageSetProtoFile.cs @@ -0,0 +1,1826 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestMessageSetProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension1.MessageSetExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension2.MessageSetExtension); + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMessageSet__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMessageSet__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMessageSetContainer__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMessageSetContainer__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMessageSetExtension1__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMessageSetExtension1__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMessageSetExtension2__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMessageSetExtension2__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_RawMessageSet__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_RawMessageSet__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_RawMessageSet_Item__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_RawMessageSet_Item__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestMessageSetProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiNnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfbXNldC5wcm90bxIRcHJvdG9i", + "dWZfdW5pdHRlc3QaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5w", + "cm90byIeCg5UZXN0TWVzc2FnZVNldCoICAQQgICAgAI6AggBIlEKF1Rlc3RN", + "ZXNzYWdlU2V0Q29udGFpbmVyEjYKC21lc3NhZ2Vfc2V0GAEgASgLMiEucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdE1lc3NhZ2VTZXQilgEKGFRlc3RNZXNzYWdl", + "U2V0RXh0ZW5zaW9uMRIJCgFpGA8gASgFMm8KFW1lc3NhZ2Vfc2V0X2V4dGVu", + "c2lvbhIhLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RNZXNzYWdlU2V0GLCmXiAB", + "KAsyKy5wcm90b2J1Zl91bml0dGVzdC5UZXN0TWVzc2FnZVNldEV4dGVuc2lv", + "bjEimAEKGFRlc3RNZXNzYWdlU2V0RXh0ZW5zaW9uMhILCgNzdHIYGSABKAky", + "bwoVbWVzc2FnZV9zZXRfZXh0ZW5zaW9uEiEucHJvdG9idWZfdW5pdHRlc3Qu", + "VGVzdE1lc3NhZ2VTZXQY+bteIAEoCzIrLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RNZXNzYWdlU2V0RXh0ZW5zaW9uMiJuCg1SYXdNZXNzYWdlU2V0EjMKBGl0", + "ZW0YASADKAoyJS5wcm90b2J1Zl91bml0dGVzdC5SYXdNZXNzYWdlU2V0Lkl0", + "ZW0aKAoESXRlbRIPCgd0eXBlX2lkGAIgAigFEg8KB21lc3NhZ2UYAyACKAxC", + "RUgBwj5ACiFHb29nbGUuUHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90b3MSG1Vu", + "aXRUZXN0TWVzc2FnZVNldFByb3RvRmlsZQ==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_TestMessageSet__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_TestMessageSet__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMessageSet__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestMessageSetContainer__Descriptor = Descriptor.MessageTypes[1]; + internal__static_protobuf_unittest_TestMessageSetContainer__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMessageSetContainer__Descriptor, + new string[] { "MessageSet", }); + internal__static_protobuf_unittest_TestMessageSetExtension1__Descriptor = Descriptor.MessageTypes[2]; + internal__static_protobuf_unittest_TestMessageSetExtension1__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMessageSetExtension1__Descriptor, + new string[] { "I", }); + global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension1.MessageSetExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension1.Descriptor.Extensions[0]); + internal__static_protobuf_unittest_TestMessageSetExtension2__Descriptor = Descriptor.MessageTypes[3]; + internal__static_protobuf_unittest_TestMessageSetExtension2__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMessageSetExtension2__Descriptor, + new string[] { "Str", }); + global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension2.MessageSetExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension2.Descriptor.Extensions[0]); + internal__static_protobuf_unittest_RawMessageSet__Descriptor = Descriptor.MessageTypes[4]; + internal__static_protobuf_unittest_RawMessageSet__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_RawMessageSet__Descriptor, + new string[] { "Item", }); + internal__static_protobuf_unittest_RawMessageSet_Item__Descriptor = internal__static_protobuf_unittest_RawMessageSet__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_RawMessageSet_Item__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_RawMessageSet_Item__Descriptor, + new string[] { "TypeId", "Message", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMessageSet : pb::ExtendableMessage { + private TestMessageSet() { } + private static readonly TestMessageSet defaultInstance = new TestMessageSet().MakeReadOnly(); + private static readonly string[] _testMessageSetFieldNames = new string[] { }; + private static readonly uint[] _testMessageSetFieldTags = new uint[] { }; + public static TestMessageSet DefaultInstance { + get { return defaultInstance; } + } + + public override TestMessageSet DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMessageSet ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_TestMessageSet__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_TestMessageSet__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMessageSetFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteAsMessageSetTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSizeAsMessageSet; + memoizedSerializedSize = size; + return size; + } + public static TestMessageSet ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageSet ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageSet ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageSet ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageSet ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageSet ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMessageSet ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMessageSet ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMessageSet ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageSet ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMessageSet MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMessageSet prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMessageSet cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMessageSet result; + + private TestMessageSet PrepareBuilder() { + if (resultIsReadOnly) { + TestMessageSet original = result; + result = new TestMessageSet(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMessageSet MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageSet.Descriptor; } + } + + public override TestMessageSet DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance; } + } + + public override TestMessageSet BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMessageSet) { + return MergeFrom((TestMessageSet) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMessageSet other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMessageSetFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMessageSetFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestMessageSet() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMessageSetContainer : pb::GeneratedMessage { + private TestMessageSetContainer() { } + private static readonly TestMessageSetContainer defaultInstance = new TestMessageSetContainer().MakeReadOnly(); + private static readonly string[] _testMessageSetContainerFieldNames = new string[] { "message_set" }; + private static readonly uint[] _testMessageSetContainerFieldTags = new uint[] { 10 }; + public static TestMessageSetContainer DefaultInstance { + get { return defaultInstance; } + } + + public override TestMessageSetContainer DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMessageSetContainer ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_TestMessageSetContainer__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_TestMessageSetContainer__FieldAccessorTable; } + } + + public const int MessageSetFieldNumber = 1; + private bool hasMessageSet; + private global::Google.ProtocolBuffers.TestProtos.TestMessageSet messageSet_; + public bool HasMessageSet { + get { return hasMessageSet; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMessageSet MessageSet { + get { return messageSet_ ?? global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMessageSetContainerFieldNames; + if (hasMessageSet) { + output.WriteMessage(1, field_names[0], MessageSet); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasMessageSet) { + size += pb::CodedOutputStream.ComputeMessageSize(1, MessageSet); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMessageSetContainer ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageSetContainer ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageSetContainer ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageSetContainer ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageSetContainer ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageSetContainer ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMessageSetContainer ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMessageSetContainer ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMessageSetContainer ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageSetContainer ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMessageSetContainer MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMessageSetContainer prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMessageSetContainer cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMessageSetContainer result; + + private TestMessageSetContainer PrepareBuilder() { + if (resultIsReadOnly) { + TestMessageSetContainer original = result; + result = new TestMessageSetContainer(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMessageSetContainer MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageSetContainer.Descriptor; } + } + + public override TestMessageSetContainer DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageSetContainer.DefaultInstance; } + } + + public override TestMessageSetContainer BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMessageSetContainer) { + return MergeFrom((TestMessageSetContainer) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMessageSetContainer other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageSetContainer.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasMessageSet) { + MergeMessageSet(other.MessageSet); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMessageSetContainerFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMessageSetContainerFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestMessageSet.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestMessageSet.CreateBuilder(); + if (result.hasMessageSet) { + subBuilder.MergeFrom(MessageSet); + } + input.ReadMessage(subBuilder, extensionRegistry); + MessageSet = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasMessageSet { + get { return result.hasMessageSet; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMessageSet MessageSet { + get { return result.MessageSet; } + set { SetMessageSet(value); } + } + public Builder SetMessageSet(global::Google.ProtocolBuffers.TestProtos.TestMessageSet value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessageSet = true; + result.messageSet_ = value; + return this; + } + public Builder SetMessageSet(global::Google.ProtocolBuffers.TestProtos.TestMessageSet.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMessageSet = true; + result.messageSet_ = builderForValue.Build(); + return this; + } + public Builder MergeMessageSet(global::Google.ProtocolBuffers.TestProtos.TestMessageSet value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMessageSet && + result.messageSet_ != global::Google.ProtocolBuffers.TestProtos.TestMessageSet.DefaultInstance) { + result.messageSet_ = global::Google.ProtocolBuffers.TestProtos.TestMessageSet.CreateBuilder(result.messageSet_).MergeFrom(value).BuildPartial(); + } else { + result.messageSet_ = value; + } + result.hasMessageSet = true; + return this; + } + public Builder ClearMessageSet() { + PrepareBuilder(); + result.hasMessageSet = false; + result.messageSet_ = null; + return this; + } + } + static TestMessageSetContainer() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMessageSetExtension1 : pb::GeneratedMessage { + private TestMessageSetExtension1() { } + private static readonly TestMessageSetExtension1 defaultInstance = new TestMessageSetExtension1().MakeReadOnly(); + private static readonly string[] _testMessageSetExtension1FieldNames = new string[] { "i" }; + private static readonly uint[] _testMessageSetExtension1FieldTags = new uint[] { 120 }; + public static TestMessageSetExtension1 DefaultInstance { + get { return defaultInstance; } + } + + public override TestMessageSetExtension1 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMessageSetExtension1 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_TestMessageSetExtension1__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_TestMessageSetExtension1__FieldAccessorTable; } + } + + public const int MessageSetExtensionFieldNumber = 1545008; + public static pb::GeneratedExtensionBase MessageSetExtension; + public const int IFieldNumber = 15; + private bool hasI; + private int i_; + public bool HasI { + get { return hasI; } + } + public int I { + get { return i_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMessageSetExtension1FieldNames; + if (hasI) { + output.WriteInt32(15, field_names[0], I); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasI) { + size += pb::CodedOutputStream.ComputeInt32Size(15, I); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMessageSetExtension1 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageSetExtension1 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageSetExtension1 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageSetExtension1 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageSetExtension1 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageSetExtension1 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMessageSetExtension1 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMessageSetExtension1 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMessageSetExtension1 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageSetExtension1 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMessageSetExtension1 MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMessageSetExtension1 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMessageSetExtension1 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMessageSetExtension1 result; + + private TestMessageSetExtension1 PrepareBuilder() { + if (resultIsReadOnly) { + TestMessageSetExtension1 original = result; + result = new TestMessageSetExtension1(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMessageSetExtension1 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension1.Descriptor; } + } + + public override TestMessageSetExtension1 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension1.DefaultInstance; } + } + + public override TestMessageSetExtension1 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMessageSetExtension1) { + return MergeFrom((TestMessageSetExtension1) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMessageSetExtension1 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension1.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasI) { + I = other.I; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMessageSetExtension1FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMessageSetExtension1FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 120: { + result.hasI = input.ReadInt32(ref result.i_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasI { + get { return result.hasI; } + } + public int I { + get { return result.I; } + set { SetI(value); } + } + public Builder SetI(int value) { + PrepareBuilder(); + result.hasI = true; + result.i_ = value; + return this; + } + public Builder ClearI() { + PrepareBuilder(); + result.hasI = false; + result.i_ = 0; + return this; + } + } + static TestMessageSetExtension1() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMessageSetExtension2 : pb::GeneratedMessage { + private TestMessageSetExtension2() { } + private static readonly TestMessageSetExtension2 defaultInstance = new TestMessageSetExtension2().MakeReadOnly(); + private static readonly string[] _testMessageSetExtension2FieldNames = new string[] { "str" }; + private static readonly uint[] _testMessageSetExtension2FieldTags = new uint[] { 202 }; + public static TestMessageSetExtension2 DefaultInstance { + get { return defaultInstance; } + } + + public override TestMessageSetExtension2 DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMessageSetExtension2 ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_TestMessageSetExtension2__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_TestMessageSetExtension2__FieldAccessorTable; } + } + + public const int MessageSetExtensionFieldNumber = 1547769; + public static pb::GeneratedExtensionBase MessageSetExtension; + public const int StrFieldNumber = 25; + private bool hasStr; + private string str_ = ""; + public bool HasStr { + get { return hasStr; } + } + public string Str { + get { return str_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMessageSetExtension2FieldNames; + if (hasStr) { + output.WriteString(25, field_names[0], Str); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasStr) { + size += pb::CodedOutputStream.ComputeStringSize(25, Str); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMessageSetExtension2 ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageSetExtension2 ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageSetExtension2 ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessageSetExtension2 ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessageSetExtension2 ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageSetExtension2 ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMessageSetExtension2 ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMessageSetExtension2 ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMessageSetExtension2 ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessageSetExtension2 ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMessageSetExtension2 MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMessageSetExtension2 prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMessageSetExtension2 cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMessageSetExtension2 result; + + private TestMessageSetExtension2 PrepareBuilder() { + if (resultIsReadOnly) { + TestMessageSetExtension2 original = result; + result = new TestMessageSetExtension2(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMessageSetExtension2 MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension2.Descriptor; } + } + + public override TestMessageSetExtension2 DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension2.DefaultInstance; } + } + + public override TestMessageSetExtension2 BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMessageSetExtension2) { + return MergeFrom((TestMessageSetExtension2) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMessageSetExtension2 other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMessageSetExtension2.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasStr) { + Str = other.Str; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMessageSetExtension2FieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMessageSetExtension2FieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 202: { + result.hasStr = input.ReadString(ref result.str_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasStr { + get { return result.hasStr; } + } + public string Str { + get { return result.Str; } + set { SetStr(value); } + } + public Builder SetStr(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasStr = true; + result.str_ = value; + return this; + } + public Builder ClearStr() { + PrepareBuilder(); + result.hasStr = false; + result.str_ = ""; + return this; + } + } + static TestMessageSetExtension2() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RawMessageSet : pb::GeneratedMessage { + private RawMessageSet() { } + private static readonly RawMessageSet defaultInstance = new RawMessageSet().MakeReadOnly(); + private static readonly string[] _rawMessageSetFieldNames = new string[] { "item" }; + private static readonly uint[] _rawMessageSetFieldTags = new uint[] { 11 }; + public static RawMessageSet DefaultInstance { + get { return defaultInstance; } + } + + public override RawMessageSet DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RawMessageSet ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_RawMessageSet__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_RawMessageSet__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Item : pb::GeneratedMessage { + private Item() { } + private static readonly Item defaultInstance = new Item().MakeReadOnly(); + private static readonly string[] _itemFieldNames = new string[] { "message", "type_id" }; + private static readonly uint[] _itemFieldTags = new uint[] { 26, 16 }; + public static Item DefaultInstance { + get { return defaultInstance; } + } + + public override Item DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Item ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_RawMessageSet_Item__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.internal__static_protobuf_unittest_RawMessageSet_Item__FieldAccessorTable; } + } + + public const int TypeIdFieldNumber = 2; + private bool hasTypeId; + private int typeId_; + public bool HasTypeId { + get { return hasTypeId; } + } + public int TypeId { + get { return typeId_; } + } + + public const int MessageFieldNumber = 3; + private bool hasMessage; + private pb::ByteString message_ = pb::ByteString.Empty; + public bool HasMessage { + get { return hasMessage; } + } + public pb::ByteString Message { + get { return message_; } + } + + public override bool IsInitialized { + get { + if (!hasTypeId) return false; + if (!hasMessage) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _itemFieldNames; + if (hasTypeId) { + output.WriteInt32(2, field_names[1], TypeId); + } + if (hasMessage) { + output.WriteBytes(3, field_names[0], Message); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasTypeId) { + size += pb::CodedOutputStream.ComputeInt32Size(2, TypeId); + } + if (hasMessage) { + size += pb::CodedOutputStream.ComputeBytesSize(3, Message); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Item ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Item ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Item ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Item ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Item ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Item ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Item ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Item ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Item ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Item ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Item MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Item prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Item cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Item result; + + private Item PrepareBuilder() { + if (resultIsReadOnly) { + Item original = result; + result = new Item(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Item MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item.Descriptor; } + } + + public override Item DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item.DefaultInstance; } + } + + public override Item BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Item) { + return MergeFrom((Item) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Item other) { + if (other == global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasTypeId) { + TypeId = other.TypeId; + } + if (other.HasMessage) { + Message = other.Message; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_itemFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _itemFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 16: { + result.hasTypeId = input.ReadInt32(ref result.typeId_); + break; + } + case 26: { + result.hasMessage = input.ReadBytes(ref result.message_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasTypeId { + get { return result.hasTypeId; } + } + public int TypeId { + get { return result.TypeId; } + set { SetTypeId(value); } + } + public Builder SetTypeId(int value) { + PrepareBuilder(); + result.hasTypeId = true; + result.typeId_ = value; + return this; + } + public Builder ClearTypeId() { + PrepareBuilder(); + result.hasTypeId = false; + result.typeId_ = 0; + return this; + } + + public bool HasMessage { + get { return result.hasMessage; } + } + public pb::ByteString Message { + get { return result.Message; } + set { SetMessage(value); } + } + public Builder SetMessage(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessage = true; + result.message_ = value; + return this; + } + public Builder ClearMessage() { + PrepareBuilder(); + result.hasMessage = false; + result.message_ = pb::ByteString.Empty; + return this; + } + } + static Item() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int ItemFieldNumber = 1; + private pbc::PopsicleList item_ = new pbc::PopsicleList(); + public scg::IList ItemList { + get { return item_; } + } + public int ItemCount { + get { return item_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item GetItem(int index) { + return item_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _rawMessageSetFieldNames; + if (item_.Count > 0) { + output.WriteGroupArray(1, field_names[0], item_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item element in ItemList) { + size += pb::CodedOutputStream.ComputeGroupSize(1, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static RawMessageSet ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RawMessageSet ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RawMessageSet ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RawMessageSet ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RawMessageSet ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RawMessageSet ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RawMessageSet ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RawMessageSet ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RawMessageSet ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RawMessageSet ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RawMessageSet MakeReadOnly() { + item_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RawMessageSet prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RawMessageSet cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RawMessageSet result; + + private RawMessageSet PrepareBuilder() { + if (resultIsReadOnly) { + RawMessageSet original = result; + result = new RawMessageSet(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RawMessageSet MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Descriptor; } + } + + public override RawMessageSet DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.RawMessageSet.DefaultInstance; } + } + + public override RawMessageSet BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is RawMessageSet) { + return MergeFrom((RawMessageSet) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RawMessageSet other) { + if (other == global::Google.ProtocolBuffers.TestProtos.RawMessageSet.DefaultInstance) return this; + PrepareBuilder(); + if (other.item_.Count != 0) { + result.item_.Add(other.item_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_rawMessageSetFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _rawMessageSetFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 11: { + input.ReadGroupArray(tag, field_name, result.item_, global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList ItemList { + get { return PrepareBuilder().item_; } + } + public int ItemCount { + get { return result.ItemCount; } + } + public global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item GetItem(int index) { + return result.GetItem(index); + } + public Builder SetItem(int index, global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.item_[index] = value; + return this; + } + public Builder SetItem(int index, global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.item_[index] = builderForValue.Build(); + return this; + } + public Builder AddItem(global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.item_.Add(value); + return this; + } + public Builder AddItem(global::Google.ProtocolBuffers.TestProtos.RawMessageSet.Types.Item.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.item_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeItem(scg::IEnumerable values) { + PrepareBuilder(); + result.item_.Add(values); + return this; + } + public Builder ClearItem() { + PrepareBuilder(); + result.item_.Clear(); + return this; + } + } + static RawMessageSet() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestMessageSetProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs new file mode 100644 index 00000000..8ff21c36 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestNoGenericServicesProtoFile.cs @@ -0,0 +1,368 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos.NoGenericService { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestNoGenericServicesProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.TestExtension); + } + #endregion + #region Extensions + public const int TestExtensionFieldNumber = 1000; + public static pb::GeneratedExtensionBase TestExtension; + #endregion + + #region Static variables + internal static pbd::MessageDescriptor internal__static_google_protobuf_no_generic_services_test_TestMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_no_generic_services_test_TestMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestNoGenericServicesProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CjJnb29nbGUvcHJvdG9idWYvdW5pdHRlc3Rfbm9fZ2VuZXJpY19zZXJ2aWNl", + "cy5wcm90bxIoZ29vZ2xlLnByb3RvYnVmLm5vX2dlbmVyaWNfc2VydmljZXNf", + "dGVzdBokZ29vZ2xlL3Byb3RvYnVmL2NzaGFycF9vcHRpb25zLnByb3RvIiMK", + "C1Rlc3RNZXNzYWdlEgkKAWEYASABKAUqCQjoBxCAgICAAioTCghUZXN0RW51", + "bRIHCgNGT08QATKCAQoLVGVzdFNlcnZpY2UScwoDRm9vEjUuZ29vZ2xlLnBy", + "b3RvYnVmLm5vX2dlbmVyaWNfc2VydmljZXNfdGVzdC5UZXN0TWVzc2FnZRo1", + "Lmdvb2dsZS5wcm90b2J1Zi5ub19nZW5lcmljX3NlcnZpY2VzX3Rlc3QuVGVz", + "dE1lc3NhZ2U6TgoOdGVzdF9leHRlbnNpb24SNS5nb29nbGUucHJvdG9idWYu", + "bm9fZ2VuZXJpY19zZXJ2aWNlc190ZXN0LlRlc3RNZXNzYWdlGOgHIAEoBUJb", + "wj5YCjJHb29nbGUuUHJvdG9jb2xCdWZmZXJzLlRlc3RQcm90b3MuTm9HZW5l", + "cmljU2VydmljZRIiVW5pdFRlc3ROb0dlbmVyaWNTZXJ2aWNlc1Byb3RvRmls", + "ZQ==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_google_protobuf_no_generic_services_test_TestMessage__Descriptor = Descriptor.MessageTypes[0]; + internal__static_google_protobuf_no_generic_services_test_TestMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_no_generic_services_test_TestMessage__Descriptor, + new string[] { "A", }); + global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.TestExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.Descriptor.Extensions[0]); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum TestEnum { + FOO = 1, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMessage : pb::ExtendableMessage { + private TestMessage() { } + private static readonly TestMessage defaultInstance = new TestMessage().MakeReadOnly(); + private static readonly string[] _testMessageFieldNames = new string[] { "a" }; + private static readonly uint[] _testMessageFieldTags = new uint[] { 8 }; + public static TestMessage DefaultInstance { + get { return defaultInstance; } + } + + public override TestMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.internal__static_google_protobuf_no_generic_services_test_TestMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.internal__static_google_protobuf_no_generic_services_test_TestMessage__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMessageFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMessage result; + + private TestMessage PrepareBuilder() { + if (resultIsReadOnly) { + TestMessage original = result; + result = new TestMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.Descriptor; } + } + + public override TestMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance; } + } + + public override TestMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMessage) { + return MergeFrom((TestMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.NoGenericService.TestMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static TestMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.NoGenericService.UnitTestNoGenericServicesProtoFile.Descriptor, null); + } + } + + #endregion + + #region Services + /* + * Service generation is now disabled by default, use the following option to enable: + * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + */ + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs new file mode 100644 index 00000000..e5b45c0d --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestOptimizeForProtoFile.cs @@ -0,0 +1,659 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestOptimizeForProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.TestExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.TestExtension2); + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestOptimizedForSize__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRequiredOptimizedForSize__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRequiredOptimizedForSize__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestOptionalOptimizedForSize__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestOptionalOptimizedForSize__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestOptimizeForProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Citnb29nbGUvcHJvdG9idWYvdW5pdHRlc3Rfb3B0aW1pemVfZm9yLnByb3Rv", + "EhFwcm90b2J1Zl91bml0dGVzdBokZ29vZ2xlL3Byb3RvYnVmL2NzaGFycF9v", + "cHRpb25zLnByb3RvGh5nb29nbGUvcHJvdG9idWYvdW5pdHRlc3QucHJvdG8i", + "kgIKFFRlc3RPcHRpbWl6ZWRGb3JTaXplEgkKAWkYASABKAUSLgoDbXNnGBMg", + "ASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2UqCQjoBxCA", + "gICAAjJACg50ZXN0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RPcHRpbWl6ZWRGb3JTaXplGNIJIAEoBTJyCg90ZXN0X2V4dGVuc2lvbjIS", + "Jy5wcm90b2J1Zl91bml0dGVzdC5UZXN0T3B0aW1pemVkRm9yU2l6ZRjTCSAB", + "KAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UmVxdWlyZWRPcHRpbWl6ZWRG", + "b3JTaXplIikKHFRlc3RSZXF1aXJlZE9wdGltaXplZEZvclNpemUSCQoBeBgB", + "IAIoBSJaChxUZXN0T3B0aW9uYWxPcHRpbWl6ZWRGb3JTaXplEjoKAW8YASAB", + "KAsyLy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UmVxdWlyZWRPcHRpbWl6ZWRG", + "b3JTaXplQkZIAsI+QQohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJv", + "dG9zEhxVbml0VGVzdE9wdGltaXplRm9yUHJvdG9GaWxl")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_TestOptimizedForSize__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor, + new string[] { "I", "Msg", }); + global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.TestExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.TestExtension2 = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Descriptor.Extensions[1]); + internal__static_protobuf_unittest_TestRequiredOptimizedForSize__Descriptor = Descriptor.MessageTypes[1]; + internal__static_protobuf_unittest_TestRequiredOptimizedForSize__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRequiredOptimizedForSize__Descriptor, + new string[] { "X", }); + internal__static_protobuf_unittest_TestOptionalOptimizedForSize__Descriptor = Descriptor.MessageTypes[2]; + internal__static_protobuf_unittest_TestOptionalOptimizedForSize__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestOptionalOptimizedForSize__Descriptor, + new string[] { "O", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestOptimizedForSize : pb::ExtendableMessage { + private TestOptimizedForSize() { } + private static readonly TestOptimizedForSize defaultInstance = new TestOptimizedForSize().MakeReadOnly(); + public static TestOptimizedForSize DefaultInstance { + get { return defaultInstance; } + } + + public override TestOptimizedForSize DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestOptimizedForSize ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptimizedForSize__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptimizedForSize__FieldAccessorTable; } + } + + public const int TestExtensionFieldNumber = 1234; + public static pb::GeneratedExtensionBase TestExtension; + public const int TestExtension2FieldNumber = 1235; + public static pb::GeneratedExtensionBase TestExtension2; + public const int IFieldNumber = 1; + private bool hasI; + private int i_; + public bool HasI { + get { return hasI; } + } + public int I { + get { return i_; } + } + + public const int MsgFieldNumber = 19; + private bool hasMsg; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage msg_; + public bool HasMsg { + get { return hasMsg; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage Msg { + get { return msg_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public static TestOptimizedForSize ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestOptimizedForSize ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestOptimizedForSize ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestOptimizedForSize ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestOptimizedForSize ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestOptimizedForSize ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestOptimizedForSize ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestOptimizedForSize ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestOptimizedForSize ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestOptimizedForSize ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestOptimizedForSize MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestOptimizedForSize prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestOptimizedForSize cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestOptimizedForSize result; + + private TestOptimizedForSize PrepareBuilder() { + if (resultIsReadOnly) { + TestOptimizedForSize original = result; + result = new TestOptimizedForSize(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestOptimizedForSize MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.Descriptor; } + } + + public override TestOptimizedForSize DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestOptimizedForSize.DefaultInstance; } + } + + public override TestOptimizedForSize BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasI { + get { return result.hasI; } + } + public int I { + get { return result.I; } + set { SetI(value); } + } + public Builder SetI(int value) { + PrepareBuilder(); + result.hasI = true; + result.i_ = value; + return this; + } + public Builder ClearI() { + PrepareBuilder(); + result.hasI = false; + result.i_ = 0; + return this; + } + + public bool HasMsg { + get { return result.hasMsg; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage Msg { + get { return result.Msg; } + set { SetMsg(value); } + } + public Builder SetMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMsg = true; + result.msg_ = value; + return this; + } + public Builder SetMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMsg = true; + result.msg_ = builderForValue.Build(); + return this; + } + public Builder MergeMsg(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMsg && + result.msg_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.msg_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.msg_).MergeFrom(value).BuildPartial(); + } else { + result.msg_ = value; + } + result.hasMsg = true; + return this; + } + public Builder ClearMsg() { + PrepareBuilder(); + result.hasMsg = false; + result.msg_ = null; + return this; + } + } + static TestOptimizedForSize() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRequiredOptimizedForSize : pb::GeneratedMessage { + private TestRequiredOptimizedForSize() { } + private static readonly TestRequiredOptimizedForSize defaultInstance = new TestRequiredOptimizedForSize().MakeReadOnly(); + public static TestRequiredOptimizedForSize DefaultInstance { + get { return defaultInstance; } + } + + public override TestRequiredOptimizedForSize DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRequiredOptimizedForSize ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestRequiredOptimizedForSize__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestRequiredOptimizedForSize__FieldAccessorTable; } + } + + public const int XFieldNumber = 1; + private bool hasX; + private int x_; + public bool HasX { + get { return hasX; } + } + public int X { + get { return x_; } + } + + public static TestRequiredOptimizedForSize ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredOptimizedForSize ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredOptimizedForSize ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredOptimizedForSize ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredOptimizedForSize ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredOptimizedForSize ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRequiredOptimizedForSize ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRequiredOptimizedForSize ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRequiredOptimizedForSize ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredOptimizedForSize ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRequiredOptimizedForSize MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRequiredOptimizedForSize prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRequiredOptimizedForSize cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRequiredOptimizedForSize result; + + private TestRequiredOptimizedForSize PrepareBuilder() { + if (resultIsReadOnly) { + TestRequiredOptimizedForSize original = result; + result = new TestRequiredOptimizedForSize(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRequiredOptimizedForSize MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.Descriptor; } + } + + public override TestRequiredOptimizedForSize DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance; } + } + + public override TestRequiredOptimizedForSize BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasX { + get { return result.hasX; } + } + public int X { + get { return result.X; } + set { SetX(value); } + } + public Builder SetX(int value) { + PrepareBuilder(); + result.hasX = true; + result.x_ = value; + return this; + } + public Builder ClearX() { + PrepareBuilder(); + result.hasX = false; + result.x_ = 0; + return this; + } + } + static TestRequiredOptimizedForSize() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestOptionalOptimizedForSize : pb::GeneratedMessage { + private TestOptionalOptimizedForSize() { } + private static readonly TestOptionalOptimizedForSize defaultInstance = new TestOptionalOptimizedForSize().MakeReadOnly(); + public static TestOptionalOptimizedForSize DefaultInstance { + get { return defaultInstance; } + } + + public override TestOptionalOptimizedForSize DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestOptionalOptimizedForSize ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptionalOptimizedForSize__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.internal__static_protobuf_unittest_TestOptionalOptimizedForSize__FieldAccessorTable; } + } + + public const int OFieldNumber = 1; + private bool hasO; + private global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize o_; + public bool HasO { + get { return hasO; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize O { + get { return o_ ?? global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance; } + } + + public static TestOptionalOptimizedForSize ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestOptionalOptimizedForSize ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestOptionalOptimizedForSize ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestOptionalOptimizedForSize ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestOptionalOptimizedForSize ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestOptionalOptimizedForSize ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestOptionalOptimizedForSize ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestOptionalOptimizedForSize ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestOptionalOptimizedForSize ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestOptionalOptimizedForSize ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestOptionalOptimizedForSize MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestOptionalOptimizedForSize prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestOptionalOptimizedForSize cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestOptionalOptimizedForSize result; + + private TestOptionalOptimizedForSize PrepareBuilder() { + if (resultIsReadOnly) { + TestOptionalOptimizedForSize original = result; + result = new TestOptionalOptimizedForSize(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestOptionalOptimizedForSize MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestOptionalOptimizedForSize.Descriptor; } + } + + public override TestOptionalOptimizedForSize DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestOptionalOptimizedForSize.DefaultInstance; } + } + + public override TestOptionalOptimizedForSize BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasO { + get { return result.hasO; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize O { + get { return result.O; } + set { SetO(value); } + } + public Builder SetO(global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasO = true; + result.o_ = value; + return this; + } + public Builder SetO(global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasO = true; + result.o_ = builderForValue.Build(); + return this; + } + public Builder MergeO(global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasO && + result.o_ != global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.DefaultInstance) { + result.o_ = global::Google.ProtocolBuffers.TestProtos.TestRequiredOptimizedForSize.CreateBuilder(result.o_).MergeFrom(value).BuildPartial(); + } else { + result.o_ = value; + } + result.hasO = true; + return this; + } + public Builder ClearO() { + PrepareBuilder(); + result.hasO = false; + result.o_ = null; + return this; + } + } + static TestOptionalOptimizedForSize() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestOptimizeForProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs new file mode 100644 index 00000000..dd31c675 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs @@ -0,0 +1,21602 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBytesExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalGroupExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringPieceExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalCordExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBytesExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedGroupExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringPieceExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedCordExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBytesExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultNestedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultForeignEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultImportEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringPieceExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultCordExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionString); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionInt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Test); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestRequired.Single); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestRequired.Multi); + } + #endregion + #region Extensions + public const int OptionalInt32ExtensionFieldNumber = 1; + public static pb::GeneratedExtensionBase OptionalInt32Extension; + public const int OptionalInt64ExtensionFieldNumber = 2; + public static pb::GeneratedExtensionBase OptionalInt64Extension; + public const int OptionalUint32ExtensionFieldNumber = 3; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalUint32Extension; + public const int OptionalUint64ExtensionFieldNumber = 4; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalUint64Extension; + public const int OptionalSint32ExtensionFieldNumber = 5; + public static pb::GeneratedExtensionBase OptionalSint32Extension; + public const int OptionalSint64ExtensionFieldNumber = 6; + public static pb::GeneratedExtensionBase OptionalSint64Extension; + public const int OptionalFixed32ExtensionFieldNumber = 7; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalFixed32Extension; + public const int OptionalFixed64ExtensionFieldNumber = 8; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalFixed64Extension; + public const int OptionalSfixed32ExtensionFieldNumber = 9; + public static pb::GeneratedExtensionBase OptionalSfixed32Extension; + public const int OptionalSfixed64ExtensionFieldNumber = 10; + public static pb::GeneratedExtensionBase OptionalSfixed64Extension; + public const int OptionalFloatExtensionFieldNumber = 11; + public static pb::GeneratedExtensionBase OptionalFloatExtension; + public const int OptionalDoubleExtensionFieldNumber = 12; + public static pb::GeneratedExtensionBase OptionalDoubleExtension; + public const int OptionalBoolExtensionFieldNumber = 13; + public static pb::GeneratedExtensionBase OptionalBoolExtension; + public const int OptionalStringExtensionFieldNumber = 14; + public static pb::GeneratedExtensionBase OptionalStringExtension; + public const int OptionalBytesExtensionFieldNumber = 15; + public static pb::GeneratedExtensionBase OptionalBytesExtension; + public const int OptionalGroupExtensionFieldNumber = 16; + public static pb::GeneratedExtensionBase OptionalGroupExtension; + public const int OptionalNestedMessageExtensionFieldNumber = 18; + public static pb::GeneratedExtensionBase OptionalNestedMessageExtension; + public const int OptionalForeignMessageExtensionFieldNumber = 19; + public static pb::GeneratedExtensionBase OptionalForeignMessageExtension; + public const int OptionalImportMessageExtensionFieldNumber = 20; + public static pb::GeneratedExtensionBase OptionalImportMessageExtension; + public const int OptionalNestedEnumExtensionFieldNumber = 21; + public static pb::GeneratedExtensionBase OptionalNestedEnumExtension; + public const int OptionalForeignEnumExtensionFieldNumber = 22; + public static pb::GeneratedExtensionBase OptionalForeignEnumExtension; + public const int OptionalImportEnumExtensionFieldNumber = 23; + public static pb::GeneratedExtensionBase OptionalImportEnumExtension; + public const int OptionalStringPieceExtensionFieldNumber = 24; + public static pb::GeneratedExtensionBase OptionalStringPieceExtension; + public const int OptionalCordExtensionFieldNumber = 25; + public static pb::GeneratedExtensionBase OptionalCordExtension; + public const int RepeatedInt32ExtensionFieldNumber = 31; + public static pb::GeneratedExtensionBase> RepeatedInt32Extension; + public const int RepeatedInt64ExtensionFieldNumber = 32; + public static pb::GeneratedExtensionBase> RepeatedInt64Extension; + public const int RepeatedUint32ExtensionFieldNumber = 33; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedUint32Extension; + public const int RepeatedUint64ExtensionFieldNumber = 34; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedUint64Extension; + public const int RepeatedSint32ExtensionFieldNumber = 35; + public static pb::GeneratedExtensionBase> RepeatedSint32Extension; + public const int RepeatedSint64ExtensionFieldNumber = 36; + public static pb::GeneratedExtensionBase> RepeatedSint64Extension; + public const int RepeatedFixed32ExtensionFieldNumber = 37; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedFixed32Extension; + public const int RepeatedFixed64ExtensionFieldNumber = 38; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedFixed64Extension; + public const int RepeatedSfixed32ExtensionFieldNumber = 39; + public static pb::GeneratedExtensionBase> RepeatedSfixed32Extension; + public const int RepeatedSfixed64ExtensionFieldNumber = 40; + public static pb::GeneratedExtensionBase> RepeatedSfixed64Extension; + public const int RepeatedFloatExtensionFieldNumber = 41; + public static pb::GeneratedExtensionBase> RepeatedFloatExtension; + public const int RepeatedDoubleExtensionFieldNumber = 42; + public static pb::GeneratedExtensionBase> RepeatedDoubleExtension; + public const int RepeatedBoolExtensionFieldNumber = 43; + public static pb::GeneratedExtensionBase> RepeatedBoolExtension; + public const int RepeatedStringExtensionFieldNumber = 44; + public static pb::GeneratedExtensionBase> RepeatedStringExtension; + public const int RepeatedBytesExtensionFieldNumber = 45; + public static pb::GeneratedExtensionBase> RepeatedBytesExtension; + public const int RepeatedGroupExtensionFieldNumber = 46; + public static pb::GeneratedExtensionBase> RepeatedGroupExtension; + public const int RepeatedNestedMessageExtensionFieldNumber = 48; + public static pb::GeneratedExtensionBase> RepeatedNestedMessageExtension; + public const int RepeatedForeignMessageExtensionFieldNumber = 49; + public static pb::GeneratedExtensionBase> RepeatedForeignMessageExtension; + public const int RepeatedImportMessageExtensionFieldNumber = 50; + public static pb::GeneratedExtensionBase> RepeatedImportMessageExtension; + public const int RepeatedNestedEnumExtensionFieldNumber = 51; + public static pb::GeneratedExtensionBase> RepeatedNestedEnumExtension; + public const int RepeatedForeignEnumExtensionFieldNumber = 52; + public static pb::GeneratedExtensionBase> RepeatedForeignEnumExtension; + public const int RepeatedImportEnumExtensionFieldNumber = 53; + public static pb::GeneratedExtensionBase> RepeatedImportEnumExtension; + public const int RepeatedStringPieceExtensionFieldNumber = 54; + public static pb::GeneratedExtensionBase> RepeatedStringPieceExtension; + public const int RepeatedCordExtensionFieldNumber = 55; + public static pb::GeneratedExtensionBase> RepeatedCordExtension; + public const int DefaultInt32ExtensionFieldNumber = 61; + public static pb::GeneratedExtensionBase DefaultInt32Extension; + public const int DefaultInt64ExtensionFieldNumber = 62; + public static pb::GeneratedExtensionBase DefaultInt64Extension; + public const int DefaultUint32ExtensionFieldNumber = 63; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultUint32Extension; + public const int DefaultUint64ExtensionFieldNumber = 64; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultUint64Extension; + public const int DefaultSint32ExtensionFieldNumber = 65; + public static pb::GeneratedExtensionBase DefaultSint32Extension; + public const int DefaultSint64ExtensionFieldNumber = 66; + public static pb::GeneratedExtensionBase DefaultSint64Extension; + public const int DefaultFixed32ExtensionFieldNumber = 67; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultFixed32Extension; + public const int DefaultFixed64ExtensionFieldNumber = 68; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultFixed64Extension; + public const int DefaultSfixed32ExtensionFieldNumber = 69; + public static pb::GeneratedExtensionBase DefaultSfixed32Extension; + public const int DefaultSfixed64ExtensionFieldNumber = 70; + public static pb::GeneratedExtensionBase DefaultSfixed64Extension; + public const int DefaultFloatExtensionFieldNumber = 71; + public static pb::GeneratedExtensionBase DefaultFloatExtension; + public const int DefaultDoubleExtensionFieldNumber = 72; + public static pb::GeneratedExtensionBase DefaultDoubleExtension; + public const int DefaultBoolExtensionFieldNumber = 73; + public static pb::GeneratedExtensionBase DefaultBoolExtension; + public const int DefaultStringExtensionFieldNumber = 74; + public static pb::GeneratedExtensionBase DefaultStringExtension; + public const int DefaultBytesExtensionFieldNumber = 75; + public static pb::GeneratedExtensionBase DefaultBytesExtension; + public const int DefaultNestedEnumExtensionFieldNumber = 81; + public static pb::GeneratedExtensionBase DefaultNestedEnumExtension; + public const int DefaultForeignEnumExtensionFieldNumber = 82; + public static pb::GeneratedExtensionBase DefaultForeignEnumExtension; + public const int DefaultImportEnumExtensionFieldNumber = 83; + public static pb::GeneratedExtensionBase DefaultImportEnumExtension; + public const int DefaultStringPieceExtensionFieldNumber = 84; + public static pb::GeneratedExtensionBase DefaultStringPieceExtension; + public const int DefaultCordExtensionFieldNumber = 85; + public static pb::GeneratedExtensionBase DefaultCordExtension; + public const int MyExtensionStringFieldNumber = 50; + public static pb::GeneratedExtensionBase MyExtensionString; + public const int MyExtensionIntFieldNumber = 5; + public static pb::GeneratedExtensionBase MyExtensionInt; + public const int PackedInt32ExtensionFieldNumber = 90; + public static pb::GeneratedExtensionBase> PackedInt32Extension; + public const int PackedInt64ExtensionFieldNumber = 91; + public static pb::GeneratedExtensionBase> PackedInt64Extension; + public const int PackedUint32ExtensionFieldNumber = 92; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedUint32Extension; + public const int PackedUint64ExtensionFieldNumber = 93; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedUint64Extension; + public const int PackedSint32ExtensionFieldNumber = 94; + public static pb::GeneratedExtensionBase> PackedSint32Extension; + public const int PackedSint64ExtensionFieldNumber = 95; + public static pb::GeneratedExtensionBase> PackedSint64Extension; + public const int PackedFixed32ExtensionFieldNumber = 96; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedFixed32Extension; + public const int PackedFixed64ExtensionFieldNumber = 97; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedFixed64Extension; + public const int PackedSfixed32ExtensionFieldNumber = 98; + public static pb::GeneratedExtensionBase> PackedSfixed32Extension; + public const int PackedSfixed64ExtensionFieldNumber = 99; + public static pb::GeneratedExtensionBase> PackedSfixed64Extension; + public const int PackedFloatExtensionFieldNumber = 100; + public static pb::GeneratedExtensionBase> PackedFloatExtension; + public const int PackedDoubleExtensionFieldNumber = 101; + public static pb::GeneratedExtensionBase> PackedDoubleExtension; + public const int PackedBoolExtensionFieldNumber = 102; + public static pb::GeneratedExtensionBase> PackedBoolExtension; + public const int PackedEnumExtensionFieldNumber = 103; + public static pb::GeneratedExtensionBase> PackedEnumExtension; + #endregion + + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_ForeignMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OptionalGroup_extension__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_RepeatedGroup_extension__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestNestedExtension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestNestedExtension__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRequired__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRequired__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRequiredForeign__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRequiredForeign__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestForeignNested__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestEmptyMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestEmptyMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMultipleExtensionRanges__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDupFieldNumber__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDupFieldNumber_Foo__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDupFieldNumber_Bar__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestNestedMessageHasBits__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestFieldOrderings__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestExtremeDefaultValues__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_SparseEnumMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OneString__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OneString__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OneBytes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OneBytes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestPackedTypes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestPackedExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestPackedExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDynamicExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_FooRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_FooResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooResponse__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_BarRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_BarRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_BarResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_BarResponse__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch5nb29nbGUvcHJvdG9idWYvdW5pdHRlc3QucHJvdG8SEXByb3RvYnVmX3Vu", + "aXR0ZXN0GiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8a", + "JWdvb2dsZS9wcm90b2J1Zi91bml0dGVzdF9pbXBvcnQucHJvdG8iuxUKDFRl", + "c3RBbGxUeXBlcxIWCg5vcHRpb25hbF9pbnQzMhgBIAEoBRIWCg5vcHRpb25h", + "bF9pbnQ2NBgCIAEoAxIXCg9vcHRpb25hbF91aW50MzIYAyABKA0SFwoPb3B0", + "aW9uYWxfdWludDY0GAQgASgEEhcKD29wdGlvbmFsX3NpbnQzMhgFIAEoERIX", + "Cg9vcHRpb25hbF9zaW50NjQYBiABKBISGAoQb3B0aW9uYWxfZml4ZWQzMhgH", + "IAEoBxIYChBvcHRpb25hbF9maXhlZDY0GAggASgGEhkKEW9wdGlvbmFsX3Nm", + "aXhlZDMyGAkgASgPEhkKEW9wdGlvbmFsX3NmaXhlZDY0GAogASgQEhYKDm9w", + "dGlvbmFsX2Zsb2F0GAsgASgCEhcKD29wdGlvbmFsX2RvdWJsZRgMIAEoARIV", + "Cg1vcHRpb25hbF9ib29sGA0gASgIEhcKD29wdGlvbmFsX3N0cmluZxgOIAEo", + "CRIWCg5vcHRpb25hbF9ieXRlcxgPIAEoDBJECg1vcHRpb25hbGdyb3VwGBAg", + "ASgKMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbFR5cGVzLk9wdGlvbmFs", + "R3JvdXASTgoXb3B0aW9uYWxfbmVzdGVkX21lc3NhZ2UYEiABKAsyLS5wcm90", + "b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZRJDChhv", + "cHRpb25hbF9mb3JlaWduX21lc3NhZ2UYEyABKAsyIS5wcm90b2J1Zl91bml0", + "dGVzdC5Gb3JlaWduTWVzc2FnZRJIChdvcHRpb25hbF9pbXBvcnRfbWVzc2Fn", + "ZRgUIAEoCzInLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRNZXNz", + "YWdlEkgKFG9wdGlvbmFsX25lc3RlZF9lbnVtGBUgASgOMioucHJvdG9idWZf", + "dW5pdHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW0SPQoVb3B0aW9uYWxf", + "Zm9yZWlnbl9lbnVtGBYgASgOMh4ucHJvdG9idWZfdW5pdHRlc3QuRm9yZWln", + "bkVudW0SQgoUb3B0aW9uYWxfaW1wb3J0X2VudW0YFyABKA4yJC5wcm90b2J1", + "Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0RW51bRIhChVvcHRpb25hbF9zdHJp", + "bmdfcGllY2UYGCABKAlCAggCEhkKDW9wdGlvbmFsX2NvcmQYGSABKAlCAggB", + "EhYKDnJlcGVhdGVkX2ludDMyGB8gAygFEhYKDnJlcGVhdGVkX2ludDY0GCAg", + "AygDEhcKD3JlcGVhdGVkX3VpbnQzMhghIAMoDRIXCg9yZXBlYXRlZF91aW50", + "NjQYIiADKAQSFwoPcmVwZWF0ZWRfc2ludDMyGCMgAygREhcKD3JlcGVhdGVk", + "X3NpbnQ2NBgkIAMoEhIYChByZXBlYXRlZF9maXhlZDMyGCUgAygHEhgKEHJl", + "cGVhdGVkX2ZpeGVkNjQYJiADKAYSGQoRcmVwZWF0ZWRfc2ZpeGVkMzIYJyAD", + "KA8SGQoRcmVwZWF0ZWRfc2ZpeGVkNjQYKCADKBASFgoOcmVwZWF0ZWRfZmxv", + "YXQYKSADKAISFwoPcmVwZWF0ZWRfZG91YmxlGCogAygBEhUKDXJlcGVhdGVk", + "X2Jvb2wYKyADKAgSFwoPcmVwZWF0ZWRfc3RyaW5nGCwgAygJEhYKDnJlcGVh", + "dGVkX2J5dGVzGC0gAygMEkQKDXJlcGVhdGVkZ3JvdXAYLiADKAoyLS5wcm90", + "b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuUmVwZWF0ZWRHcm91cBJOChdy", + "ZXBlYXRlZF9uZXN0ZWRfbWVzc2FnZRgwIAMoCzItLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxUeXBlcy5OZXN0ZWRNZXNzYWdlEkMKGHJlcGVhdGVkX2Zv", + "cmVpZ25fbWVzc2FnZRgxIAMoCzIhLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVp", + "Z25NZXNzYWdlEkgKF3JlcGVhdGVkX2ltcG9ydF9tZXNzYWdlGDIgAygLMicu", + "cHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0LkltcG9ydE1lc3NhZ2USSAoUcmVw", + "ZWF0ZWRfbmVzdGVkX2VudW0YMyADKA4yKi5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0QWxsVHlwZXMuTmVzdGVkRW51bRI9ChVyZXBlYXRlZF9mb3JlaWduX2Vu", + "dW0YNCADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bRJCChRy", + "ZXBlYXRlZF9pbXBvcnRfZW51bRg1IAMoDjIkLnByb3RvYnVmX3VuaXR0ZXN0", + "X2ltcG9ydC5JbXBvcnRFbnVtEiEKFXJlcGVhdGVkX3N0cmluZ19waWVjZRg2", + "IAMoCUICCAISGQoNcmVwZWF0ZWRfY29yZBg3IAMoCUICCAESGQoNZGVmYXVs", + "dF9pbnQzMhg9IAEoBToCNDESGQoNZGVmYXVsdF9pbnQ2NBg+IAEoAzoCNDIS", + "GgoOZGVmYXVsdF91aW50MzIYPyABKA06AjQzEhoKDmRlZmF1bHRfdWludDY0", + "GEAgASgEOgI0NBIbCg5kZWZhdWx0X3NpbnQzMhhBIAEoEToDLTQ1EhoKDmRl", + "ZmF1bHRfc2ludDY0GEIgASgSOgI0NhIbCg9kZWZhdWx0X2ZpeGVkMzIYQyAB", + "KAc6AjQ3EhsKD2RlZmF1bHRfZml4ZWQ2NBhEIAEoBjoCNDgSHAoQZGVmYXVs", + "dF9zZml4ZWQzMhhFIAEoDzoCNDkSHQoQZGVmYXVsdF9zZml4ZWQ2NBhGIAEo", + "EDoDLTUwEhsKDWRlZmF1bHRfZmxvYXQYRyABKAI6BDUxLjUSHQoOZGVmYXVs", + "dF9kb3VibGUYSCABKAE6BTUyMDAwEhoKDGRlZmF1bHRfYm9vbBhJIAEoCDoE", + "dHJ1ZRIdCg5kZWZhdWx0X3N0cmluZxhKIAEoCToFaGVsbG8SHAoNZGVmYXVs", + "dF9ieXRlcxhLIAEoDDoFd29ybGQSTAoTZGVmYXVsdF9uZXN0ZWRfZW51bRhR", + "IAEoDjIqLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxUeXBlcy5OZXN0ZWRF", + "bnVtOgNCQVISSQoUZGVmYXVsdF9mb3JlaWduX2VudW0YUiABKA4yHi5wcm90", + "b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bToLRk9SRUlHTl9CQVISTQoTZGVm", + "YXVsdF9pbXBvcnRfZW51bRhTIAEoDjIkLnByb3RvYnVmX3VuaXR0ZXN0X2lt", + "cG9ydC5JbXBvcnRFbnVtOgpJTVBPUlRfQkFSEiUKFGRlZmF1bHRfc3RyaW5n", + "X3BpZWNlGFQgASgJOgNhYmNCAggCEh0KDGRlZmF1bHRfY29yZBhVIAEoCToD", + "MTIzQgIIARobCg1OZXN0ZWRNZXNzYWdlEgoKAmJiGAEgASgFGhoKDU9wdGlv", + "bmFsR3JvdXASCQoBYRgRIAEoBRoaCg1SZXBlYXRlZEdyb3VwEgkKAWEYLyAB", + "KAUiJwoKTmVzdGVkRW51bRIHCgNGT08QARIHCgNCQVIQAhIHCgNCQVoQAyI0", + "ChRUZXN0RGVwcmVjYXRlZEZpZWxkcxIcChBkZXByZWNhdGVkX2ludDMyGAEg", + "ASgFQgIYASIbCg5Gb3JlaWduTWVzc2FnZRIJCgFjGAEgASgFIh0KEVRlc3RB", + "bGxFeHRlbnNpb25zKggIARCAgICAAiIkChdPcHRpb25hbEdyb3VwX2V4dGVu", + "c2lvbhIJCgFhGBEgASgFIiQKF1JlcGVhdGVkR3JvdXBfZXh0ZW5zaW9uEgkK", + "AWEYLyABKAUiUAoTVGVzdE5lc3RlZEV4dGVuc2lvbjI5CgR0ZXN0EiQucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMY6gcgASgJOgR0ZXN0", + "ItUFCgxUZXN0UmVxdWlyZWQSCQoBYRgBIAIoBRIOCgZkdW1teTIYAiABKAUS", + "CQoBYhgDIAIoBRIOCgZkdW1teTQYBCABKAUSDgoGZHVtbXk1GAUgASgFEg4K", + "BmR1bW15NhgGIAEoBRIOCgZkdW1teTcYByABKAUSDgoGZHVtbXk4GAggASgF", + "Eg4KBmR1bW15ORgJIAEoBRIPCgdkdW1teTEwGAogASgFEg8KB2R1bW15MTEY", + "CyABKAUSDwoHZHVtbXkxMhgMIAEoBRIPCgdkdW1teTEzGA0gASgFEg8KB2R1", + "bW15MTQYDiABKAUSDwoHZHVtbXkxNRgPIAEoBRIPCgdkdW1teTE2GBAgASgF", + "Eg8KB2R1bW15MTcYESABKAUSDwoHZHVtbXkxOBgSIAEoBRIPCgdkdW1teTE5", + "GBMgASgFEg8KB2R1bW15MjAYFCABKAUSDwoHZHVtbXkyMRgVIAEoBRIPCgdk", + "dW1teTIyGBYgASgFEg8KB2R1bW15MjMYFyABKAUSDwoHZHVtbXkyNBgYIAEo", + "BRIPCgdkdW1teTI1GBkgASgFEg8KB2R1bW15MjYYGiABKAUSDwoHZHVtbXky", + "NxgbIAEoBRIPCgdkdW1teTI4GBwgASgFEg8KB2R1bW15MjkYHSABKAUSDwoH", + "ZHVtbXkzMBgeIAEoBRIPCgdkdW1teTMxGB8gASgFEg8KB2R1bW15MzIYICAB", + "KAUSCQoBYxghIAIoBTJWCgZzaW5nbGUSJC5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0QWxsRXh0ZW5zaW9ucxjoByABKAsyHy5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0UmVxdWlyZWQyVQoFbXVsdGkSJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxjpByADKAsyHy5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "UmVxdWlyZWQimgEKE1Rlc3RSZXF1aXJlZEZvcmVpZ24SOQoQb3B0aW9uYWxf", + "bWVzc2FnZRgBIAEoCzIfLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RSZXF1aXJl", + "ZBI5ChByZXBlYXRlZF9tZXNzYWdlGAIgAygLMh8ucHJvdG9idWZfdW5pdHRl", + "c3QuVGVzdFJlcXVpcmVkEg0KBWR1bW15GAMgASgFIloKEVRlc3RGb3JlaWdu", + "TmVzdGVkEkUKDmZvcmVpZ25fbmVzdGVkGAEgASgLMi0ucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZE1lc3NhZ2UiEgoQVGVzdEVtcHR5", + "TWVzc2FnZSIqCh5UZXN0RW1wdHlNZXNzYWdlV2l0aEV4dGVuc2lvbnMqCAgB", + "EICAgIACIjcKG1Rlc3RNdWx0aXBsZUV4dGVuc2lvblJhbmdlcyoECCoQKyoG", + "CK8gEJQhKgoIgIAEEICAgIACIjQKGFRlc3RSZWFsbHlMYXJnZVRhZ051bWJl", + "chIJCgFhGAEgASgFEg0KAmJiGP///38gASgFIlUKFFRlc3RSZWN1cnNpdmVN", + "ZXNzYWdlEjIKAWEYASABKAsyJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UmVj", + "dXJzaXZlTWVzc2FnZRIJCgFpGAIgASgFIksKFFRlc3RNdXR1YWxSZWN1cnNp", + "b25BEjMKAmJiGAEgASgLMicucHJvdG9idWZfdW5pdHRlc3QuVGVzdE11dHVh", + "bFJlY3Vyc2lvbkIiYgoUVGVzdE11dHVhbFJlY3Vyc2lvbkISMgoBYRgBIAEo", + "CzInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RNdXR1YWxSZWN1cnNpb25BEhYK", + "Dm9wdGlvbmFsX2ludDMyGAIgASgFIrMBChJUZXN0RHVwRmllbGROdW1iZXIS", + "CQoBYRgBIAEoBRI2CgNmb28YAiABKAoyKS5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0RHVwRmllbGROdW1iZXIuRm9vEjYKA2JhchgDIAEoCjIpLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3REdXBGaWVsZE51bWJlci5CYXIaEAoDRm9vEgkKAWEY", + "ASABKAUaEAoDQmFyEgkKAWEYASABKAUigAIKGFRlc3ROZXN0ZWRNZXNzYWdl", + "SGFzQml0cxJaChdvcHRpb25hbF9uZXN0ZWRfbWVzc2FnZRgBIAEoCzI5LnBy", + "b3RvYnVmX3VuaXR0ZXN0LlRlc3ROZXN0ZWRNZXNzYWdlSGFzQml0cy5OZXN0", + "ZWRNZXNzYWdlGocBCg1OZXN0ZWRNZXNzYWdlEiQKHG5lc3RlZG1lc3NhZ2Vf", + "cmVwZWF0ZWRfaW50MzIYASADKAUSUAolbmVzdGVkbWVzc2FnZV9yZXBlYXRl", + "ZF9mb3JlaWdubWVzc2FnZRgCIAMoCzIhLnByb3RvYnVmX3VuaXR0ZXN0LkZv", + "cmVpZ25NZXNzYWdlIuUDChdUZXN0Q2FtZWxDYXNlRmllbGROYW1lcxIWCg5Q", + "cmltaXRpdmVGaWVsZBgBIAEoBRITCgtTdHJpbmdGaWVsZBgCIAEoCRIxCglF", + "bnVtRmllbGQYAyABKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51", + "bRI3CgxNZXNzYWdlRmllbGQYBCABKAsyIS5wcm90b2J1Zl91bml0dGVzdC5G", + "b3JlaWduTWVzc2FnZRIcChBTdHJpbmdQaWVjZUZpZWxkGAUgASgJQgIIAhIV", + "CglDb3JkRmllbGQYBiABKAlCAggBEh4KFlJlcGVhdGVkUHJpbWl0aXZlRmll", + "bGQYByADKAUSGwoTUmVwZWF0ZWRTdHJpbmdGaWVsZBgIIAMoCRI5ChFSZXBl", + "YXRlZEVudW1GaWVsZBgJIAMoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVp", + "Z25FbnVtEj8KFFJlcGVhdGVkTWVzc2FnZUZpZWxkGAogAygLMiEucHJvdG9i", + "dWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USJAoYUmVwZWF0ZWRTdHJpbmdQ", + "aWVjZUZpZWxkGAsgAygJQgIIAhIdChFSZXBlYXRlZENvcmRGaWVsZBgMIAMo", + "CUICCAEiVQoSVGVzdEZpZWxkT3JkZXJpbmdzEhEKCW15X3N0cmluZxgLIAEo", + "CRIOCgZteV9pbnQYASABKAMSEAoIbXlfZmxvYXQYZSABKAIqBAgCEAsqBAgM", + "EGUiowUKGFRlc3RFeHRyZW1lRGVmYXVsdFZhbHVlcxI/Cg1lc2NhcGVkX2J5", + "dGVzGAEgASgMOihcMDAwXDAwMVwwMDdcMDEwXDAxNFxuXHJcdFwwMTNcXFwn", + "XCJcMzc2EiAKDGxhcmdlX3VpbnQzMhgCIAEoDToKNDI5NDk2NzI5NRIqCgxs", + "YXJnZV91aW50NjQYAyABKAQ6FDE4NDQ2NzQ0MDczNzA5NTUxNjE1EiAKC3Nt", + "YWxsX2ludDMyGAQgASgFOgstMjE0NzQ4MzY0NxIpCgtzbWFsbF9pbnQ2NBgF", + "IAEoAzoULTkyMjMzNzIwMzY4NTQ3NzU4MDcSGAoLdXRmOF9zdHJpbmcYBiAB", + "KAk6A+GItBIVCgp6ZXJvX2Zsb2F0GAcgASgCOgEwEhQKCW9uZV9mbG9hdBgI", + "IAEoAjoBMRIYCgtzbWFsbF9mbG9hdBgJIAEoAjoDMS41Eh4KEm5lZ2F0aXZl", + "X29uZV9mbG9hdBgKIAEoAjoCLTESHAoObmVnYXRpdmVfZmxvYXQYCyABKAI6", + "BC0xLjUSGwoLbGFyZ2VfZmxvYXQYDCABKAI6BjJlKzAwOBIlChRzbWFsbF9u", + "ZWdhdGl2ZV9mbG9hdBgNIAEoAjoHLThlLTAyOBIXCgppbmZfZG91YmxlGA4g", + "ASgBOgNpbmYSHAoObmVnX2luZl9kb3VibGUYDyABKAE6BC1pbmYSFwoKbmFu", + "X2RvdWJsZRgQIAEoAToDbmFuEhYKCWluZl9mbG9hdBgRIAEoAjoDaW5mEhsK", + "DW5lZ19pbmZfZmxvYXQYEiABKAI6BC1pbmYSFgoJbmFuX2Zsb2F0GBMgASgC", + "OgNuYW4SKwoMY3BwX3RyaWdyYXBoGBQgASgJOhU/ID8gPz8gPz8gPz8/ID8/", + "LyA/Py0iSwoRU3BhcnNlRW51bU1lc3NhZ2USNgoLc3BhcnNlX2VudW0YASAB", + "KA4yIS5wcm90b2J1Zl91bml0dGVzdC5UZXN0U3BhcnNlRW51bSIZCglPbmVT", + "dHJpbmcSDAoEZGF0YRgBIAEoCSIYCghPbmVCeXRlcxIMCgRkYXRhGAEgASgM", + "IqoDCg9UZXN0UGFja2VkVHlwZXMSGAoMcGFja2VkX2ludDMyGFogAygFQgIQ", + "ARIYCgxwYWNrZWRfaW50NjQYWyADKANCAhABEhkKDXBhY2tlZF91aW50MzIY", + "XCADKA1CAhABEhkKDXBhY2tlZF91aW50NjQYXSADKARCAhABEhkKDXBhY2tl", + "ZF9zaW50MzIYXiADKBFCAhABEhkKDXBhY2tlZF9zaW50NjQYXyADKBJCAhAB", + "EhoKDnBhY2tlZF9maXhlZDMyGGAgAygHQgIQARIaCg5wYWNrZWRfZml4ZWQ2", + "NBhhIAMoBkICEAESGwoPcGFja2VkX3NmaXhlZDMyGGIgAygPQgIQARIbCg9w", + "YWNrZWRfc2ZpeGVkNjQYYyADKBBCAhABEhgKDHBhY2tlZF9mbG9hdBhkIAMo", + "AkICEAESGQoNcGFja2VkX2RvdWJsZRhlIAMoAUICEAESFwoLcGFja2VkX2Jv", + "b2wYZiADKAhCAhABEjcKC3BhY2tlZF9lbnVtGGcgAygOMh4ucHJvdG9idWZf", + "dW5pdHRlc3QuRm9yZWlnbkVudW1CAhABIsgDChFUZXN0VW5wYWNrZWRUeXBl", + "cxIaCg51bnBhY2tlZF9pbnQzMhhaIAMoBUICEAASGgoOdW5wYWNrZWRfaW50", + "NjQYWyADKANCAhAAEhsKD3VucGFja2VkX3VpbnQzMhhcIAMoDUICEAASGwoP", + "dW5wYWNrZWRfdWludDY0GF0gAygEQgIQABIbCg91bnBhY2tlZF9zaW50MzIY", + "XiADKBFCAhAAEhsKD3VucGFja2VkX3NpbnQ2NBhfIAMoEkICEAASHAoQdW5w", + "YWNrZWRfZml4ZWQzMhhgIAMoB0ICEAASHAoQdW5wYWNrZWRfZml4ZWQ2NBhh", + "IAMoBkICEAASHQoRdW5wYWNrZWRfc2ZpeGVkMzIYYiADKA9CAhAAEh0KEXVu", + "cGFja2VkX3NmaXhlZDY0GGMgAygQQgIQABIaCg51bnBhY2tlZF9mbG9hdBhk", + "IAMoAkICEAASGwoPdW5wYWNrZWRfZG91YmxlGGUgAygBQgIQABIZCg11bnBh", + "Y2tlZF9ib29sGGYgAygIQgIQABI5Cg11bnBhY2tlZF9lbnVtGGcgAygOMh4u", + "cHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbkVudW1CAhAAIiAKFFRlc3RQYWNr", + "ZWRFeHRlbnNpb25zKggIARCAgICAAiKZBAoVVGVzdER5bmFtaWNFeHRlbnNp", + "b25zEhkKEHNjYWxhcl9leHRlbnNpb24Y0A8gASgHEjcKDmVudW1fZXh0ZW5z", + "aW9uGNEPIAEoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25FbnVtElkK", + "FmR5bmFtaWNfZW51bV9leHRlbnNpb24Y0g8gASgOMjgucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdER5bmFtaWNFeHRlbnNpb25zLkR5bmFtaWNFbnVtVHlwZRI9", + "ChFtZXNzYWdlX2V4dGVuc2lvbhjTDyABKAsyIS5wcm90b2J1Zl91bml0dGVz", + "dC5Gb3JlaWduTWVzc2FnZRJfChlkeW5hbWljX21lc3NhZ2VfZXh0ZW5zaW9u", + "GNQPIAEoCzI7LnByb3RvYnVmX3VuaXR0ZXN0LlRlc3REeW5hbWljRXh0ZW5z", + "aW9ucy5EeW5hbWljTWVzc2FnZVR5cGUSGwoScmVwZWF0ZWRfZXh0ZW5zaW9u", + "GNUPIAMoCRIdChBwYWNrZWRfZXh0ZW5zaW9uGNYPIAMoEUICEAEaLAoSRHlu", + "YW1pY01lc3NhZ2VUeXBlEhYKDWR5bmFtaWNfZmllbGQYtBAgASgFIkcKD0R5", + "bmFtaWNFbnVtVHlwZRIQCgtEWU5BTUlDX0ZPTxCYERIQCgtEWU5BTUlDX0JB", + "UhCZERIQCgtEWU5BTUlDX0JBWhCaESLAAQojVGVzdFJlcGVhdGVkU2NhbGFy", + "RGlmZmVyZW50VGFnU2l6ZXMSGAoQcmVwZWF0ZWRfZml4ZWQzMhgMIAMoBxIW", + "Cg5yZXBlYXRlZF9pbnQzMhgNIAMoBRIZChByZXBlYXRlZF9maXhlZDY0GP4P", + "IAMoBhIXCg5yZXBlYXRlZF9pbnQ2NBj/DyADKAMSGAoOcmVwZWF0ZWRfZmxv", + "YXQY/v8PIAMoAhIZCg9yZXBlYXRlZF91aW50NjQY//8PIAMoBCIMCgpGb29S", + "ZXF1ZXN0Ig0KC0Zvb1Jlc3BvbnNlIgwKCkJhclJlcXVlc3QiDQoLQmFyUmVz", + "cG9uc2UqQAoLRm9yZWlnbkVudW0SDwoLRk9SRUlHTl9GT08QBBIPCgtGT1JF", + "SUdOX0JBUhAFEg8KC0ZPUkVJR05fQkFaEAYqRwoUVGVzdEVudW1XaXRoRHVw", + "VmFsdWUSCAoERk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08yEAES", + "CAoEQkFSMhACKokBCg5UZXN0U3BhcnNlRW51bRIMCghTUEFSU0VfQRB7Eg4K", + "CFNQQVJTRV9CEKbnAxIPCghTUEFSU0VfQxCysYAGEhUKCFNQQVJTRV9EEPH/", + "/////////wESFQoIU1BBUlNFX0UQtN78////////ARIMCghTUEFSU0VfRhAA", + "EgwKCFNQQVJTRV9HEAIymQEKC1Rlc3RTZXJ2aWNlEkQKA0ZvbxIdLnByb3Rv", + "YnVmX3VuaXR0ZXN0LkZvb1JlcXVlc3QaHi5wcm90b2J1Zl91bml0dGVzdC5G", + "b29SZXNwb25zZRJECgNCYXISHS5wcm90b2J1Zl91bml0dGVzdC5CYXJSZXF1", + "ZXN0Gh4ucHJvdG9idWZfdW5pdHRlc3QuQmFyUmVzcG9uc2U6RgoYb3B0aW9u", + "YWxfaW50MzJfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFs", + "bEV4dGVuc2lvbnMYASABKAU6RgoYb3B0aW9uYWxfaW50NjRfZXh0ZW5zaW9u", + "EiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYAiABKAM6", + "RwoZb3B0aW9uYWxfdWludDMyX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxFeHRlbnNpb25zGAMgASgNOkcKGW9wdGlvbmFsX3VpbnQ2", + "NF9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5z", + "aW9ucxgEIAEoBDpHChlvcHRpb25hbF9zaW50MzJfZXh0ZW5zaW9uEiQucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYBSABKBE6RwoZb3B0", + "aW9uYWxfc2ludDY0X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RBbGxFeHRlbnNpb25zGAYgASgSOkgKGm9wdGlvbmFsX2ZpeGVkMzJfZXh0", + "ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMY", + "ByABKAc6SAoab3B0aW9uYWxfZml4ZWQ2NF9leHRlbnNpb24SJC5wcm90b2J1", + "Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgIIAEoBjpJChtvcHRpb25h", + "bF9zZml4ZWQzMl9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxgJIAEoDzpJChtvcHRpb25hbF9zZml4ZWQ2NF9leHRl", + "bnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgK", + "IAEoEDpGChhvcHRpb25hbF9mbG9hdF9leHRlbnNpb24SJC5wcm90b2J1Zl91", + "bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgLIAEoAjpHChlvcHRpb25hbF9k", + "b3VibGVfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYDCABKAE6RQoXb3B0aW9uYWxfYm9vbF9leHRlbnNpb24SJC5w", + "cm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgNIAEoCDpHChlv", + "cHRpb25hbF9zdHJpbmdfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3Qu", + "VGVzdEFsbEV4dGVuc2lvbnMYDiABKAk6RgoYb3B0aW9uYWxfYnl0ZXNfZXh0", + "ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMY", + "DyABKAw6cQoXb3B0aW9uYWxncm91cF9leHRlbnNpb24SJC5wcm90b2J1Zl91", + "bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgQIAEoCjIqLnByb3RvYnVmX3Vu", + "aXR0ZXN0Lk9wdGlvbmFsR3JvdXBfZXh0ZW5zaW9uOn4KIW9wdGlvbmFsX25l", + "c3RlZF9tZXNzYWdlX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RBbGxFeHRlbnNpb25zGBIgASgLMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVz", + "dEFsbFR5cGVzLk5lc3RlZE1lc3NhZ2U6cwoib3B0aW9uYWxfZm9yZWlnbl9t", + "ZXNzYWdlX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxF", + "eHRlbnNpb25zGBMgASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1l", + "c3NhZ2U6eAohb3B0aW9uYWxfaW1wb3J0X21lc3NhZ2VfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYFCABKAsyJy5w", + "cm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0TWVzc2FnZTp4Ch5vcHRp", + "b25hbF9uZXN0ZWRfZW51bV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVz", + "dC5UZXN0QWxsRXh0ZW5zaW9ucxgVIAEoDjIqLnByb3RvYnVmX3VuaXR0ZXN0", + "LlRlc3RBbGxUeXBlcy5OZXN0ZWRFbnVtOm0KH29wdGlvbmFsX2ZvcmVpZ25f", + "ZW51bV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0", + "ZW5zaW9ucxgWIAEoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25FbnVt", + "OnIKHm9wdGlvbmFsX2ltcG9ydF9lbnVtX2V4dGVuc2lvbhIkLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGBcgASgOMiQucHJvdG9idWZf", + "dW5pdHRlc3RfaW1wb3J0LkltcG9ydEVudW06UQofb3B0aW9uYWxfc3RyaW5n", + "X3BpZWNlX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxF", + "eHRlbnNpb25zGBggASgJQgIIAjpJChdvcHRpb25hbF9jb3JkX2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGBkgASgJ", + "QgIIATpGChhyZXBlYXRlZF9pbnQzMl9leHRlbnNpb24SJC5wcm90b2J1Zl91", + "bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgfIAMoBTpGChhyZXBlYXRlZF9p", + "bnQ2NF9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0", + "ZW5zaW9ucxggIAMoAzpHChlyZXBlYXRlZF91aW50MzJfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYISADKA06RwoZ", + "cmVwZWF0ZWRfdWludDY0X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0", + "LlRlc3RBbGxFeHRlbnNpb25zGCIgAygEOkcKGXJlcGVhdGVkX3NpbnQzMl9l", + "eHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9u", + "cxgjIAMoETpHChlyZXBlYXRlZF9zaW50NjRfZXh0ZW5zaW9uEiQucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYJCADKBI6SAoacmVwZWF0", + "ZWRfZml4ZWQzMl9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxglIAMoBzpIChpyZXBlYXRlZF9maXhlZDY0X2V4dGVu", + "c2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGCYg", + "AygGOkkKG3JlcGVhdGVkX3NmaXhlZDMyX2V4dGVuc2lvbhIkLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGCcgAygPOkkKG3JlcGVhdGVk", + "X3NmaXhlZDY0X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RB", + "bGxFeHRlbnNpb25zGCggAygQOkYKGHJlcGVhdGVkX2Zsb2F0X2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGCkgAygC", + "OkcKGXJlcGVhdGVkX2RvdWJsZV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0", + "dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgqIAMoATpFChdyZXBlYXRlZF9ib29s", + "X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNp", + "b25zGCsgAygIOkcKGXJlcGVhdGVkX3N0cmluZ19leHRlbnNpb24SJC5wcm90", + "b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgsIAMoCTpGChhyZXBl", + "YXRlZF9ieXRlc19leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxgtIAMoDDpxChdyZXBlYXRlZGdyb3VwX2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGC4gAygK", + "MioucHJvdG9idWZfdW5pdHRlc3QuUmVwZWF0ZWRHcm91cF9leHRlbnNpb246", + "fgohcmVwZWF0ZWRfbmVzdGVkX21lc3NhZ2VfZXh0ZW5zaW9uEiQucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYMCADKAsyLS5wcm90b2J1", + "Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZTpzCiJyZXBl", + "YXRlZF9mb3JlaWduX21lc3NhZ2VfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYMSADKAsyIS5wcm90b2J1Zl91bml0", + "dGVzdC5Gb3JlaWduTWVzc2FnZTp4CiFyZXBlYXRlZF9pbXBvcnRfbWVzc2Fn", + "ZV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5z", + "aW9ucxgyIAMoCzInLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRN", + "ZXNzYWdlOngKHnJlcGVhdGVkX25lc3RlZF9lbnVtX2V4dGVuc2lvbhIkLnBy", + "b3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGDMgAygOMioucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW06bQofcmVw", + "ZWF0ZWRfZm9yZWlnbl9lbnVtX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxFeHRlbnNpb25zGDQgAygOMh4ucHJvdG9idWZfdW5pdHRl", + "c3QuRm9yZWlnbkVudW06cgoecmVwZWF0ZWRfaW1wb3J0X2VudW1fZXh0ZW5z", + "aW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYNSAD", + "KA4yJC5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0RW51bTpRCh9y", + "ZXBlYXRlZF9zdHJpbmdfcGllY2VfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYNiADKAlCAggCOkkKF3JlcGVhdGVk", + "X2NvcmRfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYNyADKAlCAggBOkkKF2RlZmF1bHRfaW50MzJfZXh0ZW5zaW9u", + "EiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYPSABKAU6", + "AjQxOkkKF2RlZmF1bHRfaW50NjRfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYPiABKAM6AjQyOkoKGGRlZmF1bHRf", + "dWludDMyX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxF", + "eHRlbnNpb25zGD8gASgNOgI0MzpKChhkZWZhdWx0X3VpbnQ2NF9leHRlbnNp", + "b24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxhAIAEo", + "BDoCNDQ6SwoYZGVmYXVsdF9zaW50MzJfZXh0ZW5zaW9uEiQucHJvdG9idWZf", + "dW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYQSABKBE6Ay00NTpKChhkZWZh", + "dWx0X3NpbnQ2NF9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxhCIAEoEjoCNDY6SwoZZGVmYXVsdF9maXhlZDMyX2V4", + "dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25z", + "GEMgASgHOgI0NzpLChlkZWZhdWx0X2ZpeGVkNjRfZXh0ZW5zaW9uEiQucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYRCABKAY6AjQ4OkwK", + "GmRlZmF1bHRfc2ZpeGVkMzJfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRl", + "c3QuVGVzdEFsbEV4dGVuc2lvbnMYRSABKA86AjQ5Ok0KGmRlZmF1bHRfc2Zp", + "eGVkNjRfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYRiABKBA6Ay01MDpLChdkZWZhdWx0X2Zsb2F0X2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGEcgASgC", + "OgQ1MS41Ok0KGGRlZmF1bHRfZG91YmxlX2V4dGVuc2lvbhIkLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGEggASgBOgU1MjAwMDpKChZk", + "ZWZhdWx0X2Jvb2xfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVz", + "dEFsbEV4dGVuc2lvbnMYSSABKAg6BHRydWU6TQoYZGVmYXVsdF9zdHJpbmdf", + "ZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lv", + "bnMYSiABKAk6BWhlbGxvOkwKF2RlZmF1bHRfYnl0ZXNfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYSyABKAw6BXdv", + "cmxkOnwKHWRlZmF1bHRfbmVzdGVkX2VudW1fZXh0ZW5zaW9uEiQucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYUSABKA4yKi5wcm90b2J1", + "Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkRW51bToDQkFSOnkKHmRl", + "ZmF1bHRfZm9yZWlnbl9lbnVtX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxFeHRlbnNpb25zGFIgASgOMh4ucHJvdG9idWZfdW5pdHRl", + "c3QuRm9yZWlnbkVudW06C0ZPUkVJR05fQkFSOn0KHWRlZmF1bHRfaW1wb3J0", + "X2VudW1fZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYUyABKA4yJC5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1w", + "b3J0RW51bToKSU1QT1JUX0JBUjpVCh5kZWZhdWx0X3N0cmluZ19waWVjZV9l", + "eHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9u", + "cxhUIAEoCToDYWJjQgIIAjpNChZkZWZhdWx0X2NvcmRfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYVSABKAk6AzEy", + "M0ICCAE6QgoTbXlfZXh0ZW5zaW9uX3N0cmluZxIlLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RGaWVsZE9yZGVyaW5ncxgyIAEoCTo/ChBteV9leHRlbnNpb25f", + "aW50EiUucHJvdG9idWZfdW5pdHRlc3QuVGVzdEZpZWxkT3JkZXJpbmdzGAUg", + "ASgFOksKFnBhY2tlZF9pbnQzMl9leHRlbnNpb24SJy5wcm90b2J1Zl91bml0", + "dGVzdC5UZXN0UGFja2VkRXh0ZW5zaW9ucxhaIAMoBUICEAE6SwoWcGFja2Vk", + "X2ludDY0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNr", + "ZWRFeHRlbnNpb25zGFsgAygDQgIQATpMChdwYWNrZWRfdWludDMyX2V4dGVu", + "c2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNrZWRFeHRlbnNpb25z", + "GFwgAygNQgIQATpMChdwYWNrZWRfdWludDY0X2V4dGVuc2lvbhInLnByb3Rv", + "YnVmX3VuaXR0ZXN0LlRlc3RQYWNrZWRFeHRlbnNpb25zGF0gAygEQgIQATpM", + "ChdwYWNrZWRfc2ludDMyX2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0", + "LlRlc3RQYWNrZWRFeHRlbnNpb25zGF4gAygRQgIQATpMChdwYWNrZWRfc2lu", + "dDY0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNrZWRF", + "eHRlbnNpb25zGF8gAygSQgIQATpNChhwYWNrZWRfZml4ZWQzMl9leHRlbnNp", + "b24SJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UGFja2VkRXh0ZW5zaW9ucxhg", + "IAMoB0ICEAE6TQoYcGFja2VkX2ZpeGVkNjRfZXh0ZW5zaW9uEicucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdFBhY2tlZEV4dGVuc2lvbnMYYSADKAZCAhABOk4K", + "GXBhY2tlZF9zZml4ZWQzMl9leHRlbnNpb24SJy5wcm90b2J1Zl91bml0dGVz", + "dC5UZXN0UGFja2VkRXh0ZW5zaW9ucxhiIAMoD0ICEAE6TgoZcGFja2VkX3Nm", + "aXhlZDY0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNr", + "ZWRFeHRlbnNpb25zGGMgAygQQgIQATpLChZwYWNrZWRfZmxvYXRfZXh0ZW5z", + "aW9uEicucHJvdG9idWZfdW5pdHRlc3QuVGVzdFBhY2tlZEV4dGVuc2lvbnMY", + "ZCADKAJCAhABOkwKF3BhY2tlZF9kb3VibGVfZXh0ZW5zaW9uEicucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdFBhY2tlZEV4dGVuc2lvbnMYZSADKAFCAhABOkoK", + "FXBhY2tlZF9ib29sX2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RQYWNrZWRFeHRlbnNpb25zGGYgAygIQgIQATpqChVwYWNrZWRfZW51bV9l", + "eHRlbnNpb24SJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UGFja2VkRXh0ZW5z", + "aW9ucxhnIAMoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25FbnVtQgIQ", + "AUJTQg1Vbml0dGVzdFByb3RvSAGAAQGIAQGQAQHCPjYKIUdvb2dsZS5Qcm90", + "b2NvbEJ1ZmZlcnMuVGVzdFByb3RvcxIRVW5pdFRlc3RQcm90b0ZpbGU=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_TestAllTypes__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes__Descriptor, + new string[] { "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalGroup", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalImportMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalImportEnum", "OptionalStringPiece", "OptionalCord", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedGroup", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedImportMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedImportEnum", "RepeatedStringPiece", "RepeatedCord", "DefaultInt32", "DefaultInt64", "DefaultUint32", "DefaultUint64", "DefaultSint32", "DefaultSint64", "DefaultFixed32", "DefaultFixed64", "DefaultSfixed32", "DefaultSfixed64", "DefaultFloat", "DefaultDouble", "DefaultBool", "DefaultString", "DefaultBytes", "DefaultNestedEnum", "DefaultForeignEnum", "DefaultImportEnum", "DefaultStringPiece", "DefaultCord", }); + internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor = internal__static_protobuf_unittest_TestAllTypes__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor, + new string[] { "Bb", }); + internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor = internal__static_protobuf_unittest_TestAllTypes__Descriptor.NestedTypes[1]; + internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor = internal__static_protobuf_unittest_TestAllTypes__Descriptor.NestedTypes[2]; + internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor = Descriptor.MessageTypes[1]; + internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor, + new string[] { "DeprecatedInt32", }); + internal__static_protobuf_unittest_ForeignMessage__Descriptor = Descriptor.MessageTypes[2]; + internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_ForeignMessage__Descriptor, + new string[] { "C", }); + internal__static_protobuf_unittest_TestAllExtensions__Descriptor = Descriptor.MessageTypes[3]; + internal__static_protobuf_unittest_TestAllExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllExtensions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor = Descriptor.MessageTypes[4]; + internal__static_protobuf_unittest_OptionalGroup_extension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor = Descriptor.MessageTypes[5]; + internal__static_protobuf_unittest_RepeatedGroup_extension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestNestedExtension__Descriptor = Descriptor.MessageTypes[6]; + internal__static_protobuf_unittest_TestNestedExtension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestNestedExtension__Descriptor, + new string[] { }); + global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Test = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Descriptor.Extensions[0]); + internal__static_protobuf_unittest_TestRequired__Descriptor = Descriptor.MessageTypes[7]; + internal__static_protobuf_unittest_TestRequired__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRequired__Descriptor, + new string[] { "A", "Dummy2", "B", "Dummy4", "Dummy5", "Dummy6", "Dummy7", "Dummy8", "Dummy9", "Dummy10", "Dummy11", "Dummy12", "Dummy13", "Dummy14", "Dummy15", "Dummy16", "Dummy17", "Dummy18", "Dummy19", "Dummy20", "Dummy21", "Dummy22", "Dummy23", "Dummy24", "Dummy25", "Dummy26", "Dummy27", "Dummy28", "Dummy29", "Dummy30", "Dummy31", "Dummy32", "C", }); + global::Google.ProtocolBuffers.TestProtos.TestRequired.Single = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestRequired.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.TestRequired.Multi = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestRequired.Descriptor.Extensions[1]); + internal__static_protobuf_unittest_TestRequiredForeign__Descriptor = Descriptor.MessageTypes[8]; + internal__static_protobuf_unittest_TestRequiredForeign__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRequiredForeign__Descriptor, + new string[] { "OptionalMessage", "RepeatedMessage", "Dummy", }); + internal__static_protobuf_unittest_TestForeignNested__Descriptor = Descriptor.MessageTypes[9]; + internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestForeignNested__Descriptor, + new string[] { "ForeignNested", }); + internal__static_protobuf_unittest_TestEmptyMessage__Descriptor = Descriptor.MessageTypes[10]; + internal__static_protobuf_unittest_TestEmptyMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestEmptyMessage__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor = Descriptor.MessageTypes[11]; + internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor = Descriptor.MessageTypes[12]; + internal__static_protobuf_unittest_TestMultipleExtensionRanges__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor = Descriptor.MessageTypes[13]; + internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor, + new string[] { "A", "Bb", }); + internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor = Descriptor.MessageTypes[14]; + internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor, + new string[] { "A", "I", }); + internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor = Descriptor.MessageTypes[15]; + internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor, + new string[] { "Bb", }); + internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor = Descriptor.MessageTypes[16]; + internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor, + new string[] { "A", "OptionalInt32", }); + internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor = Descriptor.MessageTypes[17]; + internal__static_protobuf_unittest_TestDupFieldNumber__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor, + new string[] { "A", "Foo", "Bar", }); + internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor = internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestDupFieldNumber_Foo__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor = internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor.NestedTypes[1]; + internal__static_protobuf_unittest_TestDupFieldNumber_Bar__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor = Descriptor.MessageTypes[18]; + internal__static_protobuf_unittest_TestNestedMessageHasBits__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor, + new string[] { "OptionalNestedMessage", }); + internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor = internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor, + new string[] { "NestedmessageRepeatedInt32", "NestedmessageRepeatedForeignmessage", }); + internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor = Descriptor.MessageTypes[19]; + internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor, + new string[] { "PrimitiveField", "StringField", "EnumField", "MessageField", "StringPieceField", "CordField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedStringPieceField", "RepeatedCordField", }); + internal__static_protobuf_unittest_TestFieldOrderings__Descriptor = Descriptor.MessageTypes[20]; + internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestFieldOrderings__Descriptor, + new string[] { "MyString", "MyInt", "MyFloat", }); + internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor = Descriptor.MessageTypes[21]; + internal__static_protobuf_unittest_TestExtremeDefaultValues__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor, + new string[] { "EscapedBytes", "LargeUint32", "LargeUint64", "SmallInt32", "SmallInt64", "Utf8String", "ZeroFloat", "OneFloat", "SmallFloat", "NegativeOneFloat", "NegativeFloat", "LargeFloat", "SmallNegativeFloat", "InfDouble", "NegInfDouble", "NanDouble", "InfFloat", "NegInfFloat", "NanFloat", "CppTrigraph", }); + internal__static_protobuf_unittest_SparseEnumMessage__Descriptor = Descriptor.MessageTypes[22]; + internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_SparseEnumMessage__Descriptor, + new string[] { "SparseEnum", }); + internal__static_protobuf_unittest_OneString__Descriptor = Descriptor.MessageTypes[23]; + internal__static_protobuf_unittest_OneString__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OneString__Descriptor, + new string[] { "Data", }); + internal__static_protobuf_unittest_OneBytes__Descriptor = Descriptor.MessageTypes[24]; + internal__static_protobuf_unittest_OneBytes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OneBytes__Descriptor, + new string[] { "Data", }); + internal__static_protobuf_unittest_TestPackedTypes__Descriptor = Descriptor.MessageTypes[25]; + internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestPackedTypes__Descriptor, + new string[] { "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedEnum", }); + internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor = Descriptor.MessageTypes[26]; + internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor, + new string[] { "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedEnum", }); + internal__static_protobuf_unittest_TestPackedExtensions__Descriptor = Descriptor.MessageTypes[27]; + internal__static_protobuf_unittest_TestPackedExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestPackedExtensions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor = Descriptor.MessageTypes[28]; + internal__static_protobuf_unittest_TestDynamicExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor, + new string[] { "ScalarExtension", "EnumExtension", "DynamicEnumExtension", "MessageExtension", "DynamicMessageExtension", "RepeatedExtension", "PackedExtension", }); + internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor = internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor, + new string[] { "DynamicField", }); + internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor = Descriptor.MessageTypes[29]; + internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor, + new string[] { "RepeatedFixed32", "RepeatedInt32", "RepeatedFixed64", "RepeatedInt64", "RepeatedFloat", "RepeatedUint64", }); + internal__static_protobuf_unittest_FooRequest__Descriptor = Descriptor.MessageTypes[30]; + internal__static_protobuf_unittest_FooRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_FooRequest__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_FooResponse__Descriptor = Descriptor.MessageTypes[31]; + internal__static_protobuf_unittest_FooResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_FooResponse__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_BarRequest__Descriptor = Descriptor.MessageTypes[32]; + internal__static_protobuf_unittest_BarRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_BarRequest__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_BarResponse__Descriptor = Descriptor.MessageTypes[33]; + internal__static_protobuf_unittest_BarResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_BarResponse__Descriptor, + new string[] { }); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[1]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[2]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[3]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[4]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[5]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[6]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[7]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[8]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[9]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFloatExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[10]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalDoubleExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[11]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBoolExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[12]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[13]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBytesExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[14]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalGroupExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[15]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedMessageExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[16]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignMessageExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[17]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportMessageExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[18]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[19]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[20]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[21]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringPieceExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[22]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalCordExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[23]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[24]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[25]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[26]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[27]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[28]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[29]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[30]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[31]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[32]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[33]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFloatExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[34]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedDoubleExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[35]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBoolExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[36]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[37]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBytesExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[38]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedGroupExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[39]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedMessageExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[40]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignMessageExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[41]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportMessageExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[42]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[43]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[44]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[45]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringPieceExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[46]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedCordExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[47]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[48]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[49]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[50]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[51]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[52]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[53]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[54]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[55]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[56]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[57]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFloatExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[58]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultDoubleExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[59]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBoolExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[60]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[61]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBytesExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[62]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultNestedEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[63]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultForeignEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[64]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultImportEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[65]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringPieceExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[66]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultCordExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[67]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionString = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[68]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionInt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[69]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[70]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[71]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[72]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[73]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[74]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[75]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[76]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[77]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[78]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[79]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFloatExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[80]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedDoubleExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[81]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedBoolExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[82]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[83]); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum ForeignEnum { + FOREIGN_FOO = 4, + FOREIGN_BAR = 5, + FOREIGN_BAZ = 6, + } + + public enum TestEnumWithDupValue { + FOO1 = 1, + BAR1 = 2, + BAZ = 3, + FOO2 = 1, + BAR2 = 2, + } + + public enum TestSparseEnum { + SPARSE_A = 123, + SPARSE_B = 62374, + SPARSE_C = 12589234, + SPARSE_D = -15, + SPARSE_E = -53452, + SPARSE_F = 0, + SPARSE_G = 2, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestAllTypes : pb::GeneratedMessage { + private TestAllTypes() { } + private static readonly TestAllTypes defaultInstance = new TestAllTypes().MakeReadOnly(); + private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; + private static readonly uint[] _testAllTypesFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; + public static TestAllTypes DefaultInstance { + get { return defaultInstance; } + } + + public override TestAllTypes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestAllTypes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum NestedEnum { + FOO = 1, + BAR = 2, + BAZ = 3, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); + private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; + private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; + public static NestedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override NestedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NestedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable; } + } + + public const int BbFieldNumber = 1; + private bool hasBb; + private int bb_; + public bool HasBb { + get { return hasBb; } + } + public int Bb { + get { return bb_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _nestedMessageFieldNames; + if (hasBb) { + output.WriteInt32(1, field_names[0], Bb); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasBb) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Bb); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static NestedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NestedMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NestedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (resultIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NestedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Descriptor; } + } + + public override NestedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } + } + + public override NestedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NestedMessage) { + return MergeFrom((NestedMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NestedMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasBb) { + Bb = other.Bb; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_nestedMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _nestedMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasBb = input.ReadInt32(ref result.bb_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasBb { + get { return result.hasBb; } + } + public int Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(int value) { + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = 0; + return this; + } + } + static NestedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OptionalGroup : pb::GeneratedMessage { + private OptionalGroup() { } + private static readonly OptionalGroup defaultInstance = new OptionalGroup().MakeReadOnly(); + private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; + private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; + public static OptionalGroup DefaultInstance { + get { return defaultInstance; } + } + + public override OptionalGroup DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OptionalGroup ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__FieldAccessorTable; } + } + + public const int AFieldNumber = 17; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _optionalGroupFieldNames; + if (hasA) { + output.WriteInt32(17, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(17, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OptionalGroup ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OptionalGroup ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OptionalGroup MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OptionalGroup prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OptionalGroup cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OptionalGroup result; + + private OptionalGroup PrepareBuilder() { + if (resultIsReadOnly) { + OptionalGroup original = result; + result = new OptionalGroup(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OptionalGroup MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Descriptor; } + } + + public override OptionalGroup DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; } + } + + public override OptionalGroup BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OptionalGroup) { + return MergeFrom((OptionalGroup) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OptionalGroup other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_optionalGroupFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _optionalGroupFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 136: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static OptionalGroup() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RepeatedGroup : pb::GeneratedMessage { + private RepeatedGroup() { } + private static readonly RepeatedGroup defaultInstance = new RepeatedGroup().MakeReadOnly(); + private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; + private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; + public static RepeatedGroup DefaultInstance { + get { return defaultInstance; } + } + + public override RepeatedGroup DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RepeatedGroup ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__FieldAccessorTable; } + } + + public const int AFieldNumber = 47; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _repeatedGroupFieldNames; + if (hasA) { + output.WriteInt32(47, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(47, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static RepeatedGroup ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RepeatedGroup ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RepeatedGroup MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RepeatedGroup prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RepeatedGroup cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RepeatedGroup result; + + private RepeatedGroup PrepareBuilder() { + if (resultIsReadOnly) { + RepeatedGroup original = result; + result = new RepeatedGroup(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RepeatedGroup MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Descriptor; } + } + + public override RepeatedGroup DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance; } + } + + public override RepeatedGroup BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is RepeatedGroup) { + return MergeFrom((RepeatedGroup) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RepeatedGroup other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_repeatedGroupFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _repeatedGroupFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 376: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static RepeatedGroup() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int OptionalInt32FieldNumber = 1; + private bool hasOptionalInt32; + private int optionalInt32_; + public bool HasOptionalInt32 { + get { return hasOptionalInt32; } + } + public int OptionalInt32 { + get { return optionalInt32_; } + } + + public const int OptionalInt64FieldNumber = 2; + private bool hasOptionalInt64; + private long optionalInt64_; + public bool HasOptionalInt64 { + get { return hasOptionalInt64; } + } + public long OptionalInt64 { + get { return optionalInt64_; } + } + + public const int OptionalUint32FieldNumber = 3; + private bool hasOptionalUint32; + private uint optionalUint32_; + public bool HasOptionalUint32 { + get { return hasOptionalUint32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalUint32 { + get { return optionalUint32_; } + } + + public const int OptionalUint64FieldNumber = 4; + private bool hasOptionalUint64; + private ulong optionalUint64_; + public bool HasOptionalUint64 { + get { return hasOptionalUint64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalUint64 { + get { return optionalUint64_; } + } + + public const int OptionalSint32FieldNumber = 5; + private bool hasOptionalSint32; + private int optionalSint32_; + public bool HasOptionalSint32 { + get { return hasOptionalSint32; } + } + public int OptionalSint32 { + get { return optionalSint32_; } + } + + public const int OptionalSint64FieldNumber = 6; + private bool hasOptionalSint64; + private long optionalSint64_; + public bool HasOptionalSint64 { + get { return hasOptionalSint64; } + } + public long OptionalSint64 { + get { return optionalSint64_; } + } + + public const int OptionalFixed32FieldNumber = 7; + private bool hasOptionalFixed32; + private uint optionalFixed32_; + public bool HasOptionalFixed32 { + get { return hasOptionalFixed32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalFixed32 { + get { return optionalFixed32_; } + } + + public const int OptionalFixed64FieldNumber = 8; + private bool hasOptionalFixed64; + private ulong optionalFixed64_; + public bool HasOptionalFixed64 { + get { return hasOptionalFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalFixed64 { + get { return optionalFixed64_; } + } + + public const int OptionalSfixed32FieldNumber = 9; + private bool hasOptionalSfixed32; + private int optionalSfixed32_; + public bool HasOptionalSfixed32 { + get { return hasOptionalSfixed32; } + } + public int OptionalSfixed32 { + get { return optionalSfixed32_; } + } + + public const int OptionalSfixed64FieldNumber = 10; + private bool hasOptionalSfixed64; + private long optionalSfixed64_; + public bool HasOptionalSfixed64 { + get { return hasOptionalSfixed64; } + } + public long OptionalSfixed64 { + get { return optionalSfixed64_; } + } + + public const int OptionalFloatFieldNumber = 11; + private bool hasOptionalFloat; + private float optionalFloat_; + public bool HasOptionalFloat { + get { return hasOptionalFloat; } + } + public float OptionalFloat { + get { return optionalFloat_; } + } + + public const int OptionalDoubleFieldNumber = 12; + private bool hasOptionalDouble; + private double optionalDouble_; + public bool HasOptionalDouble { + get { return hasOptionalDouble; } + } + public double OptionalDouble { + get { return optionalDouble_; } + } + + public const int OptionalBoolFieldNumber = 13; + private bool hasOptionalBool; + private bool optionalBool_; + public bool HasOptionalBool { + get { return hasOptionalBool; } + } + public bool OptionalBool { + get { return optionalBool_; } + } + + public const int OptionalStringFieldNumber = 14; + private bool hasOptionalString; + private string optionalString_ = ""; + public bool HasOptionalString { + get { return hasOptionalString; } + } + public string OptionalString { + get { return optionalString_; } + } + + public const int OptionalBytesFieldNumber = 15; + private bool hasOptionalBytes; + private pb::ByteString optionalBytes_ = pb::ByteString.Empty; + public bool HasOptionalBytes { + get { return hasOptionalBytes; } + } + public pb::ByteString OptionalBytes { + get { return optionalBytes_; } + } + + public const int OptionalGroupFieldNumber = 16; + private bool hasOptionalGroup; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup optionalGroup_; + public bool HasOptionalGroup { + get { return hasOptionalGroup; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup OptionalGroup { + get { return optionalGroup_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; } + } + + public const int OptionalNestedMessageFieldNumber = 18; + private bool hasOptionalNestedMessage; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage optionalNestedMessage_; + public bool HasOptionalNestedMessage { + get { return hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage OptionalNestedMessage { + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } + } + + public const int OptionalForeignMessageFieldNumber = 19; + private bool hasOptionalForeignMessage; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage optionalForeignMessage_; + public bool HasOptionalForeignMessage { + get { return hasOptionalForeignMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage OptionalForeignMessage { + get { return optionalForeignMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public const int OptionalImportMessageFieldNumber = 20; + private bool hasOptionalImportMessage; + private global::Google.ProtocolBuffers.TestProtos.ImportMessage optionalImportMessage_; + public bool HasOptionalImportMessage { + get { return hasOptionalImportMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage OptionalImportMessage { + get { return optionalImportMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } + } + + public const int OptionalNestedEnumFieldNumber = 21; + private bool hasOptionalNestedEnum; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.FOO; + public bool HasOptionalNestedEnum { + get { return hasOptionalNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum OptionalNestedEnum { + get { return optionalNestedEnum_; } + } + + public const int OptionalForeignEnumFieldNumber = 22; + private bool hasOptionalForeignEnum; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + public bool HasOptionalForeignEnum { + get { return hasOptionalForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum OptionalForeignEnum { + get { return optionalForeignEnum_; } + } + + public const int OptionalImportEnumFieldNumber = 23; + private bool hasOptionalImportEnum; + private global::Google.ProtocolBuffers.TestProtos.ImportEnum optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_FOO; + public bool HasOptionalImportEnum { + get { return hasOptionalImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum OptionalImportEnum { + get { return optionalImportEnum_; } + } + + public const int OptionalStringPieceFieldNumber = 24; + private bool hasOptionalStringPiece; + private string optionalStringPiece_ = ""; + public bool HasOptionalStringPiece { + get { return hasOptionalStringPiece; } + } + public string OptionalStringPiece { + get { return optionalStringPiece_; } + } + + public const int OptionalCordFieldNumber = 25; + private bool hasOptionalCord; + private string optionalCord_ = ""; + public bool HasOptionalCord { + get { return hasOptionalCord; } + } + public string OptionalCord { + get { return optionalCord_; } + } + + public const int RepeatedInt32FieldNumber = 31; + private pbc::PopsicleList repeatedInt32_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt32List { + get { return pbc::Lists.AsReadOnly(repeatedInt32_); } + } + public int RepeatedInt32Count { + get { return repeatedInt32_.Count; } + } + public int GetRepeatedInt32(int index) { + return repeatedInt32_[index]; + } + + public const int RepeatedInt64FieldNumber = 32; + private pbc::PopsicleList repeatedInt64_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt64List { + get { return pbc::Lists.AsReadOnly(repeatedInt64_); } + } + public int RepeatedInt64Count { + get { return repeatedInt64_.Count; } + } + public long GetRepeatedInt64(int index) { + return repeatedInt64_[index]; + } + + public const int RepeatedUint32FieldNumber = 33; + private pbc::PopsicleList repeatedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint32List { + get { return pbc::Lists.AsReadOnly(repeatedUint32_); } + } + public int RepeatedUint32Count { + get { return repeatedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedUint32(int index) { + return repeatedUint32_[index]; + } + + public const int RepeatedUint64FieldNumber = 34; + private pbc::PopsicleList repeatedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint64List { + get { return pbc::Lists.AsReadOnly(repeatedUint64_); } + } + public int RepeatedUint64Count { + get { return repeatedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return repeatedUint64_[index]; + } + + public const int RepeatedSint32FieldNumber = 35; + private pbc::PopsicleList repeatedSint32_ = new pbc::PopsicleList(); + public scg::IList RepeatedSint32List { + get { return pbc::Lists.AsReadOnly(repeatedSint32_); } + } + public int RepeatedSint32Count { + get { return repeatedSint32_.Count; } + } + public int GetRepeatedSint32(int index) { + return repeatedSint32_[index]; + } + + public const int RepeatedSint64FieldNumber = 36; + private pbc::PopsicleList repeatedSint64_ = new pbc::PopsicleList(); + public scg::IList RepeatedSint64List { + get { return pbc::Lists.AsReadOnly(repeatedSint64_); } + } + public int RepeatedSint64Count { + get { return repeatedSint64_.Count; } + } + public long GetRepeatedSint64(int index) { + return repeatedSint64_[index]; + } + + public const int RepeatedFixed32FieldNumber = 37; + private pbc::PopsicleList repeatedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed32List { + get { return pbc::Lists.AsReadOnly(repeatedFixed32_); } + } + public int RepeatedFixed32Count { + get { return repeatedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return repeatedFixed32_[index]; + } + + public const int RepeatedFixed64FieldNumber = 38; + private pbc::PopsicleList repeatedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed64List { + get { return pbc::Lists.AsReadOnly(repeatedFixed64_); } + } + public int RepeatedFixed64Count { + get { return repeatedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return repeatedFixed64_[index]; + } + + public const int RepeatedSfixed32FieldNumber = 39; + private pbc::PopsicleList repeatedSfixed32_ = new pbc::PopsicleList(); + public scg::IList RepeatedSfixed32List { + get { return pbc::Lists.AsReadOnly(repeatedSfixed32_); } + } + public int RepeatedSfixed32Count { + get { return repeatedSfixed32_.Count; } + } + public int GetRepeatedSfixed32(int index) { + return repeatedSfixed32_[index]; + } + + public const int RepeatedSfixed64FieldNumber = 40; + private pbc::PopsicleList repeatedSfixed64_ = new pbc::PopsicleList(); + public scg::IList RepeatedSfixed64List { + get { return pbc::Lists.AsReadOnly(repeatedSfixed64_); } + } + public int RepeatedSfixed64Count { + get { return repeatedSfixed64_.Count; } + } + public long GetRepeatedSfixed64(int index) { + return repeatedSfixed64_[index]; + } + + public const int RepeatedFloatFieldNumber = 41; + private pbc::PopsicleList repeatedFloat_ = new pbc::PopsicleList(); + public scg::IList RepeatedFloatList { + get { return pbc::Lists.AsReadOnly(repeatedFloat_); } + } + public int RepeatedFloatCount { + get { return repeatedFloat_.Count; } + } + public float GetRepeatedFloat(int index) { + return repeatedFloat_[index]; + } + + public const int RepeatedDoubleFieldNumber = 42; + private pbc::PopsicleList repeatedDouble_ = new pbc::PopsicleList(); + public scg::IList RepeatedDoubleList { + get { return pbc::Lists.AsReadOnly(repeatedDouble_); } + } + public int RepeatedDoubleCount { + get { return repeatedDouble_.Count; } + } + public double GetRepeatedDouble(int index) { + return repeatedDouble_[index]; + } + + public const int RepeatedBoolFieldNumber = 43; + private pbc::PopsicleList repeatedBool_ = new pbc::PopsicleList(); + public scg::IList RepeatedBoolList { + get { return pbc::Lists.AsReadOnly(repeatedBool_); } + } + public int RepeatedBoolCount { + get { return repeatedBool_.Count; } + } + public bool GetRepeatedBool(int index) { + return repeatedBool_[index]; + } + + public const int RepeatedStringFieldNumber = 44; + private pbc::PopsicleList repeatedString_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringList { + get { return pbc::Lists.AsReadOnly(repeatedString_); } + } + public int RepeatedStringCount { + get { return repeatedString_.Count; } + } + public string GetRepeatedString(int index) { + return repeatedString_[index]; + } + + public const int RepeatedBytesFieldNumber = 45; + private pbc::PopsicleList repeatedBytes_ = new pbc::PopsicleList(); + public scg::IList RepeatedBytesList { + get { return pbc::Lists.AsReadOnly(repeatedBytes_); } + } + public int RepeatedBytesCount { + get { return repeatedBytes_.Count; } + } + public pb::ByteString GetRepeatedBytes(int index) { + return repeatedBytes_[index]; + } + + public const int RepeatedGroupFieldNumber = 46; + private pbc::PopsicleList repeatedGroup_ = new pbc::PopsicleList(); + public scg::IList RepeatedGroupList { + get { return repeatedGroup_; } + } + public int RepeatedGroupCount { + get { return repeatedGroup_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup GetRepeatedGroup(int index) { + return repeatedGroup_[index]; + } + + public const int RepeatedNestedMessageFieldNumber = 48; + private pbc::PopsicleList repeatedNestedMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedNestedMessageList { + get { return repeatedNestedMessage_; } + } + public int RepeatedNestedMessageCount { + get { return repeatedNestedMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage GetRepeatedNestedMessage(int index) { + return repeatedNestedMessage_[index]; + } + + public const int RepeatedForeignMessageFieldNumber = 49; + private pbc::PopsicleList repeatedForeignMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedForeignMessageList { + get { return repeatedForeignMessage_; } + } + public int RepeatedForeignMessageCount { + get { return repeatedForeignMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedForeignMessage(int index) { + return repeatedForeignMessage_[index]; + } + + public const int RepeatedImportMessageFieldNumber = 50; + private pbc::PopsicleList repeatedImportMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedImportMessageList { + get { return repeatedImportMessage_; } + } + public int RepeatedImportMessageCount { + get { return repeatedImportMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage GetRepeatedImportMessage(int index) { + return repeatedImportMessage_[index]; + } + + public const int RepeatedNestedEnumFieldNumber = 51; + private pbc::PopsicleList repeatedNestedEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedNestedEnumList { + get { return pbc::Lists.AsReadOnly(repeatedNestedEnum_); } + } + public int RepeatedNestedEnumCount { + get { return repeatedNestedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum GetRepeatedNestedEnum(int index) { + return repeatedNestedEnum_[index]; + } + + public const int RepeatedForeignEnumFieldNumber = 52; + private pbc::PopsicleList repeatedForeignEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedForeignEnumList { + get { return pbc::Lists.AsReadOnly(repeatedForeignEnum_); } + } + public int RepeatedForeignEnumCount { + get { return repeatedForeignEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedForeignEnum(int index) { + return repeatedForeignEnum_[index]; + } + + public const int RepeatedImportEnumFieldNumber = 53; + private pbc::PopsicleList repeatedImportEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedImportEnumList { + get { return pbc::Lists.AsReadOnly(repeatedImportEnum_); } + } + public int RepeatedImportEnumCount { + get { return repeatedImportEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum GetRepeatedImportEnum(int index) { + return repeatedImportEnum_[index]; + } + + public const int RepeatedStringPieceFieldNumber = 54; + private pbc::PopsicleList repeatedStringPiece_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringPieceList { + get { return pbc::Lists.AsReadOnly(repeatedStringPiece_); } + } + public int RepeatedStringPieceCount { + get { return repeatedStringPiece_.Count; } + } + public string GetRepeatedStringPiece(int index) { + return repeatedStringPiece_[index]; + } + + public const int RepeatedCordFieldNumber = 55; + private pbc::PopsicleList repeatedCord_ = new pbc::PopsicleList(); + public scg::IList RepeatedCordList { + get { return pbc::Lists.AsReadOnly(repeatedCord_); } + } + public int RepeatedCordCount { + get { return repeatedCord_.Count; } + } + public string GetRepeatedCord(int index) { + return repeatedCord_[index]; + } + + public const int DefaultInt32FieldNumber = 61; + private bool hasDefaultInt32; + private int defaultInt32_ = 41; + public bool HasDefaultInt32 { + get { return hasDefaultInt32; } + } + public int DefaultInt32 { + get { return defaultInt32_; } + } + + public const int DefaultInt64FieldNumber = 62; + private bool hasDefaultInt64; + private long defaultInt64_ = 42L; + public bool HasDefaultInt64 { + get { return hasDefaultInt64; } + } + public long DefaultInt64 { + get { return defaultInt64_; } + } + + public const int DefaultUint32FieldNumber = 63; + private bool hasDefaultUint32; + private uint defaultUint32_ = 43; + public bool HasDefaultUint32 { + get { return hasDefaultUint32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultUint32 { + get { return defaultUint32_; } + } + + public const int DefaultUint64FieldNumber = 64; + private bool hasDefaultUint64; + private ulong defaultUint64_ = 44UL; + public bool HasDefaultUint64 { + get { return hasDefaultUint64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultUint64 { + get { return defaultUint64_; } + } + + public const int DefaultSint32FieldNumber = 65; + private bool hasDefaultSint32; + private int defaultSint32_ = -45; + public bool HasDefaultSint32 { + get { return hasDefaultSint32; } + } + public int DefaultSint32 { + get { return defaultSint32_; } + } + + public const int DefaultSint64FieldNumber = 66; + private bool hasDefaultSint64; + private long defaultSint64_ = 46; + public bool HasDefaultSint64 { + get { return hasDefaultSint64; } + } + public long DefaultSint64 { + get { return defaultSint64_; } + } + + public const int DefaultFixed32FieldNumber = 67; + private bool hasDefaultFixed32; + private uint defaultFixed32_ = 47; + public bool HasDefaultFixed32 { + get { return hasDefaultFixed32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultFixed32 { + get { return defaultFixed32_; } + } + + public const int DefaultFixed64FieldNumber = 68; + private bool hasDefaultFixed64; + private ulong defaultFixed64_ = 48; + public bool HasDefaultFixed64 { + get { return hasDefaultFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultFixed64 { + get { return defaultFixed64_; } + } + + public const int DefaultSfixed32FieldNumber = 69; + private bool hasDefaultSfixed32; + private int defaultSfixed32_ = 49; + public bool HasDefaultSfixed32 { + get { return hasDefaultSfixed32; } + } + public int DefaultSfixed32 { + get { return defaultSfixed32_; } + } + + public const int DefaultSfixed64FieldNumber = 70; + private bool hasDefaultSfixed64; + private long defaultSfixed64_ = -50; + public bool HasDefaultSfixed64 { + get { return hasDefaultSfixed64; } + } + public long DefaultSfixed64 { + get { return defaultSfixed64_; } + } + + public const int DefaultFloatFieldNumber = 71; + private bool hasDefaultFloat; + private float defaultFloat_ = 51.5F; + public bool HasDefaultFloat { + get { return hasDefaultFloat; } + } + public float DefaultFloat { + get { return defaultFloat_; } + } + + public const int DefaultDoubleFieldNumber = 72; + private bool hasDefaultDouble; + private double defaultDouble_ = 52000D; + public bool HasDefaultDouble { + get { return hasDefaultDouble; } + } + public double DefaultDouble { + get { return defaultDouble_; } + } + + public const int DefaultBoolFieldNumber = 73; + private bool hasDefaultBool; + private bool defaultBool_ = true; + public bool HasDefaultBool { + get { return hasDefaultBool; } + } + public bool DefaultBool { + get { return defaultBool_; } + } + + public const int DefaultStringFieldNumber = 74; + private bool hasDefaultString; + private string defaultString_ = "hello"; + public bool HasDefaultString { + get { return hasDefaultString; } + } + public string DefaultString { + get { return defaultString_; } + } + + public const int DefaultBytesFieldNumber = 75; + private bool hasDefaultBytes; + private pb::ByteString defaultBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor.Fields[62].DefaultValue; + public bool HasDefaultBytes { + get { return hasDefaultBytes; } + } + public pb::ByteString DefaultBytes { + get { return defaultBytes_; } + } + + public const int DefaultNestedEnumFieldNumber = 81; + private bool hasDefaultNestedEnum; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.BAR; + public bool HasDefaultNestedEnum { + get { return hasDefaultNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum DefaultNestedEnum { + get { return defaultNestedEnum_; } + } + + public const int DefaultForeignEnumFieldNumber = 82; + private bool hasDefaultForeignEnum; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_BAR; + public bool HasDefaultForeignEnum { + get { return hasDefaultForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum DefaultForeignEnum { + get { return defaultForeignEnum_; } + } + + public const int DefaultImportEnumFieldNumber = 83; + private bool hasDefaultImportEnum; + private global::Google.ProtocolBuffers.TestProtos.ImportEnum defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_BAR; + public bool HasDefaultImportEnum { + get { return hasDefaultImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum DefaultImportEnum { + get { return defaultImportEnum_; } + } + + public const int DefaultStringPieceFieldNumber = 84; + private bool hasDefaultStringPiece; + private string defaultStringPiece_ = "abc"; + public bool HasDefaultStringPiece { + get { return hasDefaultStringPiece; } + } + public string DefaultStringPiece { + get { return defaultStringPiece_; } + } + + public const int DefaultCordFieldNumber = 85; + private bool hasDefaultCord; + private string defaultCord_ = "123"; + public bool HasDefaultCord { + get { return hasDefaultCord; } + } + public string DefaultCord { + get { return defaultCord_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testAllTypesFieldNames; + if (hasOptionalInt32) { + output.WriteInt32(1, field_names[31], OptionalInt32); + } + if (hasOptionalInt64) { + output.WriteInt64(2, field_names[32], OptionalInt64); + } + if (hasOptionalUint32) { + output.WriteUInt32(3, field_names[41], OptionalUint32); + } + if (hasOptionalUint64) { + output.WriteUInt64(4, field_names[42], OptionalUint64); + } + if (hasOptionalSint32) { + output.WriteSInt32(5, field_names[37], OptionalSint32); + } + if (hasOptionalSint64) { + output.WriteSInt64(6, field_names[38], OptionalSint64); + } + if (hasOptionalFixed32) { + output.WriteFixed32(7, field_names[24], OptionalFixed32); + } + if (hasOptionalFixed64) { + output.WriteFixed64(8, field_names[25], OptionalFixed64); + } + if (hasOptionalSfixed32) { + output.WriteSFixed32(9, field_names[35], OptionalSfixed32); + } + if (hasOptionalSfixed64) { + output.WriteSFixed64(10, field_names[36], OptionalSfixed64); + } + if (hasOptionalFloat) { + output.WriteFloat(11, field_names[26], OptionalFloat); + } + if (hasOptionalDouble) { + output.WriteDouble(12, field_names[23], OptionalDouble); + } + if (hasOptionalBool) { + output.WriteBool(13, field_names[20], OptionalBool); + } + if (hasOptionalString) { + output.WriteString(14, field_names[39], OptionalString); + } + if (hasOptionalBytes) { + output.WriteBytes(15, field_names[21], OptionalBytes); + } + if (hasOptionalGroup) { + output.WriteGroup(16, field_names[43], OptionalGroup); + } + if (hasOptionalNestedMessage) { + output.WriteMessage(18, field_names[34], OptionalNestedMessage); + } + if (hasOptionalForeignMessage) { + output.WriteMessage(19, field_names[28], OptionalForeignMessage); + } + if (hasOptionalImportMessage) { + output.WriteMessage(20, field_names[30], OptionalImportMessage); + } + if (hasOptionalNestedEnum) { + output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum); + } + if (hasOptionalForeignEnum) { + output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum); + } + if (hasOptionalImportEnum) { + output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum); + } + if (hasOptionalStringPiece) { + output.WriteString(24, field_names[40], OptionalStringPiece); + } + if (hasOptionalCord) { + output.WriteString(25, field_names[22], OptionalCord); + } + if (repeatedInt32_.Count > 0) { + output.WriteInt32Array(31, field_names[55], repeatedInt32_); + } + if (repeatedInt64_.Count > 0) { + output.WriteInt64Array(32, field_names[56], repeatedInt64_); + } + if (repeatedUint32_.Count > 0) { + output.WriteUInt32Array(33, field_names[65], repeatedUint32_); + } + if (repeatedUint64_.Count > 0) { + output.WriteUInt64Array(34, field_names[66], repeatedUint64_); + } + if (repeatedSint32_.Count > 0) { + output.WriteSInt32Array(35, field_names[61], repeatedSint32_); + } + if (repeatedSint64_.Count > 0) { + output.WriteSInt64Array(36, field_names[62], repeatedSint64_); + } + if (repeatedFixed32_.Count > 0) { + output.WriteFixed32Array(37, field_names[48], repeatedFixed32_); + } + if (repeatedFixed64_.Count > 0) { + output.WriteFixed64Array(38, field_names[49], repeatedFixed64_); + } + if (repeatedSfixed32_.Count > 0) { + output.WriteSFixed32Array(39, field_names[59], repeatedSfixed32_); + } + if (repeatedSfixed64_.Count > 0) { + output.WriteSFixed64Array(40, field_names[60], repeatedSfixed64_); + } + if (repeatedFloat_.Count > 0) { + output.WriteFloatArray(41, field_names[50], repeatedFloat_); + } + if (repeatedDouble_.Count > 0) { + output.WriteDoubleArray(42, field_names[47], repeatedDouble_); + } + if (repeatedBool_.Count > 0) { + output.WriteBoolArray(43, field_names[44], repeatedBool_); + } + if (repeatedString_.Count > 0) { + output.WriteStringArray(44, field_names[63], repeatedString_); + } + if (repeatedBytes_.Count > 0) { + output.WriteBytesArray(45, field_names[45], repeatedBytes_); + } + if (repeatedGroup_.Count > 0) { + output.WriteGroupArray(46, field_names[67], repeatedGroup_); + } + if (repeatedNestedMessage_.Count > 0) { + output.WriteMessageArray(48, field_names[58], repeatedNestedMessage_); + } + if (repeatedForeignMessage_.Count > 0) { + output.WriteMessageArray(49, field_names[52], repeatedForeignMessage_); + } + if (repeatedImportMessage_.Count > 0) { + output.WriteMessageArray(50, field_names[54], repeatedImportMessage_); + } + if (repeatedNestedEnum_.Count > 0) { + output.WriteEnumArray(51, field_names[57], repeatedNestedEnum_); + } + if (repeatedForeignEnum_.Count > 0) { + output.WriteEnumArray(52, field_names[51], repeatedForeignEnum_); + } + if (repeatedImportEnum_.Count > 0) { + output.WriteEnumArray(53, field_names[53], repeatedImportEnum_); + } + if (repeatedStringPiece_.Count > 0) { + output.WriteStringArray(54, field_names[64], repeatedStringPiece_); + } + if (repeatedCord_.Count > 0) { + output.WriteStringArray(55, field_names[46], repeatedCord_); + } + if (hasDefaultInt32) { + output.WriteInt32(61, field_names[9], DefaultInt32); + } + if (hasDefaultInt64) { + output.WriteInt64(62, field_names[10], DefaultInt64); + } + if (hasDefaultUint32) { + output.WriteUInt32(63, field_names[18], DefaultUint32); + } + if (hasDefaultUint64) { + output.WriteUInt64(64, field_names[19], DefaultUint64); + } + if (hasDefaultSint32) { + output.WriteSInt32(65, field_names[14], DefaultSint32); + } + if (hasDefaultSint64) { + output.WriteSInt64(66, field_names[15], DefaultSint64); + } + if (hasDefaultFixed32) { + output.WriteFixed32(67, field_names[4], DefaultFixed32); + } + if (hasDefaultFixed64) { + output.WriteFixed64(68, field_names[5], DefaultFixed64); + } + if (hasDefaultSfixed32) { + output.WriteSFixed32(69, field_names[12], DefaultSfixed32); + } + if (hasDefaultSfixed64) { + output.WriteSFixed64(70, field_names[13], DefaultSfixed64); + } + if (hasDefaultFloat) { + output.WriteFloat(71, field_names[6], DefaultFloat); + } + if (hasDefaultDouble) { + output.WriteDouble(72, field_names[3], DefaultDouble); + } + if (hasDefaultBool) { + output.WriteBool(73, field_names[0], DefaultBool); + } + if (hasDefaultString) { + output.WriteString(74, field_names[16], DefaultString); + } + if (hasDefaultBytes) { + output.WriteBytes(75, field_names[1], DefaultBytes); + } + if (hasDefaultNestedEnum) { + output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum); + } + if (hasDefaultForeignEnum) { + output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum); + } + if (hasDefaultImportEnum) { + output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum); + } + if (hasDefaultStringPiece) { + output.WriteString(84, field_names[17], DefaultStringPiece); + } + if (hasDefaultCord) { + output.WriteString(85, field_names[2], DefaultCord); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(1, OptionalInt32); + } + if (hasOptionalInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(2, OptionalInt64); + } + if (hasOptionalUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(3, OptionalUint32); + } + if (hasOptionalUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(4, OptionalUint64); + } + if (hasOptionalSint32) { + size += pb::CodedOutputStream.ComputeSInt32Size(5, OptionalSint32); + } + if (hasOptionalSint64) { + size += pb::CodedOutputStream.ComputeSInt64Size(6, OptionalSint64); + } + if (hasOptionalFixed32) { + size += pb::CodedOutputStream.ComputeFixed32Size(7, OptionalFixed32); + } + if (hasOptionalFixed64) { + size += pb::CodedOutputStream.ComputeFixed64Size(8, OptionalFixed64); + } + if (hasOptionalSfixed32) { + size += pb::CodedOutputStream.ComputeSFixed32Size(9, OptionalSfixed32); + } + if (hasOptionalSfixed64) { + size += pb::CodedOutputStream.ComputeSFixed64Size(10, OptionalSfixed64); + } + if (hasOptionalFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(11, OptionalFloat); + } + if (hasOptionalDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(12, OptionalDouble); + } + if (hasOptionalBool) { + size += pb::CodedOutputStream.ComputeBoolSize(13, OptionalBool); + } + if (hasOptionalString) { + size += pb::CodedOutputStream.ComputeStringSize(14, OptionalString); + } + if (hasOptionalBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(15, OptionalBytes); + } + if (hasOptionalGroup) { + size += pb::CodedOutputStream.ComputeGroupSize(16, OptionalGroup); + } + if (hasOptionalNestedMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(18, OptionalNestedMessage); + } + if (hasOptionalForeignMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(19, OptionalForeignMessage); + } + if (hasOptionalImportMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(20, OptionalImportMessage); + } + if (hasOptionalNestedEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(21, (int) OptionalNestedEnum); + } + if (hasOptionalForeignEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(22, (int) OptionalForeignEnum); + } + if (hasOptionalImportEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(23, (int) OptionalImportEnum); + } + if (hasOptionalStringPiece) { + size += pb::CodedOutputStream.ComputeStringSize(24, OptionalStringPiece); + } + if (hasOptionalCord) { + size += pb::CodedOutputStream.ComputeStringSize(25, OptionalCord); + } + { + int dataSize = 0; + foreach (int element in RepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt32_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt64_.Count; + } + { + int dataSize = 0; + foreach (uint element in RepeatedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedUint32_.Count; + } + { + int dataSize = 0; + foreach (ulong element in RepeatedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedUint64_.Count; + } + { + int dataSize = 0; + foreach (int element in RepeatedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedSint32_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedSint64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFixed32_.Count; + size += dataSize; + size += 2 * repeatedFixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedFixed64_.Count; + size += dataSize; + size += 2 * repeatedFixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedSfixed32_.Count; + size += dataSize; + size += 2 * repeatedSfixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedSfixed64_.Count; + size += dataSize; + size += 2 * repeatedSfixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFloat_.Count; + size += dataSize; + size += 2 * repeatedFloat_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedDouble_.Count; + size += dataSize; + size += 2 * repeatedDouble_.Count; + } + { + int dataSize = 0; + dataSize = 1 * repeatedBool_.Count; + size += dataSize; + size += 2 * repeatedBool_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedStringList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedString_.Count; + } + { + int dataSize = 0; + foreach (pb::ByteString element in RepeatedBytesList) { + dataSize += pb::CodedOutputStream.ComputeBytesSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedBytes_.Count; + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup element in RepeatedGroupList) { + size += pb::CodedOutputStream.ComputeGroupSize(46, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage element in RepeatedNestedMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(48, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessage element in RepeatedForeignMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(49, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.ImportMessage element in RepeatedImportMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(50, element); + } + { + int dataSize = 0; + if (repeatedNestedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum element in repeatedNestedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedNestedEnum_.Count; + } + } + { + int dataSize = 0; + if (repeatedForeignEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in repeatedForeignEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedForeignEnum_.Count; + } + } + { + int dataSize = 0; + if (repeatedImportEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ImportEnum element in repeatedImportEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedImportEnum_.Count; + } + } + { + int dataSize = 0; + foreach (string element in RepeatedStringPieceList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedStringPiece_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedCordList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedCord_.Count; + } + if (hasDefaultInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(61, DefaultInt32); + } + if (hasDefaultInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(62, DefaultInt64); + } + if (hasDefaultUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(63, DefaultUint32); + } + if (hasDefaultUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(64, DefaultUint64); + } + if (hasDefaultSint32) { + size += pb::CodedOutputStream.ComputeSInt32Size(65, DefaultSint32); + } + if (hasDefaultSint64) { + size += pb::CodedOutputStream.ComputeSInt64Size(66, DefaultSint64); + } + if (hasDefaultFixed32) { + size += pb::CodedOutputStream.ComputeFixed32Size(67, DefaultFixed32); + } + if (hasDefaultFixed64) { + size += pb::CodedOutputStream.ComputeFixed64Size(68, DefaultFixed64); + } + if (hasDefaultSfixed32) { + size += pb::CodedOutputStream.ComputeSFixed32Size(69, DefaultSfixed32); + } + if (hasDefaultSfixed64) { + size += pb::CodedOutputStream.ComputeSFixed64Size(70, DefaultSfixed64); + } + if (hasDefaultFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(71, DefaultFloat); + } + if (hasDefaultDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(72, DefaultDouble); + } + if (hasDefaultBool) { + size += pb::CodedOutputStream.ComputeBoolSize(73, DefaultBool); + } + if (hasDefaultString) { + size += pb::CodedOutputStream.ComputeStringSize(74, DefaultString); + } + if (hasDefaultBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(75, DefaultBytes); + } + if (hasDefaultNestedEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(81, (int) DefaultNestedEnum); + } + if (hasDefaultForeignEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(82, (int) DefaultForeignEnum); + } + if (hasDefaultImportEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(83, (int) DefaultImportEnum); + } + if (hasDefaultStringPiece) { + size += pb::CodedOutputStream.ComputeStringSize(84, DefaultStringPiece); + } + if (hasDefaultCord) { + size += pb::CodedOutputStream.ComputeStringSize(85, DefaultCord); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestAllTypes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllTypes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllTypes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllTypes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllTypes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllTypes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestAllTypes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestAllTypes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestAllTypes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestAllTypes MakeReadOnly() { + repeatedInt32_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedUint32_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + repeatedSint32_.MakeReadOnly(); + repeatedSint64_.MakeReadOnly(); + repeatedFixed32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedSfixed32_.MakeReadOnly(); + repeatedSfixed64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedDouble_.MakeReadOnly(); + repeatedBool_.MakeReadOnly(); + repeatedString_.MakeReadOnly(); + repeatedBytes_.MakeReadOnly(); + repeatedGroup_.MakeReadOnly(); + repeatedNestedMessage_.MakeReadOnly(); + repeatedForeignMessage_.MakeReadOnly(); + repeatedImportMessage_.MakeReadOnly(); + repeatedNestedEnum_.MakeReadOnly(); + repeatedForeignEnum_.MakeReadOnly(); + repeatedImportEnum_.MakeReadOnly(); + repeatedStringPiece_.MakeReadOnly(); + repeatedCord_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestAllTypes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestAllTypes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestAllTypes result; + + private TestAllTypes PrepareBuilder() { + if (resultIsReadOnly) { + TestAllTypes original = result; + result = new TestAllTypes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestAllTypes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor; } + } + + public override TestAllTypes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance; } + } + + public override TestAllTypes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestAllTypes) { + return MergeFrom((TestAllTypes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestAllTypes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalInt32) { + OptionalInt32 = other.OptionalInt32; + } + if (other.HasOptionalInt64) { + OptionalInt64 = other.OptionalInt64; + } + if (other.HasOptionalUint32) { + OptionalUint32 = other.OptionalUint32; + } + if (other.HasOptionalUint64) { + OptionalUint64 = other.OptionalUint64; + } + if (other.HasOptionalSint32) { + OptionalSint32 = other.OptionalSint32; + } + if (other.HasOptionalSint64) { + OptionalSint64 = other.OptionalSint64; + } + if (other.HasOptionalFixed32) { + OptionalFixed32 = other.OptionalFixed32; + } + if (other.HasOptionalFixed64) { + OptionalFixed64 = other.OptionalFixed64; + } + if (other.HasOptionalSfixed32) { + OptionalSfixed32 = other.OptionalSfixed32; + } + if (other.HasOptionalSfixed64) { + OptionalSfixed64 = other.OptionalSfixed64; + } + if (other.HasOptionalFloat) { + OptionalFloat = other.OptionalFloat; + } + if (other.HasOptionalDouble) { + OptionalDouble = other.OptionalDouble; + } + if (other.HasOptionalBool) { + OptionalBool = other.OptionalBool; + } + if (other.HasOptionalString) { + OptionalString = other.OptionalString; + } + if (other.HasOptionalBytes) { + OptionalBytes = other.OptionalBytes; + } + if (other.HasOptionalGroup) { + MergeOptionalGroup(other.OptionalGroup); + } + if (other.HasOptionalNestedMessage) { + MergeOptionalNestedMessage(other.OptionalNestedMessage); + } + if (other.HasOptionalForeignMessage) { + MergeOptionalForeignMessage(other.OptionalForeignMessage); + } + if (other.HasOptionalImportMessage) { + MergeOptionalImportMessage(other.OptionalImportMessage); + } + if (other.HasOptionalNestedEnum) { + OptionalNestedEnum = other.OptionalNestedEnum; + } + if (other.HasOptionalForeignEnum) { + OptionalForeignEnum = other.OptionalForeignEnum; + } + if (other.HasOptionalImportEnum) { + OptionalImportEnum = other.OptionalImportEnum; + } + if (other.HasOptionalStringPiece) { + OptionalStringPiece = other.OptionalStringPiece; + } + if (other.HasOptionalCord) { + OptionalCord = other.OptionalCord; + } + if (other.repeatedInt32_.Count != 0) { + result.repeatedInt32_.Add(other.repeatedInt32_); + } + if (other.repeatedInt64_.Count != 0) { + result.repeatedInt64_.Add(other.repeatedInt64_); + } + if (other.repeatedUint32_.Count != 0) { + result.repeatedUint32_.Add(other.repeatedUint32_); + } + if (other.repeatedUint64_.Count != 0) { + result.repeatedUint64_.Add(other.repeatedUint64_); + } + if (other.repeatedSint32_.Count != 0) { + result.repeatedSint32_.Add(other.repeatedSint32_); + } + if (other.repeatedSint64_.Count != 0) { + result.repeatedSint64_.Add(other.repeatedSint64_); + } + if (other.repeatedFixed32_.Count != 0) { + result.repeatedFixed32_.Add(other.repeatedFixed32_); + } + if (other.repeatedFixed64_.Count != 0) { + result.repeatedFixed64_.Add(other.repeatedFixed64_); + } + if (other.repeatedSfixed32_.Count != 0) { + result.repeatedSfixed32_.Add(other.repeatedSfixed32_); + } + if (other.repeatedSfixed64_.Count != 0) { + result.repeatedSfixed64_.Add(other.repeatedSfixed64_); + } + if (other.repeatedFloat_.Count != 0) { + result.repeatedFloat_.Add(other.repeatedFloat_); + } + if (other.repeatedDouble_.Count != 0) { + result.repeatedDouble_.Add(other.repeatedDouble_); + } + if (other.repeatedBool_.Count != 0) { + result.repeatedBool_.Add(other.repeatedBool_); + } + if (other.repeatedString_.Count != 0) { + result.repeatedString_.Add(other.repeatedString_); + } + if (other.repeatedBytes_.Count != 0) { + result.repeatedBytes_.Add(other.repeatedBytes_); + } + if (other.repeatedGroup_.Count != 0) { + result.repeatedGroup_.Add(other.repeatedGroup_); + } + if (other.repeatedNestedMessage_.Count != 0) { + result.repeatedNestedMessage_.Add(other.repeatedNestedMessage_); + } + if (other.repeatedForeignMessage_.Count != 0) { + result.repeatedForeignMessage_.Add(other.repeatedForeignMessage_); + } + if (other.repeatedImportMessage_.Count != 0) { + result.repeatedImportMessage_.Add(other.repeatedImportMessage_); + } + if (other.repeatedNestedEnum_.Count != 0) { + result.repeatedNestedEnum_.Add(other.repeatedNestedEnum_); + } + if (other.repeatedForeignEnum_.Count != 0) { + result.repeatedForeignEnum_.Add(other.repeatedForeignEnum_); + } + if (other.repeatedImportEnum_.Count != 0) { + result.repeatedImportEnum_.Add(other.repeatedImportEnum_); + } + if (other.repeatedStringPiece_.Count != 0) { + result.repeatedStringPiece_.Add(other.repeatedStringPiece_); + } + if (other.repeatedCord_.Count != 0) { + result.repeatedCord_.Add(other.repeatedCord_); + } + if (other.HasDefaultInt32) { + DefaultInt32 = other.DefaultInt32; + } + if (other.HasDefaultInt64) { + DefaultInt64 = other.DefaultInt64; + } + if (other.HasDefaultUint32) { + DefaultUint32 = other.DefaultUint32; + } + if (other.HasDefaultUint64) { + DefaultUint64 = other.DefaultUint64; + } + if (other.HasDefaultSint32) { + DefaultSint32 = other.DefaultSint32; + } + if (other.HasDefaultSint64) { + DefaultSint64 = other.DefaultSint64; + } + if (other.HasDefaultFixed32) { + DefaultFixed32 = other.DefaultFixed32; + } + if (other.HasDefaultFixed64) { + DefaultFixed64 = other.DefaultFixed64; + } + if (other.HasDefaultSfixed32) { + DefaultSfixed32 = other.DefaultSfixed32; + } + if (other.HasDefaultSfixed64) { + DefaultSfixed64 = other.DefaultSfixed64; + } + if (other.HasDefaultFloat) { + DefaultFloat = other.DefaultFloat; + } + if (other.HasDefaultDouble) { + DefaultDouble = other.DefaultDouble; + } + if (other.HasDefaultBool) { + DefaultBool = other.DefaultBool; + } + if (other.HasDefaultString) { + DefaultString = other.DefaultString; + } + if (other.HasDefaultBytes) { + DefaultBytes = other.DefaultBytes; + } + if (other.HasDefaultNestedEnum) { + DefaultNestedEnum = other.DefaultNestedEnum; + } + if (other.HasDefaultForeignEnum) { + DefaultForeignEnum = other.DefaultForeignEnum; + } + if (other.HasDefaultImportEnum) { + DefaultImportEnum = other.DefaultImportEnum; + } + if (other.HasDefaultStringPiece) { + DefaultStringPiece = other.DefaultStringPiece; + } + if (other.HasDefaultCord) { + DefaultCord = other.DefaultCord; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testAllTypesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testAllTypesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasOptionalInt32 = input.ReadInt32(ref result.optionalInt32_); + break; + } + case 16: { + result.hasOptionalInt64 = input.ReadInt64(ref result.optionalInt64_); + break; + } + case 24: { + result.hasOptionalUint32 = input.ReadUInt32(ref result.optionalUint32_); + break; + } + case 32: { + result.hasOptionalUint64 = input.ReadUInt64(ref result.optionalUint64_); + break; + } + case 40: { + result.hasOptionalSint32 = input.ReadSInt32(ref result.optionalSint32_); + break; + } + case 48: { + result.hasOptionalSint64 = input.ReadSInt64(ref result.optionalSint64_); + break; + } + case 61: { + result.hasOptionalFixed32 = input.ReadFixed32(ref result.optionalFixed32_); + break; + } + case 65: { + result.hasOptionalFixed64 = input.ReadFixed64(ref result.optionalFixed64_); + break; + } + case 77: { + result.hasOptionalSfixed32 = input.ReadSFixed32(ref result.optionalSfixed32_); + break; + } + case 81: { + result.hasOptionalSfixed64 = input.ReadSFixed64(ref result.optionalSfixed64_); + break; + } + case 93: { + result.hasOptionalFloat = input.ReadFloat(ref result.optionalFloat_); + break; + } + case 97: { + result.hasOptionalDouble = input.ReadDouble(ref result.optionalDouble_); + break; + } + case 104: { + result.hasOptionalBool = input.ReadBool(ref result.optionalBool_); + break; + } + case 114: { + result.hasOptionalString = input.ReadString(ref result.optionalString_); + break; + } + case 122: { + result.hasOptionalBytes = input.ReadBytes(ref result.optionalBytes_); + break; + } + case 131: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.CreateBuilder(); + if (result.hasOptionalGroup) { + subBuilder.MergeFrom(OptionalGroup); + } + input.ReadGroup(16, subBuilder, extensionRegistry); + OptionalGroup = subBuilder.BuildPartial(); + break; + } + case 146: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(); + if (result.hasOptionalNestedMessage) { + subBuilder.MergeFrom(OptionalNestedMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalNestedMessage = subBuilder.BuildPartial(); + break; + } + case 154: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(); + if (result.hasOptionalForeignMessage) { + subBuilder.MergeFrom(OptionalForeignMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalForeignMessage = subBuilder.BuildPartial(); + break; + } + case 162: { + global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder(); + if (result.hasOptionalImportMessage) { + subBuilder.MergeFrom(OptionalImportMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalImportMessage = subBuilder.BuildPartial(); + break; + } + case 168: { + object unknown; + if(input.ReadEnum(ref result.optionalNestedEnum_, out unknown)) { + result.hasOptionalNestedEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(21, (ulong)(int)unknown); + } + break; + } + case 176: { + object unknown; + if(input.ReadEnum(ref result.optionalForeignEnum_, out unknown)) { + result.hasOptionalForeignEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(22, (ulong)(int)unknown); + } + break; + } + case 184: { + object unknown; + if(input.ReadEnum(ref result.optionalImportEnum_, out unknown)) { + result.hasOptionalImportEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(23, (ulong)(int)unknown); + } + break; + } + case 194: { + result.hasOptionalStringPiece = input.ReadString(ref result.optionalStringPiece_); + break; + } + case 202: { + result.hasOptionalCord = input.ReadString(ref result.optionalCord_); + break; + } + case 250: + case 248: { + input.ReadInt32Array(tag, field_name, result.repeatedInt32_); + break; + } + case 258: + case 256: { + input.ReadInt64Array(tag, field_name, result.repeatedInt64_); + break; + } + case 266: + case 264: { + input.ReadUInt32Array(tag, field_name, result.repeatedUint32_); + break; + } + case 274: + case 272: { + input.ReadUInt64Array(tag, field_name, result.repeatedUint64_); + break; + } + case 282: + case 280: { + input.ReadSInt32Array(tag, field_name, result.repeatedSint32_); + break; + } + case 290: + case 288: { + input.ReadSInt64Array(tag, field_name, result.repeatedSint64_); + break; + } + case 298: + case 301: { + input.ReadFixed32Array(tag, field_name, result.repeatedFixed32_); + break; + } + case 306: + case 305: { + input.ReadFixed64Array(tag, field_name, result.repeatedFixed64_); + break; + } + case 314: + case 317: { + input.ReadSFixed32Array(tag, field_name, result.repeatedSfixed32_); + break; + } + case 322: + case 321: { + input.ReadSFixed64Array(tag, field_name, result.repeatedSfixed64_); + break; + } + case 330: + case 333: { + input.ReadFloatArray(tag, field_name, result.repeatedFloat_); + break; + } + case 338: + case 337: { + input.ReadDoubleArray(tag, field_name, result.repeatedDouble_); + break; + } + case 346: + case 344: { + input.ReadBoolArray(tag, field_name, result.repeatedBool_); + break; + } + case 354: { + input.ReadStringArray(tag, field_name, result.repeatedString_); + break; + } + case 362: { + input.ReadBytesArray(tag, field_name, result.repeatedBytes_); + break; + } + case 371: { + input.ReadGroupArray(tag, field_name, result.repeatedGroup_, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance, extensionRegistry); + break; + } + case 386: { + input.ReadMessageArray(tag, field_name, result.repeatedNestedMessage_, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance, extensionRegistry); + break; + } + case 394: { + input.ReadMessageArray(tag, field_name, result.repeatedForeignMessage_, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance, extensionRegistry); + break; + } + case 402: { + input.ReadMessageArray(tag, field_name, result.repeatedImportMessage_, global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance, extensionRegistry); + break; + } + case 410: + case 408: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedNestedEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(51, (ulong)(int)rawValue); + } + break; + } + case 418: + case 416: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedForeignEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(52, (ulong)(int)rawValue); + } + break; + } + case 426: + case 424: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedImportEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(53, (ulong)(int)rawValue); + } + break; + } + case 434: { + input.ReadStringArray(tag, field_name, result.repeatedStringPiece_); + break; + } + case 442: { + input.ReadStringArray(tag, field_name, result.repeatedCord_); + break; + } + case 488: { + result.hasDefaultInt32 = input.ReadInt32(ref result.defaultInt32_); + break; + } + case 496: { + result.hasDefaultInt64 = input.ReadInt64(ref result.defaultInt64_); + break; + } + case 504: { + result.hasDefaultUint32 = input.ReadUInt32(ref result.defaultUint32_); + break; + } + case 512: { + result.hasDefaultUint64 = input.ReadUInt64(ref result.defaultUint64_); + break; + } + case 520: { + result.hasDefaultSint32 = input.ReadSInt32(ref result.defaultSint32_); + break; + } + case 528: { + result.hasDefaultSint64 = input.ReadSInt64(ref result.defaultSint64_); + break; + } + case 541: { + result.hasDefaultFixed32 = input.ReadFixed32(ref result.defaultFixed32_); + break; + } + case 545: { + result.hasDefaultFixed64 = input.ReadFixed64(ref result.defaultFixed64_); + break; + } + case 557: { + result.hasDefaultSfixed32 = input.ReadSFixed32(ref result.defaultSfixed32_); + break; + } + case 561: { + result.hasDefaultSfixed64 = input.ReadSFixed64(ref result.defaultSfixed64_); + break; + } + case 573: { + result.hasDefaultFloat = input.ReadFloat(ref result.defaultFloat_); + break; + } + case 577: { + result.hasDefaultDouble = input.ReadDouble(ref result.defaultDouble_); + break; + } + case 584: { + result.hasDefaultBool = input.ReadBool(ref result.defaultBool_); + break; + } + case 594: { + result.hasDefaultString = input.ReadString(ref result.defaultString_); + break; + } + case 602: { + result.hasDefaultBytes = input.ReadBytes(ref result.defaultBytes_); + break; + } + case 648: { + object unknown; + if(input.ReadEnum(ref result.defaultNestedEnum_, out unknown)) { + result.hasDefaultNestedEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(81, (ulong)(int)unknown); + } + break; + } + case 656: { + object unknown; + if(input.ReadEnum(ref result.defaultForeignEnum_, out unknown)) { + result.hasDefaultForeignEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(82, (ulong)(int)unknown); + } + break; + } + case 664: { + object unknown; + if(input.ReadEnum(ref result.defaultImportEnum_, out unknown)) { + result.hasDefaultImportEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(83, (ulong)(int)unknown); + } + break; + } + case 674: { + result.hasDefaultStringPiece = input.ReadString(ref result.defaultStringPiece_); + break; + } + case 682: { + result.hasDefaultCord = input.ReadString(ref result.defaultCord_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalInt32 { + get { return result.hasOptionalInt32; } + } + public int OptionalInt32 { + get { return result.OptionalInt32; } + set { SetOptionalInt32(value); } + } + public Builder SetOptionalInt32(int value) { + PrepareBuilder(); + result.hasOptionalInt32 = true; + result.optionalInt32_ = value; + return this; + } + public Builder ClearOptionalInt32() { + PrepareBuilder(); + result.hasOptionalInt32 = false; + result.optionalInt32_ = 0; + return this; + } + + public bool HasOptionalInt64 { + get { return result.hasOptionalInt64; } + } + public long OptionalInt64 { + get { return result.OptionalInt64; } + set { SetOptionalInt64(value); } + } + public Builder SetOptionalInt64(long value) { + PrepareBuilder(); + result.hasOptionalInt64 = true; + result.optionalInt64_ = value; + return this; + } + public Builder ClearOptionalInt64() { + PrepareBuilder(); + result.hasOptionalInt64 = false; + result.optionalInt64_ = 0L; + return this; + } + + public bool HasOptionalUint32 { + get { return result.hasOptionalUint32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalUint32 { + get { return result.OptionalUint32; } + set { SetOptionalUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalUint32(uint value) { + PrepareBuilder(); + result.hasOptionalUint32 = true; + result.optionalUint32_ = value; + return this; + } + public Builder ClearOptionalUint32() { + PrepareBuilder(); + result.hasOptionalUint32 = false; + result.optionalUint32_ = 0; + return this; + } + + public bool HasOptionalUint64 { + get { return result.hasOptionalUint64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalUint64 { + get { return result.OptionalUint64; } + set { SetOptionalUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalUint64(ulong value) { + PrepareBuilder(); + result.hasOptionalUint64 = true; + result.optionalUint64_ = value; + return this; + } + public Builder ClearOptionalUint64() { + PrepareBuilder(); + result.hasOptionalUint64 = false; + result.optionalUint64_ = 0UL; + return this; + } + + public bool HasOptionalSint32 { + get { return result.hasOptionalSint32; } + } + public int OptionalSint32 { + get { return result.OptionalSint32; } + set { SetOptionalSint32(value); } + } + public Builder SetOptionalSint32(int value) { + PrepareBuilder(); + result.hasOptionalSint32 = true; + result.optionalSint32_ = value; + return this; + } + public Builder ClearOptionalSint32() { + PrepareBuilder(); + result.hasOptionalSint32 = false; + result.optionalSint32_ = 0; + return this; + } + + public bool HasOptionalSint64 { + get { return result.hasOptionalSint64; } + } + public long OptionalSint64 { + get { return result.OptionalSint64; } + set { SetOptionalSint64(value); } + } + public Builder SetOptionalSint64(long value) { + PrepareBuilder(); + result.hasOptionalSint64 = true; + result.optionalSint64_ = value; + return this; + } + public Builder ClearOptionalSint64() { + PrepareBuilder(); + result.hasOptionalSint64 = false; + result.optionalSint64_ = 0; + return this; + } + + public bool HasOptionalFixed32 { + get { return result.hasOptionalFixed32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalFixed32 { + get { return result.OptionalFixed32; } + set { SetOptionalFixed32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalFixed32(uint value) { + PrepareBuilder(); + result.hasOptionalFixed32 = true; + result.optionalFixed32_ = value; + return this; + } + public Builder ClearOptionalFixed32() { + PrepareBuilder(); + result.hasOptionalFixed32 = false; + result.optionalFixed32_ = 0; + return this; + } + + public bool HasOptionalFixed64 { + get { return result.hasOptionalFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalFixed64 { + get { return result.OptionalFixed64; } + set { SetOptionalFixed64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalFixed64(ulong value) { + PrepareBuilder(); + result.hasOptionalFixed64 = true; + result.optionalFixed64_ = value; + return this; + } + public Builder ClearOptionalFixed64() { + PrepareBuilder(); + result.hasOptionalFixed64 = false; + result.optionalFixed64_ = 0; + return this; + } + + public bool HasOptionalSfixed32 { + get { return result.hasOptionalSfixed32; } + } + public int OptionalSfixed32 { + get { return result.OptionalSfixed32; } + set { SetOptionalSfixed32(value); } + } + public Builder SetOptionalSfixed32(int value) { + PrepareBuilder(); + result.hasOptionalSfixed32 = true; + result.optionalSfixed32_ = value; + return this; + } + public Builder ClearOptionalSfixed32() { + PrepareBuilder(); + result.hasOptionalSfixed32 = false; + result.optionalSfixed32_ = 0; + return this; + } + + public bool HasOptionalSfixed64 { + get { return result.hasOptionalSfixed64; } + } + public long OptionalSfixed64 { + get { return result.OptionalSfixed64; } + set { SetOptionalSfixed64(value); } + } + public Builder SetOptionalSfixed64(long value) { + PrepareBuilder(); + result.hasOptionalSfixed64 = true; + result.optionalSfixed64_ = value; + return this; + } + public Builder ClearOptionalSfixed64() { + PrepareBuilder(); + result.hasOptionalSfixed64 = false; + result.optionalSfixed64_ = 0; + return this; + } + + public bool HasOptionalFloat { + get { return result.hasOptionalFloat; } + } + public float OptionalFloat { + get { return result.OptionalFloat; } + set { SetOptionalFloat(value); } + } + public Builder SetOptionalFloat(float value) { + PrepareBuilder(); + result.hasOptionalFloat = true; + result.optionalFloat_ = value; + return this; + } + public Builder ClearOptionalFloat() { + PrepareBuilder(); + result.hasOptionalFloat = false; + result.optionalFloat_ = 0F; + return this; + } + + public bool HasOptionalDouble { + get { return result.hasOptionalDouble; } + } + public double OptionalDouble { + get { return result.OptionalDouble; } + set { SetOptionalDouble(value); } + } + public Builder SetOptionalDouble(double value) { + PrepareBuilder(); + result.hasOptionalDouble = true; + result.optionalDouble_ = value; + return this; + } + public Builder ClearOptionalDouble() { + PrepareBuilder(); + result.hasOptionalDouble = false; + result.optionalDouble_ = 0D; + return this; + } + + public bool HasOptionalBool { + get { return result.hasOptionalBool; } + } + public bool OptionalBool { + get { return result.OptionalBool; } + set { SetOptionalBool(value); } + } + public Builder SetOptionalBool(bool value) { + PrepareBuilder(); + result.hasOptionalBool = true; + result.optionalBool_ = value; + return this; + } + public Builder ClearOptionalBool() { + PrepareBuilder(); + result.hasOptionalBool = false; + result.optionalBool_ = false; + return this; + } + + public bool HasOptionalString { + get { return result.hasOptionalString; } + } + public string OptionalString { + get { return result.OptionalString; } + set { SetOptionalString(value); } + } + public Builder SetOptionalString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalString = true; + result.optionalString_ = value; + return this; + } + public Builder ClearOptionalString() { + PrepareBuilder(); + result.hasOptionalString = false; + result.optionalString_ = ""; + return this; + } + + public bool HasOptionalBytes { + get { return result.hasOptionalBytes; } + } + public pb::ByteString OptionalBytes { + get { return result.OptionalBytes; } + set { SetOptionalBytes(value); } + } + public Builder SetOptionalBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalBytes = true; + result.optionalBytes_ = value; + return this; + } + public Builder ClearOptionalBytes() { + PrepareBuilder(); + result.hasOptionalBytes = false; + result.optionalBytes_ = pb::ByteString.Empty; + return this; + } + + public bool HasOptionalGroup { + get { return result.hasOptionalGroup; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup OptionalGroup { + get { return result.OptionalGroup; } + set { SetOptionalGroup(value); } + } + public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalGroup = true; + result.optionalGroup_ = value; + return this; + } + public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalGroup = true; + result.optionalGroup_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalGroup && + result.optionalGroup_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) { + result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.CreateBuilder(result.optionalGroup_).MergeFrom(value).BuildPartial(); + } else { + result.optionalGroup_ = value; + } + result.hasOptionalGroup = true; + return this; + } + public Builder ClearOptionalGroup() { + PrepareBuilder(); + result.hasOptionalGroup = false; + result.optionalGroup_ = null; + return this; + } + + public bool HasOptionalNestedMessage { + get { return result.hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage OptionalNestedMessage { + get { return result.OptionalNestedMessage; } + set { SetOptionalNestedMessage(value); } + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = value; + return this; + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalNestedMessage && + result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { + result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalNestedMessage_ = value; + } + result.hasOptionalNestedMessage = true; + return this; + } + public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); + result.hasOptionalNestedMessage = false; + result.optionalNestedMessage_ = null; + return this; + } + + public bool HasOptionalForeignMessage { + get { return result.hasOptionalForeignMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage OptionalForeignMessage { + get { return result.OptionalForeignMessage; } + set { SetOptionalForeignMessage(value); } + } + public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalForeignMessage = true; + result.optionalForeignMessage_ = value; + return this; + } + public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalForeignMessage = true; + result.optionalForeignMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalForeignMessage && + result.optionalForeignMessage_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.optionalForeignMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalForeignMessage_ = value; + } + result.hasOptionalForeignMessage = true; + return this; + } + public Builder ClearOptionalForeignMessage() { + PrepareBuilder(); + result.hasOptionalForeignMessage = false; + result.optionalForeignMessage_ = null; + return this; + } + + public bool HasOptionalImportMessage { + get { return result.hasOptionalImportMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage OptionalImportMessage { + get { return result.OptionalImportMessage; } + set { SetOptionalImportMessage(value); } + } + public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalImportMessage = true; + result.optionalImportMessage_ = value; + return this; + } + public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalImportMessage = true; + result.optionalImportMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalImportMessage && + result.optionalImportMessage_ != global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) { + result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder(result.optionalImportMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalImportMessage_ = value; + } + result.hasOptionalImportMessage = true; + return this; + } + public Builder ClearOptionalImportMessage() { + PrepareBuilder(); + result.hasOptionalImportMessage = false; + result.optionalImportMessage_ = null; + return this; + } + + public bool HasOptionalNestedEnum { + get { return result.hasOptionalNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum OptionalNestedEnum { + get { return result.OptionalNestedEnum; } + set { SetOptionalNestedEnum(value); } + } + public Builder SetOptionalNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.hasOptionalNestedEnum = true; + result.optionalNestedEnum_ = value; + return this; + } + public Builder ClearOptionalNestedEnum() { + PrepareBuilder(); + result.hasOptionalNestedEnum = false; + result.optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.FOO; + return this; + } + + public bool HasOptionalForeignEnum { + get { return result.hasOptionalForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum OptionalForeignEnum { + get { return result.OptionalForeignEnum; } + set { SetOptionalForeignEnum(value); } + } + public Builder SetOptionalForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasOptionalForeignEnum = true; + result.optionalForeignEnum_ = value; + return this; + } + public Builder ClearOptionalForeignEnum() { + PrepareBuilder(); + result.hasOptionalForeignEnum = false; + result.optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + return this; + } + + public bool HasOptionalImportEnum { + get { return result.hasOptionalImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum OptionalImportEnum { + get { return result.OptionalImportEnum; } + set { SetOptionalImportEnum(value); } + } + public Builder SetOptionalImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.hasOptionalImportEnum = true; + result.optionalImportEnum_ = value; + return this; + } + public Builder ClearOptionalImportEnum() { + PrepareBuilder(); + result.hasOptionalImportEnum = false; + result.optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_FOO; + return this; + } + + public bool HasOptionalStringPiece { + get { return result.hasOptionalStringPiece; } + } + public string OptionalStringPiece { + get { return result.OptionalStringPiece; } + set { SetOptionalStringPiece(value); } + } + public Builder SetOptionalStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalStringPiece = true; + result.optionalStringPiece_ = value; + return this; + } + public Builder ClearOptionalStringPiece() { + PrepareBuilder(); + result.hasOptionalStringPiece = false; + result.optionalStringPiece_ = ""; + return this; + } + + public bool HasOptionalCord { + get { return result.hasOptionalCord; } + } + public string OptionalCord { + get { return result.OptionalCord; } + set { SetOptionalCord(value); } + } + public Builder SetOptionalCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalCord = true; + result.optionalCord_ = value; + return this; + } + public Builder ClearOptionalCord() { + PrepareBuilder(); + result.hasOptionalCord = false; + result.optionalCord_ = ""; + return this; + } + + public pbc::IPopsicleList RepeatedInt32List { + get { return PrepareBuilder().repeatedInt32_; } + } + public int RepeatedInt32Count { + get { return result.RepeatedInt32Count; } + } + public int GetRepeatedInt32(int index) { + return result.GetRepeatedInt32(index); + } + public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.repeatedInt32_[index] = value; + return this; + } + public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); + result.repeatedInt32_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt32_.Add(values); + return this; + } + public Builder ClearRepeatedInt32() { + PrepareBuilder(); + result.repeatedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt64List { + get { return PrepareBuilder().repeatedInt64_; } + } + public int RepeatedInt64Count { + get { return result.RepeatedInt64Count; } + } + public long GetRepeatedInt64(int index) { + return result.GetRepeatedInt64(index); + } + public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); + result.repeatedInt64_[index] = value; + return this; + } + public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); + result.repeatedInt64_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt64_.Add(values); + return this; + } + public Builder ClearRepeatedInt64() { + PrepareBuilder(); + result.repeatedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint32List { + get { return PrepareBuilder().repeatedUint32_; } + } + public int RepeatedUint32Count { + get { return result.RepeatedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedUint32(int index) { + return result.GetRepeatedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint32(int index, uint value) { + PrepareBuilder(); + result.repeatedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint32(uint value) { + PrepareBuilder(); + result.repeatedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint32_.Add(values); + return this; + } + public Builder ClearRepeatedUint32() { + PrepareBuilder(); + result.repeatedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint64List { + get { return PrepareBuilder().repeatedUint64_; } + } + public int RepeatedUint64Count { + get { return result.RepeatedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return result.GetRepeatedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); + result.repeatedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); + result.repeatedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint64_.Add(values); + return this; + } + public Builder ClearRepeatedUint64() { + PrepareBuilder(); + result.repeatedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSint32List { + get { return PrepareBuilder().repeatedSint32_; } + } + public int RepeatedSint32Count { + get { return result.RepeatedSint32Count; } + } + public int GetRepeatedSint32(int index) { + return result.GetRepeatedSint32(index); + } + public Builder SetRepeatedSint32(int index, int value) { + PrepareBuilder(); + result.repeatedSint32_[index] = value; + return this; + } + public Builder AddRepeatedSint32(int value) { + PrepareBuilder(); + result.repeatedSint32_.Add(value); + return this; + } + public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSint32_.Add(values); + return this; + } + public Builder ClearRepeatedSint32() { + PrepareBuilder(); + result.repeatedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSint64List { + get { return PrepareBuilder().repeatedSint64_; } + } + public int RepeatedSint64Count { + get { return result.RepeatedSint64Count; } + } + public long GetRepeatedSint64(int index) { + return result.GetRepeatedSint64(index); + } + public Builder SetRepeatedSint64(int index, long value) { + PrepareBuilder(); + result.repeatedSint64_[index] = value; + return this; + } + public Builder AddRepeatedSint64(long value) { + PrepareBuilder(); + result.repeatedSint64_.Add(value); + return this; + } + public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSint64_.Add(values); + return this; + } + public Builder ClearRepeatedSint64() { + PrepareBuilder(); + result.repeatedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed32List { + get { return PrepareBuilder().repeatedFixed32_; } + } + public int RepeatedFixed32Count { + get { return result.RepeatedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return result.GetRepeatedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); + result.repeatedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); + result.repeatedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed32_.Add(values); + return this; + } + public Builder ClearRepeatedFixed32() { + PrepareBuilder(); + result.repeatedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed64List { + get { return PrepareBuilder().repeatedFixed64_; } + } + public int RepeatedFixed64Count { + get { return result.RepeatedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return result.GetRepeatedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); + result.repeatedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); + result.repeatedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed64_.Add(values); + return this; + } + public Builder ClearRepeatedFixed64() { + PrepareBuilder(); + result.repeatedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSfixed32List { + get { return PrepareBuilder().repeatedSfixed32_; } + } + public int RepeatedSfixed32Count { + get { return result.RepeatedSfixed32Count; } + } + public int GetRepeatedSfixed32(int index) { + return result.GetRepeatedSfixed32(index); + } + public Builder SetRepeatedSfixed32(int index, int value) { + PrepareBuilder(); + result.repeatedSfixed32_[index] = value; + return this; + } + public Builder AddRepeatedSfixed32(int value) { + PrepareBuilder(); + result.repeatedSfixed32_.Add(value); + return this; + } + public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSfixed32_.Add(values); + return this; + } + public Builder ClearRepeatedSfixed32() { + PrepareBuilder(); + result.repeatedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSfixed64List { + get { return PrepareBuilder().repeatedSfixed64_; } + } + public int RepeatedSfixed64Count { + get { return result.RepeatedSfixed64Count; } + } + public long GetRepeatedSfixed64(int index) { + return result.GetRepeatedSfixed64(index); + } + public Builder SetRepeatedSfixed64(int index, long value) { + PrepareBuilder(); + result.repeatedSfixed64_[index] = value; + return this; + } + public Builder AddRepeatedSfixed64(long value) { + PrepareBuilder(); + result.repeatedSfixed64_.Add(value); + return this; + } + public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSfixed64_.Add(values); + return this; + } + public Builder ClearRepeatedSfixed64() { + PrepareBuilder(); + result.repeatedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedFloatList { + get { return PrepareBuilder().repeatedFloat_; } + } + public int RepeatedFloatCount { + get { return result.RepeatedFloatCount; } + } + public float GetRepeatedFloat(int index) { + return result.GetRepeatedFloat(index); + } + public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); + result.repeatedFloat_[index] = value; + return this; + } + public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); + result.repeatedFloat_.Add(value); + return this; + } + public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFloat_.Add(values); + return this; + } + public Builder ClearRepeatedFloat() { + PrepareBuilder(); + result.repeatedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedDoubleList { + get { return PrepareBuilder().repeatedDouble_; } + } + public int RepeatedDoubleCount { + get { return result.RepeatedDoubleCount; } + } + public double GetRepeatedDouble(int index) { + return result.GetRepeatedDouble(index); + } + public Builder SetRepeatedDouble(int index, double value) { + PrepareBuilder(); + result.repeatedDouble_[index] = value; + return this; + } + public Builder AddRepeatedDouble(double value) { + PrepareBuilder(); + result.repeatedDouble_.Add(value); + return this; + } + public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedDouble_.Add(values); + return this; + } + public Builder ClearRepeatedDouble() { + PrepareBuilder(); + result.repeatedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedBoolList { + get { return PrepareBuilder().repeatedBool_; } + } + public int RepeatedBoolCount { + get { return result.RepeatedBoolCount; } + } + public bool GetRepeatedBool(int index) { + return result.GetRepeatedBool(index); + } + public Builder SetRepeatedBool(int index, bool value) { + PrepareBuilder(); + result.repeatedBool_[index] = value; + return this; + } + public Builder AddRepeatedBool(bool value) { + PrepareBuilder(); + result.repeatedBool_.Add(value); + return this; + } + public Builder AddRangeRepeatedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedBool_.Add(values); + return this; + } + public Builder ClearRepeatedBool() { + PrepareBuilder(); + result.repeatedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringList { + get { return PrepareBuilder().repeatedString_; } + } + public int RepeatedStringCount { + get { return result.RepeatedStringCount; } + } + public string GetRepeatedString(int index) { + return result.GetRepeatedString(index); + } + public Builder SetRepeatedString(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedString_[index] = value; + return this; + } + public Builder AddRepeatedString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedString_.Add(value); + return this; + } + public Builder AddRangeRepeatedString(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedString_.Add(values); + return this; + } + public Builder ClearRepeatedString() { + PrepareBuilder(); + result.repeatedString_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedBytesList { + get { return PrepareBuilder().repeatedBytes_; } + } + public int RepeatedBytesCount { + get { return result.RepeatedBytesCount; } + } + public pb::ByteString GetRepeatedBytes(int index) { + return result.GetRepeatedBytes(index); + } + public Builder SetRepeatedBytes(int index, pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedBytes_[index] = value; + return this; + } + public Builder AddRepeatedBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedBytes_.Add(value); + return this; + } + public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedBytes_.Add(values); + return this; + } + public Builder ClearRepeatedBytes() { + PrepareBuilder(); + result.repeatedBytes_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedGroupList { + get { return PrepareBuilder().repeatedGroup_; } + } + public int RepeatedGroupCount { + get { return result.RepeatedGroupCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup GetRepeatedGroup(int index) { + return result.GetRepeatedGroup(index); + } + public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedGroup_[index] = value; + return this; + } + public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedGroup_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedGroup_.Add(value); + return this; + } + public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedGroup_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedGroup_.Add(values); + return this; + } + public Builder ClearRepeatedGroup() { + PrepareBuilder(); + result.repeatedGroup_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedNestedMessageList { + get { return PrepareBuilder().repeatedNestedMessage_; } + } + public int RepeatedNestedMessageCount { + get { return result.RepeatedNestedMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage GetRepeatedNestedMessage(int index) { + return result.GetRepeatedNestedMessage(index); + } + public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedNestedMessage_[index] = value; + return this; + } + public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedNestedMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedNestedMessage_.Add(value); + return this; + } + public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedNestedMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedNestedMessage_.Add(values); + return this; + } + public Builder ClearRepeatedNestedMessage() { + PrepareBuilder(); + result.repeatedNestedMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedForeignMessageList { + get { return PrepareBuilder().repeatedForeignMessage_; } + } + public int RepeatedForeignMessageCount { + get { return result.RepeatedForeignMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedForeignMessage(int index) { + return result.GetRepeatedForeignMessage(index); + } + public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedForeignMessage_[index] = value; + return this; + } + public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedForeignMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedForeignMessage_.Add(value); + return this; + } + public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedForeignMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedForeignMessage_.Add(values); + return this; + } + public Builder ClearRepeatedForeignMessage() { + PrepareBuilder(); + result.repeatedForeignMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedImportMessageList { + get { return PrepareBuilder().repeatedImportMessage_; } + } + public int RepeatedImportMessageCount { + get { return result.RepeatedImportMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage GetRepeatedImportMessage(int index) { + return result.GetRepeatedImportMessage(index); + } + public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedImportMessage_[index] = value; + return this; + } + public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedImportMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedImportMessage_.Add(value); + return this; + } + public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedImportMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedImportMessage_.Add(values); + return this; + } + public Builder ClearRepeatedImportMessage() { + PrepareBuilder(); + result.repeatedImportMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedNestedEnumList { + get { return PrepareBuilder().repeatedNestedEnum_; } + } + public int RepeatedNestedEnumCount { + get { return result.RepeatedNestedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum GetRepeatedNestedEnum(int index) { + return result.GetRepeatedNestedEnum(index); + } + public Builder SetRepeatedNestedEnum(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.repeatedNestedEnum_[index] = value; + return this; + } + public Builder AddRepeatedNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.repeatedNestedEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedNestedEnum_.Add(values); + return this; + } + public Builder ClearRepeatedNestedEnum() { + PrepareBuilder(); + result.repeatedNestedEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedForeignEnumList { + get { return PrepareBuilder().repeatedForeignEnum_; } + } + public int RepeatedForeignEnumCount { + get { return result.RepeatedForeignEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedForeignEnum(int index) { + return result.GetRepeatedForeignEnum(index); + } + public Builder SetRepeatedForeignEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedForeignEnum_[index] = value; + return this; + } + public Builder AddRepeatedForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedForeignEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedForeignEnum_.Add(values); + return this; + } + public Builder ClearRepeatedForeignEnum() { + PrepareBuilder(); + result.repeatedForeignEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedImportEnumList { + get { return PrepareBuilder().repeatedImportEnum_; } + } + public int RepeatedImportEnumCount { + get { return result.RepeatedImportEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum GetRepeatedImportEnum(int index) { + return result.GetRepeatedImportEnum(index); + } + public Builder SetRepeatedImportEnum(int index, global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.repeatedImportEnum_[index] = value; + return this; + } + public Builder AddRepeatedImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.repeatedImportEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedImportEnum_.Add(values); + return this; + } + public Builder ClearRepeatedImportEnum() { + PrepareBuilder(); + result.repeatedImportEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringPieceList { + get { return PrepareBuilder().repeatedStringPiece_; } + } + public int RepeatedStringPieceCount { + get { return result.RepeatedStringPieceCount; } + } + public string GetRepeatedStringPiece(int index) { + return result.GetRepeatedStringPiece(index); + } + public Builder SetRepeatedStringPiece(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPiece_[index] = value; + return this; + } + public Builder AddRepeatedStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPiece_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringPiece_.Add(values); + return this; + } + public Builder ClearRepeatedStringPiece() { + PrepareBuilder(); + result.repeatedStringPiece_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedCordList { + get { return PrepareBuilder().repeatedCord_; } + } + public int RepeatedCordCount { + get { return result.RepeatedCordCount; } + } + public string GetRepeatedCord(int index) { + return result.GetRepeatedCord(index); + } + public Builder SetRepeatedCord(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCord_[index] = value; + return this; + } + public Builder AddRepeatedCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCord_.Add(value); + return this; + } + public Builder AddRangeRepeatedCord(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedCord_.Add(values); + return this; + } + public Builder ClearRepeatedCord() { + PrepareBuilder(); + result.repeatedCord_.Clear(); + return this; + } + + public bool HasDefaultInt32 { + get { return result.hasDefaultInt32; } + } + public int DefaultInt32 { + get { return result.DefaultInt32; } + set { SetDefaultInt32(value); } + } + public Builder SetDefaultInt32(int value) { + PrepareBuilder(); + result.hasDefaultInt32 = true; + result.defaultInt32_ = value; + return this; + } + public Builder ClearDefaultInt32() { + PrepareBuilder(); + result.hasDefaultInt32 = false; + result.defaultInt32_ = 41; + return this; + } + + public bool HasDefaultInt64 { + get { return result.hasDefaultInt64; } + } + public long DefaultInt64 { + get { return result.DefaultInt64; } + set { SetDefaultInt64(value); } + } + public Builder SetDefaultInt64(long value) { + PrepareBuilder(); + result.hasDefaultInt64 = true; + result.defaultInt64_ = value; + return this; + } + public Builder ClearDefaultInt64() { + PrepareBuilder(); + result.hasDefaultInt64 = false; + result.defaultInt64_ = 42L; + return this; + } + + public bool HasDefaultUint32 { + get { return result.hasDefaultUint32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultUint32 { + get { return result.DefaultUint32; } + set { SetDefaultUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultUint32(uint value) { + PrepareBuilder(); + result.hasDefaultUint32 = true; + result.defaultUint32_ = value; + return this; + } + public Builder ClearDefaultUint32() { + PrepareBuilder(); + result.hasDefaultUint32 = false; + result.defaultUint32_ = 43; + return this; + } + + public bool HasDefaultUint64 { + get { return result.hasDefaultUint64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultUint64 { + get { return result.DefaultUint64; } + set { SetDefaultUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultUint64(ulong value) { + PrepareBuilder(); + result.hasDefaultUint64 = true; + result.defaultUint64_ = value; + return this; + } + public Builder ClearDefaultUint64() { + PrepareBuilder(); + result.hasDefaultUint64 = false; + result.defaultUint64_ = 44UL; + return this; + } + + public bool HasDefaultSint32 { + get { return result.hasDefaultSint32; } + } + public int DefaultSint32 { + get { return result.DefaultSint32; } + set { SetDefaultSint32(value); } + } + public Builder SetDefaultSint32(int value) { + PrepareBuilder(); + result.hasDefaultSint32 = true; + result.defaultSint32_ = value; + return this; + } + public Builder ClearDefaultSint32() { + PrepareBuilder(); + result.hasDefaultSint32 = false; + result.defaultSint32_ = -45; + return this; + } + + public bool HasDefaultSint64 { + get { return result.hasDefaultSint64; } + } + public long DefaultSint64 { + get { return result.DefaultSint64; } + set { SetDefaultSint64(value); } + } + public Builder SetDefaultSint64(long value) { + PrepareBuilder(); + result.hasDefaultSint64 = true; + result.defaultSint64_ = value; + return this; + } + public Builder ClearDefaultSint64() { + PrepareBuilder(); + result.hasDefaultSint64 = false; + result.defaultSint64_ = 46; + return this; + } + + public bool HasDefaultFixed32 { + get { return result.hasDefaultFixed32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultFixed32 { + get { return result.DefaultFixed32; } + set { SetDefaultFixed32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultFixed32(uint value) { + PrepareBuilder(); + result.hasDefaultFixed32 = true; + result.defaultFixed32_ = value; + return this; + } + public Builder ClearDefaultFixed32() { + PrepareBuilder(); + result.hasDefaultFixed32 = false; + result.defaultFixed32_ = 47; + return this; + } + + public bool HasDefaultFixed64 { + get { return result.hasDefaultFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultFixed64 { + get { return result.DefaultFixed64; } + set { SetDefaultFixed64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultFixed64(ulong value) { + PrepareBuilder(); + result.hasDefaultFixed64 = true; + result.defaultFixed64_ = value; + return this; + } + public Builder ClearDefaultFixed64() { + PrepareBuilder(); + result.hasDefaultFixed64 = false; + result.defaultFixed64_ = 48; + return this; + } + + public bool HasDefaultSfixed32 { + get { return result.hasDefaultSfixed32; } + } + public int DefaultSfixed32 { + get { return result.DefaultSfixed32; } + set { SetDefaultSfixed32(value); } + } + public Builder SetDefaultSfixed32(int value) { + PrepareBuilder(); + result.hasDefaultSfixed32 = true; + result.defaultSfixed32_ = value; + return this; + } + public Builder ClearDefaultSfixed32() { + PrepareBuilder(); + result.hasDefaultSfixed32 = false; + result.defaultSfixed32_ = 49; + return this; + } + + public bool HasDefaultSfixed64 { + get { return result.hasDefaultSfixed64; } + } + public long DefaultSfixed64 { + get { return result.DefaultSfixed64; } + set { SetDefaultSfixed64(value); } + } + public Builder SetDefaultSfixed64(long value) { + PrepareBuilder(); + result.hasDefaultSfixed64 = true; + result.defaultSfixed64_ = value; + return this; + } + public Builder ClearDefaultSfixed64() { + PrepareBuilder(); + result.hasDefaultSfixed64 = false; + result.defaultSfixed64_ = -50; + return this; + } + + public bool HasDefaultFloat { + get { return result.hasDefaultFloat; } + } + public float DefaultFloat { + get { return result.DefaultFloat; } + set { SetDefaultFloat(value); } + } + public Builder SetDefaultFloat(float value) { + PrepareBuilder(); + result.hasDefaultFloat = true; + result.defaultFloat_ = value; + return this; + } + public Builder ClearDefaultFloat() { + PrepareBuilder(); + result.hasDefaultFloat = false; + result.defaultFloat_ = 51.5F; + return this; + } + + public bool HasDefaultDouble { + get { return result.hasDefaultDouble; } + } + public double DefaultDouble { + get { return result.DefaultDouble; } + set { SetDefaultDouble(value); } + } + public Builder SetDefaultDouble(double value) { + PrepareBuilder(); + result.hasDefaultDouble = true; + result.defaultDouble_ = value; + return this; + } + public Builder ClearDefaultDouble() { + PrepareBuilder(); + result.hasDefaultDouble = false; + result.defaultDouble_ = 52000D; + return this; + } + + public bool HasDefaultBool { + get { return result.hasDefaultBool; } + } + public bool DefaultBool { + get { return result.DefaultBool; } + set { SetDefaultBool(value); } + } + public Builder SetDefaultBool(bool value) { + PrepareBuilder(); + result.hasDefaultBool = true; + result.defaultBool_ = value; + return this; + } + public Builder ClearDefaultBool() { + PrepareBuilder(); + result.hasDefaultBool = false; + result.defaultBool_ = true; + return this; + } + + public bool HasDefaultString { + get { return result.hasDefaultString; } + } + public string DefaultString { + get { return result.DefaultString; } + set { SetDefaultString(value); } + } + public Builder SetDefaultString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultString = true; + result.defaultString_ = value; + return this; + } + public Builder ClearDefaultString() { + PrepareBuilder(); + result.hasDefaultString = false; + result.defaultString_ = "hello"; + return this; + } + + public bool HasDefaultBytes { + get { return result.hasDefaultBytes; } + } + public pb::ByteString DefaultBytes { + get { return result.DefaultBytes; } + set { SetDefaultBytes(value); } + } + public Builder SetDefaultBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultBytes = true; + result.defaultBytes_ = value; + return this; + } + public Builder ClearDefaultBytes() { + PrepareBuilder(); + result.hasDefaultBytes = false; + result.defaultBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor.Fields[62].DefaultValue; + return this; + } + + public bool HasDefaultNestedEnum { + get { return result.hasDefaultNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum DefaultNestedEnum { + get { return result.DefaultNestedEnum; } + set { SetDefaultNestedEnum(value); } + } + public Builder SetDefaultNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.hasDefaultNestedEnum = true; + result.defaultNestedEnum_ = value; + return this; + } + public Builder ClearDefaultNestedEnum() { + PrepareBuilder(); + result.hasDefaultNestedEnum = false; + result.defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.BAR; + return this; + } + + public bool HasDefaultForeignEnum { + get { return result.hasDefaultForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum DefaultForeignEnum { + get { return result.DefaultForeignEnum; } + set { SetDefaultForeignEnum(value); } + } + public Builder SetDefaultForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasDefaultForeignEnum = true; + result.defaultForeignEnum_ = value; + return this; + } + public Builder ClearDefaultForeignEnum() { + PrepareBuilder(); + result.hasDefaultForeignEnum = false; + result.defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_BAR; + return this; + } + + public bool HasDefaultImportEnum { + get { return result.hasDefaultImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum DefaultImportEnum { + get { return result.DefaultImportEnum; } + set { SetDefaultImportEnum(value); } + } + public Builder SetDefaultImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.hasDefaultImportEnum = true; + result.defaultImportEnum_ = value; + return this; + } + public Builder ClearDefaultImportEnum() { + PrepareBuilder(); + result.hasDefaultImportEnum = false; + result.defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_BAR; + return this; + } + + public bool HasDefaultStringPiece { + get { return result.hasDefaultStringPiece; } + } + public string DefaultStringPiece { + get { return result.DefaultStringPiece; } + set { SetDefaultStringPiece(value); } + } + public Builder SetDefaultStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultStringPiece = true; + result.defaultStringPiece_ = value; + return this; + } + public Builder ClearDefaultStringPiece() { + PrepareBuilder(); + result.hasDefaultStringPiece = false; + result.defaultStringPiece_ = "abc"; + return this; + } + + public bool HasDefaultCord { + get { return result.hasDefaultCord; } + } + public string DefaultCord { + get { return result.DefaultCord; } + set { SetDefaultCord(value); } + } + public Builder SetDefaultCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultCord = true; + result.defaultCord_ = value; + return this; + } + public Builder ClearDefaultCord() { + PrepareBuilder(); + result.hasDefaultCord = false; + result.defaultCord_ = "123"; + return this; + } + } + static TestAllTypes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { + private TestDeprecatedFields() { } + private static readonly TestDeprecatedFields defaultInstance = new TestDeprecatedFields().MakeReadOnly(); + private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; + private static readonly uint[] _testDeprecatedFieldsFieldTags = new uint[] { 8 }; + public static TestDeprecatedFields DefaultInstance { + get { return defaultInstance; } + } + + public override TestDeprecatedFields DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDeprecatedFields ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable; } + } + + public const int DeprecatedInt32FieldNumber = 1; + private bool hasDeprecatedInt32; + private int deprecatedInt32_; + [global::System.ObsoleteAttribute()] + public bool HasDeprecatedInt32 { + get { return hasDeprecatedInt32; } + } + [global::System.ObsoleteAttribute()] + public int DeprecatedInt32 { + get { return deprecatedInt32_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDeprecatedFieldsFieldNames; + if (hasDeprecatedInt32) { + output.WriteInt32(1, field_names[0], DeprecatedInt32); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasDeprecatedInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(1, DeprecatedInt32); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestDeprecatedFields ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedFields ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDeprecatedFields ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDeprecatedFields MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDeprecatedFields prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDeprecatedFields cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDeprecatedFields result; + + private TestDeprecatedFields PrepareBuilder() { + if (resultIsReadOnly) { + TestDeprecatedFields original = result; + result = new TestDeprecatedFields(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDeprecatedFields MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.Descriptor; } + } + + public override TestDeprecatedFields DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.DefaultInstance; } + } + + public override TestDeprecatedFields BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestDeprecatedFields) { + return MergeFrom((TestDeprecatedFields) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDeprecatedFields other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasDeprecatedInt32) { + DeprecatedInt32 = other.DeprecatedInt32; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDeprecatedFieldsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDeprecatedFieldsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasDeprecatedInt32 = input.ReadInt32(ref result.deprecatedInt32_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + [global::System.ObsoleteAttribute()] + public bool HasDeprecatedInt32 { + get { return result.hasDeprecatedInt32; } + } + [global::System.ObsoleteAttribute()] + public int DeprecatedInt32 { + get { return result.DeprecatedInt32; } + set { SetDeprecatedInt32(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetDeprecatedInt32(int value) { + PrepareBuilder(); + result.hasDeprecatedInt32 = true; + result.deprecatedInt32_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearDeprecatedInt32() { + PrepareBuilder(); + result.hasDeprecatedInt32 = false; + result.deprecatedInt32_ = 0; + return this; + } + } + static TestDeprecatedFields() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ForeignMessage : pb::GeneratedMessage { + private ForeignMessage() { } + private static readonly ForeignMessage defaultInstance = new ForeignMessage().MakeReadOnly(); + private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; + private static readonly uint[] _foreignMessageFieldTags = new uint[] { 8 }; + public static ForeignMessage DefaultInstance { + get { return defaultInstance; } + } + + public override ForeignMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ForeignMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_ForeignMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable; } + } + + public const int CFieldNumber = 1; + private bool hasC; + private int c_; + public bool HasC { + get { return hasC; } + } + public int C { + get { return c_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _foreignMessageFieldNames; + if (hasC) { + output.WriteInt32(1, field_names[0], C); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasC) { + size += pb::CodedOutputStream.ComputeInt32Size(1, C); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ForeignMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ForeignMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ForeignMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ForeignMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ForeignMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ForeignMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ForeignMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ForeignMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ForeignMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ForeignMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ForeignMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ForeignMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ForeignMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ForeignMessage result; + + private ForeignMessage PrepareBuilder() { + if (resultIsReadOnly) { + ForeignMessage original = result; + result = new ForeignMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ForeignMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Descriptor; } + } + + public override ForeignMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public override ForeignMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ForeignMessage) { + return MergeFrom((ForeignMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ForeignMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasC) { + C = other.C; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_foreignMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _foreignMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasC = input.ReadInt32(ref result.c_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasC { + get { return result.hasC; } + } + public int C { + get { return result.C; } + set { SetC(value); } + } + public Builder SetC(int value) { + PrepareBuilder(); + result.hasC = true; + result.c_ = value; + return this; + } + public Builder ClearC() { + PrepareBuilder(); + result.hasC = false; + result.c_ = 0; + return this; + } + } + static ForeignMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestAllExtensions : pb::ExtendableMessage { + private TestAllExtensions() { } + private static readonly TestAllExtensions defaultInstance = new TestAllExtensions().MakeReadOnly(); + private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testAllExtensionsFieldTags = new uint[] { }; + public static TestAllExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestAllExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestAllExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testAllExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestAllExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestAllExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestAllExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestAllExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestAllExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestAllExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestAllExtensions result; + + private TestAllExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestAllExtensions original = result; + result = new TestAllExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestAllExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.Descriptor; } + } + + public override TestAllExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.DefaultInstance; } + } + + public override TestAllExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestAllExtensions) { + return MergeFrom((TestAllExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestAllExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testAllExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testAllExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestAllExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { + private OptionalGroup_extension() { } + private static readonly OptionalGroup_extension defaultInstance = new OptionalGroup_extension().MakeReadOnly(); + private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; + private static readonly uint[] _optionalGroupExtensionFieldTags = new uint[] { 136 }; + public static OptionalGroup_extension DefaultInstance { + get { return defaultInstance; } + } + + public override OptionalGroup_extension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OptionalGroup_extension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OptionalGroup_extension__FieldAccessorTable; } + } + + public const int AFieldNumber = 17; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _optionalGroupExtensionFieldNames; + if (hasA) { + output.WriteInt32(17, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(17, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OptionalGroup_extension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OptionalGroup_extension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OptionalGroup_extension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OptionalGroup_extension prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OptionalGroup_extension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OptionalGroup_extension result; + + private OptionalGroup_extension PrepareBuilder() { + if (resultIsReadOnly) { + OptionalGroup_extension original = result; + result = new OptionalGroup_extension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OptionalGroup_extension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.Descriptor; } + } + + public override OptionalGroup_extension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.DefaultInstance; } + } + + public override OptionalGroup_extension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OptionalGroup_extension) { + return MergeFrom((OptionalGroup_extension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OptionalGroup_extension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_optionalGroupExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _optionalGroupExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 136: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static OptionalGroup_extension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { + private RepeatedGroup_extension() { } + private static readonly RepeatedGroup_extension defaultInstance = new RepeatedGroup_extension().MakeReadOnly(); + private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; + private static readonly uint[] _repeatedGroupExtensionFieldTags = new uint[] { 376 }; + public static RepeatedGroup_extension DefaultInstance { + get { return defaultInstance; } + } + + public override RepeatedGroup_extension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RepeatedGroup_extension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_RepeatedGroup_extension__FieldAccessorTable; } + } + + public const int AFieldNumber = 47; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _repeatedGroupExtensionFieldNames; + if (hasA) { + output.WriteInt32(47, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(47, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static RepeatedGroup_extension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RepeatedGroup_extension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RepeatedGroup_extension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RepeatedGroup_extension prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RepeatedGroup_extension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RepeatedGroup_extension result; + + private RepeatedGroup_extension PrepareBuilder() { + if (resultIsReadOnly) { + RepeatedGroup_extension original = result; + result = new RepeatedGroup_extension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RepeatedGroup_extension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.Descriptor; } + } + + public override RepeatedGroup_extension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.DefaultInstance; } + } + + public override RepeatedGroup_extension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is RepeatedGroup_extension) { + return MergeFrom((RepeatedGroup_extension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RepeatedGroup_extension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_repeatedGroupExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _repeatedGroupExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 376: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static RepeatedGroup_extension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestNestedExtension : pb::GeneratedMessage { + private TestNestedExtension() { } + private static readonly TestNestedExtension defaultInstance = new TestNestedExtension().MakeReadOnly(); + private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; + private static readonly uint[] _testNestedExtensionFieldTags = new uint[] { }; + public static TestNestedExtension DefaultInstance { + get { return defaultInstance; } + } + + public override TestNestedExtension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestNestedExtension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedExtension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedExtension__FieldAccessorTable; } + } + + public const int TestFieldNumber = 1002; + public static pb::GeneratedExtensionBase Test; + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testNestedExtensionFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestNestedExtension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestNestedExtension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestNestedExtension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestNestedExtension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestNestedExtension prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestNestedExtension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestNestedExtension result; + + private TestNestedExtension PrepareBuilder() { + if (resultIsReadOnly) { + TestNestedExtension original = result; + result = new TestNestedExtension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestNestedExtension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Descriptor; } + } + + public override TestNestedExtension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.DefaultInstance; } + } + + public override TestNestedExtension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestNestedExtension) { + return MergeFrom((TestNestedExtension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestNestedExtension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testNestedExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testNestedExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestNestedExtension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRequired : pb::GeneratedMessage { + private TestRequired() { } + private static readonly TestRequired defaultInstance = new TestRequired().MakeReadOnly(); + private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; + private static readonly uint[] _testRequiredFieldTags = new uint[] { 8, 24, 264, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 16, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 32, 40, 48, 56, 64, 72 }; + public static TestRequired DefaultInstance { + get { return defaultInstance; } + } + + public override TestRequired DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRequired ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequired__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequired__FieldAccessorTable; } + } + + public const int SingleFieldNumber = 1000; + public static pb::GeneratedExtensionBase Single; + public const int MultiFieldNumber = 1001; + public static pb::GeneratedExtensionBase> Multi; + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public const int Dummy2FieldNumber = 2; + private bool hasDummy2; + private int dummy2_; + public bool HasDummy2 { + get { return hasDummy2; } + } + public int Dummy2 { + get { return dummy2_; } + } + + public const int BFieldNumber = 3; + private bool hasB; + private int b_; + public bool HasB { + get { return hasB; } + } + public int B { + get { return b_; } + } + + public const int Dummy4FieldNumber = 4; + private bool hasDummy4; + private int dummy4_; + public bool HasDummy4 { + get { return hasDummy4; } + } + public int Dummy4 { + get { return dummy4_; } + } + + public const int Dummy5FieldNumber = 5; + private bool hasDummy5; + private int dummy5_; + public bool HasDummy5 { + get { return hasDummy5; } + } + public int Dummy5 { + get { return dummy5_; } + } + + public const int Dummy6FieldNumber = 6; + private bool hasDummy6; + private int dummy6_; + public bool HasDummy6 { + get { return hasDummy6; } + } + public int Dummy6 { + get { return dummy6_; } + } + + public const int Dummy7FieldNumber = 7; + private bool hasDummy7; + private int dummy7_; + public bool HasDummy7 { + get { return hasDummy7; } + } + public int Dummy7 { + get { return dummy7_; } + } + + public const int Dummy8FieldNumber = 8; + private bool hasDummy8; + private int dummy8_; + public bool HasDummy8 { + get { return hasDummy8; } + } + public int Dummy8 { + get { return dummy8_; } + } + + public const int Dummy9FieldNumber = 9; + private bool hasDummy9; + private int dummy9_; + public bool HasDummy9 { + get { return hasDummy9; } + } + public int Dummy9 { + get { return dummy9_; } + } + + public const int Dummy10FieldNumber = 10; + private bool hasDummy10; + private int dummy10_; + public bool HasDummy10 { + get { return hasDummy10; } + } + public int Dummy10 { + get { return dummy10_; } + } + + public const int Dummy11FieldNumber = 11; + private bool hasDummy11; + private int dummy11_; + public bool HasDummy11 { + get { return hasDummy11; } + } + public int Dummy11 { + get { return dummy11_; } + } + + public const int Dummy12FieldNumber = 12; + private bool hasDummy12; + private int dummy12_; + public bool HasDummy12 { + get { return hasDummy12; } + } + public int Dummy12 { + get { return dummy12_; } + } + + public const int Dummy13FieldNumber = 13; + private bool hasDummy13; + private int dummy13_; + public bool HasDummy13 { + get { return hasDummy13; } + } + public int Dummy13 { + get { return dummy13_; } + } + + public const int Dummy14FieldNumber = 14; + private bool hasDummy14; + private int dummy14_; + public bool HasDummy14 { + get { return hasDummy14; } + } + public int Dummy14 { + get { return dummy14_; } + } + + public const int Dummy15FieldNumber = 15; + private bool hasDummy15; + private int dummy15_; + public bool HasDummy15 { + get { return hasDummy15; } + } + public int Dummy15 { + get { return dummy15_; } + } + + public const int Dummy16FieldNumber = 16; + private bool hasDummy16; + private int dummy16_; + public bool HasDummy16 { + get { return hasDummy16; } + } + public int Dummy16 { + get { return dummy16_; } + } + + public const int Dummy17FieldNumber = 17; + private bool hasDummy17; + private int dummy17_; + public bool HasDummy17 { + get { return hasDummy17; } + } + public int Dummy17 { + get { return dummy17_; } + } + + public const int Dummy18FieldNumber = 18; + private bool hasDummy18; + private int dummy18_; + public bool HasDummy18 { + get { return hasDummy18; } + } + public int Dummy18 { + get { return dummy18_; } + } + + public const int Dummy19FieldNumber = 19; + private bool hasDummy19; + private int dummy19_; + public bool HasDummy19 { + get { return hasDummy19; } + } + public int Dummy19 { + get { return dummy19_; } + } + + public const int Dummy20FieldNumber = 20; + private bool hasDummy20; + private int dummy20_; + public bool HasDummy20 { + get { return hasDummy20; } + } + public int Dummy20 { + get { return dummy20_; } + } + + public const int Dummy21FieldNumber = 21; + private bool hasDummy21; + private int dummy21_; + public bool HasDummy21 { + get { return hasDummy21; } + } + public int Dummy21 { + get { return dummy21_; } + } + + public const int Dummy22FieldNumber = 22; + private bool hasDummy22; + private int dummy22_; + public bool HasDummy22 { + get { return hasDummy22; } + } + public int Dummy22 { + get { return dummy22_; } + } + + public const int Dummy23FieldNumber = 23; + private bool hasDummy23; + private int dummy23_; + public bool HasDummy23 { + get { return hasDummy23; } + } + public int Dummy23 { + get { return dummy23_; } + } + + public const int Dummy24FieldNumber = 24; + private bool hasDummy24; + private int dummy24_; + public bool HasDummy24 { + get { return hasDummy24; } + } + public int Dummy24 { + get { return dummy24_; } + } + + public const int Dummy25FieldNumber = 25; + private bool hasDummy25; + private int dummy25_; + public bool HasDummy25 { + get { return hasDummy25; } + } + public int Dummy25 { + get { return dummy25_; } + } + + public const int Dummy26FieldNumber = 26; + private bool hasDummy26; + private int dummy26_; + public bool HasDummy26 { + get { return hasDummy26; } + } + public int Dummy26 { + get { return dummy26_; } + } + + public const int Dummy27FieldNumber = 27; + private bool hasDummy27; + private int dummy27_; + public bool HasDummy27 { + get { return hasDummy27; } + } + public int Dummy27 { + get { return dummy27_; } + } + + public const int Dummy28FieldNumber = 28; + private bool hasDummy28; + private int dummy28_; + public bool HasDummy28 { + get { return hasDummy28; } + } + public int Dummy28 { + get { return dummy28_; } + } + + public const int Dummy29FieldNumber = 29; + private bool hasDummy29; + private int dummy29_; + public bool HasDummy29 { + get { return hasDummy29; } + } + public int Dummy29 { + get { return dummy29_; } + } + + public const int Dummy30FieldNumber = 30; + private bool hasDummy30; + private int dummy30_; + public bool HasDummy30 { + get { return hasDummy30; } + } + public int Dummy30 { + get { return dummy30_; } + } + + public const int Dummy31FieldNumber = 31; + private bool hasDummy31; + private int dummy31_; + public bool HasDummy31 { + get { return hasDummy31; } + } + public int Dummy31 { + get { return dummy31_; } + } + + public const int Dummy32FieldNumber = 32; + private bool hasDummy32; + private int dummy32_; + public bool HasDummy32 { + get { return hasDummy32; } + } + public int Dummy32 { + get { return dummy32_; } + } + + public const int CFieldNumber = 33; + private bool hasC; + private int c_; + public bool HasC { + get { return hasC; } + } + public int C { + get { return c_; } + } + + public override bool IsInitialized { + get { + if (!hasA) return false; + if (!hasB) return false; + if (!hasC) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRequiredFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + if (hasDummy2) { + output.WriteInt32(2, field_names[13], Dummy2); + } + if (hasB) { + output.WriteInt32(3, field_names[1], B); + } + if (hasDummy4) { + output.WriteInt32(4, field_names[27], Dummy4); + } + if (hasDummy5) { + output.WriteInt32(5, field_names[28], Dummy5); + } + if (hasDummy6) { + output.WriteInt32(6, field_names[29], Dummy6); + } + if (hasDummy7) { + output.WriteInt32(7, field_names[30], Dummy7); + } + if (hasDummy8) { + output.WriteInt32(8, field_names[31], Dummy8); + } + if (hasDummy9) { + output.WriteInt32(9, field_names[32], Dummy9); + } + if (hasDummy10) { + output.WriteInt32(10, field_names[3], Dummy10); + } + if (hasDummy11) { + output.WriteInt32(11, field_names[4], Dummy11); + } + if (hasDummy12) { + output.WriteInt32(12, field_names[5], Dummy12); + } + if (hasDummy13) { + output.WriteInt32(13, field_names[6], Dummy13); + } + if (hasDummy14) { + output.WriteInt32(14, field_names[7], Dummy14); + } + if (hasDummy15) { + output.WriteInt32(15, field_names[8], Dummy15); + } + if (hasDummy16) { + output.WriteInt32(16, field_names[9], Dummy16); + } + if (hasDummy17) { + output.WriteInt32(17, field_names[10], Dummy17); + } + if (hasDummy18) { + output.WriteInt32(18, field_names[11], Dummy18); + } + if (hasDummy19) { + output.WriteInt32(19, field_names[12], Dummy19); + } + if (hasDummy20) { + output.WriteInt32(20, field_names[14], Dummy20); + } + if (hasDummy21) { + output.WriteInt32(21, field_names[15], Dummy21); + } + if (hasDummy22) { + output.WriteInt32(22, field_names[16], Dummy22); + } + if (hasDummy23) { + output.WriteInt32(23, field_names[17], Dummy23); + } + if (hasDummy24) { + output.WriteInt32(24, field_names[18], Dummy24); + } + if (hasDummy25) { + output.WriteInt32(25, field_names[19], Dummy25); + } + if (hasDummy26) { + output.WriteInt32(26, field_names[20], Dummy26); + } + if (hasDummy27) { + output.WriteInt32(27, field_names[21], Dummy27); + } + if (hasDummy28) { + output.WriteInt32(28, field_names[22], Dummy28); + } + if (hasDummy29) { + output.WriteInt32(29, field_names[23], Dummy29); + } + if (hasDummy30) { + output.WriteInt32(30, field_names[24], Dummy30); + } + if (hasDummy31) { + output.WriteInt32(31, field_names[25], Dummy31); + } + if (hasDummy32) { + output.WriteInt32(32, field_names[26], Dummy32); + } + if (hasC) { + output.WriteInt32(33, field_names[2], C); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + if (hasDummy2) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Dummy2); + } + if (hasB) { + size += pb::CodedOutputStream.ComputeInt32Size(3, B); + } + if (hasDummy4) { + size += pb::CodedOutputStream.ComputeInt32Size(4, Dummy4); + } + if (hasDummy5) { + size += pb::CodedOutputStream.ComputeInt32Size(5, Dummy5); + } + if (hasDummy6) { + size += pb::CodedOutputStream.ComputeInt32Size(6, Dummy6); + } + if (hasDummy7) { + size += pb::CodedOutputStream.ComputeInt32Size(7, Dummy7); + } + if (hasDummy8) { + size += pb::CodedOutputStream.ComputeInt32Size(8, Dummy8); + } + if (hasDummy9) { + size += pb::CodedOutputStream.ComputeInt32Size(9, Dummy9); + } + if (hasDummy10) { + size += pb::CodedOutputStream.ComputeInt32Size(10, Dummy10); + } + if (hasDummy11) { + size += pb::CodedOutputStream.ComputeInt32Size(11, Dummy11); + } + if (hasDummy12) { + size += pb::CodedOutputStream.ComputeInt32Size(12, Dummy12); + } + if (hasDummy13) { + size += pb::CodedOutputStream.ComputeInt32Size(13, Dummy13); + } + if (hasDummy14) { + size += pb::CodedOutputStream.ComputeInt32Size(14, Dummy14); + } + if (hasDummy15) { + size += pb::CodedOutputStream.ComputeInt32Size(15, Dummy15); + } + if (hasDummy16) { + size += pb::CodedOutputStream.ComputeInt32Size(16, Dummy16); + } + if (hasDummy17) { + size += pb::CodedOutputStream.ComputeInt32Size(17, Dummy17); + } + if (hasDummy18) { + size += pb::CodedOutputStream.ComputeInt32Size(18, Dummy18); + } + if (hasDummy19) { + size += pb::CodedOutputStream.ComputeInt32Size(19, Dummy19); + } + if (hasDummy20) { + size += pb::CodedOutputStream.ComputeInt32Size(20, Dummy20); + } + if (hasDummy21) { + size += pb::CodedOutputStream.ComputeInt32Size(21, Dummy21); + } + if (hasDummy22) { + size += pb::CodedOutputStream.ComputeInt32Size(22, Dummy22); + } + if (hasDummy23) { + size += pb::CodedOutputStream.ComputeInt32Size(23, Dummy23); + } + if (hasDummy24) { + size += pb::CodedOutputStream.ComputeInt32Size(24, Dummy24); + } + if (hasDummy25) { + size += pb::CodedOutputStream.ComputeInt32Size(25, Dummy25); + } + if (hasDummy26) { + size += pb::CodedOutputStream.ComputeInt32Size(26, Dummy26); + } + if (hasDummy27) { + size += pb::CodedOutputStream.ComputeInt32Size(27, Dummy27); + } + if (hasDummy28) { + size += pb::CodedOutputStream.ComputeInt32Size(28, Dummy28); + } + if (hasDummy29) { + size += pb::CodedOutputStream.ComputeInt32Size(29, Dummy29); + } + if (hasDummy30) { + size += pb::CodedOutputStream.ComputeInt32Size(30, Dummy30); + } + if (hasDummy31) { + size += pb::CodedOutputStream.ComputeInt32Size(31, Dummy31); + } + if (hasDummy32) { + size += pb::CodedOutputStream.ComputeInt32Size(32, Dummy32); + } + if (hasC) { + size += pb::CodedOutputStream.ComputeInt32Size(33, C); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRequired ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequired ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequired ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequired ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequired ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequired ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRequired ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRequired ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRequired ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequired ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRequired MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRequired prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRequired cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRequired result; + + private TestRequired PrepareBuilder() { + if (resultIsReadOnly) { + TestRequired original = result; + result = new TestRequired(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRequired MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequired.Descriptor; } + } + + public override TestRequired DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; } + } + + public override TestRequired BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRequired) { + return MergeFrom((TestRequired) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRequired other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + if (other.HasDummy2) { + Dummy2 = other.Dummy2; + } + if (other.HasB) { + B = other.B; + } + if (other.HasDummy4) { + Dummy4 = other.Dummy4; + } + if (other.HasDummy5) { + Dummy5 = other.Dummy5; + } + if (other.HasDummy6) { + Dummy6 = other.Dummy6; + } + if (other.HasDummy7) { + Dummy7 = other.Dummy7; + } + if (other.HasDummy8) { + Dummy8 = other.Dummy8; + } + if (other.HasDummy9) { + Dummy9 = other.Dummy9; + } + if (other.HasDummy10) { + Dummy10 = other.Dummy10; + } + if (other.HasDummy11) { + Dummy11 = other.Dummy11; + } + if (other.HasDummy12) { + Dummy12 = other.Dummy12; + } + if (other.HasDummy13) { + Dummy13 = other.Dummy13; + } + if (other.HasDummy14) { + Dummy14 = other.Dummy14; + } + if (other.HasDummy15) { + Dummy15 = other.Dummy15; + } + if (other.HasDummy16) { + Dummy16 = other.Dummy16; + } + if (other.HasDummy17) { + Dummy17 = other.Dummy17; + } + if (other.HasDummy18) { + Dummy18 = other.Dummy18; + } + if (other.HasDummy19) { + Dummy19 = other.Dummy19; + } + if (other.HasDummy20) { + Dummy20 = other.Dummy20; + } + if (other.HasDummy21) { + Dummy21 = other.Dummy21; + } + if (other.HasDummy22) { + Dummy22 = other.Dummy22; + } + if (other.HasDummy23) { + Dummy23 = other.Dummy23; + } + if (other.HasDummy24) { + Dummy24 = other.Dummy24; + } + if (other.HasDummy25) { + Dummy25 = other.Dummy25; + } + if (other.HasDummy26) { + Dummy26 = other.Dummy26; + } + if (other.HasDummy27) { + Dummy27 = other.Dummy27; + } + if (other.HasDummy28) { + Dummy28 = other.Dummy28; + } + if (other.HasDummy29) { + Dummy29 = other.Dummy29; + } + if (other.HasDummy30) { + Dummy30 = other.Dummy30; + } + if (other.HasDummy31) { + Dummy31 = other.Dummy31; + } + if (other.HasDummy32) { + Dummy32 = other.Dummy32; + } + if (other.HasC) { + C = other.C; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRequiredFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRequiredFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + case 16: { + result.hasDummy2 = input.ReadInt32(ref result.dummy2_); + break; + } + case 24: { + result.hasB = input.ReadInt32(ref result.b_); + break; + } + case 32: { + result.hasDummy4 = input.ReadInt32(ref result.dummy4_); + break; + } + case 40: { + result.hasDummy5 = input.ReadInt32(ref result.dummy5_); + break; + } + case 48: { + result.hasDummy6 = input.ReadInt32(ref result.dummy6_); + break; + } + case 56: { + result.hasDummy7 = input.ReadInt32(ref result.dummy7_); + break; + } + case 64: { + result.hasDummy8 = input.ReadInt32(ref result.dummy8_); + break; + } + case 72: { + result.hasDummy9 = input.ReadInt32(ref result.dummy9_); + break; + } + case 80: { + result.hasDummy10 = input.ReadInt32(ref result.dummy10_); + break; + } + case 88: { + result.hasDummy11 = input.ReadInt32(ref result.dummy11_); + break; + } + case 96: { + result.hasDummy12 = input.ReadInt32(ref result.dummy12_); + break; + } + case 104: { + result.hasDummy13 = input.ReadInt32(ref result.dummy13_); + break; + } + case 112: { + result.hasDummy14 = input.ReadInt32(ref result.dummy14_); + break; + } + case 120: { + result.hasDummy15 = input.ReadInt32(ref result.dummy15_); + break; + } + case 128: { + result.hasDummy16 = input.ReadInt32(ref result.dummy16_); + break; + } + case 136: { + result.hasDummy17 = input.ReadInt32(ref result.dummy17_); + break; + } + case 144: { + result.hasDummy18 = input.ReadInt32(ref result.dummy18_); + break; + } + case 152: { + result.hasDummy19 = input.ReadInt32(ref result.dummy19_); + break; + } + case 160: { + result.hasDummy20 = input.ReadInt32(ref result.dummy20_); + break; + } + case 168: { + result.hasDummy21 = input.ReadInt32(ref result.dummy21_); + break; + } + case 176: { + result.hasDummy22 = input.ReadInt32(ref result.dummy22_); + break; + } + case 184: { + result.hasDummy23 = input.ReadInt32(ref result.dummy23_); + break; + } + case 192: { + result.hasDummy24 = input.ReadInt32(ref result.dummy24_); + break; + } + case 200: { + result.hasDummy25 = input.ReadInt32(ref result.dummy25_); + break; + } + case 208: { + result.hasDummy26 = input.ReadInt32(ref result.dummy26_); + break; + } + case 216: { + result.hasDummy27 = input.ReadInt32(ref result.dummy27_); + break; + } + case 224: { + result.hasDummy28 = input.ReadInt32(ref result.dummy28_); + break; + } + case 232: { + result.hasDummy29 = input.ReadInt32(ref result.dummy29_); + break; + } + case 240: { + result.hasDummy30 = input.ReadInt32(ref result.dummy30_); + break; + } + case 248: { + result.hasDummy31 = input.ReadInt32(ref result.dummy31_); + break; + } + case 256: { + result.hasDummy32 = input.ReadInt32(ref result.dummy32_); + break; + } + case 264: { + result.hasC = input.ReadInt32(ref result.c_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + + public bool HasDummy2 { + get { return result.hasDummy2; } + } + public int Dummy2 { + get { return result.Dummy2; } + set { SetDummy2(value); } + } + public Builder SetDummy2(int value) { + PrepareBuilder(); + result.hasDummy2 = true; + result.dummy2_ = value; + return this; + } + public Builder ClearDummy2() { + PrepareBuilder(); + result.hasDummy2 = false; + result.dummy2_ = 0; + return this; + } + + public bool HasB { + get { return result.hasB; } + } + public int B { + get { return result.B; } + set { SetB(value); } + } + public Builder SetB(int value) { + PrepareBuilder(); + result.hasB = true; + result.b_ = value; + return this; + } + public Builder ClearB() { + PrepareBuilder(); + result.hasB = false; + result.b_ = 0; + return this; + } + + public bool HasDummy4 { + get { return result.hasDummy4; } + } + public int Dummy4 { + get { return result.Dummy4; } + set { SetDummy4(value); } + } + public Builder SetDummy4(int value) { + PrepareBuilder(); + result.hasDummy4 = true; + result.dummy4_ = value; + return this; + } + public Builder ClearDummy4() { + PrepareBuilder(); + result.hasDummy4 = false; + result.dummy4_ = 0; + return this; + } + + public bool HasDummy5 { + get { return result.hasDummy5; } + } + public int Dummy5 { + get { return result.Dummy5; } + set { SetDummy5(value); } + } + public Builder SetDummy5(int value) { + PrepareBuilder(); + result.hasDummy5 = true; + result.dummy5_ = value; + return this; + } + public Builder ClearDummy5() { + PrepareBuilder(); + result.hasDummy5 = false; + result.dummy5_ = 0; + return this; + } + + public bool HasDummy6 { + get { return result.hasDummy6; } + } + public int Dummy6 { + get { return result.Dummy6; } + set { SetDummy6(value); } + } + public Builder SetDummy6(int value) { + PrepareBuilder(); + result.hasDummy6 = true; + result.dummy6_ = value; + return this; + } + public Builder ClearDummy6() { + PrepareBuilder(); + result.hasDummy6 = false; + result.dummy6_ = 0; + return this; + } + + public bool HasDummy7 { + get { return result.hasDummy7; } + } + public int Dummy7 { + get { return result.Dummy7; } + set { SetDummy7(value); } + } + public Builder SetDummy7(int value) { + PrepareBuilder(); + result.hasDummy7 = true; + result.dummy7_ = value; + return this; + } + public Builder ClearDummy7() { + PrepareBuilder(); + result.hasDummy7 = false; + result.dummy7_ = 0; + return this; + } + + public bool HasDummy8 { + get { return result.hasDummy8; } + } + public int Dummy8 { + get { return result.Dummy8; } + set { SetDummy8(value); } + } + public Builder SetDummy8(int value) { + PrepareBuilder(); + result.hasDummy8 = true; + result.dummy8_ = value; + return this; + } + public Builder ClearDummy8() { + PrepareBuilder(); + result.hasDummy8 = false; + result.dummy8_ = 0; + return this; + } + + public bool HasDummy9 { + get { return result.hasDummy9; } + } + public int Dummy9 { + get { return result.Dummy9; } + set { SetDummy9(value); } + } + public Builder SetDummy9(int value) { + PrepareBuilder(); + result.hasDummy9 = true; + result.dummy9_ = value; + return this; + } + public Builder ClearDummy9() { + PrepareBuilder(); + result.hasDummy9 = false; + result.dummy9_ = 0; + return this; + } + + public bool HasDummy10 { + get { return result.hasDummy10; } + } + public int Dummy10 { + get { return result.Dummy10; } + set { SetDummy10(value); } + } + public Builder SetDummy10(int value) { + PrepareBuilder(); + result.hasDummy10 = true; + result.dummy10_ = value; + return this; + } + public Builder ClearDummy10() { + PrepareBuilder(); + result.hasDummy10 = false; + result.dummy10_ = 0; + return this; + } + + public bool HasDummy11 { + get { return result.hasDummy11; } + } + public int Dummy11 { + get { return result.Dummy11; } + set { SetDummy11(value); } + } + public Builder SetDummy11(int value) { + PrepareBuilder(); + result.hasDummy11 = true; + result.dummy11_ = value; + return this; + } + public Builder ClearDummy11() { + PrepareBuilder(); + result.hasDummy11 = false; + result.dummy11_ = 0; + return this; + } + + public bool HasDummy12 { + get { return result.hasDummy12; } + } + public int Dummy12 { + get { return result.Dummy12; } + set { SetDummy12(value); } + } + public Builder SetDummy12(int value) { + PrepareBuilder(); + result.hasDummy12 = true; + result.dummy12_ = value; + return this; + } + public Builder ClearDummy12() { + PrepareBuilder(); + result.hasDummy12 = false; + result.dummy12_ = 0; + return this; + } + + public bool HasDummy13 { + get { return result.hasDummy13; } + } + public int Dummy13 { + get { return result.Dummy13; } + set { SetDummy13(value); } + } + public Builder SetDummy13(int value) { + PrepareBuilder(); + result.hasDummy13 = true; + result.dummy13_ = value; + return this; + } + public Builder ClearDummy13() { + PrepareBuilder(); + result.hasDummy13 = false; + result.dummy13_ = 0; + return this; + } + + public bool HasDummy14 { + get { return result.hasDummy14; } + } + public int Dummy14 { + get { return result.Dummy14; } + set { SetDummy14(value); } + } + public Builder SetDummy14(int value) { + PrepareBuilder(); + result.hasDummy14 = true; + result.dummy14_ = value; + return this; + } + public Builder ClearDummy14() { + PrepareBuilder(); + result.hasDummy14 = false; + result.dummy14_ = 0; + return this; + } + + public bool HasDummy15 { + get { return result.hasDummy15; } + } + public int Dummy15 { + get { return result.Dummy15; } + set { SetDummy15(value); } + } + public Builder SetDummy15(int value) { + PrepareBuilder(); + result.hasDummy15 = true; + result.dummy15_ = value; + return this; + } + public Builder ClearDummy15() { + PrepareBuilder(); + result.hasDummy15 = false; + result.dummy15_ = 0; + return this; + } + + public bool HasDummy16 { + get { return result.hasDummy16; } + } + public int Dummy16 { + get { return result.Dummy16; } + set { SetDummy16(value); } + } + public Builder SetDummy16(int value) { + PrepareBuilder(); + result.hasDummy16 = true; + result.dummy16_ = value; + return this; + } + public Builder ClearDummy16() { + PrepareBuilder(); + result.hasDummy16 = false; + result.dummy16_ = 0; + return this; + } + + public bool HasDummy17 { + get { return result.hasDummy17; } + } + public int Dummy17 { + get { return result.Dummy17; } + set { SetDummy17(value); } + } + public Builder SetDummy17(int value) { + PrepareBuilder(); + result.hasDummy17 = true; + result.dummy17_ = value; + return this; + } + public Builder ClearDummy17() { + PrepareBuilder(); + result.hasDummy17 = false; + result.dummy17_ = 0; + return this; + } + + public bool HasDummy18 { + get { return result.hasDummy18; } + } + public int Dummy18 { + get { return result.Dummy18; } + set { SetDummy18(value); } + } + public Builder SetDummy18(int value) { + PrepareBuilder(); + result.hasDummy18 = true; + result.dummy18_ = value; + return this; + } + public Builder ClearDummy18() { + PrepareBuilder(); + result.hasDummy18 = false; + result.dummy18_ = 0; + return this; + } + + public bool HasDummy19 { + get { return result.hasDummy19; } + } + public int Dummy19 { + get { return result.Dummy19; } + set { SetDummy19(value); } + } + public Builder SetDummy19(int value) { + PrepareBuilder(); + result.hasDummy19 = true; + result.dummy19_ = value; + return this; + } + public Builder ClearDummy19() { + PrepareBuilder(); + result.hasDummy19 = false; + result.dummy19_ = 0; + return this; + } + + public bool HasDummy20 { + get { return result.hasDummy20; } + } + public int Dummy20 { + get { return result.Dummy20; } + set { SetDummy20(value); } + } + public Builder SetDummy20(int value) { + PrepareBuilder(); + result.hasDummy20 = true; + result.dummy20_ = value; + return this; + } + public Builder ClearDummy20() { + PrepareBuilder(); + result.hasDummy20 = false; + result.dummy20_ = 0; + return this; + } + + public bool HasDummy21 { + get { return result.hasDummy21; } + } + public int Dummy21 { + get { return result.Dummy21; } + set { SetDummy21(value); } + } + public Builder SetDummy21(int value) { + PrepareBuilder(); + result.hasDummy21 = true; + result.dummy21_ = value; + return this; + } + public Builder ClearDummy21() { + PrepareBuilder(); + result.hasDummy21 = false; + result.dummy21_ = 0; + return this; + } + + public bool HasDummy22 { + get { return result.hasDummy22; } + } + public int Dummy22 { + get { return result.Dummy22; } + set { SetDummy22(value); } + } + public Builder SetDummy22(int value) { + PrepareBuilder(); + result.hasDummy22 = true; + result.dummy22_ = value; + return this; + } + public Builder ClearDummy22() { + PrepareBuilder(); + result.hasDummy22 = false; + result.dummy22_ = 0; + return this; + } + + public bool HasDummy23 { + get { return result.hasDummy23; } + } + public int Dummy23 { + get { return result.Dummy23; } + set { SetDummy23(value); } + } + public Builder SetDummy23(int value) { + PrepareBuilder(); + result.hasDummy23 = true; + result.dummy23_ = value; + return this; + } + public Builder ClearDummy23() { + PrepareBuilder(); + result.hasDummy23 = false; + result.dummy23_ = 0; + return this; + } + + public bool HasDummy24 { + get { return result.hasDummy24; } + } + public int Dummy24 { + get { return result.Dummy24; } + set { SetDummy24(value); } + } + public Builder SetDummy24(int value) { + PrepareBuilder(); + result.hasDummy24 = true; + result.dummy24_ = value; + return this; + } + public Builder ClearDummy24() { + PrepareBuilder(); + result.hasDummy24 = false; + result.dummy24_ = 0; + return this; + } + + public bool HasDummy25 { + get { return result.hasDummy25; } + } + public int Dummy25 { + get { return result.Dummy25; } + set { SetDummy25(value); } + } + public Builder SetDummy25(int value) { + PrepareBuilder(); + result.hasDummy25 = true; + result.dummy25_ = value; + return this; + } + public Builder ClearDummy25() { + PrepareBuilder(); + result.hasDummy25 = false; + result.dummy25_ = 0; + return this; + } + + public bool HasDummy26 { + get { return result.hasDummy26; } + } + public int Dummy26 { + get { return result.Dummy26; } + set { SetDummy26(value); } + } + public Builder SetDummy26(int value) { + PrepareBuilder(); + result.hasDummy26 = true; + result.dummy26_ = value; + return this; + } + public Builder ClearDummy26() { + PrepareBuilder(); + result.hasDummy26 = false; + result.dummy26_ = 0; + return this; + } + + public bool HasDummy27 { + get { return result.hasDummy27; } + } + public int Dummy27 { + get { return result.Dummy27; } + set { SetDummy27(value); } + } + public Builder SetDummy27(int value) { + PrepareBuilder(); + result.hasDummy27 = true; + result.dummy27_ = value; + return this; + } + public Builder ClearDummy27() { + PrepareBuilder(); + result.hasDummy27 = false; + result.dummy27_ = 0; + return this; + } + + public bool HasDummy28 { + get { return result.hasDummy28; } + } + public int Dummy28 { + get { return result.Dummy28; } + set { SetDummy28(value); } + } + public Builder SetDummy28(int value) { + PrepareBuilder(); + result.hasDummy28 = true; + result.dummy28_ = value; + return this; + } + public Builder ClearDummy28() { + PrepareBuilder(); + result.hasDummy28 = false; + result.dummy28_ = 0; + return this; + } + + public bool HasDummy29 { + get { return result.hasDummy29; } + } + public int Dummy29 { + get { return result.Dummy29; } + set { SetDummy29(value); } + } + public Builder SetDummy29(int value) { + PrepareBuilder(); + result.hasDummy29 = true; + result.dummy29_ = value; + return this; + } + public Builder ClearDummy29() { + PrepareBuilder(); + result.hasDummy29 = false; + result.dummy29_ = 0; + return this; + } + + public bool HasDummy30 { + get { return result.hasDummy30; } + } + public int Dummy30 { + get { return result.Dummy30; } + set { SetDummy30(value); } + } + public Builder SetDummy30(int value) { + PrepareBuilder(); + result.hasDummy30 = true; + result.dummy30_ = value; + return this; + } + public Builder ClearDummy30() { + PrepareBuilder(); + result.hasDummy30 = false; + result.dummy30_ = 0; + return this; + } + + public bool HasDummy31 { + get { return result.hasDummy31; } + } + public int Dummy31 { + get { return result.Dummy31; } + set { SetDummy31(value); } + } + public Builder SetDummy31(int value) { + PrepareBuilder(); + result.hasDummy31 = true; + result.dummy31_ = value; + return this; + } + public Builder ClearDummy31() { + PrepareBuilder(); + result.hasDummy31 = false; + result.dummy31_ = 0; + return this; + } + + public bool HasDummy32 { + get { return result.hasDummy32; } + } + public int Dummy32 { + get { return result.Dummy32; } + set { SetDummy32(value); } + } + public Builder SetDummy32(int value) { + PrepareBuilder(); + result.hasDummy32 = true; + result.dummy32_ = value; + return this; + } + public Builder ClearDummy32() { + PrepareBuilder(); + result.hasDummy32 = false; + result.dummy32_ = 0; + return this; + } + + public bool HasC { + get { return result.hasC; } + } + public int C { + get { return result.C; } + set { SetC(value); } + } + public Builder SetC(int value) { + PrepareBuilder(); + result.hasC = true; + result.c_ = value; + return this; + } + public Builder ClearC() { + PrepareBuilder(); + result.hasC = false; + result.c_ = 0; + return this; + } + } + static TestRequired() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRequiredForeign : pb::GeneratedMessage { + private TestRequiredForeign() { } + private static readonly TestRequiredForeign defaultInstance = new TestRequiredForeign().MakeReadOnly(); + private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; + private static readonly uint[] _testRequiredForeignFieldTags = new uint[] { 24, 10, 18 }; + public static TestRequiredForeign DefaultInstance { + get { return defaultInstance; } + } + + public override TestRequiredForeign DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRequiredForeign ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequiredForeign__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequiredForeign__FieldAccessorTable; } + } + + public const int OptionalMessageFieldNumber = 1; + private bool hasOptionalMessage; + private global::Google.ProtocolBuffers.TestProtos.TestRequired optionalMessage_; + public bool HasOptionalMessage { + get { return hasOptionalMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired OptionalMessage { + get { return optionalMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; } + } + + public const int RepeatedMessageFieldNumber = 2; + private pbc::PopsicleList repeatedMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedMessageList { + get { return repeatedMessage_; } + } + public int RepeatedMessageCount { + get { return repeatedMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired GetRepeatedMessage(int index) { + return repeatedMessage_[index]; + } + + public const int DummyFieldNumber = 3; + private bool hasDummy; + private int dummy_; + public bool HasDummy { + get { return hasDummy; } + } + public int Dummy { + get { return dummy_; } + } + + public override bool IsInitialized { + get { + if (HasOptionalMessage) { + if (!OptionalMessage.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestRequired element in RepeatedMessageList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRequiredForeignFieldNames; + if (hasOptionalMessage) { + output.WriteMessage(1, field_names[1], OptionalMessage); + } + if (repeatedMessage_.Count > 0) { + output.WriteMessageArray(2, field_names[2], repeatedMessage_); + } + if (hasDummy) { + output.WriteInt32(3, field_names[0], Dummy); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalMessage); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestRequired element in RepeatedMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + if (hasDummy) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Dummy); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRequiredForeign ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRequiredForeign ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRequiredForeign ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRequiredForeign MakeReadOnly() { + repeatedMessage_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRequiredForeign prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRequiredForeign cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRequiredForeign result; + + private TestRequiredForeign PrepareBuilder() { + if (resultIsReadOnly) { + TestRequiredForeign original = result; + result = new TestRequiredForeign(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRequiredForeign MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.Descriptor; } + } + + public override TestRequiredForeign DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.DefaultInstance; } + } + + public override TestRequiredForeign BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRequiredForeign) { + return MergeFrom((TestRequiredForeign) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRequiredForeign other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalMessage) { + MergeOptionalMessage(other.OptionalMessage); + } + if (other.repeatedMessage_.Count != 0) { + result.repeatedMessage_.Add(other.repeatedMessage_); + } + if (other.HasDummy) { + Dummy = other.Dummy; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRequiredForeignFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRequiredForeignFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestRequired.CreateBuilder(); + if (result.hasOptionalMessage) { + subBuilder.MergeFrom(OptionalMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalMessage = subBuilder.BuildPartial(); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.repeatedMessage_, global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance, extensionRegistry); + break; + } + case 24: { + result.hasDummy = input.ReadInt32(ref result.dummy_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalMessage { + get { return result.hasOptionalMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired OptionalMessage { + get { return result.OptionalMessage; } + set { SetOptionalMessage(value); } + } + public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalMessage = true; + result.optionalMessage_ = value; + return this; + } + public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalMessage = true; + result.optionalMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalMessage && + result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) { + result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalMessage_ = value; + } + result.hasOptionalMessage = true; + return this; + } + public Builder ClearOptionalMessage() { + PrepareBuilder(); + result.hasOptionalMessage = false; + result.optionalMessage_ = null; + return this; + } + + public pbc::IPopsicleList RepeatedMessageList { + get { return PrepareBuilder().repeatedMessage_; } + } + public int RepeatedMessageCount { + get { return result.RepeatedMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired GetRepeatedMessage(int index) { + return result.GetRepeatedMessage(index); + } + public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessage_[index] = value; + return this; + } + public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessage_.Add(value); + return this; + } + public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedMessage_.Add(values); + return this; + } + public Builder ClearRepeatedMessage() { + PrepareBuilder(); + result.repeatedMessage_.Clear(); + return this; + } + + public bool HasDummy { + get { return result.hasDummy; } + } + public int Dummy { + get { return result.Dummy; } + set { SetDummy(value); } + } + public Builder SetDummy(int value) { + PrepareBuilder(); + result.hasDummy = true; + result.dummy_ = value; + return this; + } + public Builder ClearDummy() { + PrepareBuilder(); + result.hasDummy = false; + result.dummy_ = 0; + return this; + } + } + static TestRequiredForeign() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestForeignNested : pb::GeneratedMessage { + private TestForeignNested() { } + private static readonly TestForeignNested defaultInstance = new TestForeignNested().MakeReadOnly(); + private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; + private static readonly uint[] _testForeignNestedFieldTags = new uint[] { 10 }; + public static TestForeignNested DefaultInstance { + get { return defaultInstance; } + } + + public override TestForeignNested DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestForeignNested ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestForeignNested__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable; } + } + + public const int ForeignNestedFieldNumber = 1; + private bool hasForeignNested; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_; + public bool HasForeignNested { + get { return hasForeignNested; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { + get { return foreignNested_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testForeignNestedFieldNames; + if (hasForeignNested) { + output.WriteMessage(1, field_names[0], ForeignNested); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasForeignNested) { + size += pb::CodedOutputStream.ComputeMessageSize(1, ForeignNested); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestForeignNested ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestForeignNested ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestForeignNested ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestForeignNested ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestForeignNested ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestForeignNested ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestForeignNested ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestForeignNested ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestForeignNested ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestForeignNested ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestForeignNested MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestForeignNested prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestForeignNested cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestForeignNested result; + + private TestForeignNested PrepareBuilder() { + if (resultIsReadOnly) { + TestForeignNested original = result; + result = new TestForeignNested(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestForeignNested MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestForeignNested.Descriptor; } + } + + public override TestForeignNested DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestForeignNested.DefaultInstance; } + } + + public override TestForeignNested BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestForeignNested) { + return MergeFrom((TestForeignNested) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestForeignNested other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestForeignNested.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasForeignNested) { + MergeForeignNested(other.ForeignNested); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testForeignNestedFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testForeignNestedFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(); + if (result.hasForeignNested) { + subBuilder.MergeFrom(ForeignNested); + } + input.ReadMessage(subBuilder, extensionRegistry); + ForeignNested = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasForeignNested { + get { return result.hasForeignNested; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { + get { return result.ForeignNested; } + set { SetForeignNested(value); } + } + public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasForeignNested = true; + result.foreignNested_ = value; + return this; + } + public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasForeignNested = true; + result.foreignNested_ = builderForValue.Build(); + return this; + } + public Builder MergeForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasForeignNested && + result.foreignNested_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { + result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.foreignNested_).MergeFrom(value).BuildPartial(); + } else { + result.foreignNested_ = value; + } + result.hasForeignNested = true; + return this; + } + public Builder ClearForeignNested() { + PrepareBuilder(); + result.hasForeignNested = false; + result.foreignNested_ = null; + return this; + } + } + static TestForeignNested() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestEmptyMessage : pb::GeneratedMessage { + private TestEmptyMessage() { } + private static readonly TestEmptyMessage defaultInstance = new TestEmptyMessage().MakeReadOnly(); + private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; + private static readonly uint[] _testEmptyMessageFieldTags = new uint[] { }; + public static TestEmptyMessage DefaultInstance { + get { return defaultInstance; } + } + + public override TestEmptyMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestEmptyMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessage__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testEmptyMessageFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestEmptyMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestEmptyMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestEmptyMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestEmptyMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestEmptyMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestEmptyMessage result; + + private TestEmptyMessage PrepareBuilder() { + if (resultIsReadOnly) { + TestEmptyMessage original = result; + result = new TestEmptyMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestEmptyMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.Descriptor; } + } + + public override TestEmptyMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.DefaultInstance; } + } + + public override TestEmptyMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestEmptyMessage) { + return MergeFrom((TestEmptyMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestEmptyMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testEmptyMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testEmptyMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestEmptyMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { + private TestEmptyMessageWithExtensions() { } + private static readonly TestEmptyMessageWithExtensions defaultInstance = new TestEmptyMessageWithExtensions().MakeReadOnly(); + private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testEmptyMessageWithExtensionsFieldTags = new uint[] { }; + public static TestEmptyMessageWithExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestEmptyMessageWithExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestEmptyMessageWithExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testEmptyMessageWithExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestEmptyMessageWithExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestEmptyMessageWithExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestEmptyMessageWithExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestEmptyMessageWithExtensions result; + + private TestEmptyMessageWithExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestEmptyMessageWithExtensions original = result; + result = new TestEmptyMessageWithExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestEmptyMessageWithExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.Descriptor; } + } + + public override TestEmptyMessageWithExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.DefaultInstance; } + } + + public override TestEmptyMessageWithExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestEmptyMessageWithExtensions) { + return MergeFrom((TestEmptyMessageWithExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestEmptyMessageWithExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testEmptyMessageWithExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testEmptyMessageWithExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestEmptyMessageWithExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { + private TestMultipleExtensionRanges() { } + private static readonly TestMultipleExtensionRanges defaultInstance = new TestMultipleExtensionRanges().MakeReadOnly(); + private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; + private static readonly uint[] _testMultipleExtensionRangesFieldTags = new uint[] { }; + public static TestMultipleExtensionRanges DefaultInstance { + get { return defaultInstance; } + } + + public override TestMultipleExtensionRanges DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMultipleExtensionRanges ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMultipleExtensionRanges__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMultipleExtensionRangesFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(43, output); + extensionWriter.WriteUntil(4244, output); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMultipleExtensionRanges ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMultipleExtensionRanges MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMultipleExtensionRanges prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMultipleExtensionRanges cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMultipleExtensionRanges result; + + private TestMultipleExtensionRanges PrepareBuilder() { + if (resultIsReadOnly) { + TestMultipleExtensionRanges original = result; + result = new TestMultipleExtensionRanges(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMultipleExtensionRanges MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.Descriptor; } + } + + public override TestMultipleExtensionRanges DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.DefaultInstance; } + } + + public override TestMultipleExtensionRanges BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMultipleExtensionRanges) { + return MergeFrom((TestMultipleExtensionRanges) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMultipleExtensionRanges other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMultipleExtensionRangesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMultipleExtensionRangesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestMultipleExtensionRanges() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { + private TestReallyLargeTagNumber() { } + private static readonly TestReallyLargeTagNumber defaultInstance = new TestReallyLargeTagNumber().MakeReadOnly(); + private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; + private static readonly uint[] _testReallyLargeTagNumberFieldTags = new uint[] { 8, 2147483640 }; + public static TestReallyLargeTagNumber DefaultInstance { + get { return defaultInstance; } + } + + public override TestReallyLargeTagNumber DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestReallyLargeTagNumber ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public const int BbFieldNumber = 268435455; + private bool hasBb; + private int bb_; + public bool HasBb { + get { return hasBb; } + } + public int Bb { + get { return bb_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testReallyLargeTagNumberFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + if (hasBb) { + output.WriteInt32(268435455, field_names[1], Bb); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + if (hasBb) { + size += pb::CodedOutputStream.ComputeInt32Size(268435455, Bb); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestReallyLargeTagNumber ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestReallyLargeTagNumber MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestReallyLargeTagNumber prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestReallyLargeTagNumber cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestReallyLargeTagNumber result; + + private TestReallyLargeTagNumber PrepareBuilder() { + if (resultIsReadOnly) { + TestReallyLargeTagNumber original = result; + result = new TestReallyLargeTagNumber(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestReallyLargeTagNumber MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.Descriptor; } + } + + public override TestReallyLargeTagNumber DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.DefaultInstance; } + } + + public override TestReallyLargeTagNumber BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestReallyLargeTagNumber) { + return MergeFrom((TestReallyLargeTagNumber) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestReallyLargeTagNumber other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + if (other.HasBb) { + Bb = other.Bb; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testReallyLargeTagNumberFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testReallyLargeTagNumberFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + case 2147483640: { + result.hasBb = input.ReadInt32(ref result.bb_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + + public bool HasBb { + get { return result.hasBb; } + } + public int Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(int value) { + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = 0; + return this; + } + } + static TestReallyLargeTagNumber() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { + private TestRecursiveMessage() { } + private static readonly TestRecursiveMessage defaultInstance = new TestRecursiveMessage().MakeReadOnly(); + private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; + private static readonly uint[] _testRecursiveMessageFieldTags = new uint[] { 10, 16 }; + public static TestRecursiveMessage DefaultInstance { + get { return defaultInstance; } + } + + public override TestRecursiveMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRecursiveMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage a_; + public bool HasA { + get { return hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage A { + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; } + } + + public const int IFieldNumber = 2; + private bool hasI; + private int i_; + public bool HasI { + get { return hasI; } + } + public int I { + get { return i_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRecursiveMessageFieldNames; + if (hasA) { + output.WriteMessage(1, field_names[0], A); + } + if (hasI) { + output.WriteInt32(2, field_names[1], I); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeMessageSize(1, A); + } + if (hasI) { + size += pb::CodedOutputStream.ComputeInt32Size(2, I); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRecursiveMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRecursiveMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRecursiveMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRecursiveMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRecursiveMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRecursiveMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRecursiveMessage result; + + private TestRecursiveMessage PrepareBuilder() { + if (resultIsReadOnly) { + TestRecursiveMessage original = result; + result = new TestRecursiveMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRecursiveMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Descriptor; } + } + + public override TestRecursiveMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; } + } + + public override TestRecursiveMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRecursiveMessage) { + return MergeFrom((TestRecursiveMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRecursiveMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + MergeA(other.A); + } + if (other.HasI) { + I = other.I; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRecursiveMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRecursiveMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.CreateBuilder(); + if (result.hasA) { + subBuilder.MergeFrom(A); + } + input.ReadMessage(subBuilder, extensionRegistry); + A = subBuilder.BuildPartial(); + break; + } + case 16: { + result.hasI = input.ReadInt32(ref result.i_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasA = true; + result.a_ = builderForValue.Build(); + return this; + } + public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasA && + result.a_ != global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) { + result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); + } else { + result.a_ = value; + } + result.hasA = true; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = null; + return this; + } + + public bool HasI { + get { return result.hasI; } + } + public int I { + get { return result.I; } + set { SetI(value); } + } + public Builder SetI(int value) { + PrepareBuilder(); + result.hasI = true; + result.i_ = value; + return this; + } + public Builder ClearI() { + PrepareBuilder(); + result.hasI = false; + result.i_ = 0; + return this; + } + } + static TestRecursiveMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { + private TestMutualRecursionA() { } + private static readonly TestMutualRecursionA defaultInstance = new TestMutualRecursionA().MakeReadOnly(); + private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; + private static readonly uint[] _testMutualRecursionAFieldTags = new uint[] { 10 }; + public static TestMutualRecursionA DefaultInstance { + get { return defaultInstance; } + } + + public override TestMutualRecursionA DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMutualRecursionA ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable; } + } + + public const int BbFieldNumber = 1; + private bool hasBb; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB bb_; + public bool HasBb { + get { return hasBb; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB Bb { + get { return bb_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMutualRecursionAFieldNames; + if (hasBb) { + output.WriteMessage(1, field_names[0], Bb); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasBb) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Bb); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMutualRecursionA ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionA ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMutualRecursionA ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMutualRecursionA MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMutualRecursionA prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMutualRecursionA cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMutualRecursionA result; + + private TestMutualRecursionA PrepareBuilder() { + if (resultIsReadOnly) { + TestMutualRecursionA original = result; + result = new TestMutualRecursionA(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMutualRecursionA MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Descriptor; } + } + + public override TestMutualRecursionA DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; } + } + + public override TestMutualRecursionA BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMutualRecursionA) { + return MergeFrom((TestMutualRecursionA) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMutualRecursionA other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasBb) { + MergeBb(other.Bb); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMutualRecursionAFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMutualRecursionAFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.CreateBuilder(); + if (result.hasBb) { + subBuilder.MergeFrom(Bb); + } + input.ReadMessage(subBuilder, extensionRegistry); + Bb = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasBb { + get { return result.hasBb; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasBb = true; + result.bb_ = builderForValue.Build(); + return this; + } + public Builder MergeBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasBb && + result.bb_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) { + result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.CreateBuilder(result.bb_).MergeFrom(value).BuildPartial(); + } else { + result.bb_ = value; + } + result.hasBb = true; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = null; + return this; + } + } + static TestMutualRecursionA() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { + private TestMutualRecursionB() { } + private static readonly TestMutualRecursionB defaultInstance = new TestMutualRecursionB().MakeReadOnly(); + private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; + private static readonly uint[] _testMutualRecursionBFieldTags = new uint[] { 10, 16 }; + public static TestMutualRecursionB DefaultInstance { + get { return defaultInstance; } + } + + public override TestMutualRecursionB DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMutualRecursionB ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA a_; + public bool HasA { + get { return hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA A { + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; } + } + + public const int OptionalInt32FieldNumber = 2; + private bool hasOptionalInt32; + private int optionalInt32_; + public bool HasOptionalInt32 { + get { return hasOptionalInt32; } + } + public int OptionalInt32 { + get { return optionalInt32_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMutualRecursionBFieldNames; + if (hasA) { + output.WriteMessage(1, field_names[0], A); + } + if (hasOptionalInt32) { + output.WriteInt32(2, field_names[1], OptionalInt32); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeMessageSize(1, A); + } + if (hasOptionalInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(2, OptionalInt32); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMutualRecursionB ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionB ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMutualRecursionB ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMutualRecursionB MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMutualRecursionB prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMutualRecursionB cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMutualRecursionB result; + + private TestMutualRecursionB PrepareBuilder() { + if (resultIsReadOnly) { + TestMutualRecursionB original = result; + result = new TestMutualRecursionB(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMutualRecursionB MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Descriptor; } + } + + public override TestMutualRecursionB DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; } + } + + public override TestMutualRecursionB BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMutualRecursionB) { + return MergeFrom((TestMutualRecursionB) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMutualRecursionB other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + MergeA(other.A); + } + if (other.HasOptionalInt32) { + OptionalInt32 = other.OptionalInt32; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMutualRecursionBFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMutualRecursionBFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.CreateBuilder(); + if (result.hasA) { + subBuilder.MergeFrom(A); + } + input.ReadMessage(subBuilder, extensionRegistry); + A = subBuilder.BuildPartial(); + break; + } + case 16: { + result.hasOptionalInt32 = input.ReadInt32(ref result.optionalInt32_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasA = true; + result.a_ = builderForValue.Build(); + return this; + } + public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasA && + result.a_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) { + result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); + } else { + result.a_ = value; + } + result.hasA = true; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = null; + return this; + } + + public bool HasOptionalInt32 { + get { return result.hasOptionalInt32; } + } + public int OptionalInt32 { + get { return result.OptionalInt32; } + set { SetOptionalInt32(value); } + } + public Builder SetOptionalInt32(int value) { + PrepareBuilder(); + result.hasOptionalInt32 = true; + result.optionalInt32_ = value; + return this; + } + public Builder ClearOptionalInt32() { + PrepareBuilder(); + result.hasOptionalInt32 = false; + result.optionalInt32_ = 0; + return this; + } + } + static TestMutualRecursionB() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { + private TestDupFieldNumber() { } + private static readonly TestDupFieldNumber defaultInstance = new TestDupFieldNumber().MakeReadOnly(); + private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; + private static readonly uint[] _testDupFieldNumberFieldTags = new uint[] { 8, 27, 19 }; + public static TestDupFieldNumber DefaultInstance { + get { return defaultInstance; } + } + + public override TestDupFieldNumber DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDupFieldNumber ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Foo : pb::GeneratedMessage { + private Foo() { } + private static readonly Foo defaultInstance = new Foo().MakeReadOnly(); + private static readonly string[] _fooFieldNames = new string[] { "a" }; + private static readonly uint[] _fooFieldTags = new uint[] { 8 }; + public static Foo DefaultInstance { + get { return defaultInstance; } + } + + public override Foo DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Foo ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Foo__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fooFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Foo ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Foo ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Foo ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Foo ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Foo ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Foo ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Foo ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Foo ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Foo ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Foo ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Foo MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Foo prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Foo cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Foo result; + + private Foo PrepareBuilder() { + if (resultIsReadOnly) { + Foo original = result; + result = new Foo(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Foo MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Descriptor; } + } + + public override Foo DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; } + } + + public override Foo BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Foo) { + return MergeFrom((Foo) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Foo other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fooFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fooFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static Foo() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Bar : pb::GeneratedMessage { + private Bar() { } + private static readonly Bar defaultInstance = new Bar().MakeReadOnly(); + private static readonly string[] _barFieldNames = new string[] { "a" }; + private static readonly uint[] _barFieldTags = new uint[] { 8 }; + public static Bar DefaultInstance { + get { return defaultInstance; } + } + + public override Bar DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Bar ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Bar__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _barFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Bar ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Bar ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Bar ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Bar ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Bar ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Bar ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Bar ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Bar ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Bar ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Bar ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Bar MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Bar prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Bar cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Bar result; + + private Bar PrepareBuilder() { + if (resultIsReadOnly) { + Bar original = result; + result = new Bar(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Bar MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Descriptor; } + } + + public override Bar DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; } + } + + public override Bar BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Bar) { + return MergeFrom((Bar) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Bar other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_barFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _barFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static Bar() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public const int FooFieldNumber = 2; + private bool hasFoo; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo foo_; + public bool HasFoo { + get { return hasFoo; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo Foo { + get { return foo_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; } + } + + public const int BarFieldNumber = 3; + private bool hasBar; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar bar_; + public bool HasBar { + get { return hasBar; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar Bar { + get { return bar_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDupFieldNumberFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + if (hasFoo) { + output.WriteGroup(2, field_names[2], Foo); + } + if (hasBar) { + output.WriteGroup(3, field_names[1], Bar); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + if (hasFoo) { + size += pb::CodedOutputStream.ComputeGroupSize(2, Foo); + } + if (hasBar) { + size += pb::CodedOutputStream.ComputeGroupSize(3, Bar); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestDupFieldNumber ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDupFieldNumber ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDupFieldNumber ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDupFieldNumber MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDupFieldNumber prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDupFieldNumber cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDupFieldNumber result; + + private TestDupFieldNumber PrepareBuilder() { + if (resultIsReadOnly) { + TestDupFieldNumber original = result; + result = new TestDupFieldNumber(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDupFieldNumber MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Descriptor; } + } + + public override TestDupFieldNumber DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.DefaultInstance; } + } + + public override TestDupFieldNumber BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestDupFieldNumber) { + return MergeFrom((TestDupFieldNumber) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDupFieldNumber other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + if (other.HasFoo) { + MergeFoo(other.Foo); + } + if (other.HasBar) { + MergeBar(other.Bar); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDupFieldNumberFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDupFieldNumberFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + case 19: { + global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.CreateBuilder(); + if (result.hasFoo) { + subBuilder.MergeFrom(Foo); + } + input.ReadGroup(2, subBuilder, extensionRegistry); + Foo = subBuilder.BuildPartial(); + break; + } + case 27: { + global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.CreateBuilder(); + if (result.hasBar) { + subBuilder.MergeFrom(Bar); + } + input.ReadGroup(3, subBuilder, extensionRegistry); + Bar = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + + public bool HasFoo { + get { return result.hasFoo; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo Foo { + get { return result.Foo; } + set { SetFoo(value); } + } + public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasFoo = true; + result.foo_ = value; + return this; + } + public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasFoo = true; + result.foo_ = builderForValue.Build(); + return this; + } + public Builder MergeFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasFoo && + result.foo_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) { + result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.CreateBuilder(result.foo_).MergeFrom(value).BuildPartial(); + } else { + result.foo_ = value; + } + result.hasFoo = true; + return this; + } + public Builder ClearFoo() { + PrepareBuilder(); + result.hasFoo = false; + result.foo_ = null; + return this; + } + + public bool HasBar { + get { return result.hasBar; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar Bar { + get { return result.Bar; } + set { SetBar(value); } + } + public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBar = true; + result.bar_ = value; + return this; + } + public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasBar = true; + result.bar_ = builderForValue.Build(); + return this; + } + public Builder MergeBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasBar && + result.bar_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) { + result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.CreateBuilder(result.bar_).MergeFrom(value).BuildPartial(); + } else { + result.bar_ = value; + } + result.hasBar = true; + return this; + } + public Builder ClearBar() { + PrepareBuilder(); + result.hasBar = false; + result.bar_ = null; + return this; + } + } + static TestDupFieldNumber() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { + private TestNestedMessageHasBits() { } + private static readonly TestNestedMessageHasBits defaultInstance = new TestNestedMessageHasBits().MakeReadOnly(); + private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; + private static readonly uint[] _testNestedMessageHasBitsFieldTags = new uint[] { 10 }; + public static TestNestedMessageHasBits DefaultInstance { + get { return defaultInstance; } + } + + public override TestNestedMessageHasBits DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestNestedMessageHasBits ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); + private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; + private static readonly uint[] _nestedMessageFieldTags = new uint[] { 18, 8 }; + public static NestedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override NestedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NestedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__FieldAccessorTable; } + } + + public const int NestedmessageRepeatedInt32FieldNumber = 1; + private pbc::PopsicleList nestedmessageRepeatedInt32_ = new pbc::PopsicleList(); + public scg::IList NestedmessageRepeatedInt32List { + get { return pbc::Lists.AsReadOnly(nestedmessageRepeatedInt32_); } + } + public int NestedmessageRepeatedInt32Count { + get { return nestedmessageRepeatedInt32_.Count; } + } + public int GetNestedmessageRepeatedInt32(int index) { + return nestedmessageRepeatedInt32_[index]; + } + + public const int NestedmessageRepeatedForeignmessageFieldNumber = 2; + private pbc::PopsicleList nestedmessageRepeatedForeignmessage_ = new pbc::PopsicleList(); + public scg::IList NestedmessageRepeatedForeignmessageList { + get { return nestedmessageRepeatedForeignmessage_; } + } + public int NestedmessageRepeatedForeignmessageCount { + get { return nestedmessageRepeatedForeignmessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetNestedmessageRepeatedForeignmessage(int index) { + return nestedmessageRepeatedForeignmessage_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _nestedMessageFieldNames; + if (nestedmessageRepeatedInt32_.Count > 0) { + output.WriteInt32Array(1, field_names[1], nestedmessageRepeatedInt32_); + } + if (nestedmessageRepeatedForeignmessage_.Count > 0) { + output.WriteMessageArray(2, field_names[0], nestedmessageRepeatedForeignmessage_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in NestedmessageRepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * nestedmessageRepeatedInt32_.Count; + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessage element in NestedmessageRepeatedForeignmessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static NestedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NestedMessage MakeReadOnly() { + nestedmessageRepeatedInt32_.MakeReadOnly(); + nestedmessageRepeatedForeignmessage_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NestedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (resultIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NestedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Descriptor; } + } + + public override NestedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; } + } + + public override NestedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NestedMessage) { + return MergeFrom((NestedMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NestedMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.nestedmessageRepeatedInt32_.Count != 0) { + result.nestedmessageRepeatedInt32_.Add(other.nestedmessageRepeatedInt32_); + } + if (other.nestedmessageRepeatedForeignmessage_.Count != 0) { + result.nestedmessageRepeatedForeignmessage_.Add(other.nestedmessageRepeatedForeignmessage_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_nestedMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _nestedMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: + case 8: { + input.ReadInt32Array(tag, field_name, result.nestedmessageRepeatedInt32_); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.nestedmessageRepeatedForeignmessage_, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList NestedmessageRepeatedInt32List { + get { return PrepareBuilder().nestedmessageRepeatedInt32_; } + } + public int NestedmessageRepeatedInt32Count { + get { return result.NestedmessageRepeatedInt32Count; } + } + public int GetNestedmessageRepeatedInt32(int index) { + return result.GetNestedmessageRepeatedInt32(index); + } + public Builder SetNestedmessageRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_[index] = value; + return this; + } + public Builder AddNestedmessageRepeatedInt32(int value) { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_.Add(value); + return this; + } + public Builder AddRangeNestedmessageRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_.Add(values); + return this; + } + public Builder ClearNestedmessageRepeatedInt32() { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList NestedmessageRepeatedForeignmessageList { + get { return PrepareBuilder().nestedmessageRepeatedForeignmessage_; } + } + public int NestedmessageRepeatedForeignmessageCount { + get { return result.NestedmessageRepeatedForeignmessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetNestedmessageRepeatedForeignmessage(int index) { + return result.GetNestedmessageRepeatedForeignmessage(index); + } + public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_[index] = value; + return this; + } + public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Add(value); + return this; + } + public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeNestedmessageRepeatedForeignmessage(scg::IEnumerable values) { + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Add(values); + return this; + } + public Builder ClearNestedmessageRepeatedForeignmessage() { + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Clear(); + return this; + } + } + static NestedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int OptionalNestedMessageFieldNumber = 1; + private bool hasOptionalNestedMessage; + private global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage optionalNestedMessage_; + public bool HasOptionalNestedMessage { + get { return hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage OptionalNestedMessage { + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testNestedMessageHasBitsFieldNames; + if (hasOptionalNestedMessage) { + output.WriteMessage(1, field_names[0], OptionalNestedMessage); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalNestedMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalNestedMessage); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestNestedMessageHasBits ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestNestedMessageHasBits ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestNestedMessageHasBits MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestNestedMessageHasBits prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestNestedMessageHasBits cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestNestedMessageHasBits result; + + private TestNestedMessageHasBits PrepareBuilder() { + if (resultIsReadOnly) { + TestNestedMessageHasBits original = result; + result = new TestNestedMessageHasBits(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestNestedMessageHasBits MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Descriptor; } + } + + public override TestNestedMessageHasBits DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.DefaultInstance; } + } + + public override TestNestedMessageHasBits BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestNestedMessageHasBits) { + return MergeFrom((TestNestedMessageHasBits) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestNestedMessageHasBits other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalNestedMessage) { + MergeOptionalNestedMessage(other.OptionalNestedMessage); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testNestedMessageHasBitsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testNestedMessageHasBitsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.CreateBuilder(); + if (result.hasOptionalNestedMessage) { + subBuilder.MergeFrom(OptionalNestedMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalNestedMessage = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalNestedMessage { + get { return result.hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage OptionalNestedMessage { + get { return result.OptionalNestedMessage; } + set { SetOptionalNestedMessage(value); } + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = value; + return this; + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalNestedMessage && + result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) { + result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalNestedMessage_ = value; + } + result.hasOptionalNestedMessage = true; + return this; + } + public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); + result.hasOptionalNestedMessage = false; + result.optionalNestedMessage_ = null; + return this; + } + } + static TestNestedMessageHasBits() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { + private TestCamelCaseFieldNames() { } + private static readonly TestCamelCaseFieldNames defaultInstance = new TestCamelCaseFieldNames().MakeReadOnly(); + private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; + private static readonly uint[] _testCamelCaseFieldNamesFieldTags = new uint[] { 50, 24, 34, 8, 98, 72, 82, 56, 66, 90, 18, 42 }; + public static TestCamelCaseFieldNames DefaultInstance { + get { return defaultInstance; } + } + + public override TestCamelCaseFieldNames DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestCamelCaseFieldNames ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable; } + } + + public const int PrimitiveFieldFieldNumber = 1; + private bool hasPrimitiveField; + private int primitiveField_; + public bool HasPrimitiveField { + get { return hasPrimitiveField; } + } + public int PrimitiveField { + get { return primitiveField_; } + } + + public const int StringFieldFieldNumber = 2; + private bool hasStringField; + private string stringField_ = ""; + public bool HasStringField { + get { return hasStringField; } + } + public string StringField { + get { return stringField_; } + } + + public const int EnumFieldFieldNumber = 3; + private bool hasEnumField; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum enumField_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + public bool HasEnumField { + get { return hasEnumField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumField { + get { return enumField_; } + } + + public const int MessageFieldFieldNumber = 4; + private bool hasMessageField; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageField_; + public bool HasMessageField { + get { return hasMessageField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageField { + get { return messageField_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public const int StringPieceFieldFieldNumber = 5; + private bool hasStringPieceField; + private string stringPieceField_ = ""; + public bool HasStringPieceField { + get { return hasStringPieceField; } + } + public string StringPieceField { + get { return stringPieceField_; } + } + + public const int CordFieldFieldNumber = 6; + private bool hasCordField; + private string cordField_ = ""; + public bool HasCordField { + get { return hasCordField; } + } + public string CordField { + get { return cordField_; } + } + + public const int RepeatedPrimitiveFieldFieldNumber = 7; + private pbc::PopsicleList repeatedPrimitiveField_ = new pbc::PopsicleList(); + public scg::IList RepeatedPrimitiveFieldList { + get { return pbc::Lists.AsReadOnly(repeatedPrimitiveField_); } + } + public int RepeatedPrimitiveFieldCount { + get { return repeatedPrimitiveField_.Count; } + } + public int GetRepeatedPrimitiveField(int index) { + return repeatedPrimitiveField_[index]; + } + + public const int RepeatedStringFieldFieldNumber = 8; + private pbc::PopsicleList repeatedStringField_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringFieldList { + get { return pbc::Lists.AsReadOnly(repeatedStringField_); } + } + public int RepeatedStringFieldCount { + get { return repeatedStringField_.Count; } + } + public string GetRepeatedStringField(int index) { + return repeatedStringField_[index]; + } + + public const int RepeatedEnumFieldFieldNumber = 9; + private pbc::PopsicleList repeatedEnumField_ = new pbc::PopsicleList(); + public scg::IList RepeatedEnumFieldList { + get { return pbc::Lists.AsReadOnly(repeatedEnumField_); } + } + public int RepeatedEnumFieldCount { + get { return repeatedEnumField_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedEnumField(int index) { + return repeatedEnumField_[index]; + } + + public const int RepeatedMessageFieldFieldNumber = 10; + private pbc::PopsicleList repeatedMessageField_ = new pbc::PopsicleList(); + public scg::IList RepeatedMessageFieldList { + get { return repeatedMessageField_; } + } + public int RepeatedMessageFieldCount { + get { return repeatedMessageField_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedMessageField(int index) { + return repeatedMessageField_[index]; + } + + public const int RepeatedStringPieceFieldFieldNumber = 11; + private pbc::PopsicleList repeatedStringPieceField_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringPieceFieldList { + get { return pbc::Lists.AsReadOnly(repeatedStringPieceField_); } + } + public int RepeatedStringPieceFieldCount { + get { return repeatedStringPieceField_.Count; } + } + public string GetRepeatedStringPieceField(int index) { + return repeatedStringPieceField_[index]; + } + + public const int RepeatedCordFieldFieldNumber = 12; + private pbc::PopsicleList repeatedCordField_ = new pbc::PopsicleList(); + public scg::IList RepeatedCordFieldList { + get { return pbc::Lists.AsReadOnly(repeatedCordField_); } + } + public int RepeatedCordFieldCount { + get { return repeatedCordField_.Count; } + } + public string GetRepeatedCordField(int index) { + return repeatedCordField_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testCamelCaseFieldNamesFieldNames; + if (hasPrimitiveField) { + output.WriteInt32(1, field_names[3], PrimitiveField); + } + if (hasStringField) { + output.WriteString(2, field_names[10], StringField); + } + if (hasEnumField) { + output.WriteEnum(3, field_names[1], (int) EnumField, EnumField); + } + if (hasMessageField) { + output.WriteMessage(4, field_names[2], MessageField); + } + if (hasStringPieceField) { + output.WriteString(5, field_names[11], StringPieceField); + } + if (hasCordField) { + output.WriteString(6, field_names[0], CordField); + } + if (repeatedPrimitiveField_.Count > 0) { + output.WriteInt32Array(7, field_names[7], repeatedPrimitiveField_); + } + if (repeatedStringField_.Count > 0) { + output.WriteStringArray(8, field_names[8], repeatedStringField_); + } + if (repeatedEnumField_.Count > 0) { + output.WriteEnumArray(9, field_names[5], repeatedEnumField_); + } + if (repeatedMessageField_.Count > 0) { + output.WriteMessageArray(10, field_names[6], repeatedMessageField_); + } + if (repeatedStringPieceField_.Count > 0) { + output.WriteStringArray(11, field_names[9], repeatedStringPieceField_); + } + if (repeatedCordField_.Count > 0) { + output.WriteStringArray(12, field_names[4], repeatedCordField_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPrimitiveField) { + size += pb::CodedOutputStream.ComputeInt32Size(1, PrimitiveField); + } + if (hasStringField) { + size += pb::CodedOutputStream.ComputeStringSize(2, StringField); + } + if (hasEnumField) { + size += pb::CodedOutputStream.ComputeEnumSize(3, (int) EnumField); + } + if (hasMessageField) { + size += pb::CodedOutputStream.ComputeMessageSize(4, MessageField); + } + if (hasStringPieceField) { + size += pb::CodedOutputStream.ComputeStringSize(5, StringPieceField); + } + if (hasCordField) { + size += pb::CodedOutputStream.ComputeStringSize(6, CordField); + } + { + int dataSize = 0; + foreach (int element in RepeatedPrimitiveFieldList) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedPrimitiveField_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedStringFieldList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedStringField_.Count; + } + { + int dataSize = 0; + if (repeatedEnumField_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in repeatedEnumField_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1 * repeatedEnumField_.Count; + } + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessage element in RepeatedMessageFieldList) { + size += pb::CodedOutputStream.ComputeMessageSize(10, element); + } + { + int dataSize = 0; + foreach (string element in RepeatedStringPieceFieldList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedStringPieceField_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedCordFieldList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedCordField_.Count; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestCamelCaseFieldNames ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestCamelCaseFieldNames MakeReadOnly() { + repeatedPrimitiveField_.MakeReadOnly(); + repeatedStringField_.MakeReadOnly(); + repeatedEnumField_.MakeReadOnly(); + repeatedMessageField_.MakeReadOnly(); + repeatedStringPieceField_.MakeReadOnly(); + repeatedCordField_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestCamelCaseFieldNames prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestCamelCaseFieldNames cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestCamelCaseFieldNames result; + + private TestCamelCaseFieldNames PrepareBuilder() { + if (resultIsReadOnly) { + TestCamelCaseFieldNames original = result; + result = new TestCamelCaseFieldNames(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestCamelCaseFieldNames MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.Descriptor; } + } + + public override TestCamelCaseFieldNames DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.DefaultInstance; } + } + + public override TestCamelCaseFieldNames BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestCamelCaseFieldNames) { + return MergeFrom((TestCamelCaseFieldNames) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestCamelCaseFieldNames other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasPrimitiveField) { + PrimitiveField = other.PrimitiveField; + } + if (other.HasStringField) { + StringField = other.StringField; + } + if (other.HasEnumField) { + EnumField = other.EnumField; + } + if (other.HasMessageField) { + MergeMessageField(other.MessageField); + } + if (other.HasStringPieceField) { + StringPieceField = other.StringPieceField; + } + if (other.HasCordField) { + CordField = other.CordField; + } + if (other.repeatedPrimitiveField_.Count != 0) { + result.repeatedPrimitiveField_.Add(other.repeatedPrimitiveField_); + } + if (other.repeatedStringField_.Count != 0) { + result.repeatedStringField_.Add(other.repeatedStringField_); + } + if (other.repeatedEnumField_.Count != 0) { + result.repeatedEnumField_.Add(other.repeatedEnumField_); + } + if (other.repeatedMessageField_.Count != 0) { + result.repeatedMessageField_.Add(other.repeatedMessageField_); + } + if (other.repeatedStringPieceField_.Count != 0) { + result.repeatedStringPieceField_.Add(other.repeatedStringPieceField_); + } + if (other.repeatedCordField_.Count != 0) { + result.repeatedCordField_.Add(other.repeatedCordField_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testCamelCaseFieldNamesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testCamelCaseFieldNamesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasPrimitiveField = input.ReadInt32(ref result.primitiveField_); + break; + } + case 18: { + result.hasStringField = input.ReadString(ref result.stringField_); + break; + } + case 24: { + object unknown; + if(input.ReadEnum(ref result.enumField_, out unknown)) { + result.hasEnumField = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(3, (ulong)(int)unknown); + } + break; + } + case 34: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(); + if (result.hasMessageField) { + subBuilder.MergeFrom(MessageField); + } + input.ReadMessage(subBuilder, extensionRegistry); + MessageField = subBuilder.BuildPartial(); + break; + } + case 42: { + result.hasStringPieceField = input.ReadString(ref result.stringPieceField_); + break; + } + case 50: { + result.hasCordField = input.ReadString(ref result.cordField_); + break; + } + case 58: + case 56: { + input.ReadInt32Array(tag, field_name, result.repeatedPrimitiveField_); + break; + } + case 66: { + input.ReadStringArray(tag, field_name, result.repeatedStringField_); + break; + } + case 74: + case 72: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedEnumField_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(9, (ulong)(int)rawValue); + } + break; + } + case 82: { + input.ReadMessageArray(tag, field_name, result.repeatedMessageField_, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance, extensionRegistry); + break; + } + case 90: { + input.ReadStringArray(tag, field_name, result.repeatedStringPieceField_); + break; + } + case 98: { + input.ReadStringArray(tag, field_name, result.repeatedCordField_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasPrimitiveField { + get { return result.hasPrimitiveField; } + } + public int PrimitiveField { + get { return result.PrimitiveField; } + set { SetPrimitiveField(value); } + } + public Builder SetPrimitiveField(int value) { + PrepareBuilder(); + result.hasPrimitiveField = true; + result.primitiveField_ = value; + return this; + } + public Builder ClearPrimitiveField() { + PrepareBuilder(); + result.hasPrimitiveField = false; + result.primitiveField_ = 0; + return this; + } + + public bool HasStringField { + get { return result.hasStringField; } + } + public string StringField { + get { return result.StringField; } + set { SetStringField(value); } + } + public Builder SetStringField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasStringField = true; + result.stringField_ = value; + return this; + } + public Builder ClearStringField() { + PrepareBuilder(); + result.hasStringField = false; + result.stringField_ = ""; + return this; + } + + public bool HasEnumField { + get { return result.hasEnumField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumField { + get { return result.EnumField; } + set { SetEnumField(value); } + } + public Builder SetEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasEnumField = true; + result.enumField_ = value; + return this; + } + public Builder ClearEnumField() { + PrepareBuilder(); + result.hasEnumField = false; + result.enumField_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + return this; + } + + public bool HasMessageField { + get { return result.hasMessageField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageField { + get { return result.MessageField; } + set { SetMessageField(value); } + } + public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessageField = true; + result.messageField_ = value; + return this; + } + public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMessageField = true; + result.messageField_ = builderForValue.Build(); + return this; + } + public Builder MergeMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMessageField && + result.messageField_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageField_).MergeFrom(value).BuildPartial(); + } else { + result.messageField_ = value; + } + result.hasMessageField = true; + return this; + } + public Builder ClearMessageField() { + PrepareBuilder(); + result.hasMessageField = false; + result.messageField_ = null; + return this; + } + + public bool HasStringPieceField { + get { return result.hasStringPieceField; } + } + public string StringPieceField { + get { return result.StringPieceField; } + set { SetStringPieceField(value); } + } + public Builder SetStringPieceField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasStringPieceField = true; + result.stringPieceField_ = value; + return this; + } + public Builder ClearStringPieceField() { + PrepareBuilder(); + result.hasStringPieceField = false; + result.stringPieceField_ = ""; + return this; + } + + public bool HasCordField { + get { return result.hasCordField; } + } + public string CordField { + get { return result.CordField; } + set { SetCordField(value); } + } + public Builder SetCordField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasCordField = true; + result.cordField_ = value; + return this; + } + public Builder ClearCordField() { + PrepareBuilder(); + result.hasCordField = false; + result.cordField_ = ""; + return this; + } + + public pbc::IPopsicleList RepeatedPrimitiveFieldList { + get { return PrepareBuilder().repeatedPrimitiveField_; } + } + public int RepeatedPrimitiveFieldCount { + get { return result.RepeatedPrimitiveFieldCount; } + } + public int GetRepeatedPrimitiveField(int index) { + return result.GetRepeatedPrimitiveField(index); + } + public Builder SetRepeatedPrimitiveField(int index, int value) { + PrepareBuilder(); + result.repeatedPrimitiveField_[index] = value; + return this; + } + public Builder AddRepeatedPrimitiveField(int value) { + PrepareBuilder(); + result.repeatedPrimitiveField_.Add(value); + return this; + } + public Builder AddRangeRepeatedPrimitiveField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedPrimitiveField_.Add(values); + return this; + } + public Builder ClearRepeatedPrimitiveField() { + PrepareBuilder(); + result.repeatedPrimitiveField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringFieldList { + get { return PrepareBuilder().repeatedStringField_; } + } + public int RepeatedStringFieldCount { + get { return result.RepeatedStringFieldCount; } + } + public string GetRepeatedStringField(int index) { + return result.GetRepeatedStringField(index); + } + public Builder SetRepeatedStringField(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringField_[index] = value; + return this; + } + public Builder AddRepeatedStringField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringField_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringField_.Add(values); + return this; + } + public Builder ClearRepeatedStringField() { + PrepareBuilder(); + result.repeatedStringField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedEnumFieldList { + get { return PrepareBuilder().repeatedEnumField_; } + } + public int RepeatedEnumFieldCount { + get { return result.RepeatedEnumFieldCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedEnumField(int index) { + return result.GetRepeatedEnumField(index); + } + public Builder SetRepeatedEnumField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedEnumField_[index] = value; + return this; + } + public Builder AddRepeatedEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedEnumField_.Add(value); + return this; + } + public Builder AddRangeRepeatedEnumField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedEnumField_.Add(values); + return this; + } + public Builder ClearRepeatedEnumField() { + PrepareBuilder(); + result.repeatedEnumField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedMessageFieldList { + get { return PrepareBuilder().repeatedMessageField_; } + } + public int RepeatedMessageFieldCount { + get { return result.RepeatedMessageFieldCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedMessageField(int index) { + return result.GetRepeatedMessageField(index); + } + public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessageField_[index] = value; + return this; + } + public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessageField_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessageField_.Add(value); + return this; + } + public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessageField_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedMessageField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedMessageField_.Add(values); + return this; + } + public Builder ClearRepeatedMessageField() { + PrepareBuilder(); + result.repeatedMessageField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringPieceFieldList { + get { return PrepareBuilder().repeatedStringPieceField_; } + } + public int RepeatedStringPieceFieldCount { + get { return result.RepeatedStringPieceFieldCount; } + } + public string GetRepeatedStringPieceField(int index) { + return result.GetRepeatedStringPieceField(index); + } + public Builder SetRepeatedStringPieceField(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPieceField_[index] = value; + return this; + } + public Builder AddRepeatedStringPieceField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPieceField_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringPieceField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringPieceField_.Add(values); + return this; + } + public Builder ClearRepeatedStringPieceField() { + PrepareBuilder(); + result.repeatedStringPieceField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedCordFieldList { + get { return PrepareBuilder().repeatedCordField_; } + } + public int RepeatedCordFieldCount { + get { return result.RepeatedCordFieldCount; } + } + public string GetRepeatedCordField(int index) { + return result.GetRepeatedCordField(index); + } + public Builder SetRepeatedCordField(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCordField_[index] = value; + return this; + } + public Builder AddRepeatedCordField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCordField_.Add(value); + return this; + } + public Builder AddRangeRepeatedCordField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedCordField_.Add(values); + return this; + } + public Builder ClearRepeatedCordField() { + PrepareBuilder(); + result.repeatedCordField_.Clear(); + return this; + } + } + static TestCamelCaseFieldNames() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestFieldOrderings : pb::ExtendableMessage { + private TestFieldOrderings() { } + private static readonly TestFieldOrderings defaultInstance = new TestFieldOrderings().MakeReadOnly(); + private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; + private static readonly uint[] _testFieldOrderingsFieldTags = new uint[] { 813, 8, 90 }; + public static TestFieldOrderings DefaultInstance { + get { return defaultInstance; } + } + + public override TestFieldOrderings DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestFieldOrderings ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestFieldOrderings__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable; } + } + + public const int MyStringFieldNumber = 11; + private bool hasMyString; + private string myString_ = ""; + public bool HasMyString { + get { return hasMyString; } + } + public string MyString { + get { return myString_; } + } + + public const int MyIntFieldNumber = 1; + private bool hasMyInt; + private long myInt_; + public bool HasMyInt { + get { return hasMyInt; } + } + public long MyInt { + get { return myInt_; } + } + + public const int MyFloatFieldNumber = 101; + private bool hasMyFloat; + private float myFloat_; + public bool HasMyFloat { + get { return hasMyFloat; } + } + public float MyFloat { + get { return myFloat_; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testFieldOrderingsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasMyInt) { + output.WriteInt64(1, field_names[1], MyInt); + } + extensionWriter.WriteUntil(11, output); + if (hasMyString) { + output.WriteString(11, field_names[2], MyString); + } + extensionWriter.WriteUntil(101, output); + if (hasMyFloat) { + output.WriteFloat(101, field_names[0], MyFloat); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasMyString) { + size += pb::CodedOutputStream.ComputeStringSize(11, MyString); + } + if (hasMyInt) { + size += pb::CodedOutputStream.ComputeInt64Size(1, MyInt); + } + if (hasMyFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(101, MyFloat); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestFieldOrderings ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestFieldOrderings ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestFieldOrderings ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestFieldOrderings MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestFieldOrderings prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestFieldOrderings cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestFieldOrderings result; + + private TestFieldOrderings PrepareBuilder() { + if (resultIsReadOnly) { + TestFieldOrderings original = result; + result = new TestFieldOrderings(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestFieldOrderings MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.Descriptor; } + } + + public override TestFieldOrderings DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.DefaultInstance; } + } + + public override TestFieldOrderings BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestFieldOrderings) { + return MergeFrom((TestFieldOrderings) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestFieldOrderings other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasMyString) { + MyString = other.MyString; + } + if (other.HasMyInt) { + MyInt = other.MyInt; + } + if (other.HasMyFloat) { + MyFloat = other.MyFloat; + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testFieldOrderingsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testFieldOrderingsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasMyInt = input.ReadInt64(ref result.myInt_); + break; + } + case 90: { + result.hasMyString = input.ReadString(ref result.myString_); + break; + } + case 813: { + result.hasMyFloat = input.ReadFloat(ref result.myFloat_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasMyString { + get { return result.hasMyString; } + } + public string MyString { + get { return result.MyString; } + set { SetMyString(value); } + } + public Builder SetMyString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMyString = true; + result.myString_ = value; + return this; + } + public Builder ClearMyString() { + PrepareBuilder(); + result.hasMyString = false; + result.myString_ = ""; + return this; + } + + public bool HasMyInt { + get { return result.hasMyInt; } + } + public long MyInt { + get { return result.MyInt; } + set { SetMyInt(value); } + } + public Builder SetMyInt(long value) { + PrepareBuilder(); + result.hasMyInt = true; + result.myInt_ = value; + return this; + } + public Builder ClearMyInt() { + PrepareBuilder(); + result.hasMyInt = false; + result.myInt_ = 0L; + return this; + } + + public bool HasMyFloat { + get { return result.hasMyFloat; } + } + public float MyFloat { + get { return result.MyFloat; } + set { SetMyFloat(value); } + } + public Builder SetMyFloat(float value) { + PrepareBuilder(); + result.hasMyFloat = true; + result.myFloat_ = value; + return this; + } + public Builder ClearMyFloat() { + PrepareBuilder(); + result.hasMyFloat = false; + result.myFloat_ = 0F; + return this; + } + } + static TestFieldOrderings() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { + private TestExtremeDefaultValues() { } + private static readonly TestExtremeDefaultValues defaultInstance = new TestExtremeDefaultValues().MakeReadOnly(); + private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "cpp_trigraph", "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; + private static readonly uint[] _testExtremeDefaultValuesFieldTags = new uint[] { 162, 10, 113, 141, 101, 16, 24, 129, 157, 121, 149, 93, 85, 69, 77, 32, 40, 109, 50, 61 }; + public static TestExtremeDefaultValues DefaultInstance { + get { return defaultInstance; } + } + + public override TestExtremeDefaultValues DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestExtremeDefaultValues ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestExtremeDefaultValues__FieldAccessorTable; } + } + + public const int EscapedBytesFieldNumber = 1; + private bool hasEscapedBytes; + private pb::ByteString escapedBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[0].DefaultValue; + public bool HasEscapedBytes { + get { return hasEscapedBytes; } + } + public pb::ByteString EscapedBytes { + get { return escapedBytes_; } + } + + public const int LargeUint32FieldNumber = 2; + private bool hasLargeUint32; + private uint largeUint32_ = 4294967295; + public bool HasLargeUint32 { + get { return hasLargeUint32; } + } + [global::System.CLSCompliant(false)] + public uint LargeUint32 { + get { return largeUint32_; } + } + + public const int LargeUint64FieldNumber = 3; + private bool hasLargeUint64; + private ulong largeUint64_ = 18446744073709551615UL; + public bool HasLargeUint64 { + get { return hasLargeUint64; } + } + [global::System.CLSCompliant(false)] + public ulong LargeUint64 { + get { return largeUint64_; } + } + + public const int SmallInt32FieldNumber = 4; + private bool hasSmallInt32; + private int smallInt32_ = -2147483647; + public bool HasSmallInt32 { + get { return hasSmallInt32; } + } + public int SmallInt32 { + get { return smallInt32_; } + } + + public const int SmallInt64FieldNumber = 5; + private bool hasSmallInt64; + private long smallInt64_ = -9223372036854775807L; + public bool HasSmallInt64 { + get { return hasSmallInt64; } + } + public long SmallInt64 { + get { return smallInt64_; } + } + + public const int Utf8StringFieldNumber = 6; + private bool hasUtf8String; + private string utf8String_ = (string) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[5].DefaultValue; + public bool HasUtf8String { + get { return hasUtf8String; } + } + public string Utf8String { + get { return utf8String_; } + } + + public const int ZeroFloatFieldNumber = 7; + private bool hasZeroFloat; + private float zeroFloat_; + public bool HasZeroFloat { + get { return hasZeroFloat; } + } + public float ZeroFloat { + get { return zeroFloat_; } + } + + public const int OneFloatFieldNumber = 8; + private bool hasOneFloat; + private float oneFloat_ = 1F; + public bool HasOneFloat { + get { return hasOneFloat; } + } + public float OneFloat { + get { return oneFloat_; } + } + + public const int SmallFloatFieldNumber = 9; + private bool hasSmallFloat; + private float smallFloat_ = 1.5F; + public bool HasSmallFloat { + get { return hasSmallFloat; } + } + public float SmallFloat { + get { return smallFloat_; } + } + + public const int NegativeOneFloatFieldNumber = 10; + private bool hasNegativeOneFloat; + private float negativeOneFloat_ = -1F; + public bool HasNegativeOneFloat { + get { return hasNegativeOneFloat; } + } + public float NegativeOneFloat { + get { return negativeOneFloat_; } + } + + public const int NegativeFloatFieldNumber = 11; + private bool hasNegativeFloat; + private float negativeFloat_ = -1.5F; + public bool HasNegativeFloat { + get { return hasNegativeFloat; } + } + public float NegativeFloat { + get { return negativeFloat_; } + } + + public const int LargeFloatFieldNumber = 12; + private bool hasLargeFloat; + private float largeFloat_ = 2E+08F; + public bool HasLargeFloat { + get { return hasLargeFloat; } + } + public float LargeFloat { + get { return largeFloat_; } + } + + public const int SmallNegativeFloatFieldNumber = 13; + private bool hasSmallNegativeFloat; + private float smallNegativeFloat_ = -8E-28F; + public bool HasSmallNegativeFloat { + get { return hasSmallNegativeFloat; } + } + public float SmallNegativeFloat { + get { return smallNegativeFloat_; } + } + + public const int InfDoubleFieldNumber = 14; + private bool hasInfDouble; + private double infDouble_ = double.PositiveInfinity; + public bool HasInfDouble { + get { return hasInfDouble; } + } + public double InfDouble { + get { return infDouble_; } + } + + public const int NegInfDoubleFieldNumber = 15; + private bool hasNegInfDouble; + private double negInfDouble_ = double.NegativeInfinity; + public bool HasNegInfDouble { + get { return hasNegInfDouble; } + } + public double NegInfDouble { + get { return negInfDouble_; } + } + + public const int NanDoubleFieldNumber = 16; + private bool hasNanDouble; + private double nanDouble_ = double.NaN; + public bool HasNanDouble { + get { return hasNanDouble; } + } + public double NanDouble { + get { return nanDouble_; } + } + + public const int InfFloatFieldNumber = 17; + private bool hasInfFloat; + private float infFloat_ = float.PositiveInfinity; + public bool HasInfFloat { + get { return hasInfFloat; } + } + public float InfFloat { + get { return infFloat_; } + } + + public const int NegInfFloatFieldNumber = 18; + private bool hasNegInfFloat; + private float negInfFloat_ = float.NegativeInfinity; + public bool HasNegInfFloat { + get { return hasNegInfFloat; } + } + public float NegInfFloat { + get { return negInfFloat_; } + } + + public const int NanFloatFieldNumber = 19; + private bool hasNanFloat; + private float nanFloat_ = float.NaN; + public bool HasNanFloat { + get { return hasNanFloat; } + } + public float NanFloat { + get { return nanFloat_; } + } + + public const int CppTrigraphFieldNumber = 20; + private bool hasCppTrigraph; + private string cppTrigraph_ = "? ? ?? ?? ??? ??/ ??-"; + public bool HasCppTrigraph { + get { return hasCppTrigraph; } + } + public string CppTrigraph { + get { return cppTrigraph_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testExtremeDefaultValuesFieldNames; + if (hasEscapedBytes) { + output.WriteBytes(1, field_names[1], EscapedBytes); + } + if (hasLargeUint32) { + output.WriteUInt32(2, field_names[5], LargeUint32); + } + if (hasLargeUint64) { + output.WriteUInt64(3, field_names[6], LargeUint64); + } + if (hasSmallInt32) { + output.WriteInt32(4, field_names[15], SmallInt32); + } + if (hasSmallInt64) { + output.WriteInt64(5, field_names[16], SmallInt64); + } + if (hasUtf8String) { + output.WriteString(6, field_names[18], Utf8String); + } + if (hasZeroFloat) { + output.WriteFloat(7, field_names[19], ZeroFloat); + } + if (hasOneFloat) { + output.WriteFloat(8, field_names[13], OneFloat); + } + if (hasSmallFloat) { + output.WriteFloat(9, field_names[14], SmallFloat); + } + if (hasNegativeOneFloat) { + output.WriteFloat(10, field_names[12], NegativeOneFloat); + } + if (hasNegativeFloat) { + output.WriteFloat(11, field_names[11], NegativeFloat); + } + if (hasLargeFloat) { + output.WriteFloat(12, field_names[4], LargeFloat); + } + if (hasSmallNegativeFloat) { + output.WriteFloat(13, field_names[17], SmallNegativeFloat); + } + if (hasInfDouble) { + output.WriteDouble(14, field_names[2], InfDouble); + } + if (hasNegInfDouble) { + output.WriteDouble(15, field_names[9], NegInfDouble); + } + if (hasNanDouble) { + output.WriteDouble(16, field_names[7], NanDouble); + } + if (hasInfFloat) { + output.WriteFloat(17, field_names[3], InfFloat); + } + if (hasNegInfFloat) { + output.WriteFloat(18, field_names[10], NegInfFloat); + } + if (hasNanFloat) { + output.WriteFloat(19, field_names[8], NanFloat); + } + if (hasCppTrigraph) { + output.WriteString(20, field_names[0], CppTrigraph); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasEscapedBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(1, EscapedBytes); + } + if (hasLargeUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(2, LargeUint32); + } + if (hasLargeUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(3, LargeUint64); + } + if (hasSmallInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(4, SmallInt32); + } + if (hasSmallInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(5, SmallInt64); + } + if (hasUtf8String) { + size += pb::CodedOutputStream.ComputeStringSize(6, Utf8String); + } + if (hasZeroFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(7, ZeroFloat); + } + if (hasOneFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(8, OneFloat); + } + if (hasSmallFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(9, SmallFloat); + } + if (hasNegativeOneFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(10, NegativeOneFloat); + } + if (hasNegativeFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(11, NegativeFloat); + } + if (hasLargeFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(12, LargeFloat); + } + if (hasSmallNegativeFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(13, SmallNegativeFloat); + } + if (hasInfDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(14, InfDouble); + } + if (hasNegInfDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(15, NegInfDouble); + } + if (hasNanDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(16, NanDouble); + } + if (hasInfFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(17, InfFloat); + } + if (hasNegInfFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(18, NegInfFloat); + } + if (hasNanFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(19, NanFloat); + } + if (hasCppTrigraph) { + size += pb::CodedOutputStream.ComputeStringSize(20, CppTrigraph); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestExtremeDefaultValues ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestExtremeDefaultValues ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestExtremeDefaultValues MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestExtremeDefaultValues prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestExtremeDefaultValues cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestExtremeDefaultValues result; + + private TestExtremeDefaultValues PrepareBuilder() { + if (resultIsReadOnly) { + TestExtremeDefaultValues original = result; + result = new TestExtremeDefaultValues(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestExtremeDefaultValues MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor; } + } + + public override TestExtremeDefaultValues DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.DefaultInstance; } + } + + public override TestExtremeDefaultValues BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestExtremeDefaultValues) { + return MergeFrom((TestExtremeDefaultValues) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestExtremeDefaultValues other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasEscapedBytes) { + EscapedBytes = other.EscapedBytes; + } + if (other.HasLargeUint32) { + LargeUint32 = other.LargeUint32; + } + if (other.HasLargeUint64) { + LargeUint64 = other.LargeUint64; + } + if (other.HasSmallInt32) { + SmallInt32 = other.SmallInt32; + } + if (other.HasSmallInt64) { + SmallInt64 = other.SmallInt64; + } + if (other.HasUtf8String) { + Utf8String = other.Utf8String; + } + if (other.HasZeroFloat) { + ZeroFloat = other.ZeroFloat; + } + if (other.HasOneFloat) { + OneFloat = other.OneFloat; + } + if (other.HasSmallFloat) { + SmallFloat = other.SmallFloat; + } + if (other.HasNegativeOneFloat) { + NegativeOneFloat = other.NegativeOneFloat; + } + if (other.HasNegativeFloat) { + NegativeFloat = other.NegativeFloat; + } + if (other.HasLargeFloat) { + LargeFloat = other.LargeFloat; + } + if (other.HasSmallNegativeFloat) { + SmallNegativeFloat = other.SmallNegativeFloat; + } + if (other.HasInfDouble) { + InfDouble = other.InfDouble; + } + if (other.HasNegInfDouble) { + NegInfDouble = other.NegInfDouble; + } + if (other.HasNanDouble) { + NanDouble = other.NanDouble; + } + if (other.HasInfFloat) { + InfFloat = other.InfFloat; + } + if (other.HasNegInfFloat) { + NegInfFloat = other.NegInfFloat; + } + if (other.HasNanFloat) { + NanFloat = other.NanFloat; + } + if (other.HasCppTrigraph) { + CppTrigraph = other.CppTrigraph; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testExtremeDefaultValuesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testExtremeDefaultValuesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasEscapedBytes = input.ReadBytes(ref result.escapedBytes_); + break; + } + case 16: { + result.hasLargeUint32 = input.ReadUInt32(ref result.largeUint32_); + break; + } + case 24: { + result.hasLargeUint64 = input.ReadUInt64(ref result.largeUint64_); + break; + } + case 32: { + result.hasSmallInt32 = input.ReadInt32(ref result.smallInt32_); + break; + } + case 40: { + result.hasSmallInt64 = input.ReadInt64(ref result.smallInt64_); + break; + } + case 50: { + result.hasUtf8String = input.ReadString(ref result.utf8String_); + break; + } + case 61: { + result.hasZeroFloat = input.ReadFloat(ref result.zeroFloat_); + break; + } + case 69: { + result.hasOneFloat = input.ReadFloat(ref result.oneFloat_); + break; + } + case 77: { + result.hasSmallFloat = input.ReadFloat(ref result.smallFloat_); + break; + } + case 85: { + result.hasNegativeOneFloat = input.ReadFloat(ref result.negativeOneFloat_); + break; + } + case 93: { + result.hasNegativeFloat = input.ReadFloat(ref result.negativeFloat_); + break; + } + case 101: { + result.hasLargeFloat = input.ReadFloat(ref result.largeFloat_); + break; + } + case 109: { + result.hasSmallNegativeFloat = input.ReadFloat(ref result.smallNegativeFloat_); + break; + } + case 113: { + result.hasInfDouble = input.ReadDouble(ref result.infDouble_); + break; + } + case 121: { + result.hasNegInfDouble = input.ReadDouble(ref result.negInfDouble_); + break; + } + case 129: { + result.hasNanDouble = input.ReadDouble(ref result.nanDouble_); + break; + } + case 141: { + result.hasInfFloat = input.ReadFloat(ref result.infFloat_); + break; + } + case 149: { + result.hasNegInfFloat = input.ReadFloat(ref result.negInfFloat_); + break; + } + case 157: { + result.hasNanFloat = input.ReadFloat(ref result.nanFloat_); + break; + } + case 162: { + result.hasCppTrigraph = input.ReadString(ref result.cppTrigraph_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasEscapedBytes { + get { return result.hasEscapedBytes; } + } + public pb::ByteString EscapedBytes { + get { return result.EscapedBytes; } + set { SetEscapedBytes(value); } + } + public Builder SetEscapedBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasEscapedBytes = true; + result.escapedBytes_ = value; + return this; + } + public Builder ClearEscapedBytes() { + PrepareBuilder(); + result.hasEscapedBytes = false; + result.escapedBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[0].DefaultValue; + return this; + } + + public bool HasLargeUint32 { + get { return result.hasLargeUint32; } + } + [global::System.CLSCompliant(false)] + public uint LargeUint32 { + get { return result.LargeUint32; } + set { SetLargeUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetLargeUint32(uint value) { + PrepareBuilder(); + result.hasLargeUint32 = true; + result.largeUint32_ = value; + return this; + } + public Builder ClearLargeUint32() { + PrepareBuilder(); + result.hasLargeUint32 = false; + result.largeUint32_ = 4294967295; + return this; + } + + public bool HasLargeUint64 { + get { return result.hasLargeUint64; } + } + [global::System.CLSCompliant(false)] + public ulong LargeUint64 { + get { return result.LargeUint64; } + set { SetLargeUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetLargeUint64(ulong value) { + PrepareBuilder(); + result.hasLargeUint64 = true; + result.largeUint64_ = value; + return this; + } + public Builder ClearLargeUint64() { + PrepareBuilder(); + result.hasLargeUint64 = false; + result.largeUint64_ = 18446744073709551615UL; + return this; + } + + public bool HasSmallInt32 { + get { return result.hasSmallInt32; } + } + public int SmallInt32 { + get { return result.SmallInt32; } + set { SetSmallInt32(value); } + } + public Builder SetSmallInt32(int value) { + PrepareBuilder(); + result.hasSmallInt32 = true; + result.smallInt32_ = value; + return this; + } + public Builder ClearSmallInt32() { + PrepareBuilder(); + result.hasSmallInt32 = false; + result.smallInt32_ = -2147483647; + return this; + } + + public bool HasSmallInt64 { + get { return result.hasSmallInt64; } + } + public long SmallInt64 { + get { return result.SmallInt64; } + set { SetSmallInt64(value); } + } + public Builder SetSmallInt64(long value) { + PrepareBuilder(); + result.hasSmallInt64 = true; + result.smallInt64_ = value; + return this; + } + public Builder ClearSmallInt64() { + PrepareBuilder(); + result.hasSmallInt64 = false; + result.smallInt64_ = -9223372036854775807L; + return this; + } + + public bool HasUtf8String { + get { return result.hasUtf8String; } + } + public string Utf8String { + get { return result.Utf8String; } + set { SetUtf8String(value); } + } + public Builder SetUtf8String(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasUtf8String = true; + result.utf8String_ = value; + return this; + } + public Builder ClearUtf8String() { + PrepareBuilder(); + result.hasUtf8String = false; + result.utf8String_ = (string) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[5].DefaultValue; + return this; + } + + public bool HasZeroFloat { + get { return result.hasZeroFloat; } + } + public float ZeroFloat { + get { return result.ZeroFloat; } + set { SetZeroFloat(value); } + } + public Builder SetZeroFloat(float value) { + PrepareBuilder(); + result.hasZeroFloat = true; + result.zeroFloat_ = value; + return this; + } + public Builder ClearZeroFloat() { + PrepareBuilder(); + result.hasZeroFloat = false; + result.zeroFloat_ = 0F; + return this; + } + + public bool HasOneFloat { + get { return result.hasOneFloat; } + } + public float OneFloat { + get { return result.OneFloat; } + set { SetOneFloat(value); } + } + public Builder SetOneFloat(float value) { + PrepareBuilder(); + result.hasOneFloat = true; + result.oneFloat_ = value; + return this; + } + public Builder ClearOneFloat() { + PrepareBuilder(); + result.hasOneFloat = false; + result.oneFloat_ = 1F; + return this; + } + + public bool HasSmallFloat { + get { return result.hasSmallFloat; } + } + public float SmallFloat { + get { return result.SmallFloat; } + set { SetSmallFloat(value); } + } + public Builder SetSmallFloat(float value) { + PrepareBuilder(); + result.hasSmallFloat = true; + result.smallFloat_ = value; + return this; + } + public Builder ClearSmallFloat() { + PrepareBuilder(); + result.hasSmallFloat = false; + result.smallFloat_ = 1.5F; + return this; + } + + public bool HasNegativeOneFloat { + get { return result.hasNegativeOneFloat; } + } + public float NegativeOneFloat { + get { return result.NegativeOneFloat; } + set { SetNegativeOneFloat(value); } + } + public Builder SetNegativeOneFloat(float value) { + PrepareBuilder(); + result.hasNegativeOneFloat = true; + result.negativeOneFloat_ = value; + return this; + } + public Builder ClearNegativeOneFloat() { + PrepareBuilder(); + result.hasNegativeOneFloat = false; + result.negativeOneFloat_ = -1F; + return this; + } + + public bool HasNegativeFloat { + get { return result.hasNegativeFloat; } + } + public float NegativeFloat { + get { return result.NegativeFloat; } + set { SetNegativeFloat(value); } + } + public Builder SetNegativeFloat(float value) { + PrepareBuilder(); + result.hasNegativeFloat = true; + result.negativeFloat_ = value; + return this; + } + public Builder ClearNegativeFloat() { + PrepareBuilder(); + result.hasNegativeFloat = false; + result.negativeFloat_ = -1.5F; + return this; + } + + public bool HasLargeFloat { + get { return result.hasLargeFloat; } + } + public float LargeFloat { + get { return result.LargeFloat; } + set { SetLargeFloat(value); } + } + public Builder SetLargeFloat(float value) { + PrepareBuilder(); + result.hasLargeFloat = true; + result.largeFloat_ = value; + return this; + } + public Builder ClearLargeFloat() { + PrepareBuilder(); + result.hasLargeFloat = false; + result.largeFloat_ = 2E+08F; + return this; + } + + public bool HasSmallNegativeFloat { + get { return result.hasSmallNegativeFloat; } + } + public float SmallNegativeFloat { + get { return result.SmallNegativeFloat; } + set { SetSmallNegativeFloat(value); } + } + public Builder SetSmallNegativeFloat(float value) { + PrepareBuilder(); + result.hasSmallNegativeFloat = true; + result.smallNegativeFloat_ = value; + return this; + } + public Builder ClearSmallNegativeFloat() { + PrepareBuilder(); + result.hasSmallNegativeFloat = false; + result.smallNegativeFloat_ = -8E-28F; + return this; + } + + public bool HasInfDouble { + get { return result.hasInfDouble; } + } + public double InfDouble { + get { return result.InfDouble; } + set { SetInfDouble(value); } + } + public Builder SetInfDouble(double value) { + PrepareBuilder(); + result.hasInfDouble = true; + result.infDouble_ = value; + return this; + } + public Builder ClearInfDouble() { + PrepareBuilder(); + result.hasInfDouble = false; + result.infDouble_ = double.PositiveInfinity; + return this; + } + + public bool HasNegInfDouble { + get { return result.hasNegInfDouble; } + } + public double NegInfDouble { + get { return result.NegInfDouble; } + set { SetNegInfDouble(value); } + } + public Builder SetNegInfDouble(double value) { + PrepareBuilder(); + result.hasNegInfDouble = true; + result.negInfDouble_ = value; + return this; + } + public Builder ClearNegInfDouble() { + PrepareBuilder(); + result.hasNegInfDouble = false; + result.negInfDouble_ = double.NegativeInfinity; + return this; + } + + public bool HasNanDouble { + get { return result.hasNanDouble; } + } + public double NanDouble { + get { return result.NanDouble; } + set { SetNanDouble(value); } + } + public Builder SetNanDouble(double value) { + PrepareBuilder(); + result.hasNanDouble = true; + result.nanDouble_ = value; + return this; + } + public Builder ClearNanDouble() { + PrepareBuilder(); + result.hasNanDouble = false; + result.nanDouble_ = double.NaN; + return this; + } + + public bool HasInfFloat { + get { return result.hasInfFloat; } + } + public float InfFloat { + get { return result.InfFloat; } + set { SetInfFloat(value); } + } + public Builder SetInfFloat(float value) { + PrepareBuilder(); + result.hasInfFloat = true; + result.infFloat_ = value; + return this; + } + public Builder ClearInfFloat() { + PrepareBuilder(); + result.hasInfFloat = false; + result.infFloat_ = float.PositiveInfinity; + return this; + } + + public bool HasNegInfFloat { + get { return result.hasNegInfFloat; } + } + public float NegInfFloat { + get { return result.NegInfFloat; } + set { SetNegInfFloat(value); } + } + public Builder SetNegInfFloat(float value) { + PrepareBuilder(); + result.hasNegInfFloat = true; + result.negInfFloat_ = value; + return this; + } + public Builder ClearNegInfFloat() { + PrepareBuilder(); + result.hasNegInfFloat = false; + result.negInfFloat_ = float.NegativeInfinity; + return this; + } + + public bool HasNanFloat { + get { return result.hasNanFloat; } + } + public float NanFloat { + get { return result.NanFloat; } + set { SetNanFloat(value); } + } + public Builder SetNanFloat(float value) { + PrepareBuilder(); + result.hasNanFloat = true; + result.nanFloat_ = value; + return this; + } + public Builder ClearNanFloat() { + PrepareBuilder(); + result.hasNanFloat = false; + result.nanFloat_ = float.NaN; + return this; + } + + public bool HasCppTrigraph { + get { return result.hasCppTrigraph; } + } + public string CppTrigraph { + get { return result.CppTrigraph; } + set { SetCppTrigraph(value); } + } + public Builder SetCppTrigraph(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasCppTrigraph = true; + result.cppTrigraph_ = value; + return this; + } + public Builder ClearCppTrigraph() { + PrepareBuilder(); + result.hasCppTrigraph = false; + result.cppTrigraph_ = "? ? ?? ?? ??? ??/ ??-"; + return this; + } + } + static TestExtremeDefaultValues() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SparseEnumMessage : pb::GeneratedMessage { + private SparseEnumMessage() { } + private static readonly SparseEnumMessage defaultInstance = new SparseEnumMessage().MakeReadOnly(); + private static readonly string[] _sparseEnumMessageFieldNames = new string[] { "sparse_enum" }; + private static readonly uint[] _sparseEnumMessageFieldTags = new uint[] { 8 }; + public static SparseEnumMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SparseEnumMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SparseEnumMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_SparseEnumMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable; } + } + + public const int SparseEnumFieldNumber = 1; + private bool hasSparseEnum; + private global::Google.ProtocolBuffers.TestProtos.TestSparseEnum sparseEnum_ = global::Google.ProtocolBuffers.TestProtos.TestSparseEnum.SPARSE_A; + public bool HasSparseEnum { + get { return hasSparseEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestSparseEnum SparseEnum { + get { return sparseEnum_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _sparseEnumMessageFieldNames; + if (hasSparseEnum) { + output.WriteEnum(1, field_names[0], (int) SparseEnum, SparseEnum); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasSparseEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) SparseEnum); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SparseEnumMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SparseEnumMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SparseEnumMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SparseEnumMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SparseEnumMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SparseEnumMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SparseEnumMessage result; + + private SparseEnumMessage PrepareBuilder() { + if (resultIsReadOnly) { + SparseEnumMessage original = result; + result = new SparseEnumMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SparseEnumMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SparseEnumMessage.Descriptor; } + } + + public override SparseEnumMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SparseEnumMessage.DefaultInstance; } + } + + public override SparseEnumMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SparseEnumMessage) { + return MergeFrom((SparseEnumMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SparseEnumMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SparseEnumMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasSparseEnum) { + SparseEnum = other.SparseEnum; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_sparseEnumMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _sparseEnumMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + object unknown; + if(input.ReadEnum(ref result.sparseEnum_, out unknown)) { + result.hasSparseEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(1, (ulong)(int)unknown); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasSparseEnum { + get { return result.hasSparseEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestSparseEnum SparseEnum { + get { return result.SparseEnum; } + set { SetSparseEnum(value); } + } + public Builder SetSparseEnum(global::Google.ProtocolBuffers.TestProtos.TestSparseEnum value) { + PrepareBuilder(); + result.hasSparseEnum = true; + result.sparseEnum_ = value; + return this; + } + public Builder ClearSparseEnum() { + PrepareBuilder(); + result.hasSparseEnum = false; + result.sparseEnum_ = global::Google.ProtocolBuffers.TestProtos.TestSparseEnum.SPARSE_A; + return this; + } + } + static SparseEnumMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OneString : pb::GeneratedMessage { + private OneString() { } + private static readonly OneString defaultInstance = new OneString().MakeReadOnly(); + private static readonly string[] _oneStringFieldNames = new string[] { "data" }; + private static readonly uint[] _oneStringFieldTags = new uint[] { 10 }; + public static OneString DefaultInstance { + get { return defaultInstance; } + } + + public override OneString DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OneString ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneString__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneString__FieldAccessorTable; } + } + + public const int DataFieldNumber = 1; + private bool hasData; + private string data_ = ""; + public bool HasData { + get { return hasData; } + } + public string Data { + get { return data_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _oneStringFieldNames; + if (hasData) { + output.WriteString(1, field_names[0], Data); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasData) { + size += pb::CodedOutputStream.ComputeStringSize(1, Data); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OneString ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneString ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneString ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneString ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneString ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneString ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OneString ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OneString ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OneString ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneString ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OneString MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OneString prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OneString cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OneString result; + + private OneString PrepareBuilder() { + if (resultIsReadOnly) { + OneString original = result; + result = new OneString(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OneString MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneString.Descriptor; } + } + + public override OneString DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneString.DefaultInstance; } + } + + public override OneString BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OneString) { + return MergeFrom((OneString) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OneString other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OneString.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasData) { + Data = other.Data; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_oneStringFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _oneStringFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasData = input.ReadString(ref result.data_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasData { + get { return result.hasData; } + } + public string Data { + get { return result.Data; } + set { SetData(value); } + } + public Builder SetData(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasData = true; + result.data_ = value; + return this; + } + public Builder ClearData() { + PrepareBuilder(); + result.hasData = false; + result.data_ = ""; + return this; + } + } + static OneString() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OneBytes : pb::GeneratedMessage { + private OneBytes() { } + private static readonly OneBytes defaultInstance = new OneBytes().MakeReadOnly(); + private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; + private static readonly uint[] _oneBytesFieldTags = new uint[] { 10 }; + public static OneBytes DefaultInstance { + get { return defaultInstance; } + } + + public override OneBytes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OneBytes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneBytes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneBytes__FieldAccessorTable; } + } + + public const int DataFieldNumber = 1; + private bool hasData; + private pb::ByteString data_ = pb::ByteString.Empty; + public bool HasData { + get { return hasData; } + } + public pb::ByteString Data { + get { return data_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _oneBytesFieldNames; + if (hasData) { + output.WriteBytes(1, field_names[0], Data); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasData) { + size += pb::CodedOutputStream.ComputeBytesSize(1, Data); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OneBytes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneBytes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneBytes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneBytes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneBytes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneBytes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OneBytes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OneBytes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OneBytes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneBytes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OneBytes MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OneBytes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OneBytes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OneBytes result; + + private OneBytes PrepareBuilder() { + if (resultIsReadOnly) { + OneBytes original = result; + result = new OneBytes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OneBytes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneBytes.Descriptor; } + } + + public override OneBytes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneBytes.DefaultInstance; } + } + + public override OneBytes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OneBytes) { + return MergeFrom((OneBytes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OneBytes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OneBytes.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasData) { + Data = other.Data; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_oneBytesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _oneBytesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasData = input.ReadBytes(ref result.data_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasData { + get { return result.hasData; } + } + public pb::ByteString Data { + get { return result.Data; } + set { SetData(value); } + } + public Builder SetData(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasData = true; + result.data_ = value; + return this; + } + public Builder ClearData() { + PrepareBuilder(); + result.hasData = false; + result.data_ = pb::ByteString.Empty; + return this; + } + } + static OneBytes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestPackedTypes : pb::GeneratedMessage { + private TestPackedTypes() { } + private static readonly TestPackedTypes defaultInstance = new TestPackedTypes().MakeReadOnly(); + private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; + private static readonly uint[] _testPackedTypesFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; + public static TestPackedTypes DefaultInstance { + get { return defaultInstance; } + } + + public override TestPackedTypes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestPackedTypes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedTypes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable; } + } + + public const int PackedInt32FieldNumber = 90; + private int packedInt32MemoizedSerializedSize; + private pbc::PopsicleList packedInt32_ = new pbc::PopsicleList(); + public scg::IList PackedInt32List { + get { return pbc::Lists.AsReadOnly(packedInt32_); } + } + public int PackedInt32Count { + get { return packedInt32_.Count; } + } + public int GetPackedInt32(int index) { + return packedInt32_[index]; + } + + public const int PackedInt64FieldNumber = 91; + private int packedInt64MemoizedSerializedSize; + private pbc::PopsicleList packedInt64_ = new pbc::PopsicleList(); + public scg::IList PackedInt64List { + get { return pbc::Lists.AsReadOnly(packedInt64_); } + } + public int PackedInt64Count { + get { return packedInt64_.Count; } + } + public long GetPackedInt64(int index) { + return packedInt64_[index]; + } + + public const int PackedUint32FieldNumber = 92; + private int packedUint32MemoizedSerializedSize; + private pbc::PopsicleList packedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedUint32List { + get { return pbc::Lists.AsReadOnly(packedUint32_); } + } + public int PackedUint32Count { + get { return packedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedUint32(int index) { + return packedUint32_[index]; + } + + public const int PackedUint64FieldNumber = 93; + private int packedUint64MemoizedSerializedSize; + private pbc::PopsicleList packedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedUint64List { + get { return pbc::Lists.AsReadOnly(packedUint64_); } + } + public int PackedUint64Count { + get { return packedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedUint64(int index) { + return packedUint64_[index]; + } + + public const int PackedSint32FieldNumber = 94; + private int packedSint32MemoizedSerializedSize; + private pbc::PopsicleList packedSint32_ = new pbc::PopsicleList(); + public scg::IList PackedSint32List { + get { return pbc::Lists.AsReadOnly(packedSint32_); } + } + public int PackedSint32Count { + get { return packedSint32_.Count; } + } + public int GetPackedSint32(int index) { + return packedSint32_[index]; + } + + public const int PackedSint64FieldNumber = 95; + private int packedSint64MemoizedSerializedSize; + private pbc::PopsicleList packedSint64_ = new pbc::PopsicleList(); + public scg::IList PackedSint64List { + get { return pbc::Lists.AsReadOnly(packedSint64_); } + } + public int PackedSint64Count { + get { return packedSint64_.Count; } + } + public long GetPackedSint64(int index) { + return packedSint64_[index]; + } + + public const int PackedFixed32FieldNumber = 96; + private int packedFixed32MemoizedSerializedSize; + private pbc::PopsicleList packedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedFixed32List { + get { return pbc::Lists.AsReadOnly(packedFixed32_); } + } + public int PackedFixed32Count { + get { return packedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedFixed32(int index) { + return packedFixed32_[index]; + } + + public const int PackedFixed64FieldNumber = 97; + private int packedFixed64MemoizedSerializedSize; + private pbc::PopsicleList packedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedFixed64List { + get { return pbc::Lists.AsReadOnly(packedFixed64_); } + } + public int PackedFixed64Count { + get { return packedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedFixed64(int index) { + return packedFixed64_[index]; + } + + public const int PackedSfixed32FieldNumber = 98; + private int packedSfixed32MemoizedSerializedSize; + private pbc::PopsicleList packedSfixed32_ = new pbc::PopsicleList(); + public scg::IList PackedSfixed32List { + get { return pbc::Lists.AsReadOnly(packedSfixed32_); } + } + public int PackedSfixed32Count { + get { return packedSfixed32_.Count; } + } + public int GetPackedSfixed32(int index) { + return packedSfixed32_[index]; + } + + public const int PackedSfixed64FieldNumber = 99; + private int packedSfixed64MemoizedSerializedSize; + private pbc::PopsicleList packedSfixed64_ = new pbc::PopsicleList(); + public scg::IList PackedSfixed64List { + get { return pbc::Lists.AsReadOnly(packedSfixed64_); } + } + public int PackedSfixed64Count { + get { return packedSfixed64_.Count; } + } + public long GetPackedSfixed64(int index) { + return packedSfixed64_[index]; + } + + public const int PackedFloatFieldNumber = 100; + private int packedFloatMemoizedSerializedSize; + private pbc::PopsicleList packedFloat_ = new pbc::PopsicleList(); + public scg::IList PackedFloatList { + get { return pbc::Lists.AsReadOnly(packedFloat_); } + } + public int PackedFloatCount { + get { return packedFloat_.Count; } + } + public float GetPackedFloat(int index) { + return packedFloat_[index]; + } + + public const int PackedDoubleFieldNumber = 101; + private int packedDoubleMemoizedSerializedSize; + private pbc::PopsicleList packedDouble_ = new pbc::PopsicleList(); + public scg::IList PackedDoubleList { + get { return pbc::Lists.AsReadOnly(packedDouble_); } + } + public int PackedDoubleCount { + get { return packedDouble_.Count; } + } + public double GetPackedDouble(int index) { + return packedDouble_[index]; + } + + public const int PackedBoolFieldNumber = 102; + private int packedBoolMemoizedSerializedSize; + private pbc::PopsicleList packedBool_ = new pbc::PopsicleList(); + public scg::IList PackedBoolList { + get { return pbc::Lists.AsReadOnly(packedBool_); } + } + public int PackedBoolCount { + get { return packedBool_.Count; } + } + public bool GetPackedBool(int index) { + return packedBool_[index]; + } + + public const int PackedEnumFieldNumber = 103; + private int packedEnumMemoizedSerializedSize; + private pbc::PopsicleList packedEnum_ = new pbc::PopsicleList(); + public scg::IList PackedEnumList { + get { return pbc::Lists.AsReadOnly(packedEnum_); } + } + public int PackedEnumCount { + get { return packedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetPackedEnum(int index) { + return packedEnum_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testPackedTypesFieldNames; + if (packedInt32_.Count > 0) { + output.WritePackedInt32Array(90, field_names[6], packedInt32MemoizedSerializedSize, packedInt32_); + } + if (packedInt64_.Count > 0) { + output.WritePackedInt64Array(91, field_names[7], packedInt64MemoizedSerializedSize, packedInt64_); + } + if (packedUint32_.Count > 0) { + output.WritePackedUInt32Array(92, field_names[12], packedUint32MemoizedSerializedSize, packedUint32_); + } + if (packedUint64_.Count > 0) { + output.WritePackedUInt64Array(93, field_names[13], packedUint64MemoizedSerializedSize, packedUint64_); + } + if (packedSint32_.Count > 0) { + output.WritePackedSInt32Array(94, field_names[10], packedSint32MemoizedSerializedSize, packedSint32_); + } + if (packedSint64_.Count > 0) { + output.WritePackedSInt64Array(95, field_names[11], packedSint64MemoizedSerializedSize, packedSint64_); + } + if (packedFixed32_.Count > 0) { + output.WritePackedFixed32Array(96, field_names[3], packedFixed32MemoizedSerializedSize, packedFixed32_); + } + if (packedFixed64_.Count > 0) { + output.WritePackedFixed64Array(97, field_names[4], packedFixed64MemoizedSerializedSize, packedFixed64_); + } + if (packedSfixed32_.Count > 0) { + output.WritePackedSFixed32Array(98, field_names[8], packedSfixed32MemoizedSerializedSize, packedSfixed32_); + } + if (packedSfixed64_.Count > 0) { + output.WritePackedSFixed64Array(99, field_names[9], packedSfixed64MemoizedSerializedSize, packedSfixed64_); + } + if (packedFloat_.Count > 0) { + output.WritePackedFloatArray(100, field_names[5], packedFloatMemoizedSerializedSize, packedFloat_); + } + if (packedDouble_.Count > 0) { + output.WritePackedDoubleArray(101, field_names[1], packedDoubleMemoizedSerializedSize, packedDouble_); + } + if (packedBool_.Count > 0) { + output.WritePackedBoolArray(102, field_names[0], packedBoolMemoizedSerializedSize, packedBool_); + } + if (packedEnum_.Count > 0) { + output.WritePackedEnumArray(103, field_names[2], packedEnumMemoizedSerializedSize, packedEnum_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in PackedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + if (packedInt32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedInt32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (long element in PackedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + if (packedInt64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedInt64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (uint element in PackedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + if (packedUint32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedUint32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (ulong element in PackedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + if (packedUint64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedUint64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (int element in PackedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + if (packedSint32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSint32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (long element in PackedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + if (packedSint64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSint64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedFixed32_.Count; + size += dataSize; + if (packedFixed32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFixed32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedFixed64_.Count; + size += dataSize; + if (packedFixed64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFixed64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedSfixed32_.Count; + size += dataSize; + if (packedSfixed32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSfixed32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedSfixed64_.Count; + size += dataSize; + if (packedSfixed64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSfixed64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedFloat_.Count; + size += dataSize; + if (packedFloat_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFloatMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedDouble_.Count; + size += dataSize; + if (packedDouble_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedDoubleMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 1 * packedBool_.Count; + size += dataSize; + if (packedBool_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedBoolMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + if (packedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in packedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + packedEnumMemoizedSerializedSize = dataSize; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestPackedTypes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestPackedTypes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestPackedTypes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestPackedTypes MakeReadOnly() { + packedInt32_.MakeReadOnly(); + packedInt64_.MakeReadOnly(); + packedUint32_.MakeReadOnly(); + packedUint64_.MakeReadOnly(); + packedSint32_.MakeReadOnly(); + packedSint64_.MakeReadOnly(); + packedFixed32_.MakeReadOnly(); + packedFixed64_.MakeReadOnly(); + packedSfixed32_.MakeReadOnly(); + packedSfixed64_.MakeReadOnly(); + packedFloat_.MakeReadOnly(); + packedDouble_.MakeReadOnly(); + packedBool_.MakeReadOnly(); + packedEnum_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestPackedTypes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestPackedTypes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestPackedTypes result; + + private TestPackedTypes PrepareBuilder() { + if (resultIsReadOnly) { + TestPackedTypes original = result; + result = new TestPackedTypes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestPackedTypes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.Descriptor; } + } + + public override TestPackedTypes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance; } + } + + public override TestPackedTypes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestPackedTypes) { + return MergeFrom((TestPackedTypes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestPackedTypes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance) return this; + PrepareBuilder(); + if (other.packedInt32_.Count != 0) { + result.packedInt32_.Add(other.packedInt32_); + } + if (other.packedInt64_.Count != 0) { + result.packedInt64_.Add(other.packedInt64_); + } + if (other.packedUint32_.Count != 0) { + result.packedUint32_.Add(other.packedUint32_); + } + if (other.packedUint64_.Count != 0) { + result.packedUint64_.Add(other.packedUint64_); + } + if (other.packedSint32_.Count != 0) { + result.packedSint32_.Add(other.packedSint32_); + } + if (other.packedSint64_.Count != 0) { + result.packedSint64_.Add(other.packedSint64_); + } + if (other.packedFixed32_.Count != 0) { + result.packedFixed32_.Add(other.packedFixed32_); + } + if (other.packedFixed64_.Count != 0) { + result.packedFixed64_.Add(other.packedFixed64_); + } + if (other.packedSfixed32_.Count != 0) { + result.packedSfixed32_.Add(other.packedSfixed32_); + } + if (other.packedSfixed64_.Count != 0) { + result.packedSfixed64_.Add(other.packedSfixed64_); + } + if (other.packedFloat_.Count != 0) { + result.packedFloat_.Add(other.packedFloat_); + } + if (other.packedDouble_.Count != 0) { + result.packedDouble_.Add(other.packedDouble_); + } + if (other.packedBool_.Count != 0) { + result.packedBool_.Add(other.packedBool_); + } + if (other.packedEnum_.Count != 0) { + result.packedEnum_.Add(other.packedEnum_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testPackedTypesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testPackedTypesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 722: + case 720: { + input.ReadInt32Array(tag, field_name, result.packedInt32_); + break; + } + case 730: + case 728: { + input.ReadInt64Array(tag, field_name, result.packedInt64_); + break; + } + case 738: + case 736: { + input.ReadUInt32Array(tag, field_name, result.packedUint32_); + break; + } + case 746: + case 744: { + input.ReadUInt64Array(tag, field_name, result.packedUint64_); + break; + } + case 754: + case 752: { + input.ReadSInt32Array(tag, field_name, result.packedSint32_); + break; + } + case 762: + case 760: { + input.ReadSInt64Array(tag, field_name, result.packedSint64_); + break; + } + case 770: + case 773: { + input.ReadFixed32Array(tag, field_name, result.packedFixed32_); + break; + } + case 778: + case 777: { + input.ReadFixed64Array(tag, field_name, result.packedFixed64_); + break; + } + case 786: + case 789: { + input.ReadSFixed32Array(tag, field_name, result.packedSfixed32_); + break; + } + case 794: + case 793: { + input.ReadSFixed64Array(tag, field_name, result.packedSfixed64_); + break; + } + case 802: + case 805: { + input.ReadFloatArray(tag, field_name, result.packedFloat_); + break; + } + case 810: + case 809: { + input.ReadDoubleArray(tag, field_name, result.packedDouble_); + break; + } + case 818: + case 816: { + input.ReadBoolArray(tag, field_name, result.packedBool_); + break; + } + case 826: + case 824: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.packedEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(103, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList PackedInt32List { + get { return PrepareBuilder().packedInt32_; } + } + public int PackedInt32Count { + get { return result.PackedInt32Count; } + } + public int GetPackedInt32(int index) { + return result.GetPackedInt32(index); + } + public Builder SetPackedInt32(int index, int value) { + PrepareBuilder(); + result.packedInt32_[index] = value; + return this; + } + public Builder AddPackedInt32(int value) { + PrepareBuilder(); + result.packedInt32_.Add(value); + return this; + } + public Builder AddRangePackedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedInt32_.Add(values); + return this; + } + public Builder ClearPackedInt32() { + PrepareBuilder(); + result.packedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedInt64List { + get { return PrepareBuilder().packedInt64_; } + } + public int PackedInt64Count { + get { return result.PackedInt64Count; } + } + public long GetPackedInt64(int index) { + return result.GetPackedInt64(index); + } + public Builder SetPackedInt64(int index, long value) { + PrepareBuilder(); + result.packedInt64_[index] = value; + return this; + } + public Builder AddPackedInt64(long value) { + PrepareBuilder(); + result.packedInt64_.Add(value); + return this; + } + public Builder AddRangePackedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedInt64_.Add(values); + return this; + } + public Builder ClearPackedInt64() { + PrepareBuilder(); + result.packedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedUint32List { + get { return PrepareBuilder().packedUint32_; } + } + public int PackedUint32Count { + get { return result.PackedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedUint32(int index) { + return result.GetPackedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedUint32(int index, uint value) { + PrepareBuilder(); + result.packedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedUint32(uint value) { + PrepareBuilder(); + result.packedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedUint32_.Add(values); + return this; + } + public Builder ClearPackedUint32() { + PrepareBuilder(); + result.packedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedUint64List { + get { return PrepareBuilder().packedUint64_; } + } + public int PackedUint64Count { + get { return result.PackedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedUint64(int index) { + return result.GetPackedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedUint64(int index, ulong value) { + PrepareBuilder(); + result.packedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedUint64(ulong value) { + PrepareBuilder(); + result.packedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedUint64_.Add(values); + return this; + } + public Builder ClearPackedUint64() { + PrepareBuilder(); + result.packedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSint32List { + get { return PrepareBuilder().packedSint32_; } + } + public int PackedSint32Count { + get { return result.PackedSint32Count; } + } + public int GetPackedSint32(int index) { + return result.GetPackedSint32(index); + } + public Builder SetPackedSint32(int index, int value) { + PrepareBuilder(); + result.packedSint32_[index] = value; + return this; + } + public Builder AddPackedSint32(int value) { + PrepareBuilder(); + result.packedSint32_.Add(value); + return this; + } + public Builder AddRangePackedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSint32_.Add(values); + return this; + } + public Builder ClearPackedSint32() { + PrepareBuilder(); + result.packedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSint64List { + get { return PrepareBuilder().packedSint64_; } + } + public int PackedSint64Count { + get { return result.PackedSint64Count; } + } + public long GetPackedSint64(int index) { + return result.GetPackedSint64(index); + } + public Builder SetPackedSint64(int index, long value) { + PrepareBuilder(); + result.packedSint64_[index] = value; + return this; + } + public Builder AddPackedSint64(long value) { + PrepareBuilder(); + result.packedSint64_.Add(value); + return this; + } + public Builder AddRangePackedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSint64_.Add(values); + return this; + } + public Builder ClearPackedSint64() { + PrepareBuilder(); + result.packedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedFixed32List { + get { return PrepareBuilder().packedFixed32_; } + } + public int PackedFixed32Count { + get { return result.PackedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedFixed32(int index) { + return result.GetPackedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedFixed32(int index, uint value) { + PrepareBuilder(); + result.packedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedFixed32(uint value) { + PrepareBuilder(); + result.packedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFixed32_.Add(values); + return this; + } + public Builder ClearPackedFixed32() { + PrepareBuilder(); + result.packedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedFixed64List { + get { return PrepareBuilder().packedFixed64_; } + } + public int PackedFixed64Count { + get { return result.PackedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedFixed64(int index) { + return result.GetPackedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedFixed64(int index, ulong value) { + PrepareBuilder(); + result.packedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedFixed64(ulong value) { + PrepareBuilder(); + result.packedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFixed64_.Add(values); + return this; + } + public Builder ClearPackedFixed64() { + PrepareBuilder(); + result.packedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSfixed32List { + get { return PrepareBuilder().packedSfixed32_; } + } + public int PackedSfixed32Count { + get { return result.PackedSfixed32Count; } + } + public int GetPackedSfixed32(int index) { + return result.GetPackedSfixed32(index); + } + public Builder SetPackedSfixed32(int index, int value) { + PrepareBuilder(); + result.packedSfixed32_[index] = value; + return this; + } + public Builder AddPackedSfixed32(int value) { + PrepareBuilder(); + result.packedSfixed32_.Add(value); + return this; + } + public Builder AddRangePackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSfixed32_.Add(values); + return this; + } + public Builder ClearPackedSfixed32() { + PrepareBuilder(); + result.packedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSfixed64List { + get { return PrepareBuilder().packedSfixed64_; } + } + public int PackedSfixed64Count { + get { return result.PackedSfixed64Count; } + } + public long GetPackedSfixed64(int index) { + return result.GetPackedSfixed64(index); + } + public Builder SetPackedSfixed64(int index, long value) { + PrepareBuilder(); + result.packedSfixed64_[index] = value; + return this; + } + public Builder AddPackedSfixed64(long value) { + PrepareBuilder(); + result.packedSfixed64_.Add(value); + return this; + } + public Builder AddRangePackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSfixed64_.Add(values); + return this; + } + public Builder ClearPackedSfixed64() { + PrepareBuilder(); + result.packedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedFloatList { + get { return PrepareBuilder().packedFloat_; } + } + public int PackedFloatCount { + get { return result.PackedFloatCount; } + } + public float GetPackedFloat(int index) { + return result.GetPackedFloat(index); + } + public Builder SetPackedFloat(int index, float value) { + PrepareBuilder(); + result.packedFloat_[index] = value; + return this; + } + public Builder AddPackedFloat(float value) { + PrepareBuilder(); + result.packedFloat_.Add(value); + return this; + } + public Builder AddRangePackedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFloat_.Add(values); + return this; + } + public Builder ClearPackedFloat() { + PrepareBuilder(); + result.packedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedDoubleList { + get { return PrepareBuilder().packedDouble_; } + } + public int PackedDoubleCount { + get { return result.PackedDoubleCount; } + } + public double GetPackedDouble(int index) { + return result.GetPackedDouble(index); + } + public Builder SetPackedDouble(int index, double value) { + PrepareBuilder(); + result.packedDouble_[index] = value; + return this; + } + public Builder AddPackedDouble(double value) { + PrepareBuilder(); + result.packedDouble_.Add(value); + return this; + } + public Builder AddRangePackedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.packedDouble_.Add(values); + return this; + } + public Builder ClearPackedDouble() { + PrepareBuilder(); + result.packedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedBoolList { + get { return PrepareBuilder().packedBool_; } + } + public int PackedBoolCount { + get { return result.PackedBoolCount; } + } + public bool GetPackedBool(int index) { + return result.GetPackedBool(index); + } + public Builder SetPackedBool(int index, bool value) { + PrepareBuilder(); + result.packedBool_[index] = value; + return this; + } + public Builder AddPackedBool(bool value) { + PrepareBuilder(); + result.packedBool_.Add(value); + return this; + } + public Builder AddRangePackedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.packedBool_.Add(values); + return this; + } + public Builder ClearPackedBool() { + PrepareBuilder(); + result.packedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedEnumList { + get { return PrepareBuilder().packedEnum_; } + } + public int PackedEnumCount { + get { return result.PackedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetPackedEnum(int index) { + return result.GetPackedEnum(index); + } + public Builder SetPackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.packedEnum_[index] = value; + return this; + } + public Builder AddPackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.packedEnum_.Add(value); + return this; + } + public Builder AddRangePackedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.packedEnum_.Add(values); + return this; + } + public Builder ClearPackedEnum() { + PrepareBuilder(); + result.packedEnum_.Clear(); + return this; + } + } + static TestPackedTypes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { + private TestUnpackedTypes() { } + private static readonly TestUnpackedTypes defaultInstance = new TestUnpackedTypes().MakeReadOnly(); + private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; + private static readonly uint[] _testUnpackedTypesFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; + public static TestUnpackedTypes DefaultInstance { + get { return defaultInstance; } + } + + public override TestUnpackedTypes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestUnpackedTypes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable; } + } + + public const int UnpackedInt32FieldNumber = 90; + private pbc::PopsicleList unpackedInt32_ = new pbc::PopsicleList(); + public scg::IList UnpackedInt32List { + get { return pbc::Lists.AsReadOnly(unpackedInt32_); } + } + public int UnpackedInt32Count { + get { return unpackedInt32_.Count; } + } + public int GetUnpackedInt32(int index) { + return unpackedInt32_[index]; + } + + public const int UnpackedInt64FieldNumber = 91; + private pbc::PopsicleList unpackedInt64_ = new pbc::PopsicleList(); + public scg::IList UnpackedInt64List { + get { return pbc::Lists.AsReadOnly(unpackedInt64_); } + } + public int UnpackedInt64Count { + get { return unpackedInt64_.Count; } + } + public long GetUnpackedInt64(int index) { + return unpackedInt64_[index]; + } + + public const int UnpackedUint32FieldNumber = 92; + private pbc::PopsicleList unpackedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedUint32List { + get { return pbc::Lists.AsReadOnly(unpackedUint32_); } + } + public int UnpackedUint32Count { + get { return unpackedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedUint32(int index) { + return unpackedUint32_[index]; + } + + public const int UnpackedUint64FieldNumber = 93; + private pbc::PopsicleList unpackedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedUint64List { + get { return pbc::Lists.AsReadOnly(unpackedUint64_); } + } + public int UnpackedUint64Count { + get { return unpackedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedUint64(int index) { + return unpackedUint64_[index]; + } + + public const int UnpackedSint32FieldNumber = 94; + private pbc::PopsicleList unpackedSint32_ = new pbc::PopsicleList(); + public scg::IList UnpackedSint32List { + get { return pbc::Lists.AsReadOnly(unpackedSint32_); } + } + public int UnpackedSint32Count { + get { return unpackedSint32_.Count; } + } + public int GetUnpackedSint32(int index) { + return unpackedSint32_[index]; + } + + public const int UnpackedSint64FieldNumber = 95; + private pbc::PopsicleList unpackedSint64_ = new pbc::PopsicleList(); + public scg::IList UnpackedSint64List { + get { return pbc::Lists.AsReadOnly(unpackedSint64_); } + } + public int UnpackedSint64Count { + get { return unpackedSint64_.Count; } + } + public long GetUnpackedSint64(int index) { + return unpackedSint64_[index]; + } + + public const int UnpackedFixed32FieldNumber = 96; + private pbc::PopsicleList unpackedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedFixed32List { + get { return pbc::Lists.AsReadOnly(unpackedFixed32_); } + } + public int UnpackedFixed32Count { + get { return unpackedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedFixed32(int index) { + return unpackedFixed32_[index]; + } + + public const int UnpackedFixed64FieldNumber = 97; + private pbc::PopsicleList unpackedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedFixed64List { + get { return pbc::Lists.AsReadOnly(unpackedFixed64_); } + } + public int UnpackedFixed64Count { + get { return unpackedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedFixed64(int index) { + return unpackedFixed64_[index]; + } + + public const int UnpackedSfixed32FieldNumber = 98; + private pbc::PopsicleList unpackedSfixed32_ = new pbc::PopsicleList(); + public scg::IList UnpackedSfixed32List { + get { return pbc::Lists.AsReadOnly(unpackedSfixed32_); } + } + public int UnpackedSfixed32Count { + get { return unpackedSfixed32_.Count; } + } + public int GetUnpackedSfixed32(int index) { + return unpackedSfixed32_[index]; + } + + public const int UnpackedSfixed64FieldNumber = 99; + private pbc::PopsicleList unpackedSfixed64_ = new pbc::PopsicleList(); + public scg::IList UnpackedSfixed64List { + get { return pbc::Lists.AsReadOnly(unpackedSfixed64_); } + } + public int UnpackedSfixed64Count { + get { return unpackedSfixed64_.Count; } + } + public long GetUnpackedSfixed64(int index) { + return unpackedSfixed64_[index]; + } + + public const int UnpackedFloatFieldNumber = 100; + private pbc::PopsicleList unpackedFloat_ = new pbc::PopsicleList(); + public scg::IList UnpackedFloatList { + get { return pbc::Lists.AsReadOnly(unpackedFloat_); } + } + public int UnpackedFloatCount { + get { return unpackedFloat_.Count; } + } + public float GetUnpackedFloat(int index) { + return unpackedFloat_[index]; + } + + public const int UnpackedDoubleFieldNumber = 101; + private pbc::PopsicleList unpackedDouble_ = new pbc::PopsicleList(); + public scg::IList UnpackedDoubleList { + get { return pbc::Lists.AsReadOnly(unpackedDouble_); } + } + public int UnpackedDoubleCount { + get { return unpackedDouble_.Count; } + } + public double GetUnpackedDouble(int index) { + return unpackedDouble_[index]; + } + + public const int UnpackedBoolFieldNumber = 102; + private pbc::PopsicleList unpackedBool_ = new pbc::PopsicleList(); + public scg::IList UnpackedBoolList { + get { return pbc::Lists.AsReadOnly(unpackedBool_); } + } + public int UnpackedBoolCount { + get { return unpackedBool_.Count; } + } + public bool GetUnpackedBool(int index) { + return unpackedBool_[index]; + } + + public const int UnpackedEnumFieldNumber = 103; + private pbc::PopsicleList unpackedEnum_ = new pbc::PopsicleList(); + public scg::IList UnpackedEnumList { + get { return pbc::Lists.AsReadOnly(unpackedEnum_); } + } + public int UnpackedEnumCount { + get { return unpackedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetUnpackedEnum(int index) { + return unpackedEnum_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testUnpackedTypesFieldNames; + if (unpackedInt32_.Count > 0) { + output.WriteInt32Array(90, field_names[6], unpackedInt32_); + } + if (unpackedInt64_.Count > 0) { + output.WriteInt64Array(91, field_names[7], unpackedInt64_); + } + if (unpackedUint32_.Count > 0) { + output.WriteUInt32Array(92, field_names[12], unpackedUint32_); + } + if (unpackedUint64_.Count > 0) { + output.WriteUInt64Array(93, field_names[13], unpackedUint64_); + } + if (unpackedSint32_.Count > 0) { + output.WriteSInt32Array(94, field_names[10], unpackedSint32_); + } + if (unpackedSint64_.Count > 0) { + output.WriteSInt64Array(95, field_names[11], unpackedSint64_); + } + if (unpackedFixed32_.Count > 0) { + output.WriteFixed32Array(96, field_names[3], unpackedFixed32_); + } + if (unpackedFixed64_.Count > 0) { + output.WriteFixed64Array(97, field_names[4], unpackedFixed64_); + } + if (unpackedSfixed32_.Count > 0) { + output.WriteSFixed32Array(98, field_names[8], unpackedSfixed32_); + } + if (unpackedSfixed64_.Count > 0) { + output.WriteSFixed64Array(99, field_names[9], unpackedSfixed64_); + } + if (unpackedFloat_.Count > 0) { + output.WriteFloatArray(100, field_names[5], unpackedFloat_); + } + if (unpackedDouble_.Count > 0) { + output.WriteDoubleArray(101, field_names[1], unpackedDouble_); + } + if (unpackedBool_.Count > 0) { + output.WriteBoolArray(102, field_names[0], unpackedBool_); + } + if (unpackedEnum_.Count > 0) { + output.WriteEnumArray(103, field_names[2], unpackedEnum_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in UnpackedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedInt32_.Count; + } + { + int dataSize = 0; + foreach (long element in UnpackedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedInt64_.Count; + } + { + int dataSize = 0; + foreach (uint element in UnpackedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedUint32_.Count; + } + { + int dataSize = 0; + foreach (ulong element in UnpackedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedUint64_.Count; + } + { + int dataSize = 0; + foreach (int element in UnpackedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedSint32_.Count; + } + { + int dataSize = 0; + foreach (long element in UnpackedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedSint64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedFixed32_.Count; + size += dataSize; + size += 2 * unpackedFixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedFixed64_.Count; + size += dataSize; + size += 2 * unpackedFixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedSfixed32_.Count; + size += dataSize; + size += 2 * unpackedSfixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedSfixed64_.Count; + size += dataSize; + size += 2 * unpackedSfixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedFloat_.Count; + size += dataSize; + size += 2 * unpackedFloat_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedDouble_.Count; + size += dataSize; + size += 2 * unpackedDouble_.Count; + } + { + int dataSize = 0; + dataSize = 1 * unpackedBool_.Count; + size += dataSize; + size += 2 * unpackedBool_.Count; + } + { + int dataSize = 0; + if (unpackedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in unpackedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * unpackedEnum_.Count; + } + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestUnpackedTypes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestUnpackedTypes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestUnpackedTypes MakeReadOnly() { + unpackedInt32_.MakeReadOnly(); + unpackedInt64_.MakeReadOnly(); + unpackedUint32_.MakeReadOnly(); + unpackedUint64_.MakeReadOnly(); + unpackedSint32_.MakeReadOnly(); + unpackedSint64_.MakeReadOnly(); + unpackedFixed32_.MakeReadOnly(); + unpackedFixed64_.MakeReadOnly(); + unpackedSfixed32_.MakeReadOnly(); + unpackedSfixed64_.MakeReadOnly(); + unpackedFloat_.MakeReadOnly(); + unpackedDouble_.MakeReadOnly(); + unpackedBool_.MakeReadOnly(); + unpackedEnum_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestUnpackedTypes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestUnpackedTypes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestUnpackedTypes result; + + private TestUnpackedTypes PrepareBuilder() { + if (resultIsReadOnly) { + TestUnpackedTypes original = result; + result = new TestUnpackedTypes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestUnpackedTypes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.Descriptor; } + } + + public override TestUnpackedTypes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance; } + } + + public override TestUnpackedTypes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestUnpackedTypes) { + return MergeFrom((TestUnpackedTypes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestUnpackedTypes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance) return this; + PrepareBuilder(); + if (other.unpackedInt32_.Count != 0) { + result.unpackedInt32_.Add(other.unpackedInt32_); + } + if (other.unpackedInt64_.Count != 0) { + result.unpackedInt64_.Add(other.unpackedInt64_); + } + if (other.unpackedUint32_.Count != 0) { + result.unpackedUint32_.Add(other.unpackedUint32_); + } + if (other.unpackedUint64_.Count != 0) { + result.unpackedUint64_.Add(other.unpackedUint64_); + } + if (other.unpackedSint32_.Count != 0) { + result.unpackedSint32_.Add(other.unpackedSint32_); + } + if (other.unpackedSint64_.Count != 0) { + result.unpackedSint64_.Add(other.unpackedSint64_); + } + if (other.unpackedFixed32_.Count != 0) { + result.unpackedFixed32_.Add(other.unpackedFixed32_); + } + if (other.unpackedFixed64_.Count != 0) { + result.unpackedFixed64_.Add(other.unpackedFixed64_); + } + if (other.unpackedSfixed32_.Count != 0) { + result.unpackedSfixed32_.Add(other.unpackedSfixed32_); + } + if (other.unpackedSfixed64_.Count != 0) { + result.unpackedSfixed64_.Add(other.unpackedSfixed64_); + } + if (other.unpackedFloat_.Count != 0) { + result.unpackedFloat_.Add(other.unpackedFloat_); + } + if (other.unpackedDouble_.Count != 0) { + result.unpackedDouble_.Add(other.unpackedDouble_); + } + if (other.unpackedBool_.Count != 0) { + result.unpackedBool_.Add(other.unpackedBool_); + } + if (other.unpackedEnum_.Count != 0) { + result.unpackedEnum_.Add(other.unpackedEnum_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testUnpackedTypesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testUnpackedTypesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 722: + case 720: { + input.ReadInt32Array(tag, field_name, result.unpackedInt32_); + break; + } + case 730: + case 728: { + input.ReadInt64Array(tag, field_name, result.unpackedInt64_); + break; + } + case 738: + case 736: { + input.ReadUInt32Array(tag, field_name, result.unpackedUint32_); + break; + } + case 746: + case 744: { + input.ReadUInt64Array(tag, field_name, result.unpackedUint64_); + break; + } + case 754: + case 752: { + input.ReadSInt32Array(tag, field_name, result.unpackedSint32_); + break; + } + case 762: + case 760: { + input.ReadSInt64Array(tag, field_name, result.unpackedSint64_); + break; + } + case 770: + case 773: { + input.ReadFixed32Array(tag, field_name, result.unpackedFixed32_); + break; + } + case 778: + case 777: { + input.ReadFixed64Array(tag, field_name, result.unpackedFixed64_); + break; + } + case 786: + case 789: { + input.ReadSFixed32Array(tag, field_name, result.unpackedSfixed32_); + break; + } + case 794: + case 793: { + input.ReadSFixed64Array(tag, field_name, result.unpackedSfixed64_); + break; + } + case 802: + case 805: { + input.ReadFloatArray(tag, field_name, result.unpackedFloat_); + break; + } + case 810: + case 809: { + input.ReadDoubleArray(tag, field_name, result.unpackedDouble_); + break; + } + case 818: + case 816: { + input.ReadBoolArray(tag, field_name, result.unpackedBool_); + break; + } + case 826: + case 824: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.unpackedEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(103, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList UnpackedInt32List { + get { return PrepareBuilder().unpackedInt32_; } + } + public int UnpackedInt32Count { + get { return result.UnpackedInt32Count; } + } + public int GetUnpackedInt32(int index) { + return result.GetUnpackedInt32(index); + } + public Builder SetUnpackedInt32(int index, int value) { + PrepareBuilder(); + result.unpackedInt32_[index] = value; + return this; + } + public Builder AddUnpackedInt32(int value) { + PrepareBuilder(); + result.unpackedInt32_.Add(value); + return this; + } + public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedInt32_.Add(values); + return this; + } + public Builder ClearUnpackedInt32() { + PrepareBuilder(); + result.unpackedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedInt64List { + get { return PrepareBuilder().unpackedInt64_; } + } + public int UnpackedInt64Count { + get { return result.UnpackedInt64Count; } + } + public long GetUnpackedInt64(int index) { + return result.GetUnpackedInt64(index); + } + public Builder SetUnpackedInt64(int index, long value) { + PrepareBuilder(); + result.unpackedInt64_[index] = value; + return this; + } + public Builder AddUnpackedInt64(long value) { + PrepareBuilder(); + result.unpackedInt64_.Add(value); + return this; + } + public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedInt64_.Add(values); + return this; + } + public Builder ClearUnpackedInt64() { + PrepareBuilder(); + result.unpackedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedUint32List { + get { return PrepareBuilder().unpackedUint32_; } + } + public int UnpackedUint32Count { + get { return result.UnpackedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedUint32(int index) { + return result.GetUnpackedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedUint32(int index, uint value) { + PrepareBuilder(); + result.unpackedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedUint32(uint value) { + PrepareBuilder(); + result.unpackedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedUint32_.Add(values); + return this; + } + public Builder ClearUnpackedUint32() { + PrepareBuilder(); + result.unpackedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedUint64List { + get { return PrepareBuilder().unpackedUint64_; } + } + public int UnpackedUint64Count { + get { return result.UnpackedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedUint64(int index) { + return result.GetUnpackedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedUint64(int index, ulong value) { + PrepareBuilder(); + result.unpackedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedUint64(ulong value) { + PrepareBuilder(); + result.unpackedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedUint64_.Add(values); + return this; + } + public Builder ClearUnpackedUint64() { + PrepareBuilder(); + result.unpackedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSint32List { + get { return PrepareBuilder().unpackedSint32_; } + } + public int UnpackedSint32Count { + get { return result.UnpackedSint32Count; } + } + public int GetUnpackedSint32(int index) { + return result.GetUnpackedSint32(index); + } + public Builder SetUnpackedSint32(int index, int value) { + PrepareBuilder(); + result.unpackedSint32_[index] = value; + return this; + } + public Builder AddUnpackedSint32(int value) { + PrepareBuilder(); + result.unpackedSint32_.Add(value); + return this; + } + public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSint32_.Add(values); + return this; + } + public Builder ClearUnpackedSint32() { + PrepareBuilder(); + result.unpackedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSint64List { + get { return PrepareBuilder().unpackedSint64_; } + } + public int UnpackedSint64Count { + get { return result.UnpackedSint64Count; } + } + public long GetUnpackedSint64(int index) { + return result.GetUnpackedSint64(index); + } + public Builder SetUnpackedSint64(int index, long value) { + PrepareBuilder(); + result.unpackedSint64_[index] = value; + return this; + } + public Builder AddUnpackedSint64(long value) { + PrepareBuilder(); + result.unpackedSint64_.Add(value); + return this; + } + public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSint64_.Add(values); + return this; + } + public Builder ClearUnpackedSint64() { + PrepareBuilder(); + result.unpackedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedFixed32List { + get { return PrepareBuilder().unpackedFixed32_; } + } + public int UnpackedFixed32Count { + get { return result.UnpackedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedFixed32(int index) { + return result.GetUnpackedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedFixed32(int index, uint value) { + PrepareBuilder(); + result.unpackedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedFixed32(uint value) { + PrepareBuilder(); + result.unpackedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFixed32_.Add(values); + return this; + } + public Builder ClearUnpackedFixed32() { + PrepareBuilder(); + result.unpackedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedFixed64List { + get { return PrepareBuilder().unpackedFixed64_; } + } + public int UnpackedFixed64Count { + get { return result.UnpackedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedFixed64(int index) { + return result.GetUnpackedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedFixed64(int index, ulong value) { + PrepareBuilder(); + result.unpackedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedFixed64(ulong value) { + PrepareBuilder(); + result.unpackedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFixed64_.Add(values); + return this; + } + public Builder ClearUnpackedFixed64() { + PrepareBuilder(); + result.unpackedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSfixed32List { + get { return PrepareBuilder().unpackedSfixed32_; } + } + public int UnpackedSfixed32Count { + get { return result.UnpackedSfixed32Count; } + } + public int GetUnpackedSfixed32(int index) { + return result.GetUnpackedSfixed32(index); + } + public Builder SetUnpackedSfixed32(int index, int value) { + PrepareBuilder(); + result.unpackedSfixed32_[index] = value; + return this; + } + public Builder AddUnpackedSfixed32(int value) { + PrepareBuilder(); + result.unpackedSfixed32_.Add(value); + return this; + } + public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSfixed32_.Add(values); + return this; + } + public Builder ClearUnpackedSfixed32() { + PrepareBuilder(); + result.unpackedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSfixed64List { + get { return PrepareBuilder().unpackedSfixed64_; } + } + public int UnpackedSfixed64Count { + get { return result.UnpackedSfixed64Count; } + } + public long GetUnpackedSfixed64(int index) { + return result.GetUnpackedSfixed64(index); + } + public Builder SetUnpackedSfixed64(int index, long value) { + PrepareBuilder(); + result.unpackedSfixed64_[index] = value; + return this; + } + public Builder AddUnpackedSfixed64(long value) { + PrepareBuilder(); + result.unpackedSfixed64_.Add(value); + return this; + } + public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSfixed64_.Add(values); + return this; + } + public Builder ClearUnpackedSfixed64() { + PrepareBuilder(); + result.unpackedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedFloatList { + get { return PrepareBuilder().unpackedFloat_; } + } + public int UnpackedFloatCount { + get { return result.UnpackedFloatCount; } + } + public float GetUnpackedFloat(int index) { + return result.GetUnpackedFloat(index); + } + public Builder SetUnpackedFloat(int index, float value) { + PrepareBuilder(); + result.unpackedFloat_[index] = value; + return this; + } + public Builder AddUnpackedFloat(float value) { + PrepareBuilder(); + result.unpackedFloat_.Add(value); + return this; + } + public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFloat_.Add(values); + return this; + } + public Builder ClearUnpackedFloat() { + PrepareBuilder(); + result.unpackedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedDoubleList { + get { return PrepareBuilder().unpackedDouble_; } + } + public int UnpackedDoubleCount { + get { return result.UnpackedDoubleCount; } + } + public double GetUnpackedDouble(int index) { + return result.GetUnpackedDouble(index); + } + public Builder SetUnpackedDouble(int index, double value) { + PrepareBuilder(); + result.unpackedDouble_[index] = value; + return this; + } + public Builder AddUnpackedDouble(double value) { + PrepareBuilder(); + result.unpackedDouble_.Add(value); + return this; + } + public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedDouble_.Add(values); + return this; + } + public Builder ClearUnpackedDouble() { + PrepareBuilder(); + result.unpackedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedBoolList { + get { return PrepareBuilder().unpackedBool_; } + } + public int UnpackedBoolCount { + get { return result.UnpackedBoolCount; } + } + public bool GetUnpackedBool(int index) { + return result.GetUnpackedBool(index); + } + public Builder SetUnpackedBool(int index, bool value) { + PrepareBuilder(); + result.unpackedBool_[index] = value; + return this; + } + public Builder AddUnpackedBool(bool value) { + PrepareBuilder(); + result.unpackedBool_.Add(value); + return this; + } + public Builder AddRangeUnpackedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedBool_.Add(values); + return this; + } + public Builder ClearUnpackedBool() { + PrepareBuilder(); + result.unpackedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedEnumList { + get { return PrepareBuilder().unpackedEnum_; } + } + public int UnpackedEnumCount { + get { return result.UnpackedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetUnpackedEnum(int index) { + return result.GetUnpackedEnum(index); + } + public Builder SetUnpackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.unpackedEnum_[index] = value; + return this; + } + public Builder AddUnpackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.unpackedEnum_.Add(value); + return this; + } + public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedEnum_.Add(values); + return this; + } + public Builder ClearUnpackedEnum() { + PrepareBuilder(); + result.unpackedEnum_.Clear(); + return this; + } + } + static TestUnpackedTypes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestPackedExtensions : pb::ExtendableMessage { + private TestPackedExtensions() { } + private static readonly TestPackedExtensions defaultInstance = new TestPackedExtensions().MakeReadOnly(); + private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testPackedExtensionsFieldTags = new uint[] { }; + public static TestPackedExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestPackedExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestPackedExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testPackedExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestPackedExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestPackedExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestPackedExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestPackedExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestPackedExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestPackedExtensions result; + + private TestPackedExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestPackedExtensions original = result; + result = new TestPackedExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestPackedExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.Descriptor; } + } + + public override TestPackedExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.DefaultInstance; } + } + + public override TestPackedExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestPackedExtensions) { + return MergeFrom((TestPackedExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestPackedExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testPackedExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testPackedExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestPackedExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { + private TestDynamicExtensions() { } + private static readonly TestDynamicExtensions defaultInstance = new TestDynamicExtensions().MakeReadOnly(); + private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; + private static readonly uint[] _testDynamicExtensionsFieldTags = new uint[] { 16016, 16034, 16008, 16026, 16050, 16042, 16005 }; + public static TestDynamicExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestDynamicExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDynamicExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum DynamicEnumType { + DYNAMIC_FOO = 2200, + DYNAMIC_BAR = 2201, + DYNAMIC_BAZ = 2202, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class DynamicMessageType : pb::GeneratedMessage { + private DynamicMessageType() { } + private static readonly DynamicMessageType defaultInstance = new DynamicMessageType().MakeReadOnly(); + private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; + private static readonly uint[] _dynamicMessageTypeFieldTags = new uint[] { 16800 }; + public static DynamicMessageType DefaultInstance { + get { return defaultInstance; } + } + + public override DynamicMessageType DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override DynamicMessageType ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__FieldAccessorTable; } + } + + public const int DynamicFieldFieldNumber = 2100; + private bool hasDynamicField; + private int dynamicField_; + public bool HasDynamicField { + get { return hasDynamicField; } + } + public int DynamicField { + get { return dynamicField_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _dynamicMessageTypeFieldNames; + if (hasDynamicField) { + output.WriteInt32(2100, field_names[0], DynamicField); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasDynamicField) { + size += pb::CodedOutputStream.ComputeInt32Size(2100, DynamicField); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static DynamicMessageType ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DynamicMessageType ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DynamicMessageType ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DynamicMessageType ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private DynamicMessageType MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DynamicMessageType prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(DynamicMessageType cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private DynamicMessageType result; + + private DynamicMessageType PrepareBuilder() { + if (resultIsReadOnly) { + DynamicMessageType original = result; + result = new DynamicMessageType(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override DynamicMessageType MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Descriptor; } + } + + public override DynamicMessageType DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; } + } + + public override DynamicMessageType BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DynamicMessageType) { + return MergeFrom((DynamicMessageType) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DynamicMessageType other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasDynamicField) { + DynamicField = other.DynamicField; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_dynamicMessageTypeFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _dynamicMessageTypeFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 16800: { + result.hasDynamicField = input.ReadInt32(ref result.dynamicField_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasDynamicField { + get { return result.hasDynamicField; } + } + public int DynamicField { + get { return result.DynamicField; } + set { SetDynamicField(value); } + } + public Builder SetDynamicField(int value) { + PrepareBuilder(); + result.hasDynamicField = true; + result.dynamicField_ = value; + return this; + } + public Builder ClearDynamicField() { + PrepareBuilder(); + result.hasDynamicField = false; + result.dynamicField_ = 0; + return this; + } + } + static DynamicMessageType() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int ScalarExtensionFieldNumber = 2000; + private bool hasScalarExtension; + private uint scalarExtension_; + public bool HasScalarExtension { + get { return hasScalarExtension; } + } + [global::System.CLSCompliant(false)] + public uint ScalarExtension { + get { return scalarExtension_; } + } + + public const int EnumExtensionFieldNumber = 2001; + private bool hasEnumExtension; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum enumExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + public bool HasEnumExtension { + get { return hasEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumExtension { + get { return enumExtension_; } + } + + public const int DynamicEnumExtensionFieldNumber = 2002; + private bool hasDynamicEnumExtension; + private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType dynamicEnumExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType.DYNAMIC_FOO; + public bool HasDynamicEnumExtension { + get { return hasDynamicEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType DynamicEnumExtension { + get { return dynamicEnumExtension_; } + } + + public const int MessageExtensionFieldNumber = 2003; + private bool hasMessageExtension; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageExtension_; + public bool HasMessageExtension { + get { return hasMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageExtension { + get { return messageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public const int DynamicMessageExtensionFieldNumber = 2004; + private bool hasDynamicMessageExtension; + private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType dynamicMessageExtension_; + public bool HasDynamicMessageExtension { + get { return hasDynamicMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType DynamicMessageExtension { + get { return dynamicMessageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; } + } + + public const int RepeatedExtensionFieldNumber = 2005; + private pbc::PopsicleList repeatedExtension_ = new pbc::PopsicleList(); + public scg::IList RepeatedExtensionList { + get { return pbc::Lists.AsReadOnly(repeatedExtension_); } + } + public int RepeatedExtensionCount { + get { return repeatedExtension_.Count; } + } + public string GetRepeatedExtension(int index) { + return repeatedExtension_[index]; + } + + public const int PackedExtensionFieldNumber = 2006; + private int packedExtensionMemoizedSerializedSize; + private pbc::PopsicleList packedExtension_ = new pbc::PopsicleList(); + public scg::IList PackedExtensionList { + get { return pbc::Lists.AsReadOnly(packedExtension_); } + } + public int PackedExtensionCount { + get { return packedExtension_.Count; } + } + public int GetPackedExtension(int index) { + return packedExtension_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDynamicExtensionsFieldNames; + if (hasScalarExtension) { + output.WriteFixed32(2000, field_names[6], ScalarExtension); + } + if (hasEnumExtension) { + output.WriteEnum(2001, field_names[2], (int) EnumExtension, EnumExtension); + } + if (hasDynamicEnumExtension) { + output.WriteEnum(2002, field_names[0], (int) DynamicEnumExtension, DynamicEnumExtension); + } + if (hasMessageExtension) { + output.WriteMessage(2003, field_names[3], MessageExtension); + } + if (hasDynamicMessageExtension) { + output.WriteMessage(2004, field_names[1], DynamicMessageExtension); + } + if (repeatedExtension_.Count > 0) { + output.WriteStringArray(2005, field_names[5], repeatedExtension_); + } + if (packedExtension_.Count > 0) { + output.WritePackedSInt32Array(2006, field_names[4], packedExtensionMemoizedSerializedSize, packedExtension_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasScalarExtension) { + size += pb::CodedOutputStream.ComputeFixed32Size(2000, ScalarExtension); + } + if (hasEnumExtension) { + size += pb::CodedOutputStream.ComputeEnumSize(2001, (int) EnumExtension); + } + if (hasDynamicEnumExtension) { + size += pb::CodedOutputStream.ComputeEnumSize(2002, (int) DynamicEnumExtension); + } + if (hasMessageExtension) { + size += pb::CodedOutputStream.ComputeMessageSize(2003, MessageExtension); + } + if (hasDynamicMessageExtension) { + size += pb::CodedOutputStream.ComputeMessageSize(2004, DynamicMessageExtension); + } + { + int dataSize = 0; + foreach (string element in RepeatedExtensionList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedExtension_.Count; + } + { + int dataSize = 0; + foreach (int element in PackedExtensionList) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + if (packedExtension_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedExtensionMemoizedSerializedSize = dataSize; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestDynamicExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDynamicExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDynamicExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDynamicExtensions MakeReadOnly() { + repeatedExtension_.MakeReadOnly(); + packedExtension_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDynamicExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDynamicExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDynamicExtensions result; + + private TestDynamicExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestDynamicExtensions original = result; + result = new TestDynamicExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDynamicExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Descriptor; } + } + + public override TestDynamicExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.DefaultInstance; } + } + + public override TestDynamicExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestDynamicExtensions) { + return MergeFrom((TestDynamicExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDynamicExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasScalarExtension) { + ScalarExtension = other.ScalarExtension; + } + if (other.HasEnumExtension) { + EnumExtension = other.EnumExtension; + } + if (other.HasDynamicEnumExtension) { + DynamicEnumExtension = other.DynamicEnumExtension; + } + if (other.HasMessageExtension) { + MergeMessageExtension(other.MessageExtension); + } + if (other.HasDynamicMessageExtension) { + MergeDynamicMessageExtension(other.DynamicMessageExtension); + } + if (other.repeatedExtension_.Count != 0) { + result.repeatedExtension_.Add(other.repeatedExtension_); + } + if (other.packedExtension_.Count != 0) { + result.packedExtension_.Add(other.packedExtension_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDynamicExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDynamicExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 16005: { + result.hasScalarExtension = input.ReadFixed32(ref result.scalarExtension_); + break; + } + case 16008: { + object unknown; + if(input.ReadEnum(ref result.enumExtension_, out unknown)) { + result.hasEnumExtension = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(2001, (ulong)(int)unknown); + } + break; + } + case 16016: { + object unknown; + if(input.ReadEnum(ref result.dynamicEnumExtension_, out unknown)) { + result.hasDynamicEnumExtension = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(2002, (ulong)(int)unknown); + } + break; + } + case 16026: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(); + if (result.hasMessageExtension) { + subBuilder.MergeFrom(MessageExtension); + } + input.ReadMessage(subBuilder, extensionRegistry); + MessageExtension = subBuilder.BuildPartial(); + break; + } + case 16034: { + global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.CreateBuilder(); + if (result.hasDynamicMessageExtension) { + subBuilder.MergeFrom(DynamicMessageExtension); + } + input.ReadMessage(subBuilder, extensionRegistry); + DynamicMessageExtension = subBuilder.BuildPartial(); + break; + } + case 16042: { + input.ReadStringArray(tag, field_name, result.repeatedExtension_); + break; + } + case 16050: + case 16048: { + input.ReadSInt32Array(tag, field_name, result.packedExtension_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasScalarExtension { + get { return result.hasScalarExtension; } + } + [global::System.CLSCompliant(false)] + public uint ScalarExtension { + get { return result.ScalarExtension; } + set { SetScalarExtension(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetScalarExtension(uint value) { + PrepareBuilder(); + result.hasScalarExtension = true; + result.scalarExtension_ = value; + return this; + } + public Builder ClearScalarExtension() { + PrepareBuilder(); + result.hasScalarExtension = false; + result.scalarExtension_ = 0; + return this; + } + + public bool HasEnumExtension { + get { return result.hasEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumExtension { + get { return result.EnumExtension; } + set { SetEnumExtension(value); } + } + public Builder SetEnumExtension(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasEnumExtension = true; + result.enumExtension_ = value; + return this; + } + public Builder ClearEnumExtension() { + PrepareBuilder(); + result.hasEnumExtension = false; + result.enumExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + return this; + } + + public bool HasDynamicEnumExtension { + get { return result.hasDynamicEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType DynamicEnumExtension { + get { return result.DynamicEnumExtension; } + set { SetDynamicEnumExtension(value); } + } + public Builder SetDynamicEnumExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType value) { + PrepareBuilder(); + result.hasDynamicEnumExtension = true; + result.dynamicEnumExtension_ = value; + return this; + } + public Builder ClearDynamicEnumExtension() { + PrepareBuilder(); + result.hasDynamicEnumExtension = false; + result.dynamicEnumExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType.DYNAMIC_FOO; + return this; + } + + public bool HasMessageExtension { + get { return result.hasMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageExtension { + get { return result.MessageExtension; } + set { SetMessageExtension(value); } + } + public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessageExtension = true; + result.messageExtension_ = value; + return this; + } + public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMessageExtension = true; + result.messageExtension_ = builderForValue.Build(); + return this; + } + public Builder MergeMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMessageExtension && + result.messageExtension_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageExtension_).MergeFrom(value).BuildPartial(); + } else { + result.messageExtension_ = value; + } + result.hasMessageExtension = true; + return this; + } + public Builder ClearMessageExtension() { + PrepareBuilder(); + result.hasMessageExtension = false; + result.messageExtension_ = null; + return this; + } + + public bool HasDynamicMessageExtension { + get { return result.hasDynamicMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType DynamicMessageExtension { + get { return result.DynamicMessageExtension; } + set { SetDynamicMessageExtension(value); } + } + public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDynamicMessageExtension = true; + result.dynamicMessageExtension_ = value; + return this; + } + public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasDynamicMessageExtension = true; + result.dynamicMessageExtension_ = builderForValue.Build(); + return this; + } + public Builder MergeDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasDynamicMessageExtension && + result.dynamicMessageExtension_ != global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) { + result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.CreateBuilder(result.dynamicMessageExtension_).MergeFrom(value).BuildPartial(); + } else { + result.dynamicMessageExtension_ = value; + } + result.hasDynamicMessageExtension = true; + return this; + } + public Builder ClearDynamicMessageExtension() { + PrepareBuilder(); + result.hasDynamicMessageExtension = false; + result.dynamicMessageExtension_ = null; + return this; + } + + public pbc::IPopsicleList RepeatedExtensionList { + get { return PrepareBuilder().repeatedExtension_; } + } + public int RepeatedExtensionCount { + get { return result.RepeatedExtensionCount; } + } + public string GetRepeatedExtension(int index) { + return result.GetRepeatedExtension(index); + } + public Builder SetRepeatedExtension(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedExtension_[index] = value; + return this; + } + public Builder AddRepeatedExtension(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedExtension_.Add(value); + return this; + } + public Builder AddRangeRepeatedExtension(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedExtension_.Add(values); + return this; + } + public Builder ClearRepeatedExtension() { + PrepareBuilder(); + result.repeatedExtension_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedExtensionList { + get { return PrepareBuilder().packedExtension_; } + } + public int PackedExtensionCount { + get { return result.PackedExtensionCount; } + } + public int GetPackedExtension(int index) { + return result.GetPackedExtension(index); + } + public Builder SetPackedExtension(int index, int value) { + PrepareBuilder(); + result.packedExtension_[index] = value; + return this; + } + public Builder AddPackedExtension(int value) { + PrepareBuilder(); + result.packedExtension_.Add(value); + return this; + } + public Builder AddRangePackedExtension(scg::IEnumerable values) { + PrepareBuilder(); + result.packedExtension_.Add(values); + return this; + } + public Builder ClearPackedExtension() { + PrepareBuilder(); + result.packedExtension_.Clear(); + return this; + } + } + static TestDynamicExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { + private TestRepeatedScalarDifferentTagSizes() { } + private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new TestRepeatedScalarDifferentTagSizes().MakeReadOnly(); + private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; + private static readonly uint[] _testRepeatedScalarDifferentTagSizesFieldTags = new uint[] { 101, 16369, 2097141, 104, 16376, 2097144 }; + public static TestRepeatedScalarDifferentTagSizes DefaultInstance { + get { return defaultInstance; } + } + + public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRepeatedScalarDifferentTagSizes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable; } + } + + public const int RepeatedFixed32FieldNumber = 12; + private pbc::PopsicleList repeatedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed32List { + get { return pbc::Lists.AsReadOnly(repeatedFixed32_); } + } + public int RepeatedFixed32Count { + get { return repeatedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return repeatedFixed32_[index]; + } + + public const int RepeatedInt32FieldNumber = 13; + private pbc::PopsicleList repeatedInt32_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt32List { + get { return pbc::Lists.AsReadOnly(repeatedInt32_); } + } + public int RepeatedInt32Count { + get { return repeatedInt32_.Count; } + } + public int GetRepeatedInt32(int index) { + return repeatedInt32_[index]; + } + + public const int RepeatedFixed64FieldNumber = 2046; + private pbc::PopsicleList repeatedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed64List { + get { return pbc::Lists.AsReadOnly(repeatedFixed64_); } + } + public int RepeatedFixed64Count { + get { return repeatedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return repeatedFixed64_[index]; + } + + public const int RepeatedInt64FieldNumber = 2047; + private pbc::PopsicleList repeatedInt64_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt64List { + get { return pbc::Lists.AsReadOnly(repeatedInt64_); } + } + public int RepeatedInt64Count { + get { return repeatedInt64_.Count; } + } + public long GetRepeatedInt64(int index) { + return repeatedInt64_[index]; + } + + public const int RepeatedFloatFieldNumber = 262142; + private pbc::PopsicleList repeatedFloat_ = new pbc::PopsicleList(); + public scg::IList RepeatedFloatList { + get { return pbc::Lists.AsReadOnly(repeatedFloat_); } + } + public int RepeatedFloatCount { + get { return repeatedFloat_.Count; } + } + public float GetRepeatedFloat(int index) { + return repeatedFloat_[index]; + } + + public const int RepeatedUint64FieldNumber = 262143; + private pbc::PopsicleList repeatedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint64List { + get { return pbc::Lists.AsReadOnly(repeatedUint64_); } + } + public int RepeatedUint64Count { + get { return repeatedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return repeatedUint64_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRepeatedScalarDifferentTagSizesFieldNames; + if (repeatedFixed32_.Count > 0) { + output.WriteFixed32Array(12, field_names[0], repeatedFixed32_); + } + if (repeatedInt32_.Count > 0) { + output.WriteInt32Array(13, field_names[3], repeatedInt32_); + } + if (repeatedFixed64_.Count > 0) { + output.WriteFixed64Array(2046, field_names[1], repeatedFixed64_); + } + if (repeatedInt64_.Count > 0) { + output.WriteInt64Array(2047, field_names[4], repeatedInt64_); + } + if (repeatedFloat_.Count > 0) { + output.WriteFloatArray(262142, field_names[2], repeatedFloat_); + } + if (repeatedUint64_.Count > 0) { + output.WriteUInt64Array(262143, field_names[5], repeatedUint64_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + dataSize = 4 * repeatedFixed32_.Count; + size += dataSize; + size += 1 * repeatedFixed32_.Count; + } + { + int dataSize = 0; + foreach (int element in RepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedInt32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedFixed64_.Count; + size += dataSize; + size += 2 * repeatedFixed64_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFloat_.Count; + size += dataSize; + size += 3 * repeatedFloat_.Count; + } + { + int dataSize = 0; + foreach (ulong element in RepeatedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 3 * repeatedUint64_.Count; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRepeatedScalarDifferentTagSizes MakeReadOnly() { + repeatedFixed32_.MakeReadOnly(); + repeatedInt32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRepeatedScalarDifferentTagSizes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRepeatedScalarDifferentTagSizes result; + + private TestRepeatedScalarDifferentTagSizes PrepareBuilder() { + if (resultIsReadOnly) { + TestRepeatedScalarDifferentTagSizes original = result; + result = new TestRepeatedScalarDifferentTagSizes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRepeatedScalarDifferentTagSizes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.Descriptor; } + } + + public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance; } + } + + public override TestRepeatedScalarDifferentTagSizes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRepeatedScalarDifferentTagSizes) { + return MergeFrom((TestRepeatedScalarDifferentTagSizes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRepeatedScalarDifferentTagSizes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance) return this; + PrepareBuilder(); + if (other.repeatedFixed32_.Count != 0) { + result.repeatedFixed32_.Add(other.repeatedFixed32_); + } + if (other.repeatedInt32_.Count != 0) { + result.repeatedInt32_.Add(other.repeatedInt32_); + } + if (other.repeatedFixed64_.Count != 0) { + result.repeatedFixed64_.Add(other.repeatedFixed64_); + } + if (other.repeatedInt64_.Count != 0) { + result.repeatedInt64_.Add(other.repeatedInt64_); + } + if (other.repeatedFloat_.Count != 0) { + result.repeatedFloat_.Add(other.repeatedFloat_); + } + if (other.repeatedUint64_.Count != 0) { + result.repeatedUint64_.Add(other.repeatedUint64_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRepeatedScalarDifferentTagSizesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRepeatedScalarDifferentTagSizesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 98: + case 101: { + input.ReadFixed32Array(tag, field_name, result.repeatedFixed32_); + break; + } + case 106: + case 104: { + input.ReadInt32Array(tag, field_name, result.repeatedInt32_); + break; + } + case 16370: + case 16369: { + input.ReadFixed64Array(tag, field_name, result.repeatedFixed64_); + break; + } + case 16378: + case 16376: { + input.ReadInt64Array(tag, field_name, result.repeatedInt64_); + break; + } + case 2097138: + case 2097141: { + input.ReadFloatArray(tag, field_name, result.repeatedFloat_); + break; + } + case 2097146: + case 2097144: { + input.ReadUInt64Array(tag, field_name, result.repeatedUint64_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed32List { + get { return PrepareBuilder().repeatedFixed32_; } + } + public int RepeatedFixed32Count { + get { return result.RepeatedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return result.GetRepeatedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); + result.repeatedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); + result.repeatedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed32_.Add(values); + return this; + } + public Builder ClearRepeatedFixed32() { + PrepareBuilder(); + result.repeatedFixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt32List { + get { return PrepareBuilder().repeatedInt32_; } + } + public int RepeatedInt32Count { + get { return result.RepeatedInt32Count; } + } + public int GetRepeatedInt32(int index) { + return result.GetRepeatedInt32(index); + } + public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.repeatedInt32_[index] = value; + return this; + } + public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); + result.repeatedInt32_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt32_.Add(values); + return this; + } + public Builder ClearRepeatedInt32() { + PrepareBuilder(); + result.repeatedInt32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed64List { + get { return PrepareBuilder().repeatedFixed64_; } + } + public int RepeatedFixed64Count { + get { return result.RepeatedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return result.GetRepeatedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); + result.repeatedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); + result.repeatedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed64_.Add(values); + return this; + } + public Builder ClearRepeatedFixed64() { + PrepareBuilder(); + result.repeatedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt64List { + get { return PrepareBuilder().repeatedInt64_; } + } + public int RepeatedInt64Count { + get { return result.RepeatedInt64Count; } + } + public long GetRepeatedInt64(int index) { + return result.GetRepeatedInt64(index); + } + public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); + result.repeatedInt64_[index] = value; + return this; + } + public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); + result.repeatedInt64_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt64_.Add(values); + return this; + } + public Builder ClearRepeatedInt64() { + PrepareBuilder(); + result.repeatedInt64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedFloatList { + get { return PrepareBuilder().repeatedFloat_; } + } + public int RepeatedFloatCount { + get { return result.RepeatedFloatCount; } + } + public float GetRepeatedFloat(int index) { + return result.GetRepeatedFloat(index); + } + public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); + result.repeatedFloat_[index] = value; + return this; + } + public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); + result.repeatedFloat_.Add(value); + return this; + } + public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFloat_.Add(values); + return this; + } + public Builder ClearRepeatedFloat() { + PrepareBuilder(); + result.repeatedFloat_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint64List { + get { return PrepareBuilder().repeatedUint64_; } + } + public int RepeatedUint64Count { + get { return result.RepeatedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return result.GetRepeatedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); + result.repeatedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); + result.repeatedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint64_.Add(values); + return this; + } + public Builder ClearRepeatedUint64() { + PrepareBuilder(); + result.repeatedUint64_.Clear(); + return this; + } + } + static TestRepeatedScalarDifferentTagSizes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FooRequest : pb::GeneratedMessage { + private FooRequest() { } + private static readonly FooRequest defaultInstance = new FooRequest().MakeReadOnly(); + private static readonly string[] _fooRequestFieldNames = new string[] { }; + private static readonly uint[] _fooRequestFieldTags = new uint[] { }; + public static FooRequest DefaultInstance { + get { return defaultInstance; } + } + + public override FooRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FooRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooRequest__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fooRequestFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FooRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FooRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FooRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FooRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FooRequest MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FooRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FooRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FooRequest result; + + private FooRequest PrepareBuilder() { + if (resultIsReadOnly) { + FooRequest original = result; + result = new FooRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FooRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooRequest.Descriptor; } + } + + public override FooRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance; } + } + + public override FooRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FooRequest) { + return MergeFrom((FooRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FooRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fooRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fooRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static FooRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FooResponse : pb::GeneratedMessage { + private FooResponse() { } + private static readonly FooResponse defaultInstance = new FooResponse().MakeReadOnly(); + private static readonly string[] _fooResponseFieldNames = new string[] { }; + private static readonly uint[] _fooResponseFieldTags = new uint[] { }; + public static FooResponse DefaultInstance { + get { return defaultInstance; } + } + + public override FooResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FooResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooResponse__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fooResponseFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FooResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FooResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FooResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FooResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FooResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FooResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FooResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FooResponse result; + + private FooResponse PrepareBuilder() { + if (resultIsReadOnly) { + FooResponse original = result; + result = new FooResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FooResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooResponse.Descriptor; } + } + + public override FooResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance; } + } + + public override FooResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FooResponse) { + return MergeFrom((FooResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FooResponse other) { + if (other == global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fooResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fooResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static FooResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class BarRequest : pb::GeneratedMessage { + private BarRequest() { } + private static readonly BarRequest defaultInstance = new BarRequest().MakeReadOnly(); + private static readonly string[] _barRequestFieldNames = new string[] { }; + private static readonly uint[] _barRequestFieldTags = new uint[] { }; + public static BarRequest DefaultInstance { + get { return defaultInstance; } + } + + public override BarRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override BarRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarRequest__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _barRequestFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static BarRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static BarRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static BarRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static BarRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private BarRequest MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(BarRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(BarRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private BarRequest result; + + private BarRequest PrepareBuilder() { + if (resultIsReadOnly) { + BarRequest original = result; + result = new BarRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override BarRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarRequest.Descriptor; } + } + + public override BarRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance; } + } + + public override BarRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is BarRequest) { + return MergeFrom((BarRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(BarRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_barRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _barRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static BarRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class BarResponse : pb::GeneratedMessage { + private BarResponse() { } + private static readonly BarResponse defaultInstance = new BarResponse().MakeReadOnly(); + private static readonly string[] _barResponseFieldNames = new string[] { }; + private static readonly uint[] _barResponseFieldTags = new uint[] { }; + public static BarResponse DefaultInstance { + get { return defaultInstance; } + } + + public override BarResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override BarResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarResponse__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _barResponseFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static BarResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static BarResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static BarResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static BarResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private BarResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(BarResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(BarResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private BarResponse result; + + private BarResponse PrepareBuilder() { + if (resultIsReadOnly) { + BarResponse original = result; + result = new BarResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override BarResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarResponse.Descriptor; } + } + + public override BarResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance; } + } + + public override BarResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is BarResponse) { + return MergeFrom((BarResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(BarResponse other) { + if (other == global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_barResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _barResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static BarResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + #endregion + + #region Services + /* + * Service generation is now disabled by default, use the following option to enable: + * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + */ + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs new file mode 100644 index 00000000..8c6dcf61 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestRpcInterop.cs @@ -0,0 +1,1467 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestRpcInterop { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_SearchRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_SearchRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_SearchResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_SearchResponse__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_SearchResponse_ResultItem__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_SearchResponse_ResultItem__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_RefineSearchRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_RefineSearchRequest__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestRpcInterop() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiFleHRlc3QvdW5pdHRlc3RfcnBjX2ludGVyb3AucHJvdG8aJGdvb2dsZS9w", + "cm90b2J1Zi9jc2hhcnBfb3B0aW9ucy5wcm90byIhCg1TZWFyY2hSZXF1ZXN0", + "EhAKCENyaXRlcmlhGAEgAygJImYKDlNlYXJjaFJlc3BvbnNlEisKB3Jlc3Vs", + "dHMYASADKAsyGi5TZWFyY2hSZXNwb25zZS5SZXN1bHRJdGVtGicKClJlc3Vs", + "dEl0ZW0SCwoDdXJsGAEgAigJEgwKBG5hbWUYAiABKAkiUgoTUmVmaW5lU2Vh", + "cmNoUmVxdWVzdBIQCghDcml0ZXJpYRgBIAMoCRIpChBwcmV2aW91c19yZXN1", + "bHRzGAIgAigLMg8uU2VhcmNoUmVzcG9uc2UycQoNU2VhcmNoU2VydmljZRIp", + "CgZTZWFyY2gSDi5TZWFyY2hSZXF1ZXN0Gg8uU2VhcmNoUmVzcG9uc2USNQoM", + "UmVmaW5lU2VhcmNoEhQuUmVmaW5lU2VhcmNoUmVxdWVzdBoPLlNlYXJjaFJl", + "c3BvbnNlQj9IAcI+OgohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJv", + "dG9zEhJVbml0VGVzdFJwY0ludGVyb3CIDgM=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_SearchRequest__Descriptor = Descriptor.MessageTypes[0]; + internal__static_SearchRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_SearchRequest__Descriptor, + new string[] { "Criteria", }); + internal__static_SearchResponse__Descriptor = Descriptor.MessageTypes[1]; + internal__static_SearchResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_SearchResponse__Descriptor, + new string[] { "Results", }); + internal__static_SearchResponse_ResultItem__Descriptor = internal__static_SearchResponse__Descriptor.NestedTypes[0]; + internal__static_SearchResponse_ResultItem__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_SearchResponse_ResultItem__Descriptor, + new string[] { "Url", "Name", }); + internal__static_RefineSearchRequest__Descriptor = Descriptor.MessageTypes[2]; + internal__static_RefineSearchRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_RefineSearchRequest__Descriptor, + new string[] { "Criteria", "PreviousResults", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SearchRequest : pb::GeneratedMessage { + private SearchRequest() { } + private static readonly SearchRequest defaultInstance = new SearchRequest().MakeReadOnly(); + private static readonly string[] _searchRequestFieldNames = new string[] { "Criteria" }; + private static readonly uint[] _searchRequestFieldTags = new uint[] { 10 }; + public static SearchRequest DefaultInstance { + get { return defaultInstance; } + } + + public override SearchRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SearchRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchRequest__FieldAccessorTable; } + } + + public const int CriteriaFieldNumber = 1; + private pbc::PopsicleList criteria_ = new pbc::PopsicleList(); + public scg::IList CriteriaList { + get { return pbc::Lists.AsReadOnly(criteria_); } + } + public int CriteriaCount { + get { return criteria_.Count; } + } + public string GetCriteria(int index) { + return criteria_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _searchRequestFieldNames; + if (criteria_.Count > 0) { + output.WriteStringArray(1, field_names[0], criteria_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (string element in CriteriaList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * criteria_.Count; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SearchRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SearchRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SearchRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SearchRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SearchRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SearchRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SearchRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SearchRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SearchRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SearchRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SearchRequest MakeReadOnly() { + criteria_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SearchRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SearchRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SearchRequest result; + + private SearchRequest PrepareBuilder() { + if (resultIsReadOnly) { + SearchRequest original = result; + result = new SearchRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SearchRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SearchRequest.Descriptor; } + } + + public override SearchRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SearchRequest.DefaultInstance; } + } + + public override SearchRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SearchRequest) { + return MergeFrom((SearchRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SearchRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SearchRequest.DefaultInstance) return this; + PrepareBuilder(); + if (other.criteria_.Count != 0) { + result.criteria_.Add(other.criteria_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_searchRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _searchRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadStringArray(tag, field_name, result.criteria_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList CriteriaList { + get { return PrepareBuilder().criteria_; } + } + public int CriteriaCount { + get { return result.CriteriaCount; } + } + public string GetCriteria(int index) { + return result.GetCriteria(index); + } + public Builder SetCriteria(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.criteria_[index] = value; + return this; + } + public Builder AddCriteria(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.criteria_.Add(value); + return this; + } + public Builder AddRangeCriteria(scg::IEnumerable values) { + PrepareBuilder(); + result.criteria_.Add(values); + return this; + } + public Builder ClearCriteria() { + PrepareBuilder(); + result.criteria_.Clear(); + return this; + } + } + static SearchRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SearchResponse : pb::GeneratedMessage { + private SearchResponse() { } + private static readonly SearchResponse defaultInstance = new SearchResponse().MakeReadOnly(); + private static readonly string[] _searchResponseFieldNames = new string[] { "results" }; + private static readonly uint[] _searchResponseFieldTags = new uint[] { 10 }; + public static SearchResponse DefaultInstance { + get { return defaultInstance; } + } + + public override SearchResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SearchResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchResponse__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ResultItem : pb::GeneratedMessage { + private ResultItem() { } + private static readonly ResultItem defaultInstance = new ResultItem().MakeReadOnly(); + private static readonly string[] _resultItemFieldNames = new string[] { "name", "url" }; + private static readonly uint[] _resultItemFieldTags = new uint[] { 18, 10 }; + public static ResultItem DefaultInstance { + get { return defaultInstance; } + } + + public override ResultItem DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ResultItem ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchResponse_ResultItem__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_SearchResponse_ResultItem__FieldAccessorTable; } + } + + public const int UrlFieldNumber = 1; + private bool hasUrl; + private string url_ = ""; + public bool HasUrl { + get { return hasUrl; } + } + public string Url { + get { return url_; } + } + + public const int NameFieldNumber = 2; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public override bool IsInitialized { + get { + if (!hasUrl) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _resultItemFieldNames; + if (hasUrl) { + output.WriteString(1, field_names[1], Url); + } + if (hasName) { + output.WriteString(2, field_names[0], Name); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasUrl) { + size += pb::CodedOutputStream.ComputeStringSize(1, Url); + } + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(2, Name); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ResultItem ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ResultItem ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ResultItem ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ResultItem ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ResultItem ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ResultItem ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ResultItem ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ResultItem ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ResultItem ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ResultItem ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ResultItem MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ResultItem prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ResultItem cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ResultItem result; + + private ResultItem PrepareBuilder() { + if (resultIsReadOnly) { + ResultItem original = result; + result = new ResultItem(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ResultItem MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Descriptor; } + } + + public override ResultItem DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.DefaultInstance; } + } + + public override ResultItem BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ResultItem) { + return MergeFrom((ResultItem) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ResultItem other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasUrl) { + Url = other.Url; + } + if (other.HasName) { + Name = other.Name; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_resultItemFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _resultItemFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasUrl = input.ReadString(ref result.url_); + break; + } + case 18: { + result.hasName = input.ReadString(ref result.name_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasUrl { + get { return result.hasUrl; } + } + public string Url { + get { return result.Url; } + set { SetUrl(value); } + } + public Builder SetUrl(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasUrl = true; + result.url_ = value; + return this; + } + public Builder ClearUrl() { + PrepareBuilder(); + result.hasUrl = false; + result.url_ = ""; + return this; + } + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + } + static ResultItem() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.Descriptor, null); + } + } + + } + #endregion + + public const int ResultsFieldNumber = 1; + private pbc::PopsicleList results_ = new pbc::PopsicleList(); + public scg::IList ResultsList { + get { return results_; } + } + public int ResultsCount { + get { return results_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem GetResults(int index) { + return results_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _searchResponseFieldNames; + if (results_.Count > 0) { + output.WriteMessageArray(1, field_names[0], results_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) { + size += pb::CodedOutputStream.ComputeMessageSize(1, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SearchResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SearchResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SearchResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SearchResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SearchResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SearchResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SearchResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SearchResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SearchResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SearchResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SearchResponse MakeReadOnly() { + results_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SearchResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SearchResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SearchResponse result; + + private SearchResponse PrepareBuilder() { + if (resultIsReadOnly) { + SearchResponse original = result; + result = new SearchResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SearchResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.Descriptor; } + } + + public override SearchResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance; } + } + + public override SearchResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SearchResponse) { + return MergeFrom((SearchResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SearchResponse other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance) return this; + PrepareBuilder(); + if (other.results_.Count != 0) { + result.results_.Add(other.results_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_searchResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _searchResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadMessageArray(tag, field_name, result.results_, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList ResultsList { + get { return PrepareBuilder().results_; } + } + public int ResultsCount { + get { return result.ResultsCount; } + } + public global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem GetResults(int index) { + return result.GetResults(index); + } + public Builder SetResults(int index, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.results_[index] = value; + return this; + } + public Builder SetResults(int index, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.results_[index] = builderForValue.Build(); + return this; + } + public Builder AddResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.results_.Add(value); + return this; + } + public Builder AddResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.results_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeResults(scg::IEnumerable values) { + PrepareBuilder(); + result.results_.Add(values); + return this; + } + public Builder ClearResults() { + PrepareBuilder(); + result.results_.Clear(); + return this; + } + } + static SearchResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RefineSearchRequest : pb::GeneratedMessage { + private RefineSearchRequest() { } + private static readonly RefineSearchRequest defaultInstance = new RefineSearchRequest().MakeReadOnly(); + private static readonly string[] _refineSearchRequestFieldNames = new string[] { "Criteria", "previous_results" }; + private static readonly uint[] _refineSearchRequestFieldTags = new uint[] { 10, 18 }; + public static RefineSearchRequest DefaultInstance { + get { return defaultInstance; } + } + + public override RefineSearchRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RefineSearchRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_RefineSearchRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.internal__static_RefineSearchRequest__FieldAccessorTable; } + } + + public const int CriteriaFieldNumber = 1; + private pbc::PopsicleList criteria_ = new pbc::PopsicleList(); + public scg::IList CriteriaList { + get { return pbc::Lists.AsReadOnly(criteria_); } + } + public int CriteriaCount { + get { return criteria_.Count; } + } + public string GetCriteria(int index) { + return criteria_[index]; + } + + public const int PreviousResultsFieldNumber = 2; + private bool hasPreviousResults; + private global::Google.ProtocolBuffers.TestProtos.SearchResponse previousResults_; + public bool HasPreviousResults { + get { return hasPreviousResults; } + } + public global::Google.ProtocolBuffers.TestProtos.SearchResponse PreviousResults { + get { return previousResults_ ?? global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (!hasPreviousResults) return false; + if (!PreviousResults.IsInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _refineSearchRequestFieldNames; + if (criteria_.Count > 0) { + output.WriteStringArray(1, field_names[0], criteria_); + } + if (hasPreviousResults) { + output.WriteMessage(2, field_names[1], PreviousResults); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (string element in CriteriaList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * criteria_.Count; + } + if (hasPreviousResults) { + size += pb::CodedOutputStream.ComputeMessageSize(2, PreviousResults); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static RefineSearchRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RefineSearchRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RefineSearchRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RefineSearchRequest MakeReadOnly() { + criteria_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RefineSearchRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RefineSearchRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RefineSearchRequest result; + + private RefineSearchRequest PrepareBuilder() { + if (resultIsReadOnly) { + RefineSearchRequest original = result; + result = new RefineSearchRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RefineSearchRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.Descriptor; } + } + + public override RefineSearchRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.DefaultInstance; } + } + + public override RefineSearchRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is RefineSearchRequest) { + return MergeFrom((RefineSearchRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RefineSearchRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.DefaultInstance) return this; + PrepareBuilder(); + if (other.criteria_.Count != 0) { + result.criteria_.Add(other.criteria_); + } + if (other.HasPreviousResults) { + MergePreviousResults(other.PreviousResults); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_refineSearchRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _refineSearchRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadStringArray(tag, field_name, result.criteria_); + break; + } + case 18: { + global::Google.ProtocolBuffers.TestProtos.SearchResponse.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder(); + if (result.hasPreviousResults) { + subBuilder.MergeFrom(PreviousResults); + } + input.ReadMessage(subBuilder, extensionRegistry); + PreviousResults = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList CriteriaList { + get { return PrepareBuilder().criteria_; } + } + public int CriteriaCount { + get { return result.CriteriaCount; } + } + public string GetCriteria(int index) { + return result.GetCriteria(index); + } + public Builder SetCriteria(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.criteria_[index] = value; + return this; + } + public Builder AddCriteria(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.criteria_.Add(value); + return this; + } + public Builder AddRangeCriteria(scg::IEnumerable values) { + PrepareBuilder(); + result.criteria_.Add(values); + return this; + } + public Builder ClearCriteria() { + PrepareBuilder(); + result.criteria_.Clear(); + return this; + } + + public bool HasPreviousResults { + get { return result.hasPreviousResults; } + } + public global::Google.ProtocolBuffers.TestProtos.SearchResponse PreviousResults { + get { return result.PreviousResults; } + set { SetPreviousResults(value); } + } + public Builder SetPreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasPreviousResults = true; + result.previousResults_ = value; + return this; + } + public Builder SetPreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasPreviousResults = true; + result.previousResults_ = builderForValue.Build(); + return this; + } + public Builder MergePreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasPreviousResults && + result.previousResults_ != global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance) { + result.previousResults_ = global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder(result.previousResults_).MergeFrom(value).BuildPartial(); + } else { + result.previousResults_ = value; + } + result.hasPreviousResults = true; + return this; + } + public Builder ClearPreviousResults() { + PrepareBuilder(); + result.hasPreviousResults = false; + result.previousResults_ = null; + return this; + } + } + static RefineSearchRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInterop.Descriptor, null); + } + } + + #endregion + + #region Services + public partial interface ISearchService { + global::Google.ProtocolBuffers.TestProtos.SearchResponse Search(global::Google.ProtocolBuffers.TestProtos.SearchRequest searchRequest); + global::Google.ProtocolBuffers.TestProtos.SearchResponse RefineSearch(global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest refineSearchRequest); + } + + [global::System.CLSCompliant(false)] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public partial class SearchService : ISearchService, pb::IRpcDispatch, global::System.IDisposable { + private readonly bool dispose; + private readonly pb::IRpcDispatch dispatch; + public SearchService(pb::IRpcDispatch dispatch) : this(dispatch, true) { + } + public SearchService(pb::IRpcDispatch dispatch, bool dispose) { + pb::ThrowHelper.ThrowIfNull(this.dispatch = dispatch, "dispatch"); + this.dispose = dispose && dispatch is global::System.IDisposable; + } + + public void Dispose() { + if (dispose) ((global::System.IDisposable)dispatch).Dispose(); + } + + TMessage pb::IRpcDispatch.CallMethod(string method, pb::IMessageLite request, pb::IBuilderLite response) { + return dispatch.CallMethod(method, request, response); + } + + public global::Google.ProtocolBuffers.TestProtos.SearchResponse Search(global::Google.ProtocolBuffers.TestProtos.SearchRequest searchRequest) { + return dispatch.CallMethod("Search", searchRequest, global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder()); + } + + public global::Google.ProtocolBuffers.TestProtos.SearchResponse RefineSearch(global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest refineSearchRequest) { + return dispatch.CallMethod("RefineSearch", refineSearchRequest, global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder()); + } + + [global::System.CLSCompliant(false)] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public partial class Dispatch : pb::IRpcDispatch, global::System.IDisposable { + private readonly bool dispose; + private readonly ISearchService implementation; + public Dispatch(ISearchService implementation) : this(implementation, true) { + } + public Dispatch(ISearchService implementation, bool dispose) { + pb::ThrowHelper.ThrowIfNull(this.implementation = implementation, "implementation"); + this.dispose = dispose && implementation is global::System.IDisposable; + } + + public void Dispose() { + if (dispose) ((global::System.IDisposable)implementation).Dispose(); + } + + public TMessage CallMethod(string methodName, pb::IMessageLite request, pb::IBuilderLite response) + where TMessage : pb::IMessageLite + where TBuilder : pb::IBuilderLite { + switch(methodName) { + case "Search": return response.MergeFrom(implementation.Search((global::Google.ProtocolBuffers.TestProtos.SearchRequest)request)).Build(); + case "RefineSearch": return response.MergeFrom(implementation.RefineSearch((global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest)request)).Build(); + default: throw pb::ThrowHelper.CreateMissingMethod(typeof(ISearchService), methodName); + } + } + } + [global::System.CLSCompliant(false)] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public partial class ServerStub : pb::IRpcServerStub, global::System.IDisposable { + private readonly bool dispose; + private readonly pb::IRpcDispatch implementation; + public ServerStub(ISearchService implementation) : this(implementation, true) { + } + public ServerStub(ISearchService implementation, bool dispose) : this(new Dispatch(implementation, dispose), dispose) { + } + public ServerStub(pb::IRpcDispatch implementation) : this(implementation, true) { + } + public ServerStub(pb::IRpcDispatch implementation, bool dispose) { + pb::ThrowHelper.ThrowIfNull(this.implementation = implementation, "implementation"); + this.dispose = dispose && implementation is global::System.IDisposable; + } + + public void Dispose() { + if (dispose) ((global::System.IDisposable)implementation).Dispose(); + } + + public pb::IMessageLite CallMethod(string methodName, pb::ICodedInputStream input, pb::ExtensionRegistry registry) { + switch(methodName) { + case "Search": return implementation.CallMethod(methodName, global::Google.ProtocolBuffers.TestProtos.SearchRequest.ParseFrom(input, registry), global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder()); + case "RefineSearch": return implementation.CallMethod(methodName, global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.ParseFrom(input, registry), global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder()); + default: throw pb::ThrowHelper.CreateMissingMethod(typeof(ISearchService), methodName); + } + } + } + } + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs new file mode 100644 index 00000000..fe35c91d --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestProtos/UnitTestXmlSerializerTestProtoFile.cs @@ -0,0 +1,2292 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestXmlSerializerTestProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.ExtensionEnum); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.ExtensionText); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.ExtensionNumber); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.ExtensionMessage); + } + #endregion + #region Extensions + public const int ExtensionEnumFieldNumber = 101; + public static pb::GeneratedExtensionBase ExtensionEnum; + public const int ExtensionTextFieldNumber = 102; + public static pb::GeneratedExtensionBase ExtensionText; + public const int ExtensionNumberFieldNumber = 103; + public static pb::GeneratedExtensionBase> ExtensionNumber; + public const int ExtensionMessageFieldNumber = 199; + public static pb::GeneratedExtensionBase ExtensionMessage; + #endregion + + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestXmlChild__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestXmlChild__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestXmlNoFields__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestXmlNoFields__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestXmlRescursive__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestXmlRescursive__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestXmlMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestXmlMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestXmlMessage_Children__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestXmlMessage_Children__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestXmlExtension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestXmlExtension__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestXmlSerializerTestProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiRleHRlc3QvdW5pdHRlc3RfZXh0cmFzX3htbHRlc3QucHJvdG8SF3Byb3Rv", + "YnVmX3VuaXR0ZXN0X2V4dHJhGiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29w", + "dGlvbnMucHJvdG8iVQoMVGVzdFhtbENoaWxkEjUKB29wdGlvbnMYAyADKA4y", + "JC5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5FbnVtT3B0aW9ucxIOCgZiaW5h", + "cnkYBCABKAwiEQoPVGVzdFhtbE5vRmllbGRzIk4KEVRlc3RYbWxSZXNjdXJz", + "aXZlEjkKBWNoaWxkGAEgASgLMioucHJvdG9idWZfdW5pdHRlc3RfZXh0cmEu", + "VGVzdFhtbFJlc2N1cnNpdmUitwIKDlRlc3RYbWxNZXNzYWdlEg4KBm51bWJl", + "chgGIAEoAxIPCgdudW1iZXJzGAIgAygFEgwKBHRleHQYAyABKAkSEgoJdGV4", + "dGxpbmVzGLwFIAMoCRINCgV2YWxpZBgFIAEoCBI0CgVjaGlsZBgBIAEoCzIl", + "LnByb3RvYnVmX3VuaXR0ZXN0X2V4dHJhLlRlc3RYbWxDaGlsZBJDCghjaGls", + "ZHJlbhiRAyADKAoyMC5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0WG1s", + "TWVzc2FnZS5DaGlsZHJlbhpRCghDaGlsZHJlbhI1CgdvcHRpb25zGAMgAygO", + "MiQucHJvdG9idWZfdW5pdHRlc3RfZXh0cmEuRW51bU9wdGlvbnMSDgoGYmlu", + "YXJ5GAQgASgMKgUIZBDIASIiChBUZXN0WG1sRXh0ZW5zaW9uEg4KBm51bWJl", + "chgBIAIoBSoqCgtFbnVtT3B0aW9ucxIHCgNPTkUQABIHCgNUV08QARIJCgVU", + "SFJFRRACOmUKDmV4dGVuc2lvbl9lbnVtEicucHJvdG9idWZfdW5pdHRlc3Rf", + "ZXh0cmEuVGVzdFhtbE1lc3NhZ2UYZSABKA4yJC5wcm90b2J1Zl91bml0dGVz", + "dF9leHRyYS5FbnVtT3B0aW9uczo/Cg5leHRlbnNpb25fdGV4dBInLnByb3Rv", + "YnVmX3VuaXR0ZXN0X2V4dHJhLlRlc3RYbWxNZXNzYWdlGGYgASgJOkUKEGV4", + "dGVuc2lvbl9udW1iZXISJy5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0", + "WG1sTWVzc2FnZRhnIAMoBUICEAE6bgoRZXh0ZW5zaW9uX21lc3NhZ2USJy5w", + "cm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0WG1sTWVzc2FnZRjHASABKAsy", + "KS5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0WG1sRXh0ZW5zaW9uQk5I", + "AcI+SQohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEiJVbml0", + "VGVzdFhtbFNlcmlhbGl6ZXJUZXN0UHJvdG9GaWxlSAE=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_extra_TestXmlChild__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_extra_TestXmlChild__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestXmlChild__Descriptor, + new string[] { "Options", "Binary", }); + internal__static_protobuf_unittest_extra_TestXmlNoFields__Descriptor = Descriptor.MessageTypes[1]; + internal__static_protobuf_unittest_extra_TestXmlNoFields__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestXmlNoFields__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_extra_TestXmlRescursive__Descriptor = Descriptor.MessageTypes[2]; + internal__static_protobuf_unittest_extra_TestXmlRescursive__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestXmlRescursive__Descriptor, + new string[] { "Child", }); + internal__static_protobuf_unittest_extra_TestXmlMessage__Descriptor = Descriptor.MessageTypes[3]; + internal__static_protobuf_unittest_extra_TestXmlMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestXmlMessage__Descriptor, + new string[] { "Number", "Numbers", "Text", "Textlines", "Valid", "Child", "Children", }); + internal__static_protobuf_unittest_extra_TestXmlMessage_Children__Descriptor = internal__static_protobuf_unittest_extra_TestXmlMessage__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_extra_TestXmlMessage_Children__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestXmlMessage_Children__Descriptor, + new string[] { "Options", "Binary", }); + internal__static_protobuf_unittest_extra_TestXmlExtension__Descriptor = Descriptor.MessageTypes[4]; + internal__static_protobuf_unittest_extra_TestXmlExtension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestXmlExtension__Descriptor, + new string[] { "Number", }); + global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.ExtensionEnum = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.ExtensionText = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor.Extensions[1]); + global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.ExtensionNumber = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor.Extensions[2]); + global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.ExtensionMessage = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor.Extensions[3]); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum EnumOptions { + ONE = 0, + TWO = 1, + THREE = 2, + } + + #endregion + + #region Messages + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestXmlChild : pb::GeneratedMessage { + private TestXmlChild() { } + private static readonly TestXmlChild defaultInstance = new TestXmlChild().MakeReadOnly(); + private static readonly string[] _testXmlChildFieldNames = new string[] { "binary", "options" }; + private static readonly uint[] _testXmlChildFieldTags = new uint[] { 34, 24 }; + public static TestXmlChild DefaultInstance { + get { return defaultInstance; } + } + + public override TestXmlChild DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestXmlChild ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlChild__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlChild__FieldAccessorTable; } + } + + public const int OptionsFieldNumber = 3; + private pbc::PopsicleList options_ = new pbc::PopsicleList(); + public scg::IList OptionsList { + get { return pbc::Lists.AsReadOnly(options_); } + } + public int OptionsCount { + get { return options_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.EnumOptions GetOptions(int index) { + return options_[index]; + } + + public const int BinaryFieldNumber = 4; + private bool hasBinary; + private pb::ByteString binary_ = pb::ByteString.Empty; + public bool HasBinary { + get { return hasBinary; } + } + public pb::ByteString Binary { + get { return binary_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testXmlChildFieldNames; + if (options_.Count > 0) { + output.WriteEnumArray(3, field_names[1], options_); + } + if (hasBinary) { + output.WriteBytes(4, field_names[0], Binary); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + if (options_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.EnumOptions element in options_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1 * options_.Count; + } + } + if (hasBinary) { + size += pb::CodedOutputStream.ComputeBytesSize(4, Binary); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestXmlChild ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlChild ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlChild ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlChild ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlChild ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlChild ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestXmlChild ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestXmlChild ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestXmlChild ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlChild ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestXmlChild MakeReadOnly() { + options_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestXmlChild prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestXmlChild cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestXmlChild result; + + private TestXmlChild PrepareBuilder() { + if (resultIsReadOnly) { + TestXmlChild original = result; + result = new TestXmlChild(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestXmlChild MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlChild.Descriptor; } + } + + public override TestXmlChild DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance; } + } + + public override TestXmlChild BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestXmlChild) { + return MergeFrom((TestXmlChild) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestXmlChild other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance) return this; + PrepareBuilder(); + if (other.options_.Count != 0) { + result.options_.Add(other.options_); + } + if (other.HasBinary) { + Binary = other.Binary; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testXmlChildFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testXmlChildFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 26: + case 24: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.options_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(3, (ulong)(int)rawValue); + } + break; + } + case 34: { + result.hasBinary = input.ReadBytes(ref result.binary_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList OptionsList { + get { return PrepareBuilder().options_; } + } + public int OptionsCount { + get { return result.OptionsCount; } + } + public global::Google.ProtocolBuffers.TestProtos.EnumOptions GetOptions(int index) { + return result.GetOptions(index); + } + public Builder SetOptions(int index, global::Google.ProtocolBuffers.TestProtos.EnumOptions value) { + PrepareBuilder(); + result.options_[index] = value; + return this; + } + public Builder AddOptions(global::Google.ProtocolBuffers.TestProtos.EnumOptions value) { + PrepareBuilder(); + result.options_.Add(value); + return this; + } + public Builder AddRangeOptions(scg::IEnumerable values) { + PrepareBuilder(); + result.options_.Add(values); + return this; + } + public Builder ClearOptions() { + PrepareBuilder(); + result.options_.Clear(); + return this; + } + + public bool HasBinary { + get { return result.hasBinary; } + } + public pb::ByteString Binary { + get { return result.Binary; } + set { SetBinary(value); } + } + public Builder SetBinary(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBinary = true; + result.binary_ = value; + return this; + } + public Builder ClearBinary() { + PrepareBuilder(); + result.hasBinary = false; + result.binary_ = pb::ByteString.Empty; + return this; + } + } + static TestXmlChild() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestXmlNoFields : pb::GeneratedMessage { + private TestXmlNoFields() { } + private static readonly TestXmlNoFields defaultInstance = new TestXmlNoFields().MakeReadOnly(); + private static readonly string[] _testXmlNoFieldsFieldNames = new string[] { }; + private static readonly uint[] _testXmlNoFieldsFieldTags = new uint[] { }; + public static TestXmlNoFields DefaultInstance { + get { return defaultInstance; } + } + + public override TestXmlNoFields DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestXmlNoFields ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlNoFields__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlNoFields__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testXmlNoFieldsFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestXmlNoFields ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlNoFields ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlNoFields ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlNoFields ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlNoFields ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlNoFields ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestXmlNoFields ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestXmlNoFields ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestXmlNoFields ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlNoFields ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestXmlNoFields MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestXmlNoFields prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestXmlNoFields cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestXmlNoFields result; + + private TestXmlNoFields PrepareBuilder() { + if (resultIsReadOnly) { + TestXmlNoFields original = result; + result = new TestXmlNoFields(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestXmlNoFields MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlNoFields.Descriptor; } + } + + public override TestXmlNoFields DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlNoFields.DefaultInstance; } + } + + public override TestXmlNoFields BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestXmlNoFields) { + return MergeFrom((TestXmlNoFields) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestXmlNoFields other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlNoFields.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testXmlNoFieldsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testXmlNoFieldsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestXmlNoFields() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestXmlRescursive : pb::GeneratedMessage { + private TestXmlRescursive() { } + private static readonly TestXmlRescursive defaultInstance = new TestXmlRescursive().MakeReadOnly(); + private static readonly string[] _testXmlRescursiveFieldNames = new string[] { "child" }; + private static readonly uint[] _testXmlRescursiveFieldTags = new uint[] { 10 }; + public static TestXmlRescursive DefaultInstance { + get { return defaultInstance; } + } + + public override TestXmlRescursive DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestXmlRescursive ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlRescursive__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlRescursive__FieldAccessorTable; } + } + + public const int ChildFieldNumber = 1; + private bool hasChild; + private global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive child_; + public bool HasChild { + get { return hasChild; } + } + public global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive Child { + get { return child_ ?? global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testXmlRescursiveFieldNames; + if (hasChild) { + output.WriteMessage(1, field_names[0], Child); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasChild) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Child); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestXmlRescursive ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlRescursive ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlRescursive ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlRescursive ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlRescursive ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlRescursive ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestXmlRescursive ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestXmlRescursive ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestXmlRescursive ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlRescursive ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestXmlRescursive MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestXmlRescursive prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestXmlRescursive cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestXmlRescursive result; + + private TestXmlRescursive PrepareBuilder() { + if (resultIsReadOnly) { + TestXmlRescursive original = result; + result = new TestXmlRescursive(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestXmlRescursive MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.Descriptor; } + } + + public override TestXmlRescursive DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance; } + } + + public override TestXmlRescursive BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestXmlRescursive) { + return MergeFrom((TestXmlRescursive) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestXmlRescursive other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasChild) { + MergeChild(other.Child); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testXmlRescursiveFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testXmlRescursiveFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.CreateBuilder(); + if (result.hasChild) { + subBuilder.MergeFrom(Child); + } + input.ReadMessage(subBuilder, extensionRegistry); + Child = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasChild { + get { return result.hasChild; } + } + public global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive Child { + get { return result.Child; } + set { SetChild(value); } + } + public Builder SetChild(global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasChild = true; + result.child_ = value; + return this; + } + public Builder SetChild(global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasChild = true; + result.child_ = builderForValue.Build(); + return this; + } + public Builder MergeChild(global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasChild && + result.child_ != global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.DefaultInstance) { + result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlRescursive.CreateBuilder(result.child_).MergeFrom(value).BuildPartial(); + } else { + result.child_ = value; + } + result.hasChild = true; + return this; + } + public Builder ClearChild() { + PrepareBuilder(); + result.hasChild = false; + result.child_ = null; + return this; + } + } + static TestXmlRescursive() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestXmlMessage : pb::ExtendableMessage { + private TestXmlMessage() { } + private static readonly TestXmlMessage defaultInstance = new TestXmlMessage().MakeReadOnly(); + private static readonly string[] _testXmlMessageFieldNames = new string[] { "child", "children", "number", "numbers", "text", "textlines", "valid" }; + private static readonly uint[] _testXmlMessageFieldTags = new uint[] { 10, 3211, 48, 16, 26, 5602, 40 }; + public static TestXmlMessage DefaultInstance { + get { return defaultInstance; } + } + + public override TestXmlMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestXmlMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlMessage__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Children : pb::GeneratedMessage { + private Children() { } + private static readonly Children defaultInstance = new Children().MakeReadOnly(); + private static readonly string[] _childrenFieldNames = new string[] { "binary", "options" }; + private static readonly uint[] _childrenFieldTags = new uint[] { 34, 24 }; + public static Children DefaultInstance { + get { return defaultInstance; } + } + + public override Children DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Children ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlMessage_Children__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlMessage_Children__FieldAccessorTable; } + } + + public const int OptionsFieldNumber = 3; + private pbc::PopsicleList options_ = new pbc::PopsicleList(); + public scg::IList OptionsList { + get { return pbc::Lists.AsReadOnly(options_); } + } + public int OptionsCount { + get { return options_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.EnumOptions GetOptions(int index) { + return options_[index]; + } + + public const int BinaryFieldNumber = 4; + private bool hasBinary; + private pb::ByteString binary_ = pb::ByteString.Empty; + public bool HasBinary { + get { return hasBinary; } + } + public pb::ByteString Binary { + get { return binary_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _childrenFieldNames; + if (options_.Count > 0) { + output.WriteEnumArray(3, field_names[1], options_); + } + if (hasBinary) { + output.WriteBytes(4, field_names[0], Binary); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + if (options_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.EnumOptions element in options_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1 * options_.Count; + } + } + if (hasBinary) { + size += pb::CodedOutputStream.ComputeBytesSize(4, Binary); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Children ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Children ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Children ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Children ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Children ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Children ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Children ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Children ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Children ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Children ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Children MakeReadOnly() { + options_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Children prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Children cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Children result; + + private Children PrepareBuilder() { + if (resultIsReadOnly) { + Children original = result; + result = new Children(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Children MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.Descriptor; } + } + + public override Children DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.DefaultInstance; } + } + + public override Children BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Children) { + return MergeFrom((Children) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Children other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.DefaultInstance) return this; + PrepareBuilder(); + if (other.options_.Count != 0) { + result.options_.Add(other.options_); + } + if (other.HasBinary) { + Binary = other.Binary; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_childrenFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _childrenFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 26: + case 24: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.options_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(3, (ulong)(int)rawValue); + } + break; + } + case 34: { + result.hasBinary = input.ReadBytes(ref result.binary_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList OptionsList { + get { return PrepareBuilder().options_; } + } + public int OptionsCount { + get { return result.OptionsCount; } + } + public global::Google.ProtocolBuffers.TestProtos.EnumOptions GetOptions(int index) { + return result.GetOptions(index); + } + public Builder SetOptions(int index, global::Google.ProtocolBuffers.TestProtos.EnumOptions value) { + PrepareBuilder(); + result.options_[index] = value; + return this; + } + public Builder AddOptions(global::Google.ProtocolBuffers.TestProtos.EnumOptions value) { + PrepareBuilder(); + result.options_.Add(value); + return this; + } + public Builder AddRangeOptions(scg::IEnumerable values) { + PrepareBuilder(); + result.options_.Add(values); + return this; + } + public Builder ClearOptions() { + PrepareBuilder(); + result.options_.Clear(); + return this; + } + + public bool HasBinary { + get { return result.hasBinary; } + } + public pb::ByteString Binary { + get { return result.Binary; } + set { SetBinary(value); } + } + public Builder SetBinary(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBinary = true; + result.binary_ = value; + return this; + } + public Builder ClearBinary() { + PrepareBuilder(); + result.hasBinary = false; + result.binary_ = pb::ByteString.Empty; + return this; + } + } + static Children() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int NumberFieldNumber = 6; + private bool hasNumber; + private long number_; + public bool HasNumber { + get { return hasNumber; } + } + public long Number { + get { return number_; } + } + + public const int NumbersFieldNumber = 2; + private pbc::PopsicleList numbers_ = new pbc::PopsicleList(); + public scg::IList NumbersList { + get { return pbc::Lists.AsReadOnly(numbers_); } + } + public int NumbersCount { + get { return numbers_.Count; } + } + public int GetNumbers(int index) { + return numbers_[index]; + } + + public const int TextFieldNumber = 3; + private bool hasText; + private string text_ = ""; + public bool HasText { + get { return hasText; } + } + public string Text { + get { return text_; } + } + + public const int TextlinesFieldNumber = 700; + private pbc::PopsicleList textlines_ = new pbc::PopsicleList(); + public scg::IList TextlinesList { + get { return pbc::Lists.AsReadOnly(textlines_); } + } + public int TextlinesCount { + get { return textlines_.Count; } + } + public string GetTextlines(int index) { + return textlines_[index]; + } + + public const int ValidFieldNumber = 5; + private bool hasValid; + private bool valid_; + public bool HasValid { + get { return hasValid; } + } + public bool Valid { + get { return valid_; } + } + + public const int ChildFieldNumber = 1; + private bool hasChild; + private global::Google.ProtocolBuffers.TestProtos.TestXmlChild child_; + public bool HasChild { + get { return hasChild; } + } + public global::Google.ProtocolBuffers.TestProtos.TestXmlChild Child { + get { return child_ ?? global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance; } + } + + public const int ChildrenFieldNumber = 401; + private pbc::PopsicleList children_ = new pbc::PopsicleList(); + public scg::IList ChildrenList { + get { return children_; } + } + public int ChildrenCount { + get { return children_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children GetChildren(int index) { + return children_[index]; + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testXmlMessageFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasChild) { + output.WriteMessage(1, field_names[0], Child); + } + if (numbers_.Count > 0) { + output.WriteInt32Array(2, field_names[3], numbers_); + } + if (hasText) { + output.WriteString(3, field_names[4], Text); + } + if (hasValid) { + output.WriteBool(5, field_names[6], Valid); + } + if (hasNumber) { + output.WriteInt64(6, field_names[2], Number); + } + extensionWriter.WriteUntil(200, output); + if (children_.Count > 0) { + output.WriteGroupArray(401, field_names[1], children_); + } + if (textlines_.Count > 0) { + output.WriteStringArray(700, field_names[5], textlines_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasNumber) { + size += pb::CodedOutputStream.ComputeInt64Size(6, Number); + } + { + int dataSize = 0; + foreach (int element in NumbersList) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * numbers_.Count; + } + if (hasText) { + size += pb::CodedOutputStream.ComputeStringSize(3, Text); + } + { + int dataSize = 0; + foreach (string element in TextlinesList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * textlines_.Count; + } + if (hasValid) { + size += pb::CodedOutputStream.ComputeBoolSize(5, Valid); + } + if (hasChild) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Child); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children element in ChildrenList) { + size += pb::CodedOutputStream.ComputeGroupSize(401, element); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestXmlMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestXmlMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestXmlMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestXmlMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestXmlMessage MakeReadOnly() { + numbers_.MakeReadOnly(); + textlines_.MakeReadOnly(); + children_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestXmlMessage prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestXmlMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestXmlMessage result; + + private TestXmlMessage PrepareBuilder() { + if (resultIsReadOnly) { + TestXmlMessage original = result; + result = new TestXmlMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestXmlMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Descriptor; } + } + + public override TestXmlMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.DefaultInstance; } + } + + public override TestXmlMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestXmlMessage) { + return MergeFrom((TestXmlMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestXmlMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasNumber) { + Number = other.Number; + } + if (other.numbers_.Count != 0) { + result.numbers_.Add(other.numbers_); + } + if (other.HasText) { + Text = other.Text; + } + if (other.textlines_.Count != 0) { + result.textlines_.Add(other.textlines_); + } + if (other.HasValid) { + Valid = other.Valid; + } + if (other.HasChild) { + MergeChild(other.Child); + } + if (other.children_.Count != 0) { + result.children_.Add(other.children_); + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testXmlMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testXmlMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestXmlChild.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestXmlChild.CreateBuilder(); + if (result.hasChild) { + subBuilder.MergeFrom(Child); + } + input.ReadMessage(subBuilder, extensionRegistry); + Child = subBuilder.BuildPartial(); + break; + } + case 18: + case 16: { + input.ReadInt32Array(tag, field_name, result.numbers_); + break; + } + case 26: { + result.hasText = input.ReadString(ref result.text_); + break; + } + case 40: { + result.hasValid = input.ReadBool(ref result.valid_); + break; + } + case 48: { + result.hasNumber = input.ReadInt64(ref result.number_); + break; + } + case 3211: { + input.ReadGroupArray(tag, field_name, result.children_, global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.DefaultInstance, extensionRegistry); + break; + } + case 5602: { + input.ReadStringArray(tag, field_name, result.textlines_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasNumber { + get { return result.hasNumber; } + } + public long Number { + get { return result.Number; } + set { SetNumber(value); } + } + public Builder SetNumber(long value) { + PrepareBuilder(); + result.hasNumber = true; + result.number_ = value; + return this; + } + public Builder ClearNumber() { + PrepareBuilder(); + result.hasNumber = false; + result.number_ = 0L; + return this; + } + + public pbc::IPopsicleList NumbersList { + get { return PrepareBuilder().numbers_; } + } + public int NumbersCount { + get { return result.NumbersCount; } + } + public int GetNumbers(int index) { + return result.GetNumbers(index); + } + public Builder SetNumbers(int index, int value) { + PrepareBuilder(); + result.numbers_[index] = value; + return this; + } + public Builder AddNumbers(int value) { + PrepareBuilder(); + result.numbers_.Add(value); + return this; + } + public Builder AddRangeNumbers(scg::IEnumerable values) { + PrepareBuilder(); + result.numbers_.Add(values); + return this; + } + public Builder ClearNumbers() { + PrepareBuilder(); + result.numbers_.Clear(); + return this; + } + + public bool HasText { + get { return result.hasText; } + } + public string Text { + get { return result.Text; } + set { SetText(value); } + } + public Builder SetText(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasText = true; + result.text_ = value; + return this; + } + public Builder ClearText() { + PrepareBuilder(); + result.hasText = false; + result.text_ = ""; + return this; + } + + public pbc::IPopsicleList TextlinesList { + get { return PrepareBuilder().textlines_; } + } + public int TextlinesCount { + get { return result.TextlinesCount; } + } + public string GetTextlines(int index) { + return result.GetTextlines(index); + } + public Builder SetTextlines(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.textlines_[index] = value; + return this; + } + public Builder AddTextlines(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.textlines_.Add(value); + return this; + } + public Builder AddRangeTextlines(scg::IEnumerable values) { + PrepareBuilder(); + result.textlines_.Add(values); + return this; + } + public Builder ClearTextlines() { + PrepareBuilder(); + result.textlines_.Clear(); + return this; + } + + public bool HasValid { + get { return result.hasValid; } + } + public bool Valid { + get { return result.Valid; } + set { SetValid(value); } + } + public Builder SetValid(bool value) { + PrepareBuilder(); + result.hasValid = true; + result.valid_ = value; + return this; + } + public Builder ClearValid() { + PrepareBuilder(); + result.hasValid = false; + result.valid_ = false; + return this; + } + + public bool HasChild { + get { return result.hasChild; } + } + public global::Google.ProtocolBuffers.TestProtos.TestXmlChild Child { + get { return result.Child; } + set { SetChild(value); } + } + public Builder SetChild(global::Google.ProtocolBuffers.TestProtos.TestXmlChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasChild = true; + result.child_ = value; + return this; + } + public Builder SetChild(global::Google.ProtocolBuffers.TestProtos.TestXmlChild.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasChild = true; + result.child_ = builderForValue.Build(); + return this; + } + public Builder MergeChild(global::Google.ProtocolBuffers.TestProtos.TestXmlChild value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasChild && + result.child_ != global::Google.ProtocolBuffers.TestProtos.TestXmlChild.DefaultInstance) { + result.child_ = global::Google.ProtocolBuffers.TestProtos.TestXmlChild.CreateBuilder(result.child_).MergeFrom(value).BuildPartial(); + } else { + result.child_ = value; + } + result.hasChild = true; + return this; + } + public Builder ClearChild() { + PrepareBuilder(); + result.hasChild = false; + result.child_ = null; + return this; + } + + public pbc::IPopsicleList ChildrenList { + get { return PrepareBuilder().children_; } + } + public int ChildrenCount { + get { return result.ChildrenCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children GetChildren(int index) { + return result.GetChildren(index); + } + public Builder SetChildren(int index, global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.children_[index] = value; + return this; + } + public Builder SetChildren(int index, global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.children_[index] = builderForValue.Build(); + return this; + } + public Builder AddChildren(global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.children_.Add(value); + return this; + } + public Builder AddChildren(global::Google.ProtocolBuffers.TestProtos.TestXmlMessage.Types.Children.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.children_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeChildren(scg::IEnumerable values) { + PrepareBuilder(); + result.children_.Add(values); + return this; + } + public Builder ClearChildren() { + PrepareBuilder(); + result.children_.Clear(); + return this; + } + } + static TestXmlMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestXmlExtension : pb::GeneratedMessage { + private TestXmlExtension() { } + private static readonly TestXmlExtension defaultInstance = new TestXmlExtension().MakeReadOnly(); + private static readonly string[] _testXmlExtensionFieldNames = new string[] { "number" }; + private static readonly uint[] _testXmlExtensionFieldTags = new uint[] { 8 }; + public static TestXmlExtension DefaultInstance { + get { return defaultInstance; } + } + + public override TestXmlExtension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestXmlExtension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlExtension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.internal__static_protobuf_unittest_extra_TestXmlExtension__FieldAccessorTable; } + } + + public const int NumberFieldNumber = 1; + private bool hasNumber; + private int number_; + public bool HasNumber { + get { return hasNumber; } + } + public int Number { + get { return number_; } + } + + public override bool IsInitialized { + get { + if (!hasNumber) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testXmlExtensionFieldNames; + if (hasNumber) { + output.WriteInt32(1, field_names[0], Number); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasNumber) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Number); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestXmlExtension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlExtension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlExtension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestXmlExtension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestXmlExtension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlExtension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestXmlExtension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestXmlExtension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestXmlExtension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestXmlExtension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestXmlExtension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestXmlExtension prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestXmlExtension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestXmlExtension result; + + private TestXmlExtension PrepareBuilder() { + if (resultIsReadOnly) { + TestXmlExtension original = result; + result = new TestXmlExtension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestXmlExtension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlExtension.Descriptor; } + } + + public override TestXmlExtension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestXmlExtension.DefaultInstance; } + } + + public override TestXmlExtension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestXmlExtension) { + return MergeFrom((TestXmlExtension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestXmlExtension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestXmlExtension.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasNumber) { + Number = other.Number; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testXmlExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testXmlExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasNumber = input.ReadInt32(ref result.number_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasNumber { + get { return result.hasNumber; } + } + public int Number { + get { return result.Number; } + set { SetNumber(value); } + } + public Builder SetNumber(int value) { + PrepareBuilder(); + result.hasNumber = true; + result.number_ = value; + return this; + } + public Builder ClearNumber() { + PrepareBuilder(); + result.hasNumber = false; + result.number_ = 0; + return this; + } + } + static TestXmlExtension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestXmlSerializerTestProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers.Test/TestReaderForUrlEncoded.cs b/csharp/src/ProtocolBuffers.Test/TestReaderForUrlEncoded.cs new file mode 100644 index 00000000..1c43e24d --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestReaderForUrlEncoded.cs @@ -0,0 +1,84 @@ +using System; +using System.IO; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Google.ProtocolBuffers.TestProtos; +using Google.ProtocolBuffers.Serialization.Http; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class TestReaderForUrlEncoded + { + [TestMethod] + public void Example_FromQueryString() + { + Uri sampleUri = new Uri("http://sample.com/Path/File.ext?text=two+three%20four&valid=true&numbers=1&numbers=2", UriKind.Absolute); + + ICodedInputStream input = FormUrlEncodedReader.CreateInstance(sampleUri.Query); + + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + builder.MergeFrom(input); + + TestXmlMessage message = builder.Build(); + Assert.AreEqual(true, message.Valid); + Assert.AreEqual("two three four", message.Text); + Assert.AreEqual(2, message.NumbersCount); + Assert.AreEqual(1, message.NumbersList[0]); + Assert.AreEqual(2, message.NumbersList[1]); + } + + [TestMethod] + public void Example_FromFormData() + { + Stream rawPost = new MemoryStream(Encoding.UTF8.GetBytes("text=two+three%20four&valid=true&numbers=1&numbers=2"), false); + + ICodedInputStream input = FormUrlEncodedReader.CreateInstance(rawPost); + + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + builder.MergeFrom(input); + + TestXmlMessage message = builder.Build(); + Assert.AreEqual(true, message.Valid); + Assert.AreEqual("two three four", message.Text); + Assert.AreEqual(2, message.NumbersCount); + Assert.AreEqual(1, message.NumbersList[0]); + Assert.AreEqual(2, message.NumbersList[1]); + } + + [TestMethod] + public void TestEmptyValues() + { + ICodedInputStream input = FormUrlEncodedReader.CreateInstance("valid=true&text=&numbers=1"); + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + builder.MergeFrom(input); + + Assert.IsTrue(builder.Valid); + Assert.IsTrue(builder.HasText); + Assert.AreEqual("", builder.Text); + Assert.AreEqual(1, builder.NumbersCount); + Assert.AreEqual(1, builder.NumbersList[0]); + } + + [TestMethod] + public void TestNoValue() + { + ICodedInputStream input = FormUrlEncodedReader.CreateInstance("valid=true&text&numbers=1"); + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + builder.MergeFrom(input); + + Assert.IsTrue(builder.Valid); + Assert.IsTrue(builder.HasText); + Assert.AreEqual("", builder.Text); + Assert.AreEqual(1, builder.NumbersCount); + Assert.AreEqual(1, builder.NumbersList[0]); + } + + [TestMethod, ExpectedException(typeof(NotSupportedException))] + public void FormUrlEncodedReaderDoesNotSupportChildren() + { + ICodedInputStream input = FormUrlEncodedReader.CreateInstance("child=uh0"); + TestXmlMessage.CreateBuilder().MergeFrom(input); + } + } +} diff --git a/csharp/src/ProtocolBuffers.Test/TestResources.cs b/csharp/src/ProtocolBuffers.Test/TestResources.cs new file mode 100644 index 00000000..c978ca68 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestResources.cs @@ -0,0 +1,294 @@ +namespace Google.ProtocolBuffers +{ + internal class TestResources + { + #region golden_message + internal static byte[] golden_message + { + get + { + return System.Convert.FromBase64String(@" +CGUQZhhnIGgo0gEw1AE9awAAAEFsAAAAAAAAAE1tAAAAUW4AAAAAAAAAXQAA3kJhAAAAAAAAXEBo +AXIDMTE1egMxMTaDAYgBdYQBkgECCHaaAQIId6IBAgh4qAEDsAEGuAEJwgEDMTI0ygEDMTI1+AHJ +AfgBrQKAAsoBgAKuAogCywGIAq8CkALMAZACsAKYApoDmALiBKACnAOgAuQErQLPAAAArQIzAQAA +sQLQAAAAAAAAALECNAEAAAAAAAC9AtEAAAC9AjUBAADBAtIAAAAAAAAAwQI2AQAAAAAAAM0CAABT +Q80CAICbQ9ECAAAAAACAakDRAgAAAAAAgHNA2AIB2AIA4gIDMjE14gIDMzE16gIDMjE26gIDMzE2 +8wL4AtkB9ALzAvgCvQL0AoIDAwjaAYIDAwi+AooDAwjbAYoDAwi/ApIDAwjcAZIDAwjAApgDApgD +A6ADBaADBqgDCKgDCbIDAzIyNLIDAzMyNLoDAzIyNboDAzMyNegDkQPwA5ID+AOTA4AElAOIBKoG +kASsBp0ElwEAAKEEmAEAAAAAAACtBJkBAACxBJoBAAAAAAAAvQQAgM1DwQQAAAAAAMB5QMgEANIE +AzQxNdoEAzQxNogFAZAFBJgFB6IFAzQyNKoFAzQyNQ== +"); + } + } + #endregion + + #region golden_packed_fields_message + internal static byte[] golden_packed_fields_message + { + get + { + return System.Convert.FromBase64String(@" +0gUE2QS9BdoFBNoEvgXiBQTbBL8F6gUE3ATABfIFBLoJggv6BQS8CYQLggYIXwIAAMMCAACKBhBg +AgAAAAAAAMQCAAAAAAAAkgYIYQIAAMUCAACaBhBiAgAAAAAAAMYCAAAAAAAAogYIAMAYRADAMUSq +BhAAAAAAACCDQAAAAAAAQIZAsgYCAQC6BgIFBg== +"); + } + } + #endregion + + #region text_format_unittest_data + internal static string text_format_unittest_data + { + get + { + return @" +optional_int32: 101 +optional_int64: 102 +optional_uint32: 103 +optional_uint64: 104 +optional_sint32: 105 +optional_sint64: 106 +optional_fixed32: 107 +optional_fixed64: 108 +optional_sfixed32: 109 +optional_sfixed64: 110 +optional_float: 111 +optional_double: 112 +optional_bool: true +optional_string: ""115"" +optional_bytes: ""116"" +OptionalGroup { + a: 117 +} +optional_nested_message { + bb: 118 +} +optional_foreign_message { + c: 119 +} +optional_import_message { + d: 120 +} +optional_nested_enum: BAZ +optional_foreign_enum: FOREIGN_BAZ +optional_import_enum: IMPORT_BAZ +optional_string_piece: ""124"" +optional_cord: ""125"" +repeated_int32: 201 +repeated_int32: 301 +repeated_int64: 202 +repeated_int64: 302 +repeated_uint32: 203 +repeated_uint32: 303 +repeated_uint64: 204 +repeated_uint64: 304 +repeated_sint32: 205 +repeated_sint32: 305 +repeated_sint64: 206 +repeated_sint64: 306 +repeated_fixed32: 207 +repeated_fixed32: 307 +repeated_fixed64: 208 +repeated_fixed64: 308 +repeated_sfixed32: 209 +repeated_sfixed32: 309 +repeated_sfixed64: 210 +repeated_sfixed64: 310 +repeated_float: 211 +repeated_float: 311 +repeated_double: 212 +repeated_double: 312 +repeated_bool: true +repeated_bool: false +repeated_string: ""215"" +repeated_string: ""315"" +repeated_bytes: ""216"" +repeated_bytes: ""316"" +RepeatedGroup { + a: 217 +} +RepeatedGroup { + a: 317 +} +repeated_nested_message { + bb: 218 +} +repeated_nested_message { + bb: 318 +} +repeated_foreign_message { + c: 219 +} +repeated_foreign_message { + c: 319 +} +repeated_import_message { + d: 220 +} +repeated_import_message { + d: 320 +} +repeated_nested_enum: BAR +repeated_nested_enum: BAZ +repeated_foreign_enum: FOREIGN_BAR +repeated_foreign_enum: FOREIGN_BAZ +repeated_import_enum: IMPORT_BAR +repeated_import_enum: IMPORT_BAZ +repeated_string_piece: ""224"" +repeated_string_piece: ""324"" +repeated_cord: ""225"" +repeated_cord: ""325"" +default_int32: 401 +default_int64: 402 +default_uint32: 403 +default_uint64: 404 +default_sint32: 405 +default_sint64: 406 +default_fixed32: 407 +default_fixed64: 408 +default_sfixed32: 409 +default_sfixed64: 410 +default_float: 411 +default_double: 412 +default_bool: false +default_string: ""415"" +default_bytes: ""416"" +default_nested_enum: FOO +default_foreign_enum: FOREIGN_FOO +default_import_enum: IMPORT_FOO +default_string_piece: ""424"" +default_cord: ""425"" + +"; + } + } + #endregion + + #region text_format_unittest_extensions_data + internal static string text_format_unittest_extensions_data + { + get + { + return @" +[protobuf_unittest.optional_int32_extension]: 101 +[protobuf_unittest.optional_int64_extension]: 102 +[protobuf_unittest.optional_uint32_extension]: 103 +[protobuf_unittest.optional_uint64_extension]: 104 +[protobuf_unittest.optional_sint32_extension]: 105 +[protobuf_unittest.optional_sint64_extension]: 106 +[protobuf_unittest.optional_fixed32_extension]: 107 +[protobuf_unittest.optional_fixed64_extension]: 108 +[protobuf_unittest.optional_sfixed32_extension]: 109 +[protobuf_unittest.optional_sfixed64_extension]: 110 +[protobuf_unittest.optional_float_extension]: 111 +[protobuf_unittest.optional_double_extension]: 112 +[protobuf_unittest.optional_bool_extension]: true +[protobuf_unittest.optional_string_extension]: ""115"" +[protobuf_unittest.optional_bytes_extension]: ""116"" +[protobuf_unittest.optionalgroup_extension] { + a: 117 +} +[protobuf_unittest.optional_nested_message_extension] { + bb: 118 +} +[protobuf_unittest.optional_foreign_message_extension] { + c: 119 +} +[protobuf_unittest.optional_import_message_extension] { + d: 120 +} +[protobuf_unittest.optional_nested_enum_extension]: BAZ +[protobuf_unittest.optional_foreign_enum_extension]: FOREIGN_BAZ +[protobuf_unittest.optional_import_enum_extension]: IMPORT_BAZ +[protobuf_unittest.optional_string_piece_extension]: ""124"" +[protobuf_unittest.optional_cord_extension]: ""125"" +[protobuf_unittest.repeated_int32_extension]: 201 +[protobuf_unittest.repeated_int32_extension]: 301 +[protobuf_unittest.repeated_int64_extension]: 202 +[protobuf_unittest.repeated_int64_extension]: 302 +[protobuf_unittest.repeated_uint32_extension]: 203 +[protobuf_unittest.repeated_uint32_extension]: 303 +[protobuf_unittest.repeated_uint64_extension]: 204 +[protobuf_unittest.repeated_uint64_extension]: 304 +[protobuf_unittest.repeated_sint32_extension]: 205 +[protobuf_unittest.repeated_sint32_extension]: 305 +[protobuf_unittest.repeated_sint64_extension]: 206 +[protobuf_unittest.repeated_sint64_extension]: 306 +[protobuf_unittest.repeated_fixed32_extension]: 207 +[protobuf_unittest.repeated_fixed32_extension]: 307 +[protobuf_unittest.repeated_fixed64_extension]: 208 +[protobuf_unittest.repeated_fixed64_extension]: 308 +[protobuf_unittest.repeated_sfixed32_extension]: 209 +[protobuf_unittest.repeated_sfixed32_extension]: 309 +[protobuf_unittest.repeated_sfixed64_extension]: 210 +[protobuf_unittest.repeated_sfixed64_extension]: 310 +[protobuf_unittest.repeated_float_extension]: 211 +[protobuf_unittest.repeated_float_extension]: 311 +[protobuf_unittest.repeated_double_extension]: 212 +[protobuf_unittest.repeated_double_extension]: 312 +[protobuf_unittest.repeated_bool_extension]: true +[protobuf_unittest.repeated_bool_extension]: false +[protobuf_unittest.repeated_string_extension]: ""215"" +[protobuf_unittest.repeated_string_extension]: ""315"" +[protobuf_unittest.repeated_bytes_extension]: ""216"" +[protobuf_unittest.repeated_bytes_extension]: ""316"" +[protobuf_unittest.repeatedgroup_extension] { + a: 217 +} +[protobuf_unittest.repeatedgroup_extension] { + a: 317 +} +[protobuf_unittest.repeated_nested_message_extension] { + bb: 218 +} +[protobuf_unittest.repeated_nested_message_extension] { + bb: 318 +} +[protobuf_unittest.repeated_foreign_message_extension] { + c: 219 +} +[protobuf_unittest.repeated_foreign_message_extension] { + c: 319 +} +[protobuf_unittest.repeated_import_message_extension] { + d: 220 +} +[protobuf_unittest.repeated_import_message_extension] { + d: 320 +} +[protobuf_unittest.repeated_nested_enum_extension]: BAR +[protobuf_unittest.repeated_nested_enum_extension]: BAZ +[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAR +[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAZ +[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAR +[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAZ +[protobuf_unittest.repeated_string_piece_extension]: ""224"" +[protobuf_unittest.repeated_string_piece_extension]: ""324"" +[protobuf_unittest.repeated_cord_extension]: ""225"" +[protobuf_unittest.repeated_cord_extension]: ""325"" +[protobuf_unittest.default_int32_extension]: 401 +[protobuf_unittest.default_int64_extension]: 402 +[protobuf_unittest.default_uint32_extension]: 403 +[protobuf_unittest.default_uint64_extension]: 404 +[protobuf_unittest.default_sint32_extension]: 405 +[protobuf_unittest.default_sint64_extension]: 406 +[protobuf_unittest.default_fixed32_extension]: 407 +[protobuf_unittest.default_fixed64_extension]: 408 +[protobuf_unittest.default_sfixed32_extension]: 409 +[protobuf_unittest.default_sfixed64_extension]: 410 +[protobuf_unittest.default_float_extension]: 411 +[protobuf_unittest.default_double_extension]: 412 +[protobuf_unittest.default_bool_extension]: false +[protobuf_unittest.default_string_extension]: ""415"" +[protobuf_unittest.default_bytes_extension]: ""416"" +[protobuf_unittest.default_nested_enum_extension]: FOO +[protobuf_unittest.default_foreign_enum_extension]: FOREIGN_FOO +[protobuf_unittest.default_import_enum_extension]: IMPORT_FOO +[protobuf_unittest.default_string_piece_extension]: ""424"" +[protobuf_unittest.default_cord_extension]: ""425"" +"; + } + } + #endregion + } +} diff --git a/csharp/src/ProtocolBuffers.Test/TestRpcForMimeTypes.cs b/csharp/src/ProtocolBuffers.Test/TestRpcForMimeTypes.cs new file mode 100644 index 00000000..68cb93da --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestRpcForMimeTypes.cs @@ -0,0 +1,386 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers; +using Google.ProtocolBuffers.Serialization.Http; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.IO; +using Google.ProtocolBuffers.Serialization; +using System.Text; + +namespace Google.ProtocolBuffers +{ + /// + /// This class verifies the correct code is generated from unittest_rpc_interop.proto and provides a small demonstration + /// of using the new IRpcDispatch to write a client/server + /// + [TestClass] + public class TestRpcForMimeTypes + { + /// + /// A sample implementation of the ISearchService for testing + /// + private class ExampleSearchImpl : ISearchService + { + SearchResponse ISearchService.Search(SearchRequest searchRequest) + { + if (searchRequest.CriteriaCount == 0) + { + throw new ArgumentException("No criteria specified.", new InvalidOperationException()); + } + SearchResponse.Builder resp = SearchResponse.CreateBuilder(); + foreach (string criteria in searchRequest.CriteriaList) + { + resp.AddResults( + SearchResponse.Types.ResultItem.CreateBuilder().SetName(criteria).SetUrl("http://search.com"). + Build()); + } + return resp.Build(); + } + + SearchResponse ISearchService.RefineSearch(RefineSearchRequest refineSearchRequest) + { + SearchResponse.Builder resp = refineSearchRequest.PreviousResults.ToBuilder(); + foreach (string criteria in refineSearchRequest.CriteriaList) + { + resp.AddResults( + SearchResponse.Types.ResultItem.CreateBuilder().SetName(criteria).SetUrl("http://refine.com"). + Build()); + } + return resp.Build(); + } + } + + /// + /// An example extraction of the wire protocol + /// + private interface IHttpTransfer + { + void Execute(string method, string contentType, Stream input, string acceptType, Stream output); + } + + /// + /// An example of a server responding to a web/http request + /// + private class ExampleHttpServer : IHttpTransfer + { + public readonly MessageFormatOptions Options = + new MessageFormatOptions + { + ExtensionRegistry = ExtensionRegistry.Empty, + FormattedOutput = true, + XmlReaderOptions = XmlReaderOptions.ReadNestedArrays, + XmlReaderRootElementName = "request", + XmlWriterOptions = XmlWriterOptions.OutputNestedArrays, + XmlWriterRootElementName = "response" + }; + + private readonly IRpcServerStub _stub; + + public ExampleHttpServer(ISearchService implementation) + { + //on the server, we create a dispatch to call the appropriate method by name + IRpcDispatch dispatch = new SearchService.Dispatch(implementation); + //we then wrap that dispatch in a server stub which will deserialize the wire bytes to the message + //type appropriate for the method name being invoked. + _stub = new SearchService.ServerStub(dispatch); + } + + void IHttpTransfer.Execute(string method, string contentType, Stream input, string acceptType, Stream output) + { + //3.5: _stub.HttpCallMethod( + Extensions.HttpCallMethod(_stub, + method, Options, + contentType, input, + acceptType, output + ); + } + } + + /// + /// An example of a client sending a wire request + /// + private class ExampleClient : IRpcDispatch + { + public readonly MessageFormatOptions Options = + new MessageFormatOptions + { + ExtensionRegistry = ExtensionRegistry.Empty, + FormattedOutput = true, + XmlReaderOptions = XmlReaderOptions.ReadNestedArrays, + XmlReaderRootElementName = "response", + XmlWriterOptions = XmlWriterOptions.OutputNestedArrays, + XmlWriterRootElementName = "request" + }; + + + private readonly IHttpTransfer _wire; + private readonly string _mimeType; + + public ExampleClient(IHttpTransfer wire, string mimeType) + { + _wire = wire; + _mimeType = mimeType; + } + + TMessage IRpcDispatch.CallMethod(string method, IMessageLite request, + IBuilderLite response) + { + MemoryStream input = new MemoryStream(); + MemoryStream output = new MemoryStream(); + + //Write to _mimeType format + Extensions.WriteTo(request, Options, _mimeType, input); + + input.Position = 0; + _wire.Execute(method, _mimeType, input, _mimeType, output); + + //Read from _mimeType format + output.Position = 0; + Extensions.MergeFrom(response, Options, _mimeType, output); + + return response.Build(); + } + } + + /// + /// Test sending and recieving messages via text/json + /// + [TestMethod] + public void TestClientServerWithJsonFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + ISearchService client = new SearchService(new ExampleClient(wire, "text/json")); + //now the client has a real, typed, interface to work with: + SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + //The test part of this, call the only other method + result = + client.RefineSearch( + RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Refine", result.ResultsList[1].Name); + Assert.AreEqual("http://refine.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [TestMethod] + public void TestClientServerWithXmlFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + ISearchService client = new SearchService(new ExampleClient(wire, "text/xml")); + //now the client has a real, typed, interface to work with: + SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + //The test part of this, call the only other method + result = + client.RefineSearch( + RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Refine", result.ResultsList[1].Name); + Assert.AreEqual("http://refine.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [TestMethod] + public void TestClientServerWithProtoFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + ISearchService client = new SearchService(new ExampleClient(wire, "application/x-protobuf")); + //now the client has a real, typed, interface to work with: + SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + //The test part of this, call the only other method + result = + client.RefineSearch( + RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Refine", result.ResultsList[1].Name); + Assert.AreEqual("http://refine.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [TestMethod] + public void TestClientServerWithCustomFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //Setup our custom mime-type format as the only format supported: + server.Options.MimeInputTypes.Clear(); + server.Options.MimeInputTypes.Add("foo/bar", CodedInputStream.CreateInstance); + server.Options.MimeOutputTypes.Clear(); + server.Options.MimeOutputTypes.Add("foo/bar", CodedOutputStream.CreateInstance); + + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + ExampleClient exclient = new ExampleClient(wire, "foo/bar"); + //Add our custom mime-type format + exclient.Options.MimeInputTypes.Add("foo/bar", CodedInputStream.CreateInstance); + exclient.Options.MimeOutputTypes.Add("foo/bar", CodedOutputStream.CreateInstance); + ISearchService client = new SearchService(exclient); + + //now the client has a real, typed, interface to work with: + SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + //The test part of this, call the only other method + result = + client.RefineSearch( + RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Refine", result.ResultsList[1].Name); + Assert.AreEqual("http://refine.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [TestMethod] + public void TestServerWithUriFormat() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + MemoryStream input = new MemoryStream(Encoding.UTF8.GetBytes("?Criteria=Test&Criteria=Test+of%20URI")); + MemoryStream output = new MemoryStream(); + + //Call the server + wire.Execute("Search", + MessageFormatOptions.ContentFormUrlEncoded, input, + MessageFormatOptions.ContentTypeProtoBuffer, output + ); + + SearchResponse result = SearchResponse.ParseFrom(output.ToArray()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Test of URI", result.ResultsList[1].Name); + Assert.AreEqual("http://search.com", result.ResultsList[1].Url); + } + + /// + /// Test sending and recieving messages via text/json + /// + [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))] + public void TestInvalidMimeType() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + MemoryStream input = new MemoryStream(); + MemoryStream output = new MemoryStream(); + + //Call the server + wire.Execute("Search", + "bad/mime", input, + MessageFormatOptions.ContentTypeProtoBuffer, output + ); + Assert.Fail(); + } + + /// + /// Test sending and recieving messages via text/json + /// + [TestMethod] + public void TestDefaultMimeType() + { + ExampleHttpServer server = new ExampleHttpServer(new ExampleSearchImpl()); + + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IHttpTransfer wire = server; + + + MemoryStream input = new MemoryStream(new SearchRequest.Builder().AddCriteria("Test").Build().ToByteArray()); + MemoryStream output = new MemoryStream(); + + //With this default set, any invalid/unknown mime-type will be mapped to use that format + server.Options.DefaultContentType = MessageFormatOptions.ContentTypeProtoBuffer; + + wire.Execute("Search", + "foo", input, + "bar", output + ); + + SearchResponse result = SearchResponse.ParseFrom(output.ToArray()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/TestRpcGenerator.cs b/csharp/src/ProtocolBuffers.Test/TestRpcGenerator.cs new file mode 100644 index 00000000..18532d69 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestRpcGenerator.cs @@ -0,0 +1,171 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + /// + /// This class verifies the correct code is generated from unittest_rpc_interop.proto and provides a small demonstration + /// of using the new IRpcDispatch to write a client/server + /// + [TestClass] + public class TestRpcGenerator + { + /// + /// A sample implementation of the ISearchService for testing + /// + private class ExampleSearchImpl : ISearchService + { + SearchResponse ISearchService.Search(SearchRequest searchRequest) + { + if (searchRequest.CriteriaCount == 0) + { + throw new ArgumentException("No criteria specified.", new InvalidOperationException()); + } + SearchResponse.Builder resp = SearchResponse.CreateBuilder(); + foreach (string criteria in searchRequest.CriteriaList) + { + resp.AddResults( + SearchResponse.Types.ResultItem.CreateBuilder().SetName(criteria).SetUrl("http://search.com"). + Build()); + } + return resp.Build(); + } + + SearchResponse ISearchService.RefineSearch(RefineSearchRequest refineSearchRequest) + { + SearchResponse.Builder resp = refineSearchRequest.PreviousResults.ToBuilder(); + foreach (string criteria in refineSearchRequest.CriteriaList) + { + resp.AddResults( + SearchResponse.Types.ResultItem.CreateBuilder().SetName(criteria).SetUrl("http://refine.com"). + Build()); + } + return resp.Build(); + } + } + + /// + /// An example extraction of the wire protocol + /// + private interface IWireTransfer + { + byte[] Execute(string method, byte[] message); + } + + /// + /// An example of a server responding to a wire request + /// + private class ExampleServerHost : IWireTransfer + { + private readonly IRpcServerStub _stub; + + public ExampleServerHost(ISearchService implementation) + { + //on the server, we create a dispatch to call the appropriate method by name + IRpcDispatch dispatch = new SearchService.Dispatch(implementation); + //we then wrap that dispatch in a server stub which will deserialize the wire bytes to the message + //type appropriate for the method name being invoked. + _stub = new SearchService.ServerStub(dispatch); + } + + byte[] IWireTransfer.Execute(string method, byte[] message) + { + //now when we recieve a wire transmission to invoke a method by name with a byte[] or stream payload + //we just simply call the sub: + IMessageLite response = _stub.CallMethod(method, CodedInputStream.CreateInstance(message), + ExtensionRegistry.Empty); + //now we return the expected response message: + return response.ToByteArray(); + } + } + + /// + /// An example of a client sending a wire request + /// + private class ExampleClient : IRpcDispatch + { + private readonly IWireTransfer _wire; + + public ExampleClient(IWireTransfer wire) + { + _wire = wire; + } + + TMessage IRpcDispatch.CallMethod(string method, IMessageLite request, + IBuilderLite response) + { + byte[] rawResponse = _wire.Execute(method, request.ToByteArray()); + response.MergeFrom(rawResponse); + return response.Build(); + } + } + + /// + /// Put it all together to create one seamless client/server experience full of rich-type goodness ;) + /// All you need to do is send/recieve the method name and message bytes across the wire. + /// + [TestMethod] + public void TestClientServerDispatch() + { + ExampleServerHost server = new ExampleServerHost(new ExampleSearchImpl()); + //obviously if this was a 'real' transport we would not use the server, rather the server would be listening, the client transmitting + IWireTransfer wire = server; + + ISearchService client = new SearchService(new ExampleClient(wire)); + //now the client has a real, typed, interface to work with: + SearchResponse result = client.Search(SearchRequest.CreateBuilder().AddCriteria("Test").Build()); + Assert.AreEqual(1, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + //The test part of this, call the only other method + result = + client.RefineSearch( + RefineSearchRequest.CreateBuilder().SetPreviousResults(result).AddCriteria("Refine").Build()); + Assert.AreEqual(2, result.ResultsCount); + Assert.AreEqual("Test", result.ResultsList[0].Name); + Assert.AreEqual("http://search.com", result.ResultsList[0].Url); + + Assert.AreEqual("Refine", result.ResultsList[1].Name); + Assert.AreEqual("http://refine.com", result.ResultsList[1].Url); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/TestUtil.cs b/csharp/src/ProtocolBuffers.Test/TestUtil.cs new file mode 100644 index 00000000..19c0df34 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestUtil.cs @@ -0,0 +1,1812 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Globalization; +using System.IO; +using System.Text; +using System.Threading; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + internal static class TestUtil + { + private static ByteString goldenMessage = null; + + internal static ByteString GoldenMessage + { + get + { + if (goldenMessage == null) + { + goldenMessage = ByteString.CopyFrom(TestResources.golden_message); + } + return goldenMessage; + } + } + + private static ByteString goldenPackedFieldsMessage = null; + + /// + /// Get the bytes of the "golden packed fields message". This is a serialized + /// TestPackedTypes with all fields set as they would be by SetPackedFields, + /// but it is loaded from a file on disk rather than generated dynamically. + /// The file is actually generated by C++ code, so testing against it verifies compatibility + /// with C++. + /// + public static ByteString GetGoldenPackedFieldsMessage() + { + if (goldenPackedFieldsMessage == null) + { + goldenPackedFieldsMessage = ByteString.CopyFrom(TestResources.golden_packed_fields_message); + } + return goldenPackedFieldsMessage; + } + + /// + /// Creates an unmodifiable ExtensionRegistry containing all the extensions + /// of TestAllExtensions. + /// + /// + internal static ExtensionRegistry CreateExtensionRegistry() + { + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + return registry.AsReadOnly(); + } + + /// + /// Registers all of the extensions in TestAllExtensions with the given + /// ExtensionRegistry. + /// + internal static void RegisterAllExtensions(ExtensionRegistry registry) + { + registry.Add(UnitTestProtoFile.OptionalInt32Extension); + registry.Add(UnitTestProtoFile.OptionalInt64Extension); + registry.Add(UnitTestProtoFile.OptionalUint32Extension); + registry.Add(UnitTestProtoFile.OptionalUint64Extension); + registry.Add(UnitTestProtoFile.OptionalSint32Extension); + registry.Add(UnitTestProtoFile.OptionalSint64Extension); + registry.Add(UnitTestProtoFile.OptionalFixed32Extension); + registry.Add(UnitTestProtoFile.OptionalFixed64Extension); + registry.Add(UnitTestProtoFile.OptionalSfixed32Extension); + registry.Add(UnitTestProtoFile.OptionalSfixed64Extension); + registry.Add(UnitTestProtoFile.OptionalFloatExtension); + registry.Add(UnitTestProtoFile.OptionalDoubleExtension); + registry.Add(UnitTestProtoFile.OptionalBoolExtension); + registry.Add(UnitTestProtoFile.OptionalStringExtension); + registry.Add(UnitTestProtoFile.OptionalBytesExtension); + registry.Add(UnitTestProtoFile.OptionalGroupExtension); + registry.Add(UnitTestProtoFile.OptionalNestedMessageExtension); + registry.Add(UnitTestProtoFile.OptionalForeignMessageExtension); + registry.Add(UnitTestProtoFile.OptionalImportMessageExtension); + registry.Add(UnitTestProtoFile.OptionalNestedEnumExtension); + registry.Add(UnitTestProtoFile.OptionalForeignEnumExtension); + registry.Add(UnitTestProtoFile.OptionalImportEnumExtension); + registry.Add(UnitTestProtoFile.OptionalStringPieceExtension); + registry.Add(UnitTestProtoFile.OptionalCordExtension); + + registry.Add(UnitTestProtoFile.RepeatedInt32Extension); + registry.Add(UnitTestProtoFile.RepeatedInt64Extension); + registry.Add(UnitTestProtoFile.RepeatedUint32Extension); + registry.Add(UnitTestProtoFile.RepeatedUint64Extension); + registry.Add(UnitTestProtoFile.RepeatedSint32Extension); + registry.Add(UnitTestProtoFile.RepeatedSint64Extension); + registry.Add(UnitTestProtoFile.RepeatedFixed32Extension); + registry.Add(UnitTestProtoFile.RepeatedFixed64Extension); + registry.Add(UnitTestProtoFile.RepeatedSfixed32Extension); + registry.Add(UnitTestProtoFile.RepeatedSfixed64Extension); + registry.Add(UnitTestProtoFile.RepeatedFloatExtension); + registry.Add(UnitTestProtoFile.RepeatedDoubleExtension); + registry.Add(UnitTestProtoFile.RepeatedBoolExtension); + registry.Add(UnitTestProtoFile.RepeatedStringExtension); + registry.Add(UnitTestProtoFile.RepeatedBytesExtension); + registry.Add(UnitTestProtoFile.RepeatedGroupExtension); + registry.Add(UnitTestProtoFile.RepeatedNestedMessageExtension); + registry.Add(UnitTestProtoFile.RepeatedForeignMessageExtension); + registry.Add(UnitTestProtoFile.RepeatedImportMessageExtension); + registry.Add(UnitTestProtoFile.RepeatedNestedEnumExtension); + registry.Add(UnitTestProtoFile.RepeatedForeignEnumExtension); + registry.Add(UnitTestProtoFile.RepeatedImportEnumExtension); + registry.Add(UnitTestProtoFile.RepeatedStringPieceExtension); + registry.Add(UnitTestProtoFile.RepeatedCordExtension); + + registry.Add(UnitTestProtoFile.DefaultInt32Extension); + registry.Add(UnitTestProtoFile.DefaultInt64Extension); + registry.Add(UnitTestProtoFile.DefaultUint32Extension); + registry.Add(UnitTestProtoFile.DefaultUint64Extension); + registry.Add(UnitTestProtoFile.DefaultSint32Extension); + registry.Add(UnitTestProtoFile.DefaultSint64Extension); + registry.Add(UnitTestProtoFile.DefaultFixed32Extension); + registry.Add(UnitTestProtoFile.DefaultFixed64Extension); + registry.Add(UnitTestProtoFile.DefaultSfixed32Extension); + registry.Add(UnitTestProtoFile.DefaultSfixed64Extension); + registry.Add(UnitTestProtoFile.DefaultFloatExtension); + registry.Add(UnitTestProtoFile.DefaultDoubleExtension); + registry.Add(UnitTestProtoFile.DefaultBoolExtension); + registry.Add(UnitTestProtoFile.DefaultStringExtension); + registry.Add(UnitTestProtoFile.DefaultBytesExtension); + registry.Add(UnitTestProtoFile.DefaultNestedEnumExtension); + registry.Add(UnitTestProtoFile.DefaultForeignEnumExtension); + registry.Add(UnitTestProtoFile.DefaultImportEnumExtension); + registry.Add(UnitTestProtoFile.DefaultStringPieceExtension); + registry.Add(UnitTestProtoFile.DefaultCordExtension); + + registry.Add(UnitTestProtoFile.PackedInt32Extension); + registry.Add(UnitTestProtoFile.PackedInt64Extension); + registry.Add(UnitTestProtoFile.PackedUint32Extension); + registry.Add(UnitTestProtoFile.PackedUint64Extension); + registry.Add(UnitTestProtoFile.PackedSint32Extension); + registry.Add(UnitTestProtoFile.PackedSint64Extension); + registry.Add(UnitTestProtoFile.PackedFixed32Extension); + registry.Add(UnitTestProtoFile.PackedFixed64Extension); + registry.Add(UnitTestProtoFile.PackedSfixed32Extension); + registry.Add(UnitTestProtoFile.PackedSfixed64Extension); + registry.Add(UnitTestProtoFile.PackedFloatExtension); + registry.Add(UnitTestProtoFile.PackedDoubleExtension); + registry.Add(UnitTestProtoFile.PackedBoolExtension); + registry.Add(UnitTestProtoFile.PackedEnumExtension); + } + + /// + /// Helper to convert a String to ByteString. + /// + internal static ByteString ToBytes(String str) + { + return ByteString.CopyFrom(Encoding.UTF8.GetBytes(str)); + } + + internal static TestAllTypes GetAllSet() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + SetAllFields(builder); + return builder.Build(); + } + + /// + /// Sets every field of the specified message to the values expected by + /// AssertAllFieldsSet. + /// + internal static void SetAllFields(TestAllTypes.Builder message) + { + message.SetOptionalInt32(101); + message.SetOptionalInt64(102); + message.SetOptionalUint32(103); + message.SetOptionalUint64(104); + message.SetOptionalSint32(105); + message.SetOptionalSint64(106); + message.SetOptionalFixed32(107); + message.SetOptionalFixed64(108); + message.SetOptionalSfixed32(109); + message.SetOptionalSfixed64(110); + message.SetOptionalFloat(111); + message.SetOptionalDouble(112); + message.SetOptionalBool(true); + message.SetOptionalString("115"); + message.SetOptionalBytes(ToBytes("116")); + + message.SetOptionalGroup(TestAllTypes.Types.OptionalGroup.CreateBuilder().SetA(117).Build()); + message.SetOptionalNestedMessage(TestAllTypes.Types.NestedMessage.CreateBuilder().SetBb(118).Build()); + message.SetOptionalForeignMessage(ForeignMessage.CreateBuilder().SetC(119).Build()); + message.SetOptionalImportMessage(ImportMessage.CreateBuilder().SetD(120).Build()); + + message.SetOptionalNestedEnum(TestAllTypes.Types.NestedEnum.BAZ); + message.SetOptionalForeignEnum(ForeignEnum.FOREIGN_BAZ); + message.SetOptionalImportEnum(ImportEnum.IMPORT_BAZ); + + message.SetOptionalStringPiece("124"); + message.SetOptionalCord("125"); + + // ----------------------------------------------------------------- + + message.AddRepeatedInt32(201); + message.AddRepeatedInt64(202); + message.AddRepeatedUint32(203); + message.AddRepeatedUint64(204); + message.AddRepeatedSint32(205); + message.AddRepeatedSint64(206); + message.AddRepeatedFixed32(207); + message.AddRepeatedFixed64(208); + message.AddRepeatedSfixed32(209); + message.AddRepeatedSfixed64(210); + message.AddRepeatedFloat(211); + message.AddRepeatedDouble(212); + message.AddRepeatedBool(true); + message.AddRepeatedString("215"); + message.AddRepeatedBytes(ToBytes("216")); + + message.AddRepeatedGroup(TestAllTypes.Types.RepeatedGroup.CreateBuilder().SetA(217).Build()); + message.AddRepeatedNestedMessage(TestAllTypes.Types.NestedMessage.CreateBuilder().SetBb(218).Build()); + message.AddRepeatedForeignMessage(ForeignMessage.CreateBuilder().SetC(219).Build()); + message.AddRepeatedImportMessage(ImportMessage.CreateBuilder().SetD(220).Build()); + + message.AddRepeatedNestedEnum(TestAllTypes.Types.NestedEnum.BAR); + message.AddRepeatedForeignEnum(ForeignEnum.FOREIGN_BAR); + message.AddRepeatedImportEnum(ImportEnum.IMPORT_BAR); + + message.AddRepeatedStringPiece("224"); + message.AddRepeatedCord("225"); + + // Add a second one of each field. + message.AddRepeatedInt32(301); + message.AddRepeatedInt64(302); + message.AddRepeatedUint32(303); + message.AddRepeatedUint64(304); + message.AddRepeatedSint32(305); + message.AddRepeatedSint64(306); + message.AddRepeatedFixed32(307); + message.AddRepeatedFixed64(308); + message.AddRepeatedSfixed32(309); + message.AddRepeatedSfixed64(310); + message.AddRepeatedFloat(311); + message.AddRepeatedDouble(312); + message.AddRepeatedBool(false); + message.AddRepeatedString("315"); + message.AddRepeatedBytes(ToBytes("316")); + + message.AddRepeatedGroup(TestAllTypes.Types.RepeatedGroup.CreateBuilder().SetA(317).Build()); + message.AddRepeatedNestedMessage(TestAllTypes.Types.NestedMessage.CreateBuilder().SetBb(318).Build()); + message.AddRepeatedForeignMessage(ForeignMessage.CreateBuilder().SetC(319).Build()); + message.AddRepeatedImportMessage(ImportMessage.CreateBuilder().SetD(320).Build()); + + message.AddRepeatedNestedEnum(TestAllTypes.Types.NestedEnum.BAZ); + message.AddRepeatedForeignEnum(ForeignEnum.FOREIGN_BAZ); + message.AddRepeatedImportEnum(ImportEnum.IMPORT_BAZ); + + message.AddRepeatedStringPiece("324"); + message.AddRepeatedCord("325"); + + // ----------------------------------------------------------------- + + message.SetDefaultInt32(401); + message.SetDefaultInt64(402); + message.SetDefaultUint32(403); + message.SetDefaultUint64(404); + message.SetDefaultSint32(405); + message.SetDefaultSint64(406); + message.SetDefaultFixed32(407); + message.SetDefaultFixed64(408); + message.SetDefaultSfixed32(409); + message.SetDefaultSfixed64(410); + message.SetDefaultFloat(411); + message.SetDefaultDouble(412); + message.SetDefaultBool(false); + message.SetDefaultString("415"); + message.SetDefaultBytes(ToBytes("416")); + + message.SetDefaultNestedEnum(TestAllTypes.Types.NestedEnum.FOO); + message.SetDefaultForeignEnum(ForeignEnum.FOREIGN_FOO); + message.SetDefaultImportEnum(ImportEnum.IMPORT_FOO); + + message.SetDefaultStringPiece("424"); + message.SetDefaultCord("425"); + } + + /// + /// Asserts that all fields of the specified message are set to the values + /// assigned by SetAllFields. + /// + internal static void AssertAllFieldsSet(TestAllTypes message) + { + Assert.IsTrue(message.HasOptionalInt32); + Assert.IsTrue(message.HasOptionalInt64); + Assert.IsTrue(message.HasOptionalUint32); + Assert.IsTrue(message.HasOptionalUint64); + Assert.IsTrue(message.HasOptionalSint32); + Assert.IsTrue(message.HasOptionalSint64); + Assert.IsTrue(message.HasOptionalFixed32); + Assert.IsTrue(message.HasOptionalFixed64); + Assert.IsTrue(message.HasOptionalSfixed32); + Assert.IsTrue(message.HasOptionalSfixed64); + Assert.IsTrue(message.HasOptionalFloat); + Assert.IsTrue(message.HasOptionalDouble); + Assert.IsTrue(message.HasOptionalBool); + Assert.IsTrue(message.HasOptionalString); + Assert.IsTrue(message.HasOptionalBytes); + + Assert.IsTrue(message.HasOptionalGroup); + Assert.IsTrue(message.HasOptionalNestedMessage); + Assert.IsTrue(message.HasOptionalForeignMessage); + Assert.IsTrue(message.HasOptionalImportMessage); + + Assert.IsTrue(message.OptionalGroup.HasA); + Assert.IsTrue(message.OptionalNestedMessage.HasBb); + Assert.IsTrue(message.OptionalForeignMessage.HasC); + Assert.IsTrue(message.OptionalImportMessage.HasD); + + Assert.IsTrue(message.HasOptionalNestedEnum); + Assert.IsTrue(message.HasOptionalForeignEnum); + Assert.IsTrue(message.HasOptionalImportEnum); + + Assert.IsTrue(message.HasOptionalStringPiece); + Assert.IsTrue(message.HasOptionalCord); + + Assert.AreEqual(101, message.OptionalInt32); + Assert.AreEqual(102, message.OptionalInt64); + Assert.AreEqual(103u, message.OptionalUint32); + Assert.AreEqual(104u, message.OptionalUint64); + Assert.AreEqual(105, message.OptionalSint32); + Assert.AreEqual(106, message.OptionalSint64); + Assert.AreEqual(107u, message.OptionalFixed32); + Assert.AreEqual(108u, message.OptionalFixed64); + Assert.AreEqual(109, message.OptionalSfixed32); + Assert.AreEqual(110, message.OptionalSfixed64); + Assert.AreEqual(111, message.OptionalFloat); + Assert.AreEqual(112, message.OptionalDouble); + Assert.AreEqual(true, message.OptionalBool); + Assert.AreEqual("115", message.OptionalString); + Assert.AreEqual(ToBytes("116"), message.OptionalBytes); + + Assert.AreEqual(117, message.OptionalGroup.A); + Assert.AreEqual(118, message.OptionalNestedMessage.Bb); + Assert.AreEqual(119, message.OptionalForeignMessage.C); + Assert.AreEqual(120, message.OptionalImportMessage.D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAZ, message.OptionalNestedEnum); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, message.OptionalForeignEnum); + Assert.AreEqual(ImportEnum.IMPORT_BAZ, message.OptionalImportEnum); + + Assert.AreEqual("124", message.OptionalStringPiece); + Assert.AreEqual("125", message.OptionalCord); + + // ----------------------------------------------------------------- + + Assert.AreEqual(2, message.RepeatedInt32Count); + Assert.AreEqual(2, message.RepeatedInt64Count); + Assert.AreEqual(2, message.RepeatedUint32Count); + Assert.AreEqual(2, message.RepeatedUint64Count); + Assert.AreEqual(2, message.RepeatedSint32Count); + Assert.AreEqual(2, message.RepeatedSint64Count); + Assert.AreEqual(2, message.RepeatedFixed32Count); + Assert.AreEqual(2, message.RepeatedFixed64Count); + Assert.AreEqual(2, message.RepeatedSfixed32Count); + Assert.AreEqual(2, message.RepeatedSfixed64Count); + Assert.AreEqual(2, message.RepeatedFloatCount); + Assert.AreEqual(2, message.RepeatedDoubleCount); + Assert.AreEqual(2, message.RepeatedBoolCount); + Assert.AreEqual(2, message.RepeatedStringCount); + Assert.AreEqual(2, message.RepeatedBytesCount); + + Assert.AreEqual(2, message.RepeatedGroupCount); + Assert.AreEqual(2, message.RepeatedNestedMessageCount); + Assert.AreEqual(2, message.RepeatedForeignMessageCount); + Assert.AreEqual(2, message.RepeatedImportMessageCount); + Assert.AreEqual(2, message.RepeatedNestedEnumCount); + Assert.AreEqual(2, message.RepeatedForeignEnumCount); + Assert.AreEqual(2, message.RepeatedImportEnumCount); + + Assert.AreEqual(2, message.RepeatedStringPieceCount); + Assert.AreEqual(2, message.RepeatedCordCount); + + Assert.AreEqual(201, message.GetRepeatedInt32(0)); + Assert.AreEqual(202, message.GetRepeatedInt64(0)); + Assert.AreEqual(203u, message.GetRepeatedUint32(0)); + Assert.AreEqual(204u, message.GetRepeatedUint64(0)); + Assert.AreEqual(205, message.GetRepeatedSint32(0)); + Assert.AreEqual(206, message.GetRepeatedSint64(0)); + Assert.AreEqual(207u, message.GetRepeatedFixed32(0)); + Assert.AreEqual(208u, message.GetRepeatedFixed64(0)); + Assert.AreEqual(209, message.GetRepeatedSfixed32(0)); + Assert.AreEqual(210, message.GetRepeatedSfixed64(0)); + Assert.AreEqual(211, message.GetRepeatedFloat(0)); + Assert.AreEqual(212, message.GetRepeatedDouble(0)); + Assert.AreEqual(true, message.GetRepeatedBool(0)); + Assert.AreEqual("215", message.GetRepeatedString(0)); + Assert.AreEqual(ToBytes("216"), message.GetRepeatedBytes(0)); + + Assert.AreEqual(217, message.GetRepeatedGroup(0).A); + Assert.AreEqual(218, message.GetRepeatedNestedMessage(0).Bb); + Assert.AreEqual(219, message.GetRepeatedForeignMessage(0).C); + Assert.AreEqual(220, message.GetRepeatedImportMessage(0).D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, message.GetRepeatedNestedEnum(0)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAR, message.GetRepeatedForeignEnum(0)); + Assert.AreEqual(ImportEnum.IMPORT_BAR, message.GetRepeatedImportEnum(0)); + + Assert.AreEqual("224", message.GetRepeatedStringPiece(0)); + Assert.AreEqual("225", message.GetRepeatedCord(0)); + + Assert.AreEqual(301, message.GetRepeatedInt32(1)); + Assert.AreEqual(302, message.GetRepeatedInt64(1)); + Assert.AreEqual(303u, message.GetRepeatedUint32(1)); + Assert.AreEqual(304u, message.GetRepeatedUint64(1)); + Assert.AreEqual(305, message.GetRepeatedSint32(1)); + Assert.AreEqual(306, message.GetRepeatedSint64(1)); + Assert.AreEqual(307u, message.GetRepeatedFixed32(1)); + Assert.AreEqual(308u, message.GetRepeatedFixed64(1)); + Assert.AreEqual(309, message.GetRepeatedSfixed32(1)); + Assert.AreEqual(310, message.GetRepeatedSfixed64(1)); + Assert.AreEqual(311, message.GetRepeatedFloat(1), 0.0); + Assert.AreEqual(312, message.GetRepeatedDouble(1), 0.0); + Assert.AreEqual(false, message.GetRepeatedBool(1)); + Assert.AreEqual("315", message.GetRepeatedString(1)); + Assert.AreEqual(ToBytes("316"), message.GetRepeatedBytes(1)); + + Assert.AreEqual(317, message.GetRepeatedGroup(1).A); + Assert.AreEqual(318, message.GetRepeatedNestedMessage(1).Bb); + Assert.AreEqual(319, message.GetRepeatedForeignMessage(1).C); + Assert.AreEqual(320, message.GetRepeatedImportMessage(1).D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAZ, message.GetRepeatedNestedEnum(1)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, message.GetRepeatedForeignEnum(1)); + Assert.AreEqual(ImportEnum.IMPORT_BAZ, message.GetRepeatedImportEnum(1)); + + Assert.AreEqual("324", message.GetRepeatedStringPiece(1)); + Assert.AreEqual("325", message.GetRepeatedCord(1)); + + // ----------------------------------------------------------------- + + Assert.IsTrue(message.HasDefaultInt32); + Assert.IsTrue(message.HasDefaultInt64); + Assert.IsTrue(message.HasDefaultUint32); + Assert.IsTrue(message.HasDefaultUint64); + Assert.IsTrue(message.HasDefaultSint32); + Assert.IsTrue(message.HasDefaultSint64); + Assert.IsTrue(message.HasDefaultFixed32); + Assert.IsTrue(message.HasDefaultFixed64); + Assert.IsTrue(message.HasDefaultSfixed32); + Assert.IsTrue(message.HasDefaultSfixed64); + Assert.IsTrue(message.HasDefaultFloat); + Assert.IsTrue(message.HasDefaultDouble); + Assert.IsTrue(message.HasDefaultBool); + Assert.IsTrue(message.HasDefaultString); + Assert.IsTrue(message.HasDefaultBytes); + + Assert.IsTrue(message.HasDefaultNestedEnum); + Assert.IsTrue(message.HasDefaultForeignEnum); + Assert.IsTrue(message.HasDefaultImportEnum); + + Assert.IsTrue(message.HasDefaultStringPiece); + Assert.IsTrue(message.HasDefaultCord); + + Assert.AreEqual(401, message.DefaultInt32); + Assert.AreEqual(402, message.DefaultInt64); + Assert.AreEqual(403u, message.DefaultUint32); + Assert.AreEqual(404u, message.DefaultUint64); + Assert.AreEqual(405, message.DefaultSint32); + Assert.AreEqual(406, message.DefaultSint64); + Assert.AreEqual(407u, message.DefaultFixed32); + Assert.AreEqual(408u, message.DefaultFixed64); + Assert.AreEqual(409, message.DefaultSfixed32); + Assert.AreEqual(410, message.DefaultSfixed64); + Assert.AreEqual(411, message.DefaultFloat); + Assert.AreEqual(412, message.DefaultDouble); + Assert.AreEqual(false, message.DefaultBool); + Assert.AreEqual("415", message.DefaultString); + Assert.AreEqual(ToBytes("416"), message.DefaultBytes); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, message.DefaultNestedEnum); + Assert.AreEqual(ForeignEnum.FOREIGN_FOO, message.DefaultForeignEnum); + Assert.AreEqual(ImportEnum.IMPORT_FOO, message.DefaultImportEnum); + + Assert.AreEqual("424", message.DefaultStringPiece); + Assert.AreEqual("425", message.DefaultCord); + } + + internal static void AssertClear(TestAllTypes message) + { + // HasBlah() should initially be false for all optional fields. + Assert.IsFalse(message.HasOptionalInt32); + Assert.IsFalse(message.HasOptionalInt64); + Assert.IsFalse(message.HasOptionalUint32); + Assert.IsFalse(message.HasOptionalUint64); + Assert.IsFalse(message.HasOptionalSint32); + Assert.IsFalse(message.HasOptionalSint64); + Assert.IsFalse(message.HasOptionalFixed32); + Assert.IsFalse(message.HasOptionalFixed64); + Assert.IsFalse(message.HasOptionalSfixed32); + Assert.IsFalse(message.HasOptionalSfixed64); + Assert.IsFalse(message.HasOptionalFloat); + Assert.IsFalse(message.HasOptionalDouble); + Assert.IsFalse(message.HasOptionalBool); + Assert.IsFalse(message.HasOptionalString); + Assert.IsFalse(message.HasOptionalBytes); + + Assert.IsFalse(message.HasOptionalGroup); + Assert.IsFalse(message.HasOptionalNestedMessage); + Assert.IsFalse(message.HasOptionalForeignMessage); + Assert.IsFalse(message.HasOptionalImportMessage); + + Assert.IsFalse(message.HasOptionalNestedEnum); + Assert.IsFalse(message.HasOptionalForeignEnum); + Assert.IsFalse(message.HasOptionalImportEnum); + + Assert.IsFalse(message.HasOptionalStringPiece); + Assert.IsFalse(message.HasOptionalCord); + + // Optional fields without defaults are set to zero or something like it. + Assert.AreEqual(0, message.OptionalInt32); + Assert.AreEqual(0, message.OptionalInt64); + Assert.AreEqual(0u, message.OptionalUint32); + Assert.AreEqual(0u, message.OptionalUint64); + Assert.AreEqual(0, message.OptionalSint32); + Assert.AreEqual(0, message.OptionalSint64); + Assert.AreEqual(0u, message.OptionalFixed32); + Assert.AreEqual(0u, message.OptionalFixed64); + Assert.AreEqual(0, message.OptionalSfixed32); + Assert.AreEqual(0, message.OptionalSfixed64); + Assert.AreEqual(0, message.OptionalFloat); + Assert.AreEqual(0, message.OptionalDouble); + Assert.AreEqual(false, message.OptionalBool); + Assert.AreEqual("", message.OptionalString); + Assert.AreEqual(ByteString.Empty, message.OptionalBytes); + + // Embedded messages should also be clear. + Assert.IsFalse(message.OptionalGroup.HasA); + Assert.IsFalse(message.OptionalNestedMessage.HasBb); + Assert.IsFalse(message.OptionalForeignMessage.HasC); + Assert.IsFalse(message.OptionalImportMessage.HasD); + + Assert.AreEqual(0, message.OptionalGroup.A); + Assert.AreEqual(0, message.OptionalNestedMessage.Bb); + Assert.AreEqual(0, message.OptionalForeignMessage.C); + Assert.AreEqual(0, message.OptionalImportMessage.D); + + // Enums without defaults are set to the first value in the enum. + Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, message.OptionalNestedEnum); + Assert.AreEqual(ForeignEnum.FOREIGN_FOO, message.OptionalForeignEnum); + Assert.AreEqual(ImportEnum.IMPORT_FOO, message.OptionalImportEnum); + + Assert.AreEqual("", message.OptionalStringPiece); + Assert.AreEqual("", message.OptionalCord); + + // Repeated fields are empty. + Assert.AreEqual(0, message.RepeatedInt32Count); + Assert.AreEqual(0, message.RepeatedInt64Count); + Assert.AreEqual(0, message.RepeatedUint32Count); + Assert.AreEqual(0, message.RepeatedUint64Count); + Assert.AreEqual(0, message.RepeatedSint32Count); + Assert.AreEqual(0, message.RepeatedSint64Count); + Assert.AreEqual(0, message.RepeatedFixed32Count); + Assert.AreEqual(0, message.RepeatedFixed64Count); + Assert.AreEqual(0, message.RepeatedSfixed32Count); + Assert.AreEqual(0, message.RepeatedSfixed64Count); + Assert.AreEqual(0, message.RepeatedFloatCount); + Assert.AreEqual(0, message.RepeatedDoubleCount); + Assert.AreEqual(0, message.RepeatedBoolCount); + Assert.AreEqual(0, message.RepeatedStringCount); + Assert.AreEqual(0, message.RepeatedBytesCount); + + Assert.AreEqual(0, message.RepeatedGroupCount); + Assert.AreEqual(0, message.RepeatedNestedMessageCount); + Assert.AreEqual(0, message.RepeatedForeignMessageCount); + Assert.AreEqual(0, message.RepeatedImportMessageCount); + Assert.AreEqual(0, message.RepeatedNestedEnumCount); + Assert.AreEqual(0, message.RepeatedForeignEnumCount); + Assert.AreEqual(0, message.RepeatedImportEnumCount); + + Assert.AreEqual(0, message.RepeatedStringPieceCount); + Assert.AreEqual(0, message.RepeatedCordCount); + + // HasBlah() should also be false for all default fields. + Assert.IsFalse(message.HasDefaultInt32); + Assert.IsFalse(message.HasDefaultInt64); + Assert.IsFalse(message.HasDefaultUint32); + Assert.IsFalse(message.HasDefaultUint64); + Assert.IsFalse(message.HasDefaultSint32); + Assert.IsFalse(message.HasDefaultSint64); + Assert.IsFalse(message.HasDefaultFixed32); + Assert.IsFalse(message.HasDefaultFixed64); + Assert.IsFalse(message.HasDefaultSfixed32); + Assert.IsFalse(message.HasDefaultSfixed64); + Assert.IsFalse(message.HasDefaultFloat); + Assert.IsFalse(message.HasDefaultDouble); + Assert.IsFalse(message.HasDefaultBool); + Assert.IsFalse(message.HasDefaultString); + Assert.IsFalse(message.HasDefaultBytes); + + Assert.IsFalse(message.HasDefaultNestedEnum); + Assert.IsFalse(message.HasDefaultForeignEnum); + Assert.IsFalse(message.HasDefaultImportEnum); + + Assert.IsFalse(message.HasDefaultStringPiece); + Assert.IsFalse(message.HasDefaultCord); + + // Fields with defaults have their default values (duh). + Assert.AreEqual(41, message.DefaultInt32); + Assert.AreEqual(42, message.DefaultInt64); + Assert.AreEqual(43u, message.DefaultUint32); + Assert.AreEqual(44u, message.DefaultUint64); + Assert.AreEqual(-45, message.DefaultSint32); + Assert.AreEqual(46, message.DefaultSint64); + Assert.AreEqual(47u, message.DefaultFixed32); + Assert.AreEqual(48u, message.DefaultFixed64); + Assert.AreEqual(49, message.DefaultSfixed32); + Assert.AreEqual(-50, message.DefaultSfixed64); + Assert.AreEqual(51.5, message.DefaultFloat, 0.0); + Assert.AreEqual(52e3, message.DefaultDouble, 0.0); + Assert.AreEqual(true, message.DefaultBool); + Assert.AreEqual("hello", message.DefaultString); + Assert.AreEqual(ToBytes("world"), message.DefaultBytes); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, message.DefaultNestedEnum); + Assert.AreEqual(ForeignEnum.FOREIGN_BAR, message.DefaultForeignEnum); + Assert.AreEqual(ImportEnum.IMPORT_BAR, message.DefaultImportEnum); + + Assert.AreEqual("abc", message.DefaultStringPiece); + Assert.AreEqual("123", message.DefaultCord); + } + + /// + /// Get a TestAllExtensions with all fields set as they would be by + /// SetAllExtensions(TestAllExtensions.Builder). + /// + internal static TestAllExtensions GetAllExtensionsSet() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + SetAllExtensions(builder); + return builder.Build(); + } + + public static TestPackedTypes GetPackedSet() + { + TestPackedTypes.Builder builder = TestPackedTypes.CreateBuilder(); + SetPackedFields(builder); + return builder.Build(); + } + + public static TestPackedExtensions GetPackedExtensionsSet() + { + TestPackedExtensions.Builder builder = TestPackedExtensions.CreateBuilder(); + SetPackedExtensions(builder); + return builder.Build(); + } + + /// + /// Sets every field of the specified builder to the values expected by + /// AssertAllExtensionsSet. + /// + internal static void SetAllExtensions(TestAllExtensions.Builder message) + { + message.SetExtension(UnitTestProtoFile.OptionalInt32Extension, 101); + message.SetExtension(UnitTestProtoFile.OptionalInt64Extension, 102L); + message.SetExtension(UnitTestProtoFile.OptionalUint32Extension, 103U); + message.SetExtension(UnitTestProtoFile.OptionalUint64Extension, 104UL); + message.SetExtension(UnitTestProtoFile.OptionalSint32Extension, 105); + message.SetExtension(UnitTestProtoFile.OptionalSint64Extension, 106L); + message.SetExtension(UnitTestProtoFile.OptionalFixed32Extension, 107U); + message.SetExtension(UnitTestProtoFile.OptionalFixed64Extension, 108UL); + message.SetExtension(UnitTestProtoFile.OptionalSfixed32Extension, 109); + message.SetExtension(UnitTestProtoFile.OptionalSfixed64Extension, 110L); + message.SetExtension(UnitTestProtoFile.OptionalFloatExtension, 111F); + message.SetExtension(UnitTestProtoFile.OptionalDoubleExtension, 112D); + message.SetExtension(UnitTestProtoFile.OptionalBoolExtension, true); + message.SetExtension(UnitTestProtoFile.OptionalStringExtension, "115"); + message.SetExtension(UnitTestProtoFile.OptionalBytesExtension, ToBytes("116")); + + message.SetExtension(UnitTestProtoFile.OptionalGroupExtension, + OptionalGroup_extension.CreateBuilder().SetA(117).Build()); + message.SetExtension(UnitTestProtoFile.OptionalNestedMessageExtension, + TestAllTypes.Types.NestedMessage.CreateBuilder().SetBb(118).Build()); + message.SetExtension(UnitTestProtoFile.OptionalForeignMessageExtension, + ForeignMessage.CreateBuilder().SetC(119).Build()); + message.SetExtension(UnitTestProtoFile.OptionalImportMessageExtension, + ImportMessage.CreateBuilder().SetD(120).Build()); + + message.SetExtension(UnitTestProtoFile.OptionalNestedEnumExtension, TestAllTypes.Types.NestedEnum.BAZ); + message.SetExtension(UnitTestProtoFile.OptionalForeignEnumExtension, ForeignEnum.FOREIGN_BAZ); + message.SetExtension(UnitTestProtoFile.OptionalImportEnumExtension, ImportEnum.IMPORT_BAZ); + + message.SetExtension(UnitTestProtoFile.OptionalStringPieceExtension, "124"); + message.SetExtension(UnitTestProtoFile.OptionalCordExtension, "125"); + + // ----------------------------------------------------------------- + + message.AddExtension(UnitTestProtoFile.RepeatedInt32Extension, 201); + message.AddExtension(UnitTestProtoFile.RepeatedInt64Extension, 202L); + message.AddExtension(UnitTestProtoFile.RepeatedUint32Extension, 203U); + message.AddExtension(UnitTestProtoFile.RepeatedUint64Extension, 204UL); + message.AddExtension(UnitTestProtoFile.RepeatedSint32Extension, 205); + message.AddExtension(UnitTestProtoFile.RepeatedSint64Extension, 206L); + message.AddExtension(UnitTestProtoFile.RepeatedFixed32Extension, 207U); + message.AddExtension(UnitTestProtoFile.RepeatedFixed64Extension, 208UL); + message.AddExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 209); + message.AddExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 210L); + message.AddExtension(UnitTestProtoFile.RepeatedFloatExtension, 211F); + message.AddExtension(UnitTestProtoFile.RepeatedDoubleExtension, 212D); + message.AddExtension(UnitTestProtoFile.RepeatedBoolExtension, true); + message.AddExtension(UnitTestProtoFile.RepeatedStringExtension, "215"); + message.AddExtension(UnitTestProtoFile.RepeatedBytesExtension, ToBytes("216")); + + message.AddExtension(UnitTestProtoFile.RepeatedGroupExtension, + RepeatedGroup_extension.CreateBuilder().SetA(217).Build()); + message.AddExtension(UnitTestProtoFile.RepeatedNestedMessageExtension, + TestAllTypes.Types.NestedMessage.CreateBuilder().SetBb(218).Build()); + message.AddExtension(UnitTestProtoFile.RepeatedForeignMessageExtension, + ForeignMessage.CreateBuilder().SetC(219).Build()); + message.AddExtension(UnitTestProtoFile.RepeatedImportMessageExtension, + ImportMessage.CreateBuilder().SetD(220).Build()); + + message.AddExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, TestAllTypes.Types.NestedEnum.BAR); + message.AddExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, ForeignEnum.FOREIGN_BAR); + message.AddExtension(UnitTestProtoFile.RepeatedImportEnumExtension, ImportEnum.IMPORT_BAR); + + message.AddExtension(UnitTestProtoFile.RepeatedStringPieceExtension, "224"); + message.AddExtension(UnitTestProtoFile.RepeatedCordExtension, "225"); + + // Add a second one of each field. + message.AddExtension(UnitTestProtoFile.RepeatedInt32Extension, 301); + message.AddExtension(UnitTestProtoFile.RepeatedInt64Extension, 302L); + message.AddExtension(UnitTestProtoFile.RepeatedUint32Extension, 303U); + message.AddExtension(UnitTestProtoFile.RepeatedUint64Extension, 304UL); + message.AddExtension(UnitTestProtoFile.RepeatedSint32Extension, 305); + message.AddExtension(UnitTestProtoFile.RepeatedSint64Extension, 306L); + message.AddExtension(UnitTestProtoFile.RepeatedFixed32Extension, 307U); + message.AddExtension(UnitTestProtoFile.RepeatedFixed64Extension, 308UL); + message.AddExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 309); + message.AddExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 310L); + message.AddExtension(UnitTestProtoFile.RepeatedFloatExtension, 311F); + message.AddExtension(UnitTestProtoFile.RepeatedDoubleExtension, 312D); + message.AddExtension(UnitTestProtoFile.RepeatedBoolExtension, false); + message.AddExtension(UnitTestProtoFile.RepeatedStringExtension, "315"); + message.AddExtension(UnitTestProtoFile.RepeatedBytesExtension, ToBytes("316")); + + message.AddExtension(UnitTestProtoFile.RepeatedGroupExtension, + RepeatedGroup_extension.CreateBuilder().SetA(317).Build()); + message.AddExtension(UnitTestProtoFile.RepeatedNestedMessageExtension, + TestAllTypes.Types.NestedMessage.CreateBuilder().SetBb(318).Build()); + message.AddExtension(UnitTestProtoFile.RepeatedForeignMessageExtension, + ForeignMessage.CreateBuilder().SetC(319).Build()); + message.AddExtension(UnitTestProtoFile.RepeatedImportMessageExtension, + ImportMessage.CreateBuilder().SetD(320).Build()); + + message.AddExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, TestAllTypes.Types.NestedEnum.BAZ); + message.AddExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, ForeignEnum.FOREIGN_BAZ); + message.AddExtension(UnitTestProtoFile.RepeatedImportEnumExtension, ImportEnum.IMPORT_BAZ); + + message.AddExtension(UnitTestProtoFile.RepeatedStringPieceExtension, "324"); + message.AddExtension(UnitTestProtoFile.RepeatedCordExtension, "325"); + + // ----------------------------------------------------------------- + + message.SetExtension(UnitTestProtoFile.DefaultInt32Extension, 401); + message.SetExtension(UnitTestProtoFile.DefaultInt64Extension, 402L); + message.SetExtension(UnitTestProtoFile.DefaultUint32Extension, 403U); + message.SetExtension(UnitTestProtoFile.DefaultUint64Extension, 404UL); + message.SetExtension(UnitTestProtoFile.DefaultSint32Extension, 405); + message.SetExtension(UnitTestProtoFile.DefaultSint64Extension, 406L); + message.SetExtension(UnitTestProtoFile.DefaultFixed32Extension, 407U); + message.SetExtension(UnitTestProtoFile.DefaultFixed64Extension, 408UL); + message.SetExtension(UnitTestProtoFile.DefaultSfixed32Extension, 409); + message.SetExtension(UnitTestProtoFile.DefaultSfixed64Extension, 410L); + message.SetExtension(UnitTestProtoFile.DefaultFloatExtension, 411F); + message.SetExtension(UnitTestProtoFile.DefaultDoubleExtension, 412D); + message.SetExtension(UnitTestProtoFile.DefaultBoolExtension, false); + message.SetExtension(UnitTestProtoFile.DefaultStringExtension, "415"); + message.SetExtension(UnitTestProtoFile.DefaultBytesExtension, ToBytes("416")); + + message.SetExtension(UnitTestProtoFile.DefaultNestedEnumExtension, TestAllTypes.Types.NestedEnum.FOO); + message.SetExtension(UnitTestProtoFile.DefaultForeignEnumExtension, ForeignEnum.FOREIGN_FOO); + message.SetExtension(UnitTestProtoFile.DefaultImportEnumExtension, ImportEnum.IMPORT_FOO); + + message.SetExtension(UnitTestProtoFile.DefaultStringPieceExtension, "424"); + message.SetExtension(UnitTestProtoFile.DefaultCordExtension, "425"); + } + + internal static void ModifyRepeatedFields(TestAllTypes.Builder message) + { + message.SetRepeatedInt32(1, 501); + message.SetRepeatedInt64(1, 502); + message.SetRepeatedUint32(1, 503); + message.SetRepeatedUint64(1, 504); + message.SetRepeatedSint32(1, 505); + message.SetRepeatedSint64(1, 506); + message.SetRepeatedFixed32(1, 507); + message.SetRepeatedFixed64(1, 508); + message.SetRepeatedSfixed32(1, 509); + message.SetRepeatedSfixed64(1, 510); + message.SetRepeatedFloat(1, 511); + message.SetRepeatedDouble(1, 512); + message.SetRepeatedBool(1, true); + message.SetRepeatedString(1, "515"); + message.SetRepeatedBytes(1, ToBytes("516")); + + message.SetRepeatedGroup(1, TestAllTypes.Types.RepeatedGroup.CreateBuilder().SetA(517).Build()); + message.SetRepeatedNestedMessage(1, TestAllTypes.Types.NestedMessage.CreateBuilder().SetBb(518).Build()); + message.SetRepeatedForeignMessage(1, ForeignMessage.CreateBuilder().SetC(519).Build()); + message.SetRepeatedImportMessage(1, ImportMessage.CreateBuilder().SetD(520).Build()); + + message.SetRepeatedNestedEnum(1, TestAllTypes.Types.NestedEnum.FOO); + message.SetRepeatedForeignEnum(1, ForeignEnum.FOREIGN_FOO); + message.SetRepeatedImportEnum(1, ImportEnum.IMPORT_FOO); + + message.SetRepeatedStringPiece(1, "524"); + message.SetRepeatedCord(1, "525"); + } + + internal static void AssertRepeatedFieldsModified(TestAllTypes message) + { + // ModifyRepeatedFields only sets the second repeated element of each + // field. In addition to verifying this, we also verify that the first + // element and size were *not* modified. + Assert.AreEqual(2, message.RepeatedInt32Count); + Assert.AreEqual(2, message.RepeatedInt64Count); + Assert.AreEqual(2, message.RepeatedUint32Count); + Assert.AreEqual(2, message.RepeatedUint64Count); + Assert.AreEqual(2, message.RepeatedSint32Count); + Assert.AreEqual(2, message.RepeatedSint64Count); + Assert.AreEqual(2, message.RepeatedFixed32Count); + Assert.AreEqual(2, message.RepeatedFixed64Count); + Assert.AreEqual(2, message.RepeatedSfixed32Count); + Assert.AreEqual(2, message.RepeatedSfixed64Count); + Assert.AreEqual(2, message.RepeatedFloatCount); + Assert.AreEqual(2, message.RepeatedDoubleCount); + Assert.AreEqual(2, message.RepeatedBoolCount); + Assert.AreEqual(2, message.RepeatedStringCount); + Assert.AreEqual(2, message.RepeatedBytesCount); + + Assert.AreEqual(2, message.RepeatedGroupCount); + Assert.AreEqual(2, message.RepeatedNestedMessageCount); + Assert.AreEqual(2, message.RepeatedForeignMessageCount); + Assert.AreEqual(2, message.RepeatedImportMessageCount); + Assert.AreEqual(2, message.RepeatedNestedEnumCount); + Assert.AreEqual(2, message.RepeatedForeignEnumCount); + Assert.AreEqual(2, message.RepeatedImportEnumCount); + + Assert.AreEqual(2, message.RepeatedStringPieceCount); + Assert.AreEqual(2, message.RepeatedCordCount); + + Assert.AreEqual(201, message.GetRepeatedInt32(0)); + Assert.AreEqual(202L, message.GetRepeatedInt64(0)); + Assert.AreEqual(203U, message.GetRepeatedUint32(0)); + Assert.AreEqual(204UL, message.GetRepeatedUint64(0)); + Assert.AreEqual(205, message.GetRepeatedSint32(0)); + Assert.AreEqual(206L, message.GetRepeatedSint64(0)); + Assert.AreEqual(207U, message.GetRepeatedFixed32(0)); + Assert.AreEqual(208UL, message.GetRepeatedFixed64(0)); + Assert.AreEqual(209, message.GetRepeatedSfixed32(0)); + Assert.AreEqual(210L, message.GetRepeatedSfixed64(0)); + Assert.AreEqual(211F, message.GetRepeatedFloat(0)); + Assert.AreEqual(212D, message.GetRepeatedDouble(0)); + Assert.AreEqual(true, message.GetRepeatedBool(0)); + Assert.AreEqual("215", message.GetRepeatedString(0)); + Assert.AreEqual(ToBytes("216"), message.GetRepeatedBytes(0)); + + Assert.AreEqual(217, message.GetRepeatedGroup(0).A); + Assert.AreEqual(218, message.GetRepeatedNestedMessage(0).Bb); + Assert.AreEqual(219, message.GetRepeatedForeignMessage(0).C); + Assert.AreEqual(220, message.GetRepeatedImportMessage(0).D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, message.GetRepeatedNestedEnum(0)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAR, message.GetRepeatedForeignEnum(0)); + Assert.AreEqual(ImportEnum.IMPORT_BAR, message.GetRepeatedImportEnum(0)); + + Assert.AreEqual("224", message.GetRepeatedStringPiece(0)); + Assert.AreEqual("225", message.GetRepeatedCord(0)); + + // Actually verify the second (modified) elements now. + Assert.AreEqual(501, message.GetRepeatedInt32(1)); + Assert.AreEqual(502L, message.GetRepeatedInt64(1)); + Assert.AreEqual(503U, message.GetRepeatedUint32(1)); + Assert.AreEqual(504UL, message.GetRepeatedUint64(1)); + Assert.AreEqual(505, message.GetRepeatedSint32(1)); + Assert.AreEqual(506L, message.GetRepeatedSint64(1)); + Assert.AreEqual(507U, message.GetRepeatedFixed32(1)); + Assert.AreEqual(508UL, message.GetRepeatedFixed64(1)); + Assert.AreEqual(509, message.GetRepeatedSfixed32(1)); + Assert.AreEqual(510L, message.GetRepeatedSfixed64(1)); + Assert.AreEqual(511F, message.GetRepeatedFloat(1)); + Assert.AreEqual(512D, message.GetRepeatedDouble(1)); + Assert.AreEqual(true, message.GetRepeatedBool(1)); + Assert.AreEqual("515", message.GetRepeatedString(1)); + Assert.AreEqual(ToBytes("516"), message.GetRepeatedBytes(1)); + + Assert.AreEqual(517, message.GetRepeatedGroup(1).A); + Assert.AreEqual(518, message.GetRepeatedNestedMessage(1).Bb); + Assert.AreEqual(519, message.GetRepeatedForeignMessage(1).C); + Assert.AreEqual(520, message.GetRepeatedImportMessage(1).D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, message.GetRepeatedNestedEnum(1)); + Assert.AreEqual(ForeignEnum.FOREIGN_FOO, message.GetRepeatedForeignEnum(1)); + Assert.AreEqual(ImportEnum.IMPORT_FOO, message.GetRepeatedImportEnum(1)); + + Assert.AreEqual("524", message.GetRepeatedStringPiece(1)); + Assert.AreEqual("525", message.GetRepeatedCord(1)); + } + + /// + /// Helper to assert that sequences are equal. + /// + internal static void AssertEqual(IEnumerable first, IEnumerable second) + { + using (IEnumerator firstEnumerator = first.GetEnumerator()) + { + foreach (T secondElement in second) + { + Assert.IsTrue(firstEnumerator.MoveNext(), "First enumerator ran out of elements too early."); + Assert.AreEqual(firstEnumerator.Current, secondElement); + } + Assert.IsFalse(firstEnumerator.MoveNext(), "Second enumerator ran out of elements too early."); + } + } + + internal static void AssertEqualBytes(byte[] expected, byte[] actual) + { + Assert.AreEqual(ByteString.CopyFrom(expected), ByteString.CopyFrom(actual)); + } + + internal static void AssertAllExtensionsSet(TestAllExtensions message) + { + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalInt32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalInt64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalUint32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalUint64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalSint32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalSint64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalFixed32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalFixed64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalSfixed32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalSfixed64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalFloatExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalDoubleExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalBoolExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalStringExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalBytesExtension)); + + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalGroupExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalNestedMessageExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalForeignMessageExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalImportMessageExtension)); + + Assert.IsTrue(message.GetExtension(UnitTestProtoFile.OptionalGroupExtension).HasA); + Assert.IsTrue(message.GetExtension(UnitTestProtoFile.OptionalNestedMessageExtension).HasBb); + Assert.IsTrue(message.GetExtension(UnitTestProtoFile.OptionalForeignMessageExtension).HasC); + Assert.IsTrue(message.GetExtension(UnitTestProtoFile.OptionalImportMessageExtension).HasD); + + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalNestedEnumExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalForeignEnumExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalImportEnumExtension)); + + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalStringPieceExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.OptionalCordExtension)); + + Assert.AreEqual(101, message.GetExtension(UnitTestProtoFile.OptionalInt32Extension)); + Assert.AreEqual(102L, message.GetExtension(UnitTestProtoFile.OptionalInt64Extension)); + Assert.AreEqual(103U, message.GetExtension(UnitTestProtoFile.OptionalUint32Extension)); + Assert.AreEqual(104UL, message.GetExtension(UnitTestProtoFile.OptionalUint64Extension)); + Assert.AreEqual(105, message.GetExtension(UnitTestProtoFile.OptionalSint32Extension)); + Assert.AreEqual(106L, message.GetExtension(UnitTestProtoFile.OptionalSint64Extension)); + Assert.AreEqual(107U, message.GetExtension(UnitTestProtoFile.OptionalFixed32Extension)); + Assert.AreEqual(108UL, message.GetExtension(UnitTestProtoFile.OptionalFixed64Extension)); + Assert.AreEqual(109, message.GetExtension(UnitTestProtoFile.OptionalSfixed32Extension)); + Assert.AreEqual(110L, message.GetExtension(UnitTestProtoFile.OptionalSfixed64Extension)); + Assert.AreEqual(111F, message.GetExtension(UnitTestProtoFile.OptionalFloatExtension)); + Assert.AreEqual(112D, message.GetExtension(UnitTestProtoFile.OptionalDoubleExtension)); + Assert.AreEqual(true, message.GetExtension(UnitTestProtoFile.OptionalBoolExtension)); + Assert.AreEqual("115", message.GetExtension(UnitTestProtoFile.OptionalStringExtension)); + Assert.AreEqual(ToBytes("116"), message.GetExtension(UnitTestProtoFile.OptionalBytesExtension)); + + Assert.AreEqual(117, message.GetExtension(UnitTestProtoFile.OptionalGroupExtension).A); + Assert.AreEqual(118, message.GetExtension(UnitTestProtoFile.OptionalNestedMessageExtension).Bb); + Assert.AreEqual(119, message.GetExtension(UnitTestProtoFile.OptionalForeignMessageExtension).C); + Assert.AreEqual(120, message.GetExtension(UnitTestProtoFile.OptionalImportMessageExtension).D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAZ, + message.GetExtension(UnitTestProtoFile.OptionalNestedEnumExtension)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, + message.GetExtension(UnitTestProtoFile.OptionalForeignEnumExtension)); + Assert.AreEqual(ImportEnum.IMPORT_BAZ, message.GetExtension(UnitTestProtoFile.OptionalImportEnumExtension)); + + Assert.AreEqual("124", message.GetExtension(UnitTestProtoFile.OptionalStringPieceExtension)); + Assert.AreEqual("125", message.GetExtension(UnitTestProtoFile.OptionalCordExtension)); + + // ----------------------------------------------------------------- + + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedInt32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedInt64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedUint32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedUint64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedSint32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedSint64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedFixed32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedFixed64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedSfixed32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedSfixed64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedFloatExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedDoubleExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedBoolExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedStringExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedBytesExtension)); + + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedGroupExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedNestedMessageExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedForeignMessageExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedImportMessageExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedNestedEnumExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedForeignEnumExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedImportEnumExtension)); + + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedStringPieceExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedCordExtension)); + + Assert.AreEqual(201, message.GetExtension(UnitTestProtoFile.RepeatedInt32Extension, 0)); + Assert.AreEqual(202L, message.GetExtension(UnitTestProtoFile.RepeatedInt64Extension, 0)); + Assert.AreEqual(203U, message.GetExtension(UnitTestProtoFile.RepeatedUint32Extension, 0)); + Assert.AreEqual(204UL, message.GetExtension(UnitTestProtoFile.RepeatedUint64Extension, 0)); + Assert.AreEqual(205, message.GetExtension(UnitTestProtoFile.RepeatedSint32Extension, 0)); + Assert.AreEqual(206L, message.GetExtension(UnitTestProtoFile.RepeatedSint64Extension, 0)); + Assert.AreEqual(207U, message.GetExtension(UnitTestProtoFile.RepeatedFixed32Extension, 0)); + Assert.AreEqual(208UL, message.GetExtension(UnitTestProtoFile.RepeatedFixed64Extension, 0)); + Assert.AreEqual(209, message.GetExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 0)); + Assert.AreEqual(210L, message.GetExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 0)); + Assert.AreEqual(211F, message.GetExtension(UnitTestProtoFile.RepeatedFloatExtension, 0)); + Assert.AreEqual(212D, message.GetExtension(UnitTestProtoFile.RepeatedDoubleExtension, 0)); + Assert.AreEqual(true, message.GetExtension(UnitTestProtoFile.RepeatedBoolExtension, 0)); + Assert.AreEqual("215", message.GetExtension(UnitTestProtoFile.RepeatedStringExtension, 0)); + Assert.AreEqual(ToBytes("216"), message.GetExtension(UnitTestProtoFile.RepeatedBytesExtension, 0)); + + Assert.AreEqual(217, message.GetExtension(UnitTestProtoFile.RepeatedGroupExtension, 0).A); + Assert.AreEqual(218, message.GetExtension(UnitTestProtoFile.RepeatedNestedMessageExtension, 0).Bb); + Assert.AreEqual(219, message.GetExtension(UnitTestProtoFile.RepeatedForeignMessageExtension, 0).C); + Assert.AreEqual(220, message.GetExtension(UnitTestProtoFile.RepeatedImportMessageExtension, 0).D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, + message.GetExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, 0)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAR, + message.GetExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, 0)); + Assert.AreEqual(ImportEnum.IMPORT_BAR, + message.GetExtension(UnitTestProtoFile.RepeatedImportEnumExtension, 0)); + + Assert.AreEqual("224", message.GetExtension(UnitTestProtoFile.RepeatedStringPieceExtension, 0)); + Assert.AreEqual("225", message.GetExtension(UnitTestProtoFile.RepeatedCordExtension, 0)); + + Assert.AreEqual(301, message.GetExtension(UnitTestProtoFile.RepeatedInt32Extension, 1)); + Assert.AreEqual(302L, message.GetExtension(UnitTestProtoFile.RepeatedInt64Extension, 1)); + Assert.AreEqual(303U, message.GetExtension(UnitTestProtoFile.RepeatedUint32Extension, 1)); + Assert.AreEqual(304UL, message.GetExtension(UnitTestProtoFile.RepeatedUint64Extension, 1)); + Assert.AreEqual(305, message.GetExtension(UnitTestProtoFile.RepeatedSint32Extension, 1)); + Assert.AreEqual(306L, message.GetExtension(UnitTestProtoFile.RepeatedSint64Extension, 1)); + Assert.AreEqual(307U, message.GetExtension(UnitTestProtoFile.RepeatedFixed32Extension, 1)); + Assert.AreEqual(308UL, message.GetExtension(UnitTestProtoFile.RepeatedFixed64Extension, 1)); + Assert.AreEqual(309, message.GetExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 1)); + Assert.AreEqual(310L, message.GetExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 1)); + Assert.AreEqual(311F, message.GetExtension(UnitTestProtoFile.RepeatedFloatExtension, 1)); + Assert.AreEqual(312D, message.GetExtension(UnitTestProtoFile.RepeatedDoubleExtension, 1)); + Assert.AreEqual(false, message.GetExtension(UnitTestProtoFile.RepeatedBoolExtension, 1)); + Assert.AreEqual("315", message.GetExtension(UnitTestProtoFile.RepeatedStringExtension, 1)); + Assert.AreEqual(ToBytes("316"), message.GetExtension(UnitTestProtoFile.RepeatedBytesExtension, 1)); + + Assert.AreEqual(317, message.GetExtension(UnitTestProtoFile.RepeatedGroupExtension, 1).A); + Assert.AreEqual(318, message.GetExtension(UnitTestProtoFile.RepeatedNestedMessageExtension, 1).Bb); + Assert.AreEqual(319, message.GetExtension(UnitTestProtoFile.RepeatedForeignMessageExtension, 1).C); + Assert.AreEqual(320, message.GetExtension(UnitTestProtoFile.RepeatedImportMessageExtension, 1).D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAZ, + message.GetExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, 1)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, + message.GetExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, 1)); + Assert.AreEqual(ImportEnum.IMPORT_BAZ, + message.GetExtension(UnitTestProtoFile.RepeatedImportEnumExtension, 1)); + + Assert.AreEqual("324", message.GetExtension(UnitTestProtoFile.RepeatedStringPieceExtension, 1)); + Assert.AreEqual("325", message.GetExtension(UnitTestProtoFile.RepeatedCordExtension, 1)); + + // ----------------------------------------------------------------- + + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultInt32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultInt64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultUint32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultUint64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultSint32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultSint64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultFixed32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultFixed64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultSfixed32Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultSfixed64Extension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultFloatExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultDoubleExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultBoolExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultStringExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultBytesExtension)); + + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultNestedEnumExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultForeignEnumExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultImportEnumExtension)); + + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultStringPieceExtension)); + Assert.IsTrue(message.HasExtension(UnitTestProtoFile.DefaultCordExtension)); + + Assert.AreEqual(401, message.GetExtension(UnitTestProtoFile.DefaultInt32Extension)); + Assert.AreEqual(402L, message.GetExtension(UnitTestProtoFile.DefaultInt64Extension)); + Assert.AreEqual(403U, message.GetExtension(UnitTestProtoFile.DefaultUint32Extension)); + Assert.AreEqual(404UL, message.GetExtension(UnitTestProtoFile.DefaultUint64Extension)); + Assert.AreEqual(405, message.GetExtension(UnitTestProtoFile.DefaultSint32Extension)); + Assert.AreEqual(406L, message.GetExtension(UnitTestProtoFile.DefaultSint64Extension)); + Assert.AreEqual(407U, message.GetExtension(UnitTestProtoFile.DefaultFixed32Extension)); + Assert.AreEqual(408UL, message.GetExtension(UnitTestProtoFile.DefaultFixed64Extension)); + Assert.AreEqual(409, message.GetExtension(UnitTestProtoFile.DefaultSfixed32Extension)); + Assert.AreEqual(410L, message.GetExtension(UnitTestProtoFile.DefaultSfixed64Extension)); + Assert.AreEqual(411F, message.GetExtension(UnitTestProtoFile.DefaultFloatExtension)); + Assert.AreEqual(412D, message.GetExtension(UnitTestProtoFile.DefaultDoubleExtension)); + Assert.AreEqual(false, message.GetExtension(UnitTestProtoFile.DefaultBoolExtension)); + Assert.AreEqual("415", message.GetExtension(UnitTestProtoFile.DefaultStringExtension)); + Assert.AreEqual(ToBytes("416"), message.GetExtension(UnitTestProtoFile.DefaultBytesExtension)); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, + message.GetExtension(UnitTestProtoFile.DefaultNestedEnumExtension)); + Assert.AreEqual(ForeignEnum.FOREIGN_FOO, message.GetExtension(UnitTestProtoFile.DefaultForeignEnumExtension)); + Assert.AreEqual(ImportEnum.IMPORT_FOO, message.GetExtension(UnitTestProtoFile.DefaultImportEnumExtension)); + + Assert.AreEqual("424", message.GetExtension(UnitTestProtoFile.DefaultStringPieceExtension)); + Assert.AreEqual("425", message.GetExtension(UnitTestProtoFile.DefaultCordExtension)); + } + + /// + /// Modifies the repeated extensions of the given message to contain the values + /// expected by AssertRepeatedExtensionsModified. + /// + internal static void ModifyRepeatedExtensions(TestAllExtensions.Builder message) + { + message.SetExtension(UnitTestProtoFile.RepeatedInt32Extension, 1, 501); + message.SetExtension(UnitTestProtoFile.RepeatedInt64Extension, 1, 502L); + message.SetExtension(UnitTestProtoFile.RepeatedUint32Extension, 1, 503U); + message.SetExtension(UnitTestProtoFile.RepeatedUint64Extension, 1, 504UL); + message.SetExtension(UnitTestProtoFile.RepeatedSint32Extension, 1, 505); + message.SetExtension(UnitTestProtoFile.RepeatedSint64Extension, 1, 506L); + message.SetExtension(UnitTestProtoFile.RepeatedFixed32Extension, 1, 507U); + message.SetExtension(UnitTestProtoFile.RepeatedFixed64Extension, 1, 508UL); + message.SetExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 1, 509); + message.SetExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 1, 510L); + message.SetExtension(UnitTestProtoFile.RepeatedFloatExtension, 1, 511F); + message.SetExtension(UnitTestProtoFile.RepeatedDoubleExtension, 1, 512D); + message.SetExtension(UnitTestProtoFile.RepeatedBoolExtension, 1, true); + message.SetExtension(UnitTestProtoFile.RepeatedStringExtension, 1, "515"); + message.SetExtension(UnitTestProtoFile.RepeatedBytesExtension, 1, ToBytes("516")); + + message.SetExtension(UnitTestProtoFile.RepeatedGroupExtension, 1, + RepeatedGroup_extension.CreateBuilder().SetA(517).Build()); + message.SetExtension(UnitTestProtoFile.RepeatedNestedMessageExtension, 1, + TestAllTypes.Types.NestedMessage.CreateBuilder().SetBb(518).Build()); + message.SetExtension(UnitTestProtoFile.RepeatedForeignMessageExtension, 1, + ForeignMessage.CreateBuilder().SetC(519).Build()); + message.SetExtension(UnitTestProtoFile.RepeatedImportMessageExtension, 1, + ImportMessage.CreateBuilder().SetD(520).Build()); + + message.SetExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, 1, TestAllTypes.Types.NestedEnum.FOO); + message.SetExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, 1, ForeignEnum.FOREIGN_FOO); + message.SetExtension(UnitTestProtoFile.RepeatedImportEnumExtension, 1, ImportEnum.IMPORT_FOO); + + message.SetExtension(UnitTestProtoFile.RepeatedStringPieceExtension, 1, "524"); + message.SetExtension(UnitTestProtoFile.RepeatedCordExtension, 1, "525"); + } + + /// + /// Asserts that all repeated extensions are set to the values assigned by + /// SetAllExtensions follwed by ModifyRepeatedExtensions. + /// + internal static void AssertRepeatedExtensionsModified(TestAllExtensions message) + { + // ModifyRepeatedFields only sets the second repeated element of each + // field. In addition to verifying this, we also verify that the first + // element and size were *not* modified. + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedInt32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedInt64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedUint32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedUint64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedSint32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedSint64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedFixed32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedFixed64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedSfixed32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedSfixed64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedFloatExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedDoubleExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedBoolExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedStringExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedBytesExtension)); + + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedGroupExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedNestedMessageExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedForeignMessageExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedImportMessageExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedNestedEnumExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedForeignEnumExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedImportEnumExtension)); + + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedStringPieceExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.RepeatedCordExtension)); + + Assert.AreEqual(201, message.GetExtension(UnitTestProtoFile.RepeatedInt32Extension, 0)); + Assert.AreEqual(202L, message.GetExtension(UnitTestProtoFile.RepeatedInt64Extension, 0)); + Assert.AreEqual(203U, message.GetExtension(UnitTestProtoFile.RepeatedUint32Extension, 0)); + Assert.AreEqual(204UL, message.GetExtension(UnitTestProtoFile.RepeatedUint64Extension, 0)); + Assert.AreEqual(205, message.GetExtension(UnitTestProtoFile.RepeatedSint32Extension, 0)); + Assert.AreEqual(206L, message.GetExtension(UnitTestProtoFile.RepeatedSint64Extension, 0)); + Assert.AreEqual(207U, message.GetExtension(UnitTestProtoFile.RepeatedFixed32Extension, 0)); + Assert.AreEqual(208UL, message.GetExtension(UnitTestProtoFile.RepeatedFixed64Extension, 0)); + Assert.AreEqual(209, message.GetExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 0)); + Assert.AreEqual(210L, message.GetExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 0)); + Assert.AreEqual(211F, message.GetExtension(UnitTestProtoFile.RepeatedFloatExtension, 0)); + Assert.AreEqual(212D, message.GetExtension(UnitTestProtoFile.RepeatedDoubleExtension, 0)); + Assert.AreEqual(true, message.GetExtension(UnitTestProtoFile.RepeatedBoolExtension, 0)); + Assert.AreEqual("215", message.GetExtension(UnitTestProtoFile.RepeatedStringExtension, 0)); + Assert.AreEqual(ToBytes("216"), message.GetExtension(UnitTestProtoFile.RepeatedBytesExtension, 0)); + + Assert.AreEqual(217, message.GetExtension(UnitTestProtoFile.RepeatedGroupExtension, 0).A); + Assert.AreEqual(218, message.GetExtension(UnitTestProtoFile.RepeatedNestedMessageExtension, 0).Bb); + Assert.AreEqual(219, message.GetExtension(UnitTestProtoFile.RepeatedForeignMessageExtension, 0).C); + Assert.AreEqual(220, message.GetExtension(UnitTestProtoFile.RepeatedImportMessageExtension, 0).D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, + message.GetExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, 0)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAR, + message.GetExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, 0)); + Assert.AreEqual(ImportEnum.IMPORT_BAR, + message.GetExtension(UnitTestProtoFile.RepeatedImportEnumExtension, 0)); + + Assert.AreEqual("224", message.GetExtension(UnitTestProtoFile.RepeatedStringPieceExtension, 0)); + Assert.AreEqual("225", message.GetExtension(UnitTestProtoFile.RepeatedCordExtension, 0)); + + // Actually verify the second (modified) elements now. + Assert.AreEqual(501, message.GetExtension(UnitTestProtoFile.RepeatedInt32Extension, 1)); + Assert.AreEqual(502L, message.GetExtension(UnitTestProtoFile.RepeatedInt64Extension, 1)); + Assert.AreEqual(503U, message.GetExtension(UnitTestProtoFile.RepeatedUint32Extension, 1)); + Assert.AreEqual(504UL, message.GetExtension(UnitTestProtoFile.RepeatedUint64Extension, 1)); + Assert.AreEqual(505, message.GetExtension(UnitTestProtoFile.RepeatedSint32Extension, 1)); + Assert.AreEqual(506L, message.GetExtension(UnitTestProtoFile.RepeatedSint64Extension, 1)); + Assert.AreEqual(507U, message.GetExtension(UnitTestProtoFile.RepeatedFixed32Extension, 1)); + Assert.AreEqual(508UL, message.GetExtension(UnitTestProtoFile.RepeatedFixed64Extension, 1)); + Assert.AreEqual(509, message.GetExtension(UnitTestProtoFile.RepeatedSfixed32Extension, 1)); + Assert.AreEqual(510L, message.GetExtension(UnitTestProtoFile.RepeatedSfixed64Extension, 1)); + Assert.AreEqual(511F, message.GetExtension(UnitTestProtoFile.RepeatedFloatExtension, 1)); + Assert.AreEqual(512D, message.GetExtension(UnitTestProtoFile.RepeatedDoubleExtension, 1)); + Assert.AreEqual(true, message.GetExtension(UnitTestProtoFile.RepeatedBoolExtension, 1)); + Assert.AreEqual("515", message.GetExtension(UnitTestProtoFile.RepeatedStringExtension, 1)); + Assert.AreEqual(ToBytes("516"), message.GetExtension(UnitTestProtoFile.RepeatedBytesExtension, 1)); + + Assert.AreEqual(517, message.GetExtension(UnitTestProtoFile.RepeatedGroupExtension, 1).A); + Assert.AreEqual(518, message.GetExtension(UnitTestProtoFile.RepeatedNestedMessageExtension, 1).Bb); + Assert.AreEqual(519, message.GetExtension(UnitTestProtoFile.RepeatedForeignMessageExtension, 1).C); + Assert.AreEqual(520, message.GetExtension(UnitTestProtoFile.RepeatedImportMessageExtension, 1).D); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, + message.GetExtension(UnitTestProtoFile.RepeatedNestedEnumExtension, 1)); + Assert.AreEqual(ForeignEnum.FOREIGN_FOO, + message.GetExtension(UnitTestProtoFile.RepeatedForeignEnumExtension, 1)); + Assert.AreEqual(ImportEnum.IMPORT_FOO, + message.GetExtension(UnitTestProtoFile.RepeatedImportEnumExtension, 1)); + + Assert.AreEqual("524", message.GetExtension(UnitTestProtoFile.RepeatedStringPieceExtension, 1)); + Assert.AreEqual("525", message.GetExtension(UnitTestProtoFile.RepeatedCordExtension, 1)); + } + + internal static void AssertExtensionsClear(TestAllExtensions message) + { + // HasBlah() should initially be false for all optional fields. + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalInt32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalInt64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalUint32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalUint64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalSint32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalSint64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalFixed32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalFixed64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalSfixed32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalSfixed64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalFloatExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalDoubleExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalBoolExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalStringExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalBytesExtension)); + + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalGroupExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalNestedMessageExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalForeignMessageExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalImportMessageExtension)); + + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalNestedEnumExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalForeignEnumExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalImportEnumExtension)); + + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalStringPieceExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.OptionalCordExtension)); + + // Optional fields without defaults are set to zero or something like it. + Assert.AreEqual(0, message.GetExtension(UnitTestProtoFile.OptionalInt32Extension)); + Assert.AreEqual(0L, message.GetExtension(UnitTestProtoFile.OptionalInt64Extension)); + Assert.AreEqual(0U, message.GetExtension(UnitTestProtoFile.OptionalUint32Extension)); + Assert.AreEqual(0UL, message.GetExtension(UnitTestProtoFile.OptionalUint64Extension)); + Assert.AreEqual(0, message.GetExtension(UnitTestProtoFile.OptionalSint32Extension)); + Assert.AreEqual(0L, message.GetExtension(UnitTestProtoFile.OptionalSint64Extension)); + Assert.AreEqual(0U, message.GetExtension(UnitTestProtoFile.OptionalFixed32Extension)); + Assert.AreEqual(0UL, message.GetExtension(UnitTestProtoFile.OptionalFixed64Extension)); + Assert.AreEqual(0, message.GetExtension(UnitTestProtoFile.OptionalSfixed32Extension)); + Assert.AreEqual(0L, message.GetExtension(UnitTestProtoFile.OptionalSfixed64Extension)); + Assert.AreEqual(0F, message.GetExtension(UnitTestProtoFile.OptionalFloatExtension)); + Assert.AreEqual(0D, message.GetExtension(UnitTestProtoFile.OptionalDoubleExtension)); + Assert.AreEqual(false, message.GetExtension(UnitTestProtoFile.OptionalBoolExtension)); + Assert.AreEqual("", message.GetExtension(UnitTestProtoFile.OptionalStringExtension)); + Assert.AreEqual(ByteString.Empty, message.GetExtension(UnitTestProtoFile.OptionalBytesExtension)); + + // Embedded messages should also be clear. + Assert.IsFalse(message.GetExtension(UnitTestProtoFile.OptionalGroupExtension).HasA); + Assert.IsFalse(message.GetExtension(UnitTestProtoFile.OptionalNestedMessageExtension).HasBb); + Assert.IsFalse(message.GetExtension(UnitTestProtoFile.OptionalForeignMessageExtension).HasC); + Assert.IsFalse(message.GetExtension(UnitTestProtoFile.OptionalImportMessageExtension).HasD); + + Assert.AreEqual(0, message.GetExtension(UnitTestProtoFile.OptionalGroupExtension).A); + Assert.AreEqual(0, message.GetExtension(UnitTestProtoFile.OptionalNestedMessageExtension).Bb); + Assert.AreEqual(0, message.GetExtension(UnitTestProtoFile.OptionalForeignMessageExtension).C); + Assert.AreEqual(0, message.GetExtension(UnitTestProtoFile.OptionalImportMessageExtension).D); + + // Enums without defaults are set to the first value in the enum. + Assert.AreEqual(TestAllTypes.Types.NestedEnum.FOO, + message.GetExtension(UnitTestProtoFile.OptionalNestedEnumExtension)); + Assert.AreEqual(ForeignEnum.FOREIGN_FOO, + message.GetExtension(UnitTestProtoFile.OptionalForeignEnumExtension)); + Assert.AreEqual(ImportEnum.IMPORT_FOO, message.GetExtension(UnitTestProtoFile.OptionalImportEnumExtension)); + + Assert.AreEqual("", message.GetExtension(UnitTestProtoFile.OptionalStringPieceExtension)); + Assert.AreEqual("", message.GetExtension(UnitTestProtoFile.OptionalCordExtension)); + + // Repeated fields are empty. + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedInt32Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedInt64Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedUint32Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedUint64Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedSint32Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedSint64Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedFixed32Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedFixed64Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedSfixed32Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedSfixed64Extension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedFloatExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedDoubleExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedBoolExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedStringExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedBytesExtension)); + + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedGroupExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedNestedMessageExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedForeignMessageExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedImportMessageExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedNestedEnumExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedForeignEnumExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedImportEnumExtension)); + + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedStringPieceExtension)); + Assert.AreEqual(0, message.GetExtensionCount(UnitTestProtoFile.RepeatedCordExtension)); + + // HasBlah() should also be false for all default fields. + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultInt32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultInt64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultUint32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultUint64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultSint32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultSint64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultFixed32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultFixed64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultSfixed32Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultSfixed64Extension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultFloatExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultDoubleExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultBoolExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultStringExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultBytesExtension)); + + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultNestedEnumExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultForeignEnumExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultImportEnumExtension)); + + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultStringPieceExtension)); + Assert.IsFalse(message.HasExtension(UnitTestProtoFile.DefaultCordExtension)); + + // Fields with defaults have their default values (duh). + Assert.AreEqual(41, message.GetExtension(UnitTestProtoFile.DefaultInt32Extension)); + Assert.AreEqual(42L, message.GetExtension(UnitTestProtoFile.DefaultInt64Extension)); + Assert.AreEqual(43U, message.GetExtension(UnitTestProtoFile.DefaultUint32Extension)); + Assert.AreEqual(44UL, message.GetExtension(UnitTestProtoFile.DefaultUint64Extension)); + Assert.AreEqual(-45, message.GetExtension(UnitTestProtoFile.DefaultSint32Extension)); + Assert.AreEqual(46L, message.GetExtension(UnitTestProtoFile.DefaultSint64Extension)); + Assert.AreEqual(47U, message.GetExtension(UnitTestProtoFile.DefaultFixed32Extension)); + Assert.AreEqual(48UL, message.GetExtension(UnitTestProtoFile.DefaultFixed64Extension)); + Assert.AreEqual(49, message.GetExtension(UnitTestProtoFile.DefaultSfixed32Extension)); + Assert.AreEqual(-50L, message.GetExtension(UnitTestProtoFile.DefaultSfixed64Extension)); + Assert.AreEqual(51.5F, message.GetExtension(UnitTestProtoFile.DefaultFloatExtension)); + Assert.AreEqual(52e3D, message.GetExtension(UnitTestProtoFile.DefaultDoubleExtension)); + Assert.AreEqual(true, message.GetExtension(UnitTestProtoFile.DefaultBoolExtension)); + Assert.AreEqual("hello", message.GetExtension(UnitTestProtoFile.DefaultStringExtension)); + Assert.AreEqual(ToBytes("world"), message.GetExtension(UnitTestProtoFile.DefaultBytesExtension)); + + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, + message.GetExtension(UnitTestProtoFile.DefaultNestedEnumExtension)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAR, message.GetExtension(UnitTestProtoFile.DefaultForeignEnumExtension)); + Assert.AreEqual(ImportEnum.IMPORT_BAR, message.GetExtension(UnitTestProtoFile.DefaultImportEnumExtension)); + + Assert.AreEqual("abc", message.GetExtension(UnitTestProtoFile.DefaultStringPieceExtension)); + Assert.AreEqual("123", message.GetExtension(UnitTestProtoFile.DefaultCordExtension)); + } + + /// + /// Set every field of the specified message to a unique value. + /// + public static void SetPackedFields(TestPackedTypes.Builder message) + { + message.AddPackedInt32(601); + message.AddPackedInt64(602); + message.AddPackedUint32(603); + message.AddPackedUint64(604); + message.AddPackedSint32(605); + message.AddPackedSint64(606); + message.AddPackedFixed32(607); + message.AddPackedFixed64(608); + message.AddPackedSfixed32(609); + message.AddPackedSfixed64(610); + message.AddPackedFloat(611); + message.AddPackedDouble(612); + message.AddPackedBool(true); + message.AddPackedEnum(ForeignEnum.FOREIGN_BAR); + // Add a second one of each field. + message.AddPackedInt32(701); + message.AddPackedInt64(702); + message.AddPackedUint32(703); + message.AddPackedUint64(704); + message.AddPackedSint32(705); + message.AddPackedSint64(706); + message.AddPackedFixed32(707); + message.AddPackedFixed64(708); + message.AddPackedSfixed32(709); + message.AddPackedSfixed64(710); + message.AddPackedFloat(711); + message.AddPackedDouble(712); + message.AddPackedBool(false); + message.AddPackedEnum(ForeignEnum.FOREIGN_BAZ); + } + + /// + /// Asserts that all the fields of the specified message are set to the values assigned + /// in SetPackedFields. + /// + public static void AssertPackedFieldsSet(TestPackedTypes message) + { + Assert.AreEqual(2, message.PackedInt32Count); + Assert.AreEqual(2, message.PackedInt64Count); + Assert.AreEqual(2, message.PackedUint32Count); + Assert.AreEqual(2, message.PackedUint64Count); + Assert.AreEqual(2, message.PackedSint32Count); + Assert.AreEqual(2, message.PackedSint64Count); + Assert.AreEqual(2, message.PackedFixed32Count); + Assert.AreEqual(2, message.PackedFixed64Count); + Assert.AreEqual(2, message.PackedSfixed32Count); + Assert.AreEqual(2, message.PackedSfixed64Count); + Assert.AreEqual(2, message.PackedFloatCount); + Assert.AreEqual(2, message.PackedDoubleCount); + Assert.AreEqual(2, message.PackedBoolCount); + Assert.AreEqual(2, message.PackedEnumCount); + Assert.AreEqual(601, message.GetPackedInt32(0)); + Assert.AreEqual(602, message.GetPackedInt64(0)); + Assert.AreEqual(603u, message.GetPackedUint32(0)); + Assert.AreEqual(604u, message.GetPackedUint64(0)); + Assert.AreEqual(605, message.GetPackedSint32(0)); + Assert.AreEqual(606, message.GetPackedSint64(0)); + Assert.AreEqual(607u, message.GetPackedFixed32(0)); + Assert.AreEqual(608u, message.GetPackedFixed64(0)); + Assert.AreEqual(609, message.GetPackedSfixed32(0)); + Assert.AreEqual(610, message.GetPackedSfixed64(0)); + Assert.AreEqual(611, message.GetPackedFloat(0), 0.0); + Assert.AreEqual(612, message.GetPackedDouble(0), 0.0); + Assert.AreEqual(true, message.GetPackedBool(0)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAR, message.GetPackedEnum(0)); + Assert.AreEqual(701, message.GetPackedInt32(1)); + Assert.AreEqual(702, message.GetPackedInt64(1)); + Assert.AreEqual(703u, message.GetPackedUint32(1)); + Assert.AreEqual(704u, message.GetPackedUint64(1)); + Assert.AreEqual(705, message.GetPackedSint32(1)); + Assert.AreEqual(706, message.GetPackedSint64(1)); + Assert.AreEqual(707u, message.GetPackedFixed32(1)); + Assert.AreEqual(708u, message.GetPackedFixed64(1)); + Assert.AreEqual(709, message.GetPackedSfixed32(1)); + Assert.AreEqual(710, message.GetPackedSfixed64(1)); + Assert.AreEqual(711, message.GetPackedFloat(1), 0.0); + Assert.AreEqual(712, message.GetPackedDouble(1), 0.0); + Assert.AreEqual(false, message.GetPackedBool(1)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, message.GetPackedEnum(1)); + } + /// + /// Asserts that all the fields of the specified message are set to the values assigned + /// in SetPackedFields. + /// + public static void AssertUnpackedFieldsSet(TestUnpackedTypes message) + { + Assert.AreEqual(2, message.UnpackedInt32Count); + Assert.AreEqual(2, message.UnpackedInt64Count); + Assert.AreEqual(2, message.UnpackedUint32Count); + Assert.AreEqual(2, message.UnpackedUint64Count); + Assert.AreEqual(2, message.UnpackedSint32Count); + Assert.AreEqual(2, message.UnpackedSint64Count); + Assert.AreEqual(2, message.UnpackedFixed32Count); + Assert.AreEqual(2, message.UnpackedFixed64Count); + Assert.AreEqual(2, message.UnpackedSfixed32Count); + Assert.AreEqual(2, message.UnpackedSfixed64Count); + Assert.AreEqual(2, message.UnpackedFloatCount); + Assert.AreEqual(2, message.UnpackedDoubleCount); + Assert.AreEqual(2, message.UnpackedBoolCount); + Assert.AreEqual(2, message.UnpackedEnumCount); + Assert.AreEqual(601, message.GetUnpackedInt32(0)); + Assert.AreEqual(602, message.GetUnpackedInt64(0)); + Assert.AreEqual(603u, message.GetUnpackedUint32(0)); + Assert.AreEqual(604u, message.GetUnpackedUint64(0)); + Assert.AreEqual(605, message.GetUnpackedSint32(0)); + Assert.AreEqual(606, message.GetUnpackedSint64(0)); + Assert.AreEqual(607u, message.GetUnpackedFixed32(0)); + Assert.AreEqual(608u, message.GetUnpackedFixed64(0)); + Assert.AreEqual(609, message.GetUnpackedSfixed32(0)); + Assert.AreEqual(610, message.GetUnpackedSfixed64(0)); + Assert.AreEqual(611, message.GetUnpackedFloat(0), 0.0); + Assert.AreEqual(612, message.GetUnpackedDouble(0), 0.0); + Assert.AreEqual(true, message.GetUnpackedBool(0)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAR, message.GetUnpackedEnum(0)); + Assert.AreEqual(701, message.GetUnpackedInt32(1)); + Assert.AreEqual(702, message.GetUnpackedInt64(1)); + Assert.AreEqual(703u, message.GetUnpackedUint32(1)); + Assert.AreEqual(704u, message.GetUnpackedUint64(1)); + Assert.AreEqual(705, message.GetUnpackedSint32(1)); + Assert.AreEqual(706, message.GetUnpackedSint64(1)); + Assert.AreEqual(707u, message.GetUnpackedFixed32(1)); + Assert.AreEqual(708u, message.GetUnpackedFixed64(1)); + Assert.AreEqual(709, message.GetUnpackedSfixed32(1)); + Assert.AreEqual(710, message.GetUnpackedSfixed64(1)); + Assert.AreEqual(711, message.GetUnpackedFloat(1), 0.0); + Assert.AreEqual(712, message.GetUnpackedDouble(1), 0.0); + Assert.AreEqual(false, message.GetUnpackedBool(1)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, message.GetUnpackedEnum(1)); + } + + public static void SetPackedExtensions(TestPackedExtensions.Builder message) + { + message.AddExtension(UnitTestProtoFile.PackedInt32Extension, 601); + message.AddExtension(UnitTestProtoFile.PackedInt64Extension, 602L); + message.AddExtension(UnitTestProtoFile.PackedUint32Extension, 603U); + message.AddExtension(UnitTestProtoFile.PackedUint64Extension, 604UL); + message.AddExtension(UnitTestProtoFile.PackedSint32Extension, 605); + message.AddExtension(UnitTestProtoFile.PackedSint64Extension, 606L); + message.AddExtension(UnitTestProtoFile.PackedFixed32Extension, 607U); + message.AddExtension(UnitTestProtoFile.PackedFixed64Extension, 608UL); + message.AddExtension(UnitTestProtoFile.PackedSfixed32Extension, 609); + message.AddExtension(UnitTestProtoFile.PackedSfixed64Extension, 610L); + message.AddExtension(UnitTestProtoFile.PackedFloatExtension, 611F); + message.AddExtension(UnitTestProtoFile.PackedDoubleExtension, 612D); + message.AddExtension(UnitTestProtoFile.PackedBoolExtension, true); + message.AddExtension(UnitTestProtoFile.PackedEnumExtension, ForeignEnum.FOREIGN_BAR); + // Add a second one of each field. + message.AddExtension(UnitTestProtoFile.PackedInt32Extension, 701); + message.AddExtension(UnitTestProtoFile.PackedInt64Extension, 702L); + message.AddExtension(UnitTestProtoFile.PackedUint32Extension, 703U); + message.AddExtension(UnitTestProtoFile.PackedUint64Extension, 704UL); + message.AddExtension(UnitTestProtoFile.PackedSint32Extension, 705); + message.AddExtension(UnitTestProtoFile.PackedSint64Extension, 706L); + message.AddExtension(UnitTestProtoFile.PackedFixed32Extension, 707U); + message.AddExtension(UnitTestProtoFile.PackedFixed64Extension, 708UL); + message.AddExtension(UnitTestProtoFile.PackedSfixed32Extension, 709); + message.AddExtension(UnitTestProtoFile.PackedSfixed64Extension, 710L); + message.AddExtension(UnitTestProtoFile.PackedFloatExtension, 711F); + message.AddExtension(UnitTestProtoFile.PackedDoubleExtension, 712D); + message.AddExtension(UnitTestProtoFile.PackedBoolExtension, false); + message.AddExtension(UnitTestProtoFile.PackedEnumExtension, ForeignEnum.FOREIGN_BAZ); + } + + public static void AssertPackedExtensionsSet(TestPackedExtensions message) + { + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedInt32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedInt64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedUint32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedUint64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedSint32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedSint64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedFixed32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedFixed64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedSfixed32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedSfixed64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedFloatExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedDoubleExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedBoolExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestProtoFile.PackedEnumExtension)); + Assert.AreEqual(601, message.GetExtension(UnitTestProtoFile.PackedInt32Extension, 0)); + Assert.AreEqual(602L, message.GetExtension(UnitTestProtoFile.PackedInt64Extension, 0)); + Assert.AreEqual(603u, message.GetExtension(UnitTestProtoFile.PackedUint32Extension, 0)); + Assert.AreEqual(604uL, message.GetExtension(UnitTestProtoFile.PackedUint64Extension, 0)); + Assert.AreEqual(605, message.GetExtension(UnitTestProtoFile.PackedSint32Extension, 0)); + Assert.AreEqual(606L, message.GetExtension(UnitTestProtoFile.PackedSint64Extension, 0)); + Assert.AreEqual(607u, message.GetExtension(UnitTestProtoFile.PackedFixed32Extension, 0)); + Assert.AreEqual(608uL, message.GetExtension(UnitTestProtoFile.PackedFixed64Extension, 0)); + Assert.AreEqual(609, message.GetExtension(UnitTestProtoFile.PackedSfixed32Extension, 0)); + Assert.AreEqual(610L, message.GetExtension(UnitTestProtoFile.PackedSfixed64Extension, 0)); + Assert.AreEqual(611F, message.GetExtension(UnitTestProtoFile.PackedFloatExtension, 0)); + Assert.AreEqual(612D, message.GetExtension(UnitTestProtoFile.PackedDoubleExtension, 0)); + Assert.AreEqual(true, message.GetExtension(UnitTestProtoFile.PackedBoolExtension, 0)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAR, + message.GetExtension(UnitTestProtoFile.PackedEnumExtension, 0)); + Assert.AreEqual(701, message.GetExtension(UnitTestProtoFile.PackedInt32Extension, 1)); + Assert.AreEqual(702L, message.GetExtension(UnitTestProtoFile.PackedInt64Extension, 1)); + Assert.AreEqual(703u, message.GetExtension(UnitTestProtoFile.PackedUint32Extension, 1)); + Assert.AreEqual(704uL, message.GetExtension(UnitTestProtoFile.PackedUint64Extension, 1)); + Assert.AreEqual(705, message.GetExtension(UnitTestProtoFile.PackedSint32Extension, 1)); + Assert.AreEqual(706L, message.GetExtension(UnitTestProtoFile.PackedSint64Extension, 1)); + Assert.AreEqual(707u, message.GetExtension(UnitTestProtoFile.PackedFixed32Extension, 1)); + Assert.AreEqual(708uL, message.GetExtension(UnitTestProtoFile.PackedFixed64Extension, 1)); + Assert.AreEqual(709, message.GetExtension(UnitTestProtoFile.PackedSfixed32Extension, 1)); + Assert.AreEqual(710L, message.GetExtension(UnitTestProtoFile.PackedSfixed64Extension, 1)); + Assert.AreEqual(711F, message.GetExtension(UnitTestProtoFile.PackedFloatExtension, 1)); + Assert.AreEqual(712D, message.GetExtension(UnitTestProtoFile.PackedDoubleExtension, 1)); + Assert.AreEqual(false, message.GetExtension(UnitTestProtoFile.PackedBoolExtension, 1)); + Assert.AreEqual(ForeignEnum.FOREIGN_BAZ, message.GetExtension(UnitTestProtoFile.PackedEnumExtension, 1)); + } + + public static void AssertUnpackedExtensionsSet(TestUnpackedExtensions message) + { + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedInt32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedInt64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedUint32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedUint64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSint32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSint64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedFixed32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedFixed64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSfixed32Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedSfixed64Extension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedFloatExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedDoubleExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedBoolExtension)); + Assert.AreEqual(2, message.GetExtensionCount(UnitTestExtrasProtoFile.UnpackedEnumExtension)); + Assert.AreEqual(601, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt32Extension, 0)); + Assert.AreEqual(602L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt64Extension, 0)); + Assert.AreEqual(603u, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint32Extension, 0)); + Assert.AreEqual(604uL, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint64Extension, 0)); + Assert.AreEqual(605, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint32Extension, 0)); + Assert.AreEqual(606L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint64Extension, 0)); + Assert.AreEqual(607u, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed32Extension, 0)); + Assert.AreEqual(608uL, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed64Extension, 0)); + Assert.AreEqual(609, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed32Extension, 0)); + Assert.AreEqual(610L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed64Extension, 0)); + Assert.AreEqual(611F, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFloatExtension, 0)); + Assert.AreEqual(612D, message.GetExtension(UnitTestExtrasProtoFile.UnpackedDoubleExtension, 0)); + Assert.AreEqual(true, message.GetExtension(UnitTestExtrasProtoFile.UnpackedBoolExtension, 0)); + Assert.AreEqual(UnpackedExtensionsForeignEnum.FOREIGN_BAR, + message.GetExtension(UnitTestExtrasProtoFile.UnpackedEnumExtension, 0)); + Assert.AreEqual(701, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt32Extension, 1)); + Assert.AreEqual(702L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedInt64Extension, 1)); + Assert.AreEqual(703u, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint32Extension, 1)); + Assert.AreEqual(704uL, message.GetExtension(UnitTestExtrasProtoFile.UnpackedUint64Extension, 1)); + Assert.AreEqual(705, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint32Extension, 1)); + Assert.AreEqual(706L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSint64Extension, 1)); + Assert.AreEqual(707u, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed32Extension, 1)); + Assert.AreEqual(708uL, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFixed64Extension, 1)); + Assert.AreEqual(709, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed32Extension, 1)); + Assert.AreEqual(710L, message.GetExtension(UnitTestExtrasProtoFile.UnpackedSfixed64Extension, 1)); + Assert.AreEqual(711F, message.GetExtension(UnitTestExtrasProtoFile.UnpackedFloatExtension, 1)); + Assert.AreEqual(712D, message.GetExtension(UnitTestExtrasProtoFile.UnpackedDoubleExtension, 1)); + Assert.AreEqual(false, message.GetExtension(UnitTestExtrasProtoFile.UnpackedBoolExtension, 1)); + Assert.AreEqual(UnpackedExtensionsForeignEnum.FOREIGN_BAZ, message.GetExtension(UnitTestExtrasProtoFile.UnpackedEnumExtension, 1)); + } + + private static readonly string[] TestCultures = {"en-US", "en-GB", "fr-FR", "de-DE"}; + + public delegate void CultureAction(); + + public static void TestInMultipleCultures(CultureAction test) + { +#if COMPACT_FRAMEWORK + test(); +#else + CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture; + foreach (string culture in TestCultures) + { + try + { + Thread.CurrentThread.CurrentCulture = new CultureInfo(culture); + test(); + } + finally + { + Thread.CurrentThread.CurrentCulture = originalCulture; + } + } +#endif + } + + /// + /// Helper to construct a byte array from a bunch of bytes. + /// + internal static byte[] Bytes(params byte[] bytesAsInts) + { + byte[] bytes = new byte[bytesAsInts.Length]; + for (int i = 0; i < bytesAsInts.Length; i++) + { + bytes[i] = (byte) bytesAsInts[i]; + } + return bytes; + } + + + internal delegate void Action(); + + internal static void AssertNotSupported(Action action) + { + try + { + action(); + Assert.Fail("Expected NotSupportedException"); + } + catch (NotSupportedException) + { + // Expected + } + } + + internal static void AssertArgumentNullException(Action action) + { + try + { + action(); + Assert.Fail("Exception was not thrown"); + } + // Not a general case, however, Compact Framework v2 does use Invoke + catch (System.Reflection.TargetInvocationException te) + { + if (te.InnerException.GetType() != typeof(ArgumentNullException)) + throw; + } + // Normally expected exception + catch (ArgumentNullException) + { + // We expect this exception. + } + } + + internal static void AssertBytesEqual(byte[] a, byte[]b) + { + if (a == null || b == null) + { + Assert.AreEqual(a, b); + } + else + { + Assert.AreEqual(a.Length, b.Length, "The byte[] is not of the expected length."); + + for (int i = 0; i < a.Length; i++) + { + if (a[i] != b[i]) + { + Assert.AreEqual(a[i], b[i], "Byte[] differs at index " + i); + } + } + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/TestWriterFormatJson.cs b/csharp/src/ProtocolBuffers.Test/TestWriterFormatJson.cs new file mode 100644 index 00000000..a3543afa --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestWriterFormatJson.cs @@ -0,0 +1,498 @@ +using System; +using System.IO; +using System.Text; +using Google.ProtocolBuffers.DescriptorProtos; +using Google.ProtocolBuffers.Serialization; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Google.ProtocolBuffers.TestProtos; +using EnumOptions = Google.ProtocolBuffers.TestProtos.EnumOptions; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class TestWriterFormatJson + { + [TestMethod] + public void Example_FromJson() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + + //3.5: builder.MergeFromJson(@"{""valid"":true}"); + Extensions.MergeFromJson(builder, @"{""valid"":true}"); + + TestXmlMessage message = builder.Build(); + Assert.AreEqual(true, message.Valid); + } + + [TestMethod] + public void Example_ToJson() + { + TestXmlMessage message = + TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(); + + //3.5: string json = message.ToJson(); + string json = Extensions.ToJson(message); + + Assert.AreEqual(@"{""valid"":true}", json); + } + + [TestMethod] + public void Example_WriteJsonUsingICodedOutputStream() + { + TestXmlMessage message = + TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(); + + using (TextWriter output = new StringWriter()) + { + ICodedOutputStream writer = JsonFormatWriter.CreateInstance(output); + writer.WriteMessageStart(); //manually begin the message, output is '{' + + writer.Flush(); + Assert.AreEqual("{", output.ToString()); + + ICodedOutputStream stream = writer; + message.WriteTo(stream); //write the message normally + + writer.Flush(); + Assert.AreEqual(@"{""valid"":true", output.ToString()); + + writer.WriteMessageEnd(); //manually write the end message '}' + Assert.AreEqual(@"{""valid"":true}", output.ToString()); + } + } + + [TestMethod] + public void Example_ReadJsonUsingICodedInputStream() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + ICodedInputStream reader = JsonFormatReader.CreateInstance(@"{""valid"":true}"); + + reader.ReadMessageStart(); //manually read the begin the message '{' + + builder.MergeFrom(reader); //write the message normally + + reader.ReadMessageEnd(); //manually read the end message '}' + } + + protected string Content; + [System.Diagnostics.DebuggerNonUserCode] + protected void FormatterAssert(TMessage message, params string[] expecting) where TMessage : IMessageLite + { + StringWriter sw = new StringWriter(); + JsonFormatWriter.CreateInstance(sw).WriteMessage(message); + + Content = sw.ToString(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestXmlSerializerTestProtoFile.RegisterAllExtensions(registry); + + IMessageLite copy = + JsonFormatReader.CreateInstance(Content) + .Merge(message.WeakCreateBuilderForType(), registry).WeakBuild(); + + Assert.AreEqual(typeof(TMessage), copy.GetType()); + Assert.AreEqual(message, copy); + foreach (string expect in expecting) + Assert.IsTrue(Content.IndexOf(expect) >= 0, "Expected to find content '{0}' in: \r\n{1}", expect, Content); + } + + [TestMethod] + public void TestToJsonParseFromJson() + { + TestAllTypes msg = new TestAllTypes.Builder().SetDefaultBool(true).Build(); + string json = Extensions.ToJson(msg); + Assert.AreEqual("{\"default_bool\":true}", json); + TestAllTypes copy = Extensions.MergeFromJson(new TestAllTypes.Builder(), json).Build(); + Assert.IsTrue(copy.HasDefaultBool && copy.DefaultBool); + Assert.AreEqual(msg, copy); + } + + [TestMethod] + public void TestToJsonParseFromJsonReader() + { + TestAllTypes msg = new TestAllTypes.Builder().SetDefaultBool(true).Build(); + string json = Extensions.ToJson(msg); + Assert.AreEqual("{\"default_bool\":true}", json); + TestAllTypes copy = Extensions.MergeFromJson(new TestAllTypes.Builder(), new StringReader(json)).Build(); + Assert.IsTrue(copy.HasDefaultBool && copy.DefaultBool); + Assert.AreEqual(msg, copy); + } + + [TestMethod] + public void TestJsonFormatted() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetNumber(0x1010) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder()) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.ONE)) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.ONE).AddOptions(EnumOptions.TWO)) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().SetBinary(ByteString.CopyFromUtf8("abc"))) + .Build(); + + StringWriter sw = new StringWriter(); + JsonFormatWriter.CreateInstance(sw).Formatted() + .WriteMessage(message); + + string json = sw.ToString(); + + TestXmlMessage copy = JsonFormatReader.CreateInstance(json) + .Merge(TestXmlMessage.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + + [TestMethod] + public void TestEmptyMessage() + { + FormatterAssert( + TestXmlChild.CreateBuilder() + .Build(), + @"{}" + ); + } + + [TestMethod] + public void TestRepeatedField() + { + FormatterAssert( + TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .AddOptions(EnumOptions.TWO) + .Build(), + @"{""options"":[""ONE"",""TWO""]}" + ); + } + + [TestMethod] + public void TestNestedEmptyMessage() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetChild(TestXmlChild.CreateBuilder().Build()) + .Build(), + @"{""child"":{}}" + ); + } + + [TestMethod] + public void TestNestedMessage() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.TWO).Build()) + .Build(), + @"{""child"":{""options"":[""TWO""]}}" + ); + } + + [TestMethod] + public void TestBooleanTypes() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(), + @"{""valid"":true}" + ); + } + + [TestMethod] + public void TestFullMessage() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .AddTextlines("a") + .AddTextlines("b") + .AddTextlines("c") + .SetNumber(0x1010101010) + .AddNumbers(1) + .AddNumbers(2) + .AddNumbers(3) + .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.ONE).SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.TWO).SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.THREE).SetBinary(ByteString.CopyFrom(new byte[3]))) + .Build(), + @"""text"":""text""", + @"[""a"",""b"",""c""]", + @"[1,2,3]", + @"""child"":{", + @"""children"":[{", + @"AA==", + @"AAA=", + @"AAAA", + 0x1010101010L.ToString() + ); + } + + [TestMethod] + public void TestMessageWithXmlText() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetText("") + .Build(), + @"{""text"":""<\/text>""}" + ); + } + + [TestMethod] + public void TestWithEscapeChars() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetText(" \t <- \"leading space and trailing\" -> \\ \xef54 \x0000 \xFF \xFFFF \b \f \r \n \t ") + .Build(), + "{\"text\":\" \\t <- \\\"leading space and trailing\\\" -> \\\\ \\uef54 \\u0000 \\u00ff \\uffff \\b \\f \\r \\n \\t \"}" + ); + } + + [TestMethod] + public void TestWithExtensionText() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetValid(false) + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, " extension text value ! ") + .Build(), + @"{""valid"":false,""extension_text"":"" extension text value ! ""}" + ); + } + + [TestMethod] + public void TestWithExtensionNumber() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, + new TestXmlExtension.Builder().SetNumber(42).Build()) + .Build(), + @"{""number"":42}" + ); + } + + [TestMethod] + public void TestWithExtensionArray() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 101) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 102) + .Build(), + @"{""extension_number"":[100,101,102]}" + ); + } + + [TestMethod] + public void TestWithExtensionEnum() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionEnum, EnumOptions.ONE) + .Build(), + @"{""extension_enum"":""ONE""}" + ); + } + + [TestMethod] + public void TestMessageWithExtensions() + { + FormatterAssert( + TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, "extension text") + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, new TestXmlExtension.Builder().SetNumber(42).Build()) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 101) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 102) + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionEnum, EnumOptions.ONE) + .Build(), + @"""text"":""text""", + @"""valid"":true", + @"""extension_enum"":""ONE""", + @"""extension_text"":""extension text""", + @"""extension_number"":[100,101,102]", + @"""extension_message"":{""number"":42}" + ); + } + + [TestMethod] + public void TestMessageMissingExtensions() + { + TestXmlMessage original = TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, " extension text value ! ") + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, new TestXmlExtension.Builder().SetNumber(42).Build()) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 101) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 102) + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionEnum, EnumOptions.ONE) + .Build(); + + TestXmlMessage message = original.ToBuilder() + .ClearExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText) + .ClearExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage) + .ClearExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber) + .ClearExtension(UnitTestXmlSerializerTestProtoFile.ExtensionEnum) + .Build(); + + JsonFormatWriter writer = JsonFormatWriter.CreateInstance(); + writer.WriteMessage(original); + Content = writer.ToString(); + + IMessageLite copy = JsonFormatReader.CreateInstance(Content) + .Merge(message.CreateBuilderForType()).Build(); + + Assert.AreNotEqual(original, message); + Assert.AreNotEqual(original, copy); + Assert.AreEqual(message, copy); + } + + [TestMethod] + public void TestMergeFields() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + builder.MergeFrom(JsonFormatReader.CreateInstance("\"valid\": true")); + builder.MergeFrom(JsonFormatReader.CreateInstance("\"text\": \"text\", \"number\": \"411\"")); + Assert.AreEqual(true, builder.Valid); + Assert.AreEqual("text", builder.Text); + Assert.AreEqual(411, builder.Number); + } + + [TestMethod] + public void TestMessageArray() + { + JsonFormatWriter writer = JsonFormatWriter.CreateInstance().Formatted(); + using (writer.StartArray()) + { + writer.WriteMessage(TestXmlMessage.CreateBuilder().SetNumber(1).AddTextlines("a").Build()); + writer.WriteMessage(TestXmlMessage.CreateBuilder().SetNumber(2).AddTextlines("b").Build()); + writer.WriteMessage(TestXmlMessage.CreateBuilder().SetNumber(3).AddTextlines("c").Build()); + } + string json = writer.ToString(); + JsonFormatReader reader = JsonFormatReader.CreateInstance(json); + + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + int ordinal = 0; + + foreach (JsonFormatReader r in reader.EnumerateArray()) + { + r.Merge(builder); + Assert.AreEqual(++ordinal, builder.Number); + } + Assert.AreEqual(3, ordinal); + Assert.AreEqual(3, builder.TextlinesCount); + } + + [TestMethod] + public void TestNestedMessageArray() + { + JsonFormatWriter writer = JsonFormatWriter.CreateInstance(); + using (writer.StartArray()) + { + using (writer.StartArray()) + { + writer.WriteMessage(TestXmlMessage.CreateBuilder().SetNumber(1).AddTextlines("a").Build()); + writer.WriteMessage(TestXmlMessage.CreateBuilder().SetNumber(2).AddTextlines("b").Build()); + } + using (writer.StartArray()) + writer.WriteMessage(TestXmlMessage.CreateBuilder().SetNumber(3).AddTextlines("c").Build()); + } + string json = writer.ToString(); + JsonFormatReader reader = JsonFormatReader.CreateInstance(json); + + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + int ordinal = 0; + + foreach (JsonFormatReader r in reader.EnumerateArray()) + foreach (JsonFormatReader r2 in r.EnumerateArray()) + { + r2.Merge(builder); + Assert.AreEqual(++ordinal, builder.Number); + } + Assert.AreEqual(3, ordinal); + Assert.AreEqual(3, builder.TextlinesCount); + } + + [TestMethod] + public void TestReadWriteJsonWithoutRoot() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + TestXmlMessage message = builder.SetText("abc").SetNumber(123).Build(); + + string Json; + using (StringWriter sw = new StringWriter()) + { + ICodedOutputStream output = JsonFormatWriter.CreateInstance(sw); + + message.WriteTo(output); + output.Flush(); + Json = sw.ToString(); + } + Assert.AreEqual(@"""text"":""abc"",""number"":123", Json); + + ICodedInputStream input = JsonFormatReader.CreateInstance(Json); + TestXmlMessage copy = TestXmlMessage.CreateBuilder().MergeFrom(input).Build(); + + Assert.AreEqual(message, copy); + } + + [TestMethod,ExpectedException(typeof(RecursionLimitExceededException))] + public void TestRecursiveLimit() + { + StringBuilder sb = new StringBuilder(8192); + for (int i = 0; i < 80; i++) + sb.Append("{\"child\":"); + TestXmlRescursive msg = Extensions.MergeFromJson(new TestXmlRescursive.Builder(), sb.ToString()).Build(); + } + + [TestMethod, ExpectedException(typeof(FormatException))] + public void FailWithEmptyText() + { + JsonFormatReader.CreateInstance("") + .Merge(TestXmlMessage.CreateBuilder()); + } + + [TestMethod, ExpectedException(typeof(FormatException))] + public void FailWithUnexpectedValue() + { + JsonFormatReader.CreateInstance("{{}}") + .Merge(TestXmlMessage.CreateBuilder()); + } + + [TestMethod, ExpectedException(typeof(FormatException))] + public void FailWithUnQuotedName() + { + JsonFormatReader.CreateInstance("{name:{}}") + .Merge(TestXmlMessage.CreateBuilder()); + } + + [TestMethod, ExpectedException(typeof(FormatException))] + public void FailWithUnexpectedType() + { + JsonFormatReader.CreateInstance("{\"valid\":{}}") + .Merge(TestXmlMessage.CreateBuilder()); + } + + // See issue 64 for background. + [TestMethod] + public void ToJsonRequiringBufferExpansion() + { + string s = new string('.', 4086); + var opts = FileDescriptorProto.CreateBuilder() + .SetName(s) + .SetPackage("package") + .BuildPartial(); + + Assert.IsNotNull(Extensions.ToJson(opts)); + } + } +} diff --git a/csharp/src/ProtocolBuffers.Test/TestWriterFormatXml.cs b/csharp/src/ProtocolBuffers.Test/TestWriterFormatXml.cs new file mode 100644 index 00000000..13ea060b --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TestWriterFormatXml.cs @@ -0,0 +1,455 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Xml; +using Google.ProtocolBuffers.Serialization; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Google.ProtocolBuffers.TestProtos; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class TestWriterFormatXml + { + [TestMethod] + public void Example_FromXml() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + + XmlReader rdr = XmlReader.Create(new StringReader(@"true")); + //3.5: builder.MergeFromXml(rdr); + Extensions.MergeFromXml(builder, rdr); + + TestXmlMessage message = builder.Build(); + Assert.AreEqual(true, message.Valid); + } + + [TestMethod] + public void Example_ToXml() + { + TestXmlMessage message = + TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(); + + //3.5: string Xml = message.ToXml(); + string Xml = Extensions.ToXml(message); + + Assert.AreEqual(@"true", Xml); + } + + [TestMethod] + public void Example_WriteXmlUsingICodedOutputStream() + { + TestXmlMessage message = + TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(); + + using (TextWriter output = new StringWriter()) + { + ICodedOutputStream writer = XmlFormatWriter.CreateInstance(output); + writer.WriteMessageStart(); //manually begin the message, output is '{' + + ICodedOutputStream stream = writer; + message.WriteTo(stream); //write the message normally + + writer.WriteMessageEnd(); //manually write the end message '}' + Assert.AreEqual(@"true", output.ToString()); + } + } + + [TestMethod] + public void Example_ReadXmlUsingICodedInputStream() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + ICodedInputStream reader = XmlFormatReader.CreateInstance(@"true"); + + reader.ReadMessageStart(); //manually read the begin the message '{' + + builder.MergeFrom(reader); //read the message normally + + reader.ReadMessageEnd(); //manually read the end message '}' + } + + [TestMethod] + public void TestToXmlParseFromXml() + { + TestAllTypes msg = new TestAllTypes.Builder().SetDefaultBool(true).Build(); + string xml = Extensions.ToXml(msg); + Assert.AreEqual("true", xml); + TestAllTypes copy = Extensions.MergeFromXml(new TestAllTypes.Builder(), XmlReader.Create(new StringReader(xml))).Build(); + Assert.IsTrue(copy.HasDefaultBool && copy.DefaultBool); + Assert.AreEqual(msg, copy); + } + + [TestMethod] + public void TestToXmlParseFromXmlWithRootName() + { + TestAllTypes msg = new TestAllTypes.Builder().SetDefaultBool(true).Build(); + string xml = Extensions.ToXml(msg, "message"); + Assert.AreEqual("true", xml); + TestAllTypes copy = Extensions.MergeFromXml(new TestAllTypes.Builder(), "message", XmlReader.Create(new StringReader(xml))).Build(); + Assert.IsTrue(copy.HasDefaultBool && copy.DefaultBool); + Assert.AreEqual(msg, copy); + } + + [TestMethod] + public void TestEmptyMessage() + { + TestXmlChild message = TestXmlChild.CreateBuilder() + .Build(); + + StringWriter sw = new StringWriter(); + XmlWriter xw = XmlWriter.Create(sw); + + //When we call message.WriteTo, we are responsible for the root element + xw.WriteStartElement("root"); + message.WriteTo(XmlFormatWriter.CreateInstance(xw)); + xw.WriteEndElement(); + xw.Flush(); + + string xml = sw.ToString(); + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlChild copy = rdr.Merge(TestXmlChild.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestRepeatedField() + { + TestXmlChild message = TestXmlChild.CreateBuilder() + .AddOptions(EnumOptions.ONE) + .AddOptions(EnumOptions.TWO) + .Build(); + + //Allow the writer to write the root element + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlChild copy = rdr.Merge(TestXmlChild.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestNestedEmptyMessage() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetChild(TestXmlChild.CreateBuilder().Build()) + .Build(); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestNestedMessage() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.TWO).Build()) + .Build(); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestBooleanTypes() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetValid(true) + .Build(); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestFullMessage() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .AddTextlines("a") + .AddTextlines("b") + .AddTextlines("c") + .SetNumber(0x1010101010) + .AddNumbers(1) + .AddNumbers(2) + .AddNumbers(3) + .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.ONE).SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.TWO).SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.THREE).SetBinary(ByteString.CopyFrom(new byte[3]))) + .Build(); + + StringWriter sw = new StringWriter(); + XmlWriter xwtr = XmlWriter.Create(sw, new XmlWriterSettings {Indent = true, IndentChars = " "}); + + XmlFormatWriter.CreateInstance(xwtr).WriteMessage("root", message); + + string xml = sw.ToString(); + + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestFullMessageWithRichTypes() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .AddTextlines("a") + .AddTextlines("b") + .AddTextlines("c") + .SetNumber(0x1010101010) + .AddNumbers(1) + .AddNumbers(2) + .AddNumbers(3) + .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.ONE).SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.TWO).SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.THREE).SetBinary(ByteString.CopyFrom(new byte[3]))) + .Build(); + + StringWriter sw = new StringWriter(); + XmlWriter xwtr = XmlWriter.Create(sw, new XmlWriterSettings { Indent = true, IndentChars = " " }); + + XmlFormatWriter.CreateInstance(xwtr) + .SetOptions(XmlWriterOptions.OutputNestedArrays | XmlWriterOptions.OutputEnumValues) + .WriteMessage("root", message); + + string xml = sw.ToString(); + + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + rdr.Options = XmlReaderOptions.ReadNestedArrays; + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestFullMessageWithUnknownFields() + { + TestXmlMessage origial = TestXmlMessage.CreateBuilder() + .SetValid(true) + .SetText("text") + .AddTextlines("a") + .AddTextlines("b") + .AddTextlines("c") + .SetNumber(0x1010101010) + .AddNumbers(1) + .AddNumbers(2) + .AddNumbers(3) + .SetChild(TestXmlChild.CreateBuilder().AddOptions(EnumOptions.ONE).SetBinary(ByteString.CopyFrom(new byte[1]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.TWO).SetBinary(ByteString.CopyFrom(new byte[2]))) + .AddChildren(TestXmlMessage.Types.Children.CreateBuilder().AddOptions(EnumOptions.THREE).SetBinary(ByteString.CopyFrom(new byte[3]))) + .Build(); + TestXmlNoFields message = TestXmlNoFields.CreateBuilder().MergeFrom(origial.ToByteArray()).Build(); + + Assert.AreEqual(0, message.AllFields.Count); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw) + .SetOptions(XmlWriterOptions.OutputNestedArrays | XmlWriterOptions.OutputEnumValues) + .WriteMessage("root", message); + + string xml = sw.ToString(); + + using (XmlReader x = XmlReader.Create(new StringReader(xml))) + { + x.MoveToContent(); + Assert.AreEqual(XmlNodeType.Element, x.NodeType); + //should always be empty + Assert.IsTrue(x.IsEmptyElement || + (x.Read() && x.NodeType == XmlNodeType.EndElement) + ); + } + + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + rdr.Options = XmlReaderOptions.ReadNestedArrays; + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder()).Build(); + Assert.AreEqual(TestXmlMessage.DefaultInstance, copy); + } + [TestMethod] + public void TestMessageWithXmlText() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetText("").Build(); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestXmlWithWhitespace() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetText(" \t <- leading space and trailing -> \r\n\t").Build(); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder()).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestXmlWithExtensionText() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionText, " extension text value ! ") + .Build(); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestXmlSerializerTestProtoFile.RegisterAllExtensions(registry); + + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder(), registry).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestXmlWithExtensionMessage() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionMessage, + new TestXmlExtension.Builder().SetNumber(42).Build()).Build(); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestXmlSerializerTestProtoFile.RegisterAllExtensions(registry); + + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder(), registry).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestXmlWithExtensionArray() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 100) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 101) + .AddExtension(UnitTestXmlSerializerTestProtoFile.ExtensionNumber, 102) + .Build(); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestXmlSerializerTestProtoFile.RegisterAllExtensions(registry); + + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder(), registry).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestXmlWithExtensionEnum() + { + TestXmlMessage message = TestXmlMessage.CreateBuilder() + .SetExtension(UnitTestXmlSerializerTestProtoFile.ExtensionEnum, EnumOptions.ONE) + .Build(); + + StringWriter sw = new StringWriter(); + XmlFormatWriter.CreateInstance(sw).WriteMessage("root", message); + + string xml = sw.ToString(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestXmlSerializerTestProtoFile.RegisterAllExtensions(registry); + + XmlFormatReader rdr = XmlFormatReader.CreateInstance(xml); + TestXmlMessage copy = rdr.Merge(TestXmlMessage.CreateBuilder(), registry).Build(); + Assert.AreEqual(message, copy); + } + [TestMethod] + public void TestXmlReadEmptyRoot() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + ICodedInputStream reader = XmlFormatReader.CreateInstance(@""); + + reader.ReadMessageStart(); //manually read the begin the message '{' + + builder.MergeFrom(reader); //write the message normally + + reader.ReadMessageEnd(); //manually read the end message '}' + } + + [TestMethod] + public void TestXmlReadEmptyChild() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + ICodedInputStream reader = XmlFormatReader.CreateInstance(@""); + + reader.ReadMessageStart(); //manually read the begin the message '{' + + builder.MergeFrom(reader); //write the message normally + Assert.IsTrue(builder.HasText); + Assert.AreEqual(String.Empty, builder.Text); + } + + [TestMethod] + public void TestXmlReadWriteWithoutRoot() + { + TestXmlMessage.Builder builder = TestXmlMessage.CreateBuilder(); + TestXmlMessage message = builder.SetText("abc").SetNumber(123).Build(); + + string xml; + using (StringWriter sw = new StringWriter()) + { + ICodedOutputStream output = XmlFormatWriter.CreateInstance( + XmlWriter.Create(sw, new XmlWriterSettings() { ConformanceLevel = ConformanceLevel.Fragment })); + + message.WriteTo(output); + output.Flush(); + xml = sw.ToString(); + } + Assert.AreEqual("abc123", xml); + + TestXmlMessage copy; + using (XmlReader xr = XmlReader.Create(new StringReader(xml), new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Fragment })) + { + ICodedInputStream input = XmlFormatReader.CreateInstance(xr); + copy = TestXmlMessage.CreateBuilder().MergeFrom(input).Build(); + } + + Assert.AreEqual(message, copy); + } + + [TestMethod, ExpectedException(typeof(RecursionLimitExceededException))] + public void TestRecursiveLimit() + { + StringBuilder sb = new StringBuilder(8192); + for (int i = 0; i < 80; i++) + sb.Append(""); + TestXmlRescursive msg = Extensions.MergeFromXml(new TestXmlRescursive.Builder(), "child", XmlReader.Create(new StringReader(sb.ToString()))).Build(); + } + } +} diff --git a/csharp/src/ProtocolBuffers.Test/TextFormatTest.cs b/csharp/src/ProtocolBuffers.Test/TextFormatTest.cs new file mode 100644 index 00000000..37a4192a --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/TextFormatTest.cs @@ -0,0 +1,586 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using System.Text; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Globalization; +using System.Threading; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class TextFormatTest + { + private static readonly string AllFieldsSetText = TestResources.text_format_unittest_data; + private static readonly string AllExtensionsSetText = TestResources.text_format_unittest_extensions_data; + + /// + /// Note that this is slightly different to the Java - 123.0 becomes 123, and 1.23E17 becomes 1.23E+17. + /// Both of these differences can be parsed by the Java and the C++, and we can parse their output too. + /// + private const string ExoticText = + "repeated_int32: -1\n" + + "repeated_int32: -2147483648\n" + + "repeated_int64: -1\n" + + "repeated_int64: -9223372036854775808\n" + + "repeated_uint32: 4294967295\n" + + "repeated_uint32: 2147483648\n" + + "repeated_uint64: 18446744073709551615\n" + + "repeated_uint64: 9223372036854775808\n" + + "repeated_double: 123\n" + + "repeated_double: 123.5\n" + + "repeated_double: 0.125\n" + + "repeated_double: 1.23E+17\n" + + "repeated_double: 1.235E+22\n" + + "repeated_double: 1.235E-18\n" + + "repeated_double: 123.456789\n" + + "repeated_double: Infinity\n" + + "repeated_double: -Infinity\n" + + "repeated_double: NaN\n" + + "repeated_string: \"\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\"" + + "\\341\\210\\264\"\n" + + "repeated_bytes: \"\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\"\\376\"\n"; + + private const string MessageSetText = + "[protobuf_unittest.TestMessageSetExtension1] {\n" + + " i: 123\n" + + "}\n" + + "[protobuf_unittest.TestMessageSetExtension2] {\n" + + " str: \"foo\"\n" + + "}\n"; + + /// + /// Print TestAllTypes and compare with golden file. + /// + [TestMethod] + public void PrintMessage() + { + TestUtil.TestInMultipleCultures(() => + { + string text = TextFormat.PrintToString(TestUtil.GetAllSet()); + Assert.AreEqual(AllFieldsSetText.Replace("\r\n", "\n").Trim(), + text.Replace("\r\n", "\n").Trim()); + }); + } + + /// + /// Tests that a builder prints the same way as a message. + /// + [TestMethod] + public void PrintBuilder() + { + TestUtil.TestInMultipleCultures(() => + { + string messageText = TextFormat.PrintToString(TestUtil.GetAllSet()); + string builderText = TextFormat.PrintToString(TestUtil.GetAllSet().ToBuilder()); + Assert.AreEqual(messageText, builderText); + }); + } + + /// + /// Print TestAllExtensions and compare with golden file. + /// + [TestMethod] + public void PrintExtensions() + { + string text = TextFormat.PrintToString(TestUtil.GetAllExtensionsSet()); + + Assert.AreEqual(AllExtensionsSetText.Replace("\r\n", "\n").Trim(), text.Replace("\r\n", "\n").Trim()); + } + + /// + /// Test printing of unknown fields in a message. + /// + [TestMethod] + public void PrintUnknownFields() + { + TestEmptyMessage message = + TestEmptyMessage.CreateBuilder() + .SetUnknownFields( + UnknownFieldSet.CreateBuilder() + .AddField(5, + UnknownField.CreateBuilder() + .AddVarint(1) + .AddFixed32(2) + .AddFixed64(3) + .AddLengthDelimited(ByteString.CopyFromUtf8("4")) + .AddGroup( + UnknownFieldSet.CreateBuilder() + .AddField(10, + UnknownField.CreateBuilder() + .AddVarint(5) + .Build()) + .Build()) + .Build()) + .AddField(8, + UnknownField.CreateBuilder() + .AddVarint(1) + .AddVarint(2) + .AddVarint(3) + .Build()) + .AddField(15, + UnknownField.CreateBuilder() + .AddVarint(0xABCDEF1234567890L) + .AddFixed32(0xABCD1234) + .AddFixed64(0xABCDEF1234567890L) + .Build()) + .Build()) + .Build(); + + Assert.AreEqual( + "5: 1\n" + + "5: 0x00000002\n" + + "5: 0x0000000000000003\n" + + "5: \"4\"\n" + + "5 {\n" + + " 10: 5\n" + + "}\n" + + "8: 1\n" + + "8: 2\n" + + "8: 3\n" + + "15: 12379813812177893520\n" + + "15: 0xabcd1234\n" + + "15: 0xabcdef1234567890\n", + TextFormat.PrintToString(message)); + } + + /// + /// Helper to construct a ByteString from a string containing only 8-bit + /// characters. The characters are converted directly to bytes, *not* + /// encoded using UTF-8. + /// + private static ByteString Bytes(string str) + { + byte[] bytes = new byte[str.Length]; + for (int i = 0; i < bytes.Length; i++) + bytes[i] = (byte)str[i]; + return ByteString.CopyFrom(bytes); + } + + [TestMethod] + public void PrintExotic() + { + IMessage message = TestAllTypes.CreateBuilder() + // Signed vs. unsigned numbers. + .AddRepeatedInt32(-1) + .AddRepeatedUint32(uint.MaxValue) + .AddRepeatedInt64(-1) + .AddRepeatedUint64(ulong.MaxValue) + .AddRepeatedInt32(1 << 31) + .AddRepeatedUint32(1U << 31) + .AddRepeatedInt64(1L << 63) + .AddRepeatedUint64(1UL << 63) + + // Floats of various precisions and exponents. + .AddRepeatedDouble(123) + .AddRepeatedDouble(123.5) + .AddRepeatedDouble(0.125) + .AddRepeatedDouble(123e15) + .AddRepeatedDouble(123.5e20) + .AddRepeatedDouble(123.5e-20) + .AddRepeatedDouble(123.456789) + .AddRepeatedDouble(Double.PositiveInfinity) + .AddRepeatedDouble(Double.NegativeInfinity) + .AddRepeatedDouble(Double.NaN) + + // Strings and bytes that needing escaping. + .AddRepeatedString("\0\u0001\u0007\b\f\n\r\t\v\\\'\"\u1234") + .AddRepeatedBytes(Bytes("\0\u0001\u0007\b\f\n\r\t\v\\\'\"\u00fe")) + .Build(); + + Assert.AreEqual(ExoticText, message.ToString()); + } + + [TestMethod] + public void PrintMessageSet() + { + TestMessageSet messageSet = + TestMessageSet.CreateBuilder() + .SetExtension( + TestMessageSetExtension1.MessageSetExtension, + TestMessageSetExtension1.CreateBuilder().SetI(123).Build()) + .SetExtension( + TestMessageSetExtension2.MessageSetExtension, + TestMessageSetExtension2.CreateBuilder().SetStr("foo").Build()) + .Build(); + + Assert.AreEqual(MessageSetText, messageSet.ToString()); + } + + // ================================================================= + + [TestMethod] + public void Parse() + { + TestUtil.TestInMultipleCultures(() => + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TextFormat.Merge(AllFieldsSetText, builder); + TestUtil.AssertAllFieldsSet(builder.Build()); + }); + } + + [TestMethod] + public void ParseReader() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TextFormat.Merge(new StringReader(AllFieldsSetText), builder); + TestUtil.AssertAllFieldsSet(builder.Build()); + } + + [TestMethod] + public void ParseExtensions() + { + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + TextFormat.Merge(AllExtensionsSetText, + TestUtil.CreateExtensionRegistry(), + builder); + TestUtil.AssertAllExtensionsSet(builder.Build()); + } + + [TestMethod] + public void ParseCompatibility() + { + string original = "repeated_float: inf\n" + + "repeated_float: -inf\n" + + "repeated_float: nan\n" + + "repeated_float: inff\n" + + "repeated_float: -inff\n" + + "repeated_float: nanf\n" + + "repeated_float: 1.0f\n" + + "repeated_float: infinityf\n" + + "repeated_float: -Infinityf\n" + + "repeated_double: infinity\n" + + "repeated_double: -infinity\n" + + "repeated_double: nan\n"; + string canonical = "repeated_float: Infinity\n" + + "repeated_float: -Infinity\n" + + "repeated_float: NaN\n" + + "repeated_float: Infinity\n" + + "repeated_float: -Infinity\n" + + "repeated_float: NaN\n" + + "repeated_float: 1\n" + // Java has 1.0; this is fine + "repeated_float: Infinity\n" + + "repeated_float: -Infinity\n" + + "repeated_double: Infinity\n" + + "repeated_double: -Infinity\n" + + "repeated_double: NaN\n"; + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TextFormat.Merge(original, builder); + Assert.AreEqual(canonical, builder.Build().ToString()); + } + + [TestMethod] + public void ParseExotic() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TextFormat.Merge(ExoticText, builder); + + // Too lazy to check things individually. Don't try to debug this + // if testPrintExotic() is Assert.Failing. + Assert.AreEqual(ExoticText, builder.Build().ToString()); + } + + [TestMethod] + public void ParseMessageSet() + { + ExtensionRegistry extensionRegistry = ExtensionRegistry.CreateInstance(); + extensionRegistry.Add(TestMessageSetExtension1.MessageSetExtension); + extensionRegistry.Add(TestMessageSetExtension2.MessageSetExtension); + + TestMessageSet.Builder builder = TestMessageSet.CreateBuilder(); + TextFormat.Merge(MessageSetText, extensionRegistry, builder); + TestMessageSet messageSet = builder.Build(); + + Assert.IsTrue(messageSet.HasExtension(TestMessageSetExtension1.MessageSetExtension)); + Assert.AreEqual(123, messageSet.GetExtension(TestMessageSetExtension1.MessageSetExtension).I); + Assert.IsTrue(messageSet.HasExtension(TestMessageSetExtension2.MessageSetExtension)); + Assert.AreEqual("foo", messageSet.GetExtension(TestMessageSetExtension2.MessageSetExtension).Str); + } + + [TestMethod] + public void ParseNumericEnum() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TextFormat.Merge("optional_nested_enum: 2", builder); + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, builder.OptionalNestedEnum); + } + + [TestMethod] + public void ParseAngleBrackets() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TextFormat.Merge("OptionalGroup: < a: 1 >", builder); + Assert.IsTrue(builder.HasOptionalGroup); + Assert.AreEqual(1, builder.OptionalGroup.A); + } + + [TestMethod] + public void ParseComment() + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TextFormat.Merge( + "# this is a comment\n" + + "optional_int32: 1 # another comment\n" + + "optional_int64: 2\n" + + "# EOF comment", builder); + Assert.AreEqual(1, builder.OptionalInt32); + Assert.AreEqual(2, builder.OptionalInt64); + } + + + private static void AssertParseError(string error, string text) + { + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + try + { + TextFormat.Merge(text, TestUtil.CreateExtensionRegistry(), builder); + Assert.Fail("Expected parse exception."); + } + catch (FormatException e) + { + Assert.AreEqual(error, e.Message); + } + } + + [TestMethod] + public void ParseErrors() + { + AssertParseError( + "1:16: Expected \":\".", + "optional_int32 123"); + AssertParseError( + "1:23: Expected identifier.", + "optional_nested_enum: ?"); + AssertParseError( + "1:18: Couldn't parse integer: Number must be positive: -1", + "optional_uint32: -1"); + AssertParseError( + "1:17: Couldn't parse integer: Number out of range for 32-bit signed " + + "integer: 82301481290849012385230157", + "optional_int32: 82301481290849012385230157"); + AssertParseError( + "1:16: Expected \"true\" or \"false\".", + "optional_bool: maybe"); + AssertParseError( + "1:18: Expected string.", + "optional_string: 123"); + AssertParseError( + "1:18: String missing ending quote.", + "optional_string: \"ueoauaoe"); + AssertParseError( + "1:18: String missing ending quote.", + "optional_string: \"ueoauaoe\n" + + "optional_int32: 123"); + AssertParseError( + "1:18: Invalid escape sequence: '\\z'", + "optional_string: \"\\z\""); + AssertParseError( + "1:18: String missing ending quote.", + "optional_string: \"ueoauaoe\n" + + "optional_int32: 123"); + AssertParseError( + "1:2: Extension \"nosuchext\" not found in the ExtensionRegistry.", + "[nosuchext]: 123"); + AssertParseError( + "1:20: Extension \"protobuf_unittest.optional_int32_extension\" " + + "not found in the ExtensionRegistry.", + "[protobuf_unittest.optional_int32_extension]: 123"); + AssertParseError( + "1:1: Message type \"protobuf_unittest.TestAllTypes\" has no field " + + "named \"nosuchfield\".", + "nosuchfield: 123"); + AssertParseError( + "1:21: Expected \">\".", + "OptionalGroup < a: 1"); + AssertParseError( + "1:23: Enum type \"protobuf_unittest.TestAllTypes.NestedEnum\" has no " + + "value named \"NO_SUCH_VALUE\".", + "optional_nested_enum: NO_SUCH_VALUE"); + AssertParseError( + "1:23: Enum type \"protobuf_unittest.TestAllTypes.NestedEnum\" has no " + + "value with number 123.", + "optional_nested_enum: 123"); + + // Delimiters must match. + AssertParseError( + "1:22: Expected identifier.", + "OptionalGroup < a: 1 }"); + AssertParseError( + "1:22: Expected identifier.", + "OptionalGroup { a: 1 >"); + } + + // ================================================================= + + private static ByteString Bytes(params byte[] bytes) + { + return ByteString.CopyFrom(bytes); + } + + private delegate void FormattingAction(); + + private static void AssertFormatException(FormattingAction action) + { + try + { + action(); + Assert.Fail("Should have thrown an exception."); + } + catch (FormatException) + { + // success + } + } + + [TestMethod] + public void Escape() + { + // Escape sequences. + Assert.AreEqual("\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\"", + TextFormat.EscapeBytes(Bytes("\0\u0001\u0007\b\f\n\r\t\v\\\'\""))); + Assert.AreEqual("\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\"", + TextFormat.EscapeText("\0\u0001\u0007\b\f\n\r\t\v\\\'\"")); + Assert.AreEqual(Bytes("\0\u0001\u0007\b\f\n\r\t\v\\\'\""), + TextFormat.UnescapeBytes("\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\"")); + Assert.AreEqual("\0\u0001\u0007\b\f\n\r\t\v\\\'\"", + TextFormat.UnescapeText("\\000\\001\\a\\b\\f\\n\\r\\t\\v\\\\\\'\\\"")); + + // Unicode handling. + Assert.AreEqual("\\341\\210\\264", TextFormat.EscapeText("\u1234")); + Assert.AreEqual("\\341\\210\\264", TextFormat.EscapeBytes(Bytes(0xe1, 0x88, 0xb4))); + Assert.AreEqual("\u1234", TextFormat.UnescapeText("\\341\\210\\264")); + Assert.AreEqual(Bytes(0xe1, 0x88, 0xb4), TextFormat.UnescapeBytes("\\341\\210\\264")); + Assert.AreEqual("\u1234", TextFormat.UnescapeText("\\xe1\\x88\\xb4")); + Assert.AreEqual(Bytes(0xe1, 0x88, 0xb4), TextFormat.UnescapeBytes("\\xe1\\x88\\xb4")); + + // Errors. + AssertFormatException(() => TextFormat.UnescapeText("\\x")); + AssertFormatException(() => TextFormat.UnescapeText("\\z")); + AssertFormatException(() => TextFormat.UnescapeText("\\")); + } + + [TestMethod] + public void ParseInteger() + { + Assert.AreEqual(0, TextFormat.ParseInt32("0")); + Assert.AreEqual(1, TextFormat.ParseInt32("1")); + Assert.AreEqual(-1, TextFormat.ParseInt32("-1")); + Assert.AreEqual(12345, TextFormat.ParseInt32("12345")); + Assert.AreEqual(-12345, TextFormat.ParseInt32("-12345")); + Assert.AreEqual(2147483647, TextFormat.ParseInt32("2147483647")); + Assert.AreEqual(-2147483648, TextFormat.ParseInt32("-2147483648")); + + Assert.AreEqual(0u, TextFormat.ParseUInt32("0")); + Assert.AreEqual(1u, TextFormat.ParseUInt32("1")); + Assert.AreEqual(12345u, TextFormat.ParseUInt32("12345")); + Assert.AreEqual(2147483647u, TextFormat.ParseUInt32("2147483647")); + Assert.AreEqual(2147483648U, TextFormat.ParseUInt32("2147483648")); + Assert.AreEqual(4294967295U, TextFormat.ParseUInt32("4294967295")); + + Assert.AreEqual(0L, TextFormat.ParseInt64("0")); + Assert.AreEqual(1L, TextFormat.ParseInt64("1")); + Assert.AreEqual(-1L, TextFormat.ParseInt64("-1")); + Assert.AreEqual(12345L, TextFormat.ParseInt64("12345")); + Assert.AreEqual(-12345L, TextFormat.ParseInt64("-12345")); + Assert.AreEqual(2147483647L, TextFormat.ParseInt64("2147483647")); + Assert.AreEqual(-2147483648L, TextFormat.ParseInt64("-2147483648")); + Assert.AreEqual(4294967295L, TextFormat.ParseInt64("4294967295")); + Assert.AreEqual(4294967296L, TextFormat.ParseInt64("4294967296")); + Assert.AreEqual(9223372036854775807L, TextFormat.ParseInt64("9223372036854775807")); + Assert.AreEqual(-9223372036854775808L, TextFormat.ParseInt64("-9223372036854775808")); + + Assert.AreEqual(0uL, TextFormat.ParseUInt64("0")); + Assert.AreEqual(1uL, TextFormat.ParseUInt64("1")); + Assert.AreEqual(12345uL, TextFormat.ParseUInt64("12345")); + Assert.AreEqual(2147483647uL, TextFormat.ParseUInt64("2147483647")); + Assert.AreEqual(4294967295uL, TextFormat.ParseUInt64("4294967295")); + Assert.AreEqual(4294967296uL, TextFormat.ParseUInt64("4294967296")); + Assert.AreEqual(9223372036854775807UL, TextFormat.ParseUInt64("9223372036854775807")); + Assert.AreEqual(9223372036854775808UL, TextFormat.ParseUInt64("9223372036854775808")); + Assert.AreEqual(18446744073709551615UL, TextFormat.ParseUInt64("18446744073709551615")); + + // Hex + Assert.AreEqual(0x1234abcd, TextFormat.ParseInt32("0x1234abcd")); + Assert.AreEqual(-0x1234abcd, TextFormat.ParseInt32("-0x1234abcd")); + Assert.AreEqual(0xffffffffffffffffUL, TextFormat.ParseUInt64("0xffffffffffffffff")); + Assert.AreEqual(0x7fffffffffffffffL, + TextFormat.ParseInt64("0x7fffffffffffffff")); + + // Octal + Assert.AreEqual(342391, TextFormat.ParseInt32("01234567")); + + // Out-of-range + AssertFormatException(() => TextFormat.ParseInt32("2147483648")); + AssertFormatException(() => TextFormat.ParseInt32("-2147483649")); + AssertFormatException(() => TextFormat.ParseUInt32("4294967296")); + AssertFormatException(() => TextFormat.ParseUInt32("-1")); + AssertFormatException(() => TextFormat.ParseInt64("9223372036854775808")); + AssertFormatException(() => TextFormat.ParseInt64("-9223372036854775809")); + AssertFormatException(() => TextFormat.ParseUInt64("18446744073709551616")); + AssertFormatException(() => TextFormat.ParseUInt64("-1")); + AssertFormatException(() => TextFormat.ParseInt32("abcd")); + } + + [TestMethod] + public void ParseLongString() + { + string longText = + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890" + + "123456789012345678901234567890123456789012345678901234567890"; + TestAllTypes.Builder builder = TestAllTypes.CreateBuilder(); + TextFormat.Merge("optional_string: \"" + longText + "\"", builder); + Assert.AreEqual(longText, builder.OptionalString); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/UnknownFieldSetTest.cs b/csharp/src/ProtocolBuffers.Test/UnknownFieldSetTest.cs new file mode 100644 index 00000000..f9bfd84e --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/UnknownFieldSetTest.cs @@ -0,0 +1,433 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class UnknownFieldSetTest + { + private MessageDescriptor descriptor; + private TestAllTypes allFields; + private ByteString allFieldsData; + + /// + /// An empty message that has been parsed from allFieldsData. So, it has + /// unknown fields of every type. + /// + private TestEmptyMessage emptyMessage; + + private UnknownFieldSet unknownFields; + + [TestInitialize] + public void SetUp() + { + descriptor = TestAllTypes.Descriptor; + allFields = TestUtil.GetAllSet(); + allFieldsData = allFields.ToByteString(); + emptyMessage = TestEmptyMessage.ParseFrom(allFieldsData); + unknownFields = emptyMessage.UnknownFields; + } + + private UnknownField GetField(String name) + { + FieldDescriptor field = descriptor.FindDescriptor(name); + Assert.IsNotNull(field); + return unknownFields.FieldDictionary[field.FieldNumber]; + } + + /// + /// Constructs a protocol buffer which contains fields with all the same + /// numbers as allFieldsData except that each field is some other wire + /// type. + /// + private ByteString GetBizarroData() + { + UnknownFieldSet.Builder bizarroFields = UnknownFieldSet.CreateBuilder(); + + UnknownField varintField = UnknownField.CreateBuilder().AddVarint(1).Build(); + UnknownField fixed32Field = UnknownField.CreateBuilder().AddFixed32(1).Build(); + + foreach (KeyValuePair entry in unknownFields.FieldDictionary) + { + if (entry.Value.VarintList.Count == 0) + { + // Original field is not a varint, so use a varint. + bizarroFields.AddField(entry.Key, varintField); + } + else + { + // Original field *is* a varint, so use something else. + bizarroFields.AddField(entry.Key, fixed32Field); + } + } + + return bizarroFields.Build().ToByteString(); + } + + // ================================================================= + + [TestMethod] + public void Varint() + { + UnknownField field = GetField("optional_int32"); + Assert.AreEqual(1, field.VarintList.Count); + Assert.AreEqual(allFields.OptionalInt32, (long) field.VarintList[0]); + } + + [TestMethod] + public void Fixed32() + { + UnknownField field = GetField("optional_fixed32"); + Assert.AreEqual(1, field.Fixed32List.Count); + Assert.AreEqual(allFields.OptionalFixed32, (int) field.Fixed32List[0]); + } + + [TestMethod] + public void Fixed64() + { + UnknownField field = GetField("optional_fixed64"); + Assert.AreEqual(1, field.Fixed64List.Count); + Assert.AreEqual((long)allFields.OptionalFixed64, (long)field.Fixed64List[0]); + } + + [TestMethod] + public void LengthDelimited() + { + UnknownField field = GetField("optional_bytes"); + Assert.AreEqual(1, field.LengthDelimitedList.Count); + Assert.AreEqual(allFields.OptionalBytes, field.LengthDelimitedList[0]); + } + + [TestMethod] + public void Group() + { + FieldDescriptor nestedFieldDescriptor = + TestAllTypes.Types.OptionalGroup.Descriptor.FindDescriptor("a"); + Assert.IsNotNull(nestedFieldDescriptor); + + UnknownField field = GetField("optionalgroup"); + Assert.AreEqual(1, field.GroupList.Count); + + UnknownFieldSet group = field.GroupList[0]; + Assert.AreEqual(1, group.FieldDictionary.Count); + Assert.IsTrue(group.HasField(nestedFieldDescriptor.FieldNumber)); + + UnknownField nestedField = group[nestedFieldDescriptor.FieldNumber]; + Assert.AreEqual(1, nestedField.VarintList.Count); + Assert.AreEqual(allFields.OptionalGroup.A, (long) nestedField.VarintList[0]); + } + + [TestMethod] + public void Serialize() + { + // Check that serializing the UnknownFieldSet produces the original data again. + ByteString data = emptyMessage.ToByteString(); + Assert.AreEqual(allFieldsData, data); + } + + [TestMethod] + public void CopyFrom() + { + TestEmptyMessage message = + TestEmptyMessage.CreateBuilder().MergeFrom(emptyMessage).Build(); + + Assert.AreEqual(emptyMessage.ToString(), message.ToString()); + } + + [TestMethod] + public void MergeFrom() + { + TestEmptyMessage source = + TestEmptyMessage.CreateBuilder() + .SetUnknownFields( + UnknownFieldSet.CreateBuilder() + .AddField(2, + UnknownField.CreateBuilder() + .AddVarint(2).Build()) + .AddField(3, + UnknownField.CreateBuilder() + .AddVarint(4).Build()) + .Build()) + .Build(); + TestEmptyMessage destination = + TestEmptyMessage.CreateBuilder() + .SetUnknownFields( + UnknownFieldSet.CreateBuilder() + .AddField(1, + UnknownField.CreateBuilder() + .AddVarint(1).Build()) + .AddField(3, + UnknownField.CreateBuilder() + .AddVarint(3).Build()) + .Build()) + .MergeFrom(source) + .Build(); + + Assert.AreEqual( + "1: 1\n" + + "2: 2\n" + + "3: 3\n" + + "3: 4\n", + destination.ToString()); + } + + [TestMethod] + public void Clear() + { + UnknownFieldSet fields = + UnknownFieldSet.CreateBuilder().MergeFrom(unknownFields).Clear().Build(); + Assert.AreEqual(0, fields.FieldDictionary.Count); + } + + [TestMethod] + public void ClearMessage() + { + TestEmptyMessage message = + TestEmptyMessage.CreateBuilder().MergeFrom(emptyMessage).Clear().Build(); + Assert.AreEqual(0, message.SerializedSize); + } + + [TestMethod] + public void ParseKnownAndUnknown() + { + // Test mixing known and unknown fields when parsing. + + UnknownFieldSet fields = + UnknownFieldSet.CreateBuilder(unknownFields) + .AddField(123456, + UnknownField.CreateBuilder().AddVarint(654321).Build()) + .Build(); + + ByteString data = fields.ToByteString(); + TestAllTypes destination = TestAllTypes.ParseFrom(data); + + TestUtil.AssertAllFieldsSet(destination); + Assert.AreEqual(1, destination.UnknownFields.FieldDictionary.Count); + + UnknownField field = destination.UnknownFields[123456]; + Assert.AreEqual(1, field.VarintList.Count); + Assert.AreEqual(654321, (long) field.VarintList[0]); + } + + [TestMethod] + public void WrongTypeTreatedAsUnknown() + { + // Test that fields of the wrong wire type are treated like unknown fields + // when parsing. + + ByteString bizarroData = GetBizarroData(); + TestAllTypes allTypesMessage = TestAllTypes.ParseFrom(bizarroData); + TestEmptyMessage emptyMessage = TestEmptyMessage.ParseFrom(bizarroData); + + // All fields should have been interpreted as unknown, so the debug strings + // should be the same. + Assert.AreEqual(emptyMessage.ToString(), allTypesMessage.ToString()); + } + + [TestMethod] + public void UnknownExtensions() + { + // Make sure fields are properly parsed to the UnknownFieldSet even when + // they are declared as extension numbers. + + TestEmptyMessageWithExtensions message = + TestEmptyMessageWithExtensions.ParseFrom(allFieldsData); + + Assert.AreEqual(unknownFields.FieldDictionary.Count, + message.UnknownFields.FieldDictionary.Count); + Assert.AreEqual(allFieldsData, message.ToByteString()); + } + + [TestMethod] + public void WrongExtensionTypeTreatedAsUnknown() + { + // Test that fields of the wrong wire type are treated like unknown fields + // when parsing extensions. + + ByteString bizarroData = GetBizarroData(); + TestAllExtensions allExtensionsMessage = TestAllExtensions.ParseFrom(bizarroData); + TestEmptyMessage emptyMessage = TestEmptyMessage.ParseFrom(bizarroData); + + // All fields should have been interpreted as unknown, so the debug strings + // should be the same. + Assert.AreEqual(emptyMessage.ToString(), + allExtensionsMessage.ToString()); + } + + [TestMethod] + public void ParseUnknownEnumValue() + { + FieldDescriptor singularField = + TestAllTypes.Descriptor.FindDescriptor("optional_nested_enum"); + FieldDescriptor repeatedField = + TestAllTypes.Descriptor.FindDescriptor("repeated_nested_enum"); + Assert.IsNotNull(singularField); + Assert.IsNotNull(repeatedField); + + ByteString data = + UnknownFieldSet.CreateBuilder() + .AddField(singularField.FieldNumber, + UnknownField.CreateBuilder() + .AddVarint((int) TestAllTypes.Types.NestedEnum.BAR) + .AddVarint(5) // not valid + .Build()) + .AddField(repeatedField.FieldNumber, + UnknownField.CreateBuilder() + .AddVarint((int) TestAllTypes.Types.NestedEnum.FOO) + .AddVarint(4) // not valid + .AddVarint((int) TestAllTypes.Types.NestedEnum.BAZ) + .AddVarint(6) // not valid + .Build()) + .Build() + .ToByteString(); + + { + TestAllTypes message = TestAllTypes.ParseFrom(data); + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, + message.OptionalNestedEnum); + TestUtil.AssertEqual(new[] {TestAllTypes.Types.NestedEnum.FOO, TestAllTypes.Types.NestedEnum.BAZ}, + message.RepeatedNestedEnumList); + TestUtil.AssertEqual(new[] {5UL}, message.UnknownFields[singularField.FieldNumber].VarintList); + TestUtil.AssertEqual(new[] {4UL, 6UL}, message.UnknownFields[repeatedField.FieldNumber].VarintList); + } + + { + TestAllExtensions message = + TestAllExtensions.ParseFrom(data, TestUtil.CreateExtensionRegistry()); + Assert.AreEqual(TestAllTypes.Types.NestedEnum.BAR, + message.GetExtension(UnitTestProtoFile.OptionalNestedEnumExtension)); + TestUtil.AssertEqual(new[] {TestAllTypes.Types.NestedEnum.FOO, TestAllTypes.Types.NestedEnum.BAZ}, + message.GetExtension(UnitTestProtoFile.RepeatedNestedEnumExtension)); + TestUtil.AssertEqual(new[] {5UL}, message.UnknownFields[singularField.FieldNumber].VarintList); + TestUtil.AssertEqual(new[] {4UL, 6UL}, message.UnknownFields[repeatedField.FieldNumber].VarintList); + } + } + + [TestMethod] + public void LargeVarint() + { + ByteString data = + UnknownFieldSet.CreateBuilder() + .AddField(1, + UnknownField.CreateBuilder() + .AddVarint(0x7FFFFFFFFFFFFFFFL) + .Build()) + .Build() + .ToByteString(); + UnknownFieldSet parsed = UnknownFieldSet.ParseFrom(data); + UnknownField field = parsed[1]; + Assert.AreEqual(1, field.VarintList.Count); + Assert.AreEqual(0x7FFFFFFFFFFFFFFFUL, field.VarintList[0]); + } + + [TestMethod] + public void EqualsAndHashCode() + { + UnknownField fixed32Field = UnknownField.CreateBuilder().AddFixed32(1).Build(); + UnknownField fixed64Field = UnknownField.CreateBuilder().AddFixed64(1).Build(); + UnknownField varIntField = UnknownField.CreateBuilder().AddVarint(1).Build(); + UnknownField lengthDelimitedField = + UnknownField.CreateBuilder().AddLengthDelimited(ByteString.Empty).Build(); + UnknownField groupField = UnknownField.CreateBuilder().AddGroup(unknownFields).Build(); + + UnknownFieldSet a = UnknownFieldSet.CreateBuilder().AddField(1, fixed32Field).Build(); + UnknownFieldSet b = UnknownFieldSet.CreateBuilder().AddField(1, fixed64Field).Build(); + UnknownFieldSet c = UnknownFieldSet.CreateBuilder().AddField(1, varIntField).Build(); + UnknownFieldSet d = UnknownFieldSet.CreateBuilder().AddField(1, lengthDelimitedField).Build(); + UnknownFieldSet e = UnknownFieldSet.CreateBuilder().AddField(1, groupField).Build(); + + CheckEqualsIsConsistent(a); + CheckEqualsIsConsistent(b); + CheckEqualsIsConsistent(c); + CheckEqualsIsConsistent(d); + CheckEqualsIsConsistent(e); + + CheckNotEqual(a, b); + CheckNotEqual(a, c); + CheckNotEqual(a, d); + CheckNotEqual(a, e); + CheckNotEqual(b, c); + CheckNotEqual(b, d); + CheckNotEqual(b, e); + CheckNotEqual(c, d); + CheckNotEqual(c, e); + CheckNotEqual(d, e); + } + + /// + /// Asserts that the given field sets are not equal and have different + /// hash codes. + /// + /// + /// It's valid for non-equal objects to have the same hash code, so + /// this test is stricter than it needs to be. However, this should happen + /// relatively rarely. + /// + /// + /// + private static void CheckNotEqual(UnknownFieldSet s1, UnknownFieldSet s2) + { + String equalsError = string.Format("{0} should not be equal to {1}", s1, s2); + Assert.IsFalse(s1.Equals(s2), equalsError); + Assert.IsFalse(s2.Equals(s1), equalsError); + + Assert.IsFalse(s1.GetHashCode() == s2.GetHashCode(), + string.Format("{0} should have a different hash code from {1}", s1, s2)); + } + + /** + * Asserts that the given field sets are equal and have identical hash codes. + */ + + private static void CheckEqualsIsConsistent(UnknownFieldSet set) + { + // Object should be equal to itself. + Assert.AreEqual(set, set); + + // Object should be equal to a copy of itself. + UnknownFieldSet copy = UnknownFieldSet.CreateBuilder(set).Build(); + Assert.AreEqual(set, copy); + Assert.AreEqual(copy, set); + Assert.AreEqual(set.GetHashCode(), copy.GetHashCode()); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.Test/WireFormatTest.cs b/csharp/src/ProtocolBuffers.Test/WireFormatTest.cs new file mode 100644 index 00000000..2e2c0773 --- /dev/null +++ b/csharp/src/ProtocolBuffers.Test/WireFormatTest.cs @@ -0,0 +1,312 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using System.Reflection; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class WireFormatTest + { + /// + /// Keeps the attributes on FieldType and the switch statement in WireFormat in sync. + /// + [TestMethod] + public void FieldTypeToWireTypeMapping() + { + foreach (FieldInfo field in typeof(FieldType).GetFields(BindingFlags.Static | BindingFlags.Public)) + { + FieldType fieldType = (FieldType) field.GetValue(null); + FieldMappingAttribute mapping = + (FieldMappingAttribute) field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0]; + Assert.AreEqual(mapping.WireType, WireFormat.GetWireType(fieldType)); + } + } + + [TestMethod] + public void Serialization() + { + TestAllTypes message = TestUtil.GetAllSet(); + + ByteString rawBytes = message.ToByteString(); + Assert.AreEqual(rawBytes.Length, message.SerializedSize); + + TestAllTypes message2 = TestAllTypes.ParseFrom(rawBytes); + + TestUtil.AssertAllFieldsSet(message2); + } + + [TestMethod] + public void SerializationPacked() + { + TestPackedTypes message = TestUtil.GetPackedSet(); + ByteString rawBytes = message.ToByteString(); + Assert.AreEqual(rawBytes.Length, message.SerializedSize); + TestPackedTypes message2 = TestPackedTypes.ParseFrom(rawBytes); + TestUtil.AssertPackedFieldsSet(message2); + } + + [TestMethod] + public void SerializeExtensions() + { + // TestAllTypes and TestAllExtensions should have compatible wire formats, + // so if we serialize a TestAllExtensions then parse it as TestAllTypes + // it should work. + TestAllExtensions message = TestUtil.GetAllExtensionsSet(); + ByteString rawBytes = message.ToByteString(); + Assert.AreEqual(rawBytes.Length, message.SerializedSize); + + TestAllTypes message2 = TestAllTypes.ParseFrom(rawBytes); + + TestUtil.AssertAllFieldsSet(message2); + } + + [TestMethod] + public void SerializePackedExtensions() + { + // TestPackedTypes and TestPackedExtensions should have compatible wire + // formats; check that they serialize to the same string. + TestPackedExtensions message = TestUtil.GetPackedExtensionsSet(); + ByteString rawBytes = message.ToByteString(); + + TestPackedTypes message2 = TestUtil.GetPackedSet(); + ByteString rawBytes2 = message2.ToByteString(); + + Assert.AreEqual(rawBytes, rawBytes2); + } + + [TestMethod] + public void SerializeDelimited() + { + MemoryStream stream = new MemoryStream(); + TestUtil.GetAllSet().WriteDelimitedTo(stream); + stream.WriteByte(12); + TestUtil.GetPackedSet().WriteDelimitedTo(stream); + stream.WriteByte(34); + + stream.Position = 0; + + TestUtil.AssertAllFieldsSet(TestAllTypes.ParseDelimitedFrom(stream)); + Assert.AreEqual(12, stream.ReadByte()); + TestUtil.AssertPackedFieldsSet(TestPackedTypes.ParseDelimitedFrom(stream)); + Assert.AreEqual(34, stream.ReadByte()); + Assert.AreEqual(-1, stream.ReadByte()); + } + + [TestMethod] + public void ParseExtensions() + { + // TestAllTypes and TestAllExtensions should have compatible wire formats, + // so if we serealize a TestAllTypes then parse it as TestAllExtensions + // it should work. + + TestAllTypes message = TestUtil.GetAllSet(); + ByteString rawBytes = message.ToByteString(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + TestUtil.RegisterAllExtensions(registry); + registry = registry.AsReadOnly(); + + TestAllExtensions message2 = TestAllExtensions.ParseFrom(rawBytes, registry); + + TestUtil.AssertAllExtensionsSet(message2); + } + + [TestMethod] + public void ParsePackedExtensions() + { + // Ensure that packed extensions can be properly parsed. + TestPackedExtensions message = TestUtil.GetPackedExtensionsSet(); + ByteString rawBytes = message.ToByteString(); + + ExtensionRegistry registry = TestUtil.CreateExtensionRegistry(); + + TestPackedExtensions message2 = TestPackedExtensions.ParseFrom(rawBytes, registry); + TestUtil.AssertPackedExtensionsSet(message2); + } + + [TestMethod] + public void ExtensionsSerializedSize() + { + Assert.AreEqual(TestUtil.GetAllSet().SerializedSize, TestUtil.GetAllExtensionsSet().SerializedSize); + } + + private static void AssertFieldsInOrder(ByteString data) + { + CodedInputStream input = data.CreateCodedInput(); + uint previousTag = 0; + + uint tag; + string name; + while (input.ReadTag(out tag, out name)) + { + Assert.IsTrue(tag > previousTag); + previousTag = tag; + input.SkipField(); + } + } + + [TestMethod] + public void InterleavedFieldsAndExtensions() + { + // Tests that fields are written in order even when extension ranges + // are interleaved with field numbers. + ByteString data = + TestFieldOrderings.CreateBuilder() + .SetMyInt(1) + .SetMyString("foo") + .SetMyFloat(1.0F) + .SetExtension(UnitTestProtoFile.MyExtensionInt, 23) + .SetExtension(UnitTestProtoFile.MyExtensionString, "bar") + .Build().ToByteString(); + AssertFieldsInOrder(data); + + MessageDescriptor descriptor = TestFieldOrderings.Descriptor; + ByteString dynamic_data = + DynamicMessage.CreateBuilder(TestFieldOrderings.Descriptor) + .SetField(descriptor.FindDescriptor("my_int"), 1L) + .SetField(descriptor.FindDescriptor("my_string"), "foo") + .SetField(descriptor.FindDescriptor("my_float"), 1.0F) + .SetField(UnitTestProtoFile.MyExtensionInt.Descriptor, 23) + .SetField(UnitTestProtoFile.MyExtensionString.Descriptor, "bar") + .WeakBuild().ToByteString(); + AssertFieldsInOrder(dynamic_data); + } + + private const int UnknownTypeId = 1550055; + private static readonly int TypeId1 = TestMessageSetExtension1.Descriptor.Extensions[0].FieldNumber; + private static readonly int TypeId2 = TestMessageSetExtension2.Descriptor.Extensions[0].FieldNumber; + + [TestMethod] + public void SerializeMessageSet() + { + // Set up a TestMessageSet with two known messages and an unknown one. + TestMessageSet messageSet = + TestMessageSet.CreateBuilder() + .SetExtension( + TestMessageSetExtension1.MessageSetExtension, + TestMessageSetExtension1.CreateBuilder().SetI(123).Build()) + .SetExtension( + TestMessageSetExtension2.MessageSetExtension, + TestMessageSetExtension2.CreateBuilder().SetStr("foo").Build()) + .SetUnknownFields( + UnknownFieldSet.CreateBuilder() + .AddField(UnknownTypeId, + UnknownField.CreateBuilder() + .AddLengthDelimited(ByteString.CopyFromUtf8("bar")) + .Build()) + .Build()) + .Build(); + + ByteString data = messageSet.ToByteString(); + + // Parse back using RawMessageSet and check the contents. + RawMessageSet raw = RawMessageSet.ParseFrom(data); + + Assert.AreEqual(0, raw.UnknownFields.FieldDictionary.Count); + + Assert.AreEqual(3, raw.ItemCount); + Assert.AreEqual(TypeId1, raw.ItemList[0].TypeId); + Assert.AreEqual(TypeId2, raw.ItemList[1].TypeId); + Assert.AreEqual(UnknownTypeId, raw.ItemList[2].TypeId); + + TestMessageSetExtension1 message1 = TestMessageSetExtension1.ParseFrom(raw.GetItem(0).Message.ToByteArray()); + Assert.AreEqual(123, message1.I); + + TestMessageSetExtension2 message2 = TestMessageSetExtension2.ParseFrom(raw.GetItem(1).Message.ToByteArray()); + Assert.AreEqual("foo", message2.Str); + + Assert.AreEqual("bar", raw.GetItem(2).Message.ToStringUtf8()); + } + + [TestMethod] + public void ParseMessageSet() + { + ExtensionRegistry extensionRegistry = ExtensionRegistry.CreateInstance(); + extensionRegistry.Add(TestMessageSetExtension1.MessageSetExtension); + extensionRegistry.Add(TestMessageSetExtension2.MessageSetExtension); + + // Set up a RawMessageSet with two known messages and an unknown one. + RawMessageSet raw = + RawMessageSet.CreateBuilder() + .AddItem( + RawMessageSet.Types.Item.CreateBuilder() + .SetTypeId(TypeId1) + .SetMessage( + TestMessageSetExtension1.CreateBuilder() + .SetI(123) + .Build().ToByteString()) + .Build()) + .AddItem( + RawMessageSet.Types.Item.CreateBuilder() + .SetTypeId(TypeId2) + .SetMessage( + TestMessageSetExtension2.CreateBuilder() + .SetStr("foo") + .Build().ToByteString()) + .Build()) + .AddItem( + RawMessageSet.Types.Item.CreateBuilder() + .SetTypeId(UnknownTypeId) + .SetMessage(ByteString.CopyFromUtf8("bar")) + .Build()) + .Build(); + + ByteString data = raw.ToByteString(); + + // Parse as a TestMessageSet and check the contents. + TestMessageSet messageSet = + TestMessageSet.ParseFrom(data, extensionRegistry); + + Assert.AreEqual(123, messageSet.GetExtension(TestMessageSetExtension1.MessageSetExtension).I); + Assert.AreEqual("foo", messageSet.GetExtension(TestMessageSetExtension2.MessageSetExtension).Str); + + // Check for unknown field with type LENGTH_DELIMITED, + // number UNKNOWN_TYPE_ID, and contents "bar". + UnknownFieldSet unknownFields = messageSet.UnknownFields; + Assert.AreEqual(1, unknownFields.FieldDictionary.Count); + Assert.IsTrue(unknownFields.HasField(UnknownTypeId)); + + UnknownField field = unknownFields[UnknownTypeId]; + Assert.AreEqual(1, field.LengthDelimitedList.Count); + Assert.AreEqual("bar", field.LengthDelimitedList[0].ToStringUtf8()); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers.sln b/csharp/src/ProtocolBuffers.sln new file mode 100644 index 00000000..7741777b --- /dev/null +++ b/csharp/src/ProtocolBuffers.sln @@ -0,0 +1,215 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "proto", "proto", "{1F896D5C-5FC2-4671-9216-781CB8187EC7}" + ProjectSection(SolutionItems) = preProject + ..\protos\tutorial\addressbook.proto = ..\protos\tutorial\addressbook.proto + ..\protos\google\protobuf\csharp_options.proto = ..\protos\google\protobuf\csharp_options.proto + ..\protos\google\protobuf\descriptor.proto = ..\protos\google\protobuf\descriptor.proto + ..\protos\google\protobuf\compiler\plugin.proto = ..\protos\google\protobuf\compiler\plugin.proto + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unittest", "unittest", "{C8D3015A-EA39-4F03-AEEC-3FF1F2087A12}" + ProjectSection(SolutionItems) = preProject + ..\protos\google\test\google_size.proto = ..\protos\google\test\google_size.proto + ..\protos\google\test\google_speed.proto = ..\protos\google\test\google_speed.proto + ..\protos\google\protobuf\unittest.proto = ..\protos\google\protobuf\unittest.proto + ..\protos\google\protobuf\unittest_csharp_options.proto = ..\protos\google\protobuf\unittest_csharp_options.proto + ..\protos\google\protobuf\unittest_custom_options.proto = ..\protos\google\protobuf\unittest_custom_options.proto + ..\protos\google\protobuf\unittest_embed_optimize_for.proto = ..\protos\google\protobuf\unittest_embed_optimize_for.proto + ..\protos\google\protobuf\unittest_empty.proto = ..\protos\google\protobuf\unittest_empty.proto + ..\protos\google\protobuf\unittest_enormous_descriptor.proto = ..\protos\google\protobuf\unittest_enormous_descriptor.proto + ..\protos\extest\unittest_extras.proto = ..\protos\extest\unittest_extras.proto + ..\protos\extest\unittest_extras_full.proto = ..\protos\extest\unittest_extras_full.proto + ..\protos\extest\unittest_extras_lite.proto = ..\protos\extest\unittest_extras_lite.proto + ..\protos\extest\unittest_extras_xmltest.proto = ..\protos\extest\unittest_extras_xmltest.proto + ..\protos\extest\unittest_generic_services.proto = ..\protos\extest\unittest_generic_services.proto + ..\protos\google\protobuf\unittest_import.proto = ..\protos\google\protobuf\unittest_import.proto + ..\protos\google\protobuf\unittest_import_lite.proto = ..\protos\google\protobuf\unittest_import_lite.proto + ..\protos\extest\unittest_issues.proto = ..\protos\extest\unittest_issues.proto + ..\protos\google\protobuf\unittest_lite.proto = ..\protos\google\protobuf\unittest_lite.proto + ..\protos\google\protobuf\unittest_lite_imports_nonlite.proto = ..\protos\google\protobuf\unittest_lite_imports_nonlite.proto + ..\protos\google\protobuf\unittest_mset.proto = ..\protos\google\protobuf\unittest_mset.proto + ..\protos\google\protobuf\unittest_no_generic_services.proto = ..\protos\google\protobuf\unittest_no_generic_services.proto + ..\protos\google\protobuf\unittest_optimize_for.proto = ..\protos\google\protobuf\unittest_optimize_for.proto + ..\protos\extest\unittest_rpc_interop.proto = ..\protos\extest\unittest_rpc_interop.proto + ..\protos\extest\unittest_rpc_interop_lite.proto = ..\protos\extest\unittest_rpc_interop_lite.proto + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoGen", "ProtoGen\ProtoGen.csproj", "{250ADE34-82FD-4BAE-86D5-985FBE589C4A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoGen.Test", "ProtoGen.Test\ProtoGen.Test.csproj", "{C268DA4C-4004-47DA-AF23-44C983281A68}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddressBook", "AddressBook\AddressBook.csproj", "{A31F5FB2-4FF3-432A-B35B-5CD203606311}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoMunge", "ProtoMunge\ProtoMunge.csproj", "{8F09AF72-3327-4FA7-BC09-070B80221AB9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoBench", "ProtoBench\ProtoBench.csproj", "{C7A4A435-2813-41C8-AA87-BD914BA5223D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoDump", "ProtoDump\ProtoDump.csproj", "{D7282E99-2DC3-405B-946F-177DB2FD2AE2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{66ED1950-AD27-42D7-88F8-94355AEC8225}" + ProjectSection(SolutionItems) = preProject + ..\build\build.bat = ..\build\build.bat + ..\build\build.csproj = ..\build\build.csproj + ..\build\BuildAll.bat = ..\build\BuildAll.bat + ..\build\Common.targets = ..\build\Common.targets + ..\build\GenerateProjects.bat = ..\build\GenerateProjects.bat + ..\build\GenerateSource.bat = ..\build\GenerateSource.bat + ..\build\Google.ProtocolBuffers.nuspec = ..\build\Google.ProtocolBuffers.nuspec + ..\build\Google.ProtocolBuffersLite.nuspec = ..\build\Google.ProtocolBuffersLite.nuspec + ..\build\publish.csproj = ..\build\publish.csproj + ..\build\PublishTool.bat = ..\build\PublishTool.bat + ..\build\RunBenchmarks.bat = ..\build\RunBenchmarks.bat + ..\build\target.csproj = ..\build\target.csproj + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{0D7CDA8F-1BBF-4E0F-8D35-31AEA21A96E6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{C7B69674-7A51-4AC6-8674-0330BA742CE4}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{75D5D25A-01A6-4594-957F-5993FB83F450}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{FA9F5250-FDDC-48B8-832E-96E0464A02E6}" + ProjectSection(SolutionItems) = preProject + ..\protos\benchmarks\google_size.proto = ..\protos\benchmarks\google_size.proto + ..\protos\benchmarks\google_speed.proto = ..\protos\benchmarks\google_speed.proto + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "protoc-gen-cs", "ProtoGen\protoc-gen-cs.csproj", "{250ADE34-82FD-4BAE-86D5-985FBE589C4B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "protoc-gen-cs.Test", "ProtoGen.Test\protoc-gen-cs.Test.csproj", "{C1024C9C-8176-48C3-B547-B9F6DF6B80A6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug_Silverlight|Any CPU = Debug_Silverlight|Any CPU + Debug|Any CPU = Debug|Any CPU + Release_Silverlight|Any CPU = Release_Silverlight|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4A}.Release|Any CPU.Build.0 = Release|Any CPU + {C268DA4C-4004-47DA-AF23-44C983281A68}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {C268DA4C-4004-47DA-AF23-44C983281A68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C268DA4C-4004-47DA-AF23-44C983281A68}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C268DA4C-4004-47DA-AF23-44C983281A68}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {C268DA4C-4004-47DA-AF23-44C983281A68}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C268DA4C-4004-47DA-AF23-44C983281A68}.Release|Any CPU.Build.0 = Release|Any CPU + {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A31F5FB2-4FF3-432A-B35B-5CD203606311}.Release|Any CPU.Build.0 = Release|Any CPU + {8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8F09AF72-3327-4FA7-BC09-070B80221AB9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8F09AF72-3327-4FA7-BC09-070B80221AB9}.Release|Any CPU.Build.0 = Release|Any CPU + {C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7A4A435-2813-41C8-AA87-BD914BA5223D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7A4A435-2813-41C8-AA87-BD914BA5223D}.Release|Any CPU.Build.0 = Release|Any CPU + {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D7282E99-2DC3-405B-946F-177DB2FD2AE2}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4B}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4B}.Debug_Silverlight|Any CPU.Build.0 = Debug|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4B}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4B}.Release_Silverlight|Any CPU.Build.0 = Release|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {250ADE34-82FD-4BAE-86D5-985FBE589C4B}.Release|Any CPU.Build.0 = Release|Any CPU + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6}.Debug_Silverlight|Any CPU.ActiveCfg = Debug|Any CPU + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6}.Debug_Silverlight|Any CPU.Build.0 = Debug|Any CPU + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6}.Release_Silverlight|Any CPU.ActiveCfg = Release|Any CPU + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6}.Release_Silverlight|Any CPU.Build.0 = Release|Any CPU + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {C8D3015A-EA39-4F03-AEEC-3FF1F2087A12} = {1F896D5C-5FC2-4671-9216-781CB8187EC7} + {FA9F5250-FDDC-48B8-832E-96E0464A02E6} = {1F896D5C-5FC2-4671-9216-781CB8187EC7} + {C268DA4C-4004-47DA-AF23-44C983281A68} = {C7B69674-7A51-4AC6-8674-0330BA742CE4} + {EE01ED24-3750-4567-9A23-1DB676A15610} = {C7B69674-7A51-4AC6-8674-0330BA742CE4} + {EEFFED24-3750-4567-9A23-1DB676A15610} = {C7B69674-7A51-4AC6-8674-0330BA742CE4} + {DD01ED24-3750-4567-9A23-1DB676A15610} = {C7B69674-7A51-4AC6-8674-0330BA742CE4} + {C1024C9C-8176-48C3-B547-B9F6DF6B80A6} = {C7B69674-7A51-4AC6-8674-0330BA742CE4} + {A31F5FB2-4FF3-432A-B35B-5CD203606311} = {75D5D25A-01A6-4594-957F-5993FB83F450} + {C7A4A435-2813-41C8-AA87-BD914BA5223D} = {0D7CDA8F-1BBF-4E0F-8D35-31AEA21A96E6} + {D7282E99-2DC3-405B-946F-177DB2FD2AE2} = {0D7CDA8F-1BBF-4E0F-8D35-31AEA21A96E6} + {8F09AF72-3327-4FA7-BC09-070B80221AB9} = {0D7CDA8F-1BBF-4E0F-8D35-31AEA21A96E6} + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffers/AbstractBuilder.cs b/csharp/src/ProtocolBuffers/AbstractBuilder.cs new file mode 100644 index 00000000..e7a41fb3 --- /dev/null +++ b/csharp/src/ProtocolBuffers/AbstractBuilder.cs @@ -0,0 +1,266 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Implementation of the non-generic IMessage interface as far as possible. + /// + public abstract partial class AbstractBuilder : AbstractBuilderLite, + IBuilder + where TMessage : AbstractMessage + where TBuilder : AbstractBuilder + { + #region Unimplemented members of IBuilder + + public abstract UnknownFieldSet UnknownFields { get; set; } + public abstract IDictionary AllFields { get; } + public abstract object this[FieldDescriptor field] { get; set; } + public abstract MessageDescriptor DescriptorForType { get; } + public abstract int GetRepeatedFieldCount(FieldDescriptor field); + public abstract object this[FieldDescriptor field, int index] { get; set; } + public abstract bool HasField(FieldDescriptor field); + public abstract IBuilder CreateBuilderForField(FieldDescriptor field); + public abstract TBuilder ClearField(FieldDescriptor field); + public abstract TBuilder AddRepeatedField(FieldDescriptor field, object value); + + #endregion + + public TBuilder SetUnknownFields(UnknownFieldSet fields) + { + UnknownFields = fields; + return ThisBuilder; + } + + public override TBuilder Clear() + { + foreach (FieldDescriptor field in AllFields.Keys) + { + ClearField(field); + } + return ThisBuilder; + } + + public override sealed TBuilder MergeFrom(IMessageLite other) + { + if (other is IMessage) + { + return MergeFrom((IMessage) other); + } + throw new ArgumentException("MergeFrom(Message) can only merge messages of the same type."); + } + + /// + /// Merge the specified other message into the message being + /// built. Merging occurs as follows. For each field: + /// For singular primitive fields, if the field is set in , + /// then 's value overwrites the value in this message. + /// For singular message fields, if the field is set in , + /// it is merged into the corresponding sub-message of this message using the same + /// merging rules. + /// For repeated fields, the elements in are concatenated + /// with the elements in this message. + /// + /// + /// + public abstract TBuilder MergeFrom(TMessage other); + + public virtual TBuilder MergeFrom(IMessage other) + { + if (other.DescriptorForType != DescriptorForType) + { + throw new ArgumentException("MergeFrom(IMessage) can only merge messages of the same type."); + } + + // Note: We don't attempt to verify that other's fields have valid + // types. Doing so would be a losing battle. We'd have to verify + // all sub-messages as well, and we'd have to make copies of all of + // them to insure that they don't change after verification (since + // the Message interface itself cannot enforce immutability of + // implementations). + // TODO(jonskeet): Provide a function somewhere called MakeDeepCopy() + // which allows people to make secure deep copies of messages. + foreach (KeyValuePair entry in other.AllFields) + { + FieldDescriptor field = entry.Key; + if (field.IsRepeated) + { + // Concatenate repeated fields + foreach (object element in (IEnumerable) entry.Value) + { + AddRepeatedField(field, element); + } + } + else if (field.MappedType == MappedType.Message) + { + // Merge singular messages + IMessageLite existingValue = (IMessageLite) this[field]; + if (existingValue == existingValue.WeakDefaultInstanceForType) + { + this[field] = entry.Value; + } + else + { + this[field] = existingValue.WeakCreateBuilderForType() + .WeakMergeFrom(existingValue) + .WeakMergeFrom((IMessageLite) entry.Value) + .WeakBuild(); + } + } + else + { + // Overwrite simple values + this[field] = entry.Value; + } + } + + //Fix for unknown fields not merging, see java's AbstractMessage.Builder line 236 + MergeUnknownFields(other.UnknownFields); + + return ThisBuilder; + } + + public override TBuilder MergeFrom(ICodedInputStream input, ExtensionRegistry extensionRegistry) + { + UnknownFieldSet.Builder unknownFields = UnknownFieldSet.CreateBuilder(UnknownFields); + unknownFields.MergeFrom(input, extensionRegistry, this); + UnknownFields = unknownFields.Build(); + return ThisBuilder; + } + + public virtual TBuilder MergeUnknownFields(UnknownFieldSet unknownFields) + { + UnknownFields = UnknownFieldSet.CreateBuilder(UnknownFields) + .MergeFrom(unknownFields) + .Build(); + return ThisBuilder; + } + + public virtual IBuilder SetField(FieldDescriptor field, object value) + { + this[field] = value; + return ThisBuilder; + } + + public virtual IBuilder SetRepeatedField(FieldDescriptor field, int index, object value) + { + this[field, index] = value; + return ThisBuilder; + } + + #region Explicit Implementations + + IMessage IBuilder.WeakBuild() + { + return Build(); + } + + IBuilder IBuilder.WeakAddRepeatedField(FieldDescriptor field, object value) + { + return AddRepeatedField(field, value); + } + + IBuilder IBuilder.WeakClear() + { + return Clear(); + } + + IBuilder IBuilder.WeakMergeFrom(IMessage message) + { + return MergeFrom(message); + } + + IBuilder IBuilder.WeakMergeFrom(ICodedInputStream input) + { + return MergeFrom(input); + } + + IBuilder IBuilder.WeakMergeFrom(ICodedInputStream input, ExtensionRegistry registry) + { + return MergeFrom(input, registry); + } + + IBuilder IBuilder.WeakMergeFrom(ByteString data) + { + return MergeFrom(data); + } + + IBuilder IBuilder.WeakMergeFrom(ByteString data, ExtensionRegistry registry) + { + return MergeFrom(data, registry); + } + + IMessage IBuilder.WeakBuildPartial() + { + return BuildPartial(); + } + + IBuilder IBuilder.WeakClone() + { + return Clone(); + } + + IMessage IBuilder.WeakDefaultInstanceForType + { + get { return DefaultInstanceForType; } + } + + IBuilder IBuilder.WeakClearField(FieldDescriptor field) + { + return ClearField(field); + } + + #endregion + + /// + /// Converts this builder to a string using . + /// + /// + /// This method is not sealed (in the way that it is in + /// as it was added after earlier releases; some other implementations may already be overriding the + /// method. + /// + public override string ToString() + { + return TextFormat.PrintToString(this); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/AbstractBuilderLite.cs b/csharp/src/ProtocolBuffers/AbstractBuilderLite.cs new file mode 100644 index 00000000..a7fedeae --- /dev/null +++ b/csharp/src/ProtocolBuffers/AbstractBuilderLite.cs @@ -0,0 +1,264 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers +{ + /// + /// Implementation of the non-generic IMessage interface as far as possible. + /// + public abstract partial class AbstractBuilderLite : IBuilderLite + where TMessage : AbstractMessageLite + where TBuilder : AbstractBuilderLite + { + protected abstract TBuilder ThisBuilder { get; } + + public abstract bool IsInitialized { get; } + + public abstract TBuilder Clear(); + + public abstract TBuilder Clone(); + + public abstract TMessage Build(); + + public abstract TMessage BuildPartial(); + + public abstract TBuilder MergeFrom(IMessageLite other); + + public abstract TBuilder MergeFrom(ICodedInputStream input, ExtensionRegistry extensionRegistry); + + public abstract TMessage DefaultInstanceForType { get; } + + #region IBuilderLite Members + + public virtual TBuilder MergeFrom(ICodedInputStream input) + { + return MergeFrom(input, ExtensionRegistry.CreateInstance()); + } + + public TBuilder MergeDelimitedFrom(Stream input) + { + return MergeDelimitedFrom(input, ExtensionRegistry.CreateInstance()); + } + + public TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistry extensionRegistry) + { + int size = (int) CodedInputStream.ReadRawVarint32(input); + Stream limitedStream = new LimitedInputStream(input, size); + return MergeFrom(limitedStream, extensionRegistry); + } + + public TBuilder MergeFrom(ByteString data) + { + return MergeFrom(data, ExtensionRegistry.CreateInstance()); + } + + public TBuilder MergeFrom(ByteString data, ExtensionRegistry extensionRegistry) + { + CodedInputStream input = data.CreateCodedInput(); + MergeFrom(input, extensionRegistry); + input.CheckLastTagWas(0); + return ThisBuilder; + } + + public TBuilder MergeFrom(byte[] data) + { + CodedInputStream input = CodedInputStream.CreateInstance(data); + MergeFrom(input); + input.CheckLastTagWas(0); + return ThisBuilder; + } + + public TBuilder MergeFrom(byte[] data, ExtensionRegistry extensionRegistry) + { + CodedInputStream input = CodedInputStream.CreateInstance(data); + MergeFrom(input, extensionRegistry); + input.CheckLastTagWas(0); + return ThisBuilder; + } + + public TBuilder MergeFrom(Stream input) + { + CodedInputStream codedInput = CodedInputStream.CreateInstance(input); + MergeFrom(codedInput); + codedInput.CheckLastTagWas(0); + return ThisBuilder; + } + + public TBuilder MergeFrom(Stream input, ExtensionRegistry extensionRegistry) + { + CodedInputStream codedInput = CodedInputStream.CreateInstance(input); + MergeFrom(codedInput, extensionRegistry); + codedInput.CheckLastTagWas(0); + return ThisBuilder; + } + + #endregion + + #region Explicit definitions + + IBuilderLite IBuilderLite.WeakClear() + { + return Clear(); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(IMessageLite message) + { + return MergeFrom(message); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(ByteString data) + { + return MergeFrom(data); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(ByteString data, ExtensionRegistry registry) + { + return MergeFrom(data, registry); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(ICodedInputStream input) + { + return MergeFrom(input); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(ICodedInputStream input, ExtensionRegistry registry) + { + return MergeFrom(input, registry); + } + + IMessageLite IBuilderLite.WeakBuild() + { + return Build(); + } + + IMessageLite IBuilderLite.WeakBuildPartial() + { + return BuildPartial(); + } + + IBuilderLite IBuilderLite.WeakClone() + { + return Clone(); + } + + IMessageLite IBuilderLite.WeakDefaultInstanceForType + { + get { return DefaultInstanceForType; } + } + + #endregion + + #region LimitedInputStream + + /// + /// Stream implementation which proxies another stream, only allowing a certain amount + /// of data to be read. Note that this is only used to read delimited streams, so it + /// doesn't attempt to implement everything. + /// + private class LimitedInputStream : Stream + { + private readonly Stream proxied; + private int bytesLeft; + + internal LimitedInputStream(Stream proxied, int size) + { + this.proxied = proxied; + bytesLeft = size; + } + + public override bool CanRead + { + get { return true; } + } + + public override bool CanSeek + { + get { return false; } + } + + public override bool CanWrite + { + get { return false; } + } + + public override void Flush() + { + } + + public override long Length + { + get { throw new NotSupportedException(); } + } + + public override long Position + { + get { throw new NotSupportedException(); } + set { throw new NotSupportedException(); } + } + + public override int Read(byte[] buffer, int offset, int count) + { + if (bytesLeft > 0) + { + int bytesRead = proxied.Read(buffer, offset, Math.Min(bytesLeft, count)); + bytesLeft -= bytesRead; + return bytesRead; + } + return 0; + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotSupportedException(); + } + + public override void SetLength(long value) + { + throw new NotSupportedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + throw new NotSupportedException(); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/AbstractMessage.cs b/csharp/src/ProtocolBuffers/AbstractMessage.cs new file mode 100644 index 00000000..16c8c786 --- /dev/null +++ b/csharp/src/ProtocolBuffers/AbstractMessage.cs @@ -0,0 +1,291 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Implementation of the non-generic IMessage interface as far as possible. + /// + public abstract partial class AbstractMessage : AbstractMessageLite, + IMessage + where TMessage : AbstractMessage + where TBuilder : AbstractBuilder + { + /// + /// The serialized size if it's already been computed, or null + /// if we haven't computed it yet. + /// + private int? memoizedSize = null; + + #region Unimplemented members of IMessage + + public abstract MessageDescriptor DescriptorForType { get; } + public abstract IDictionary AllFields { get; } + public abstract bool HasField(FieldDescriptor field); + public abstract object this[FieldDescriptor field] { get; } + public abstract int GetRepeatedFieldCount(FieldDescriptor field); + public abstract object this[FieldDescriptor field, int index] { get; } + public abstract UnknownFieldSet UnknownFields { get; } + + #endregion + + /// + /// Returns true iff all required fields in the message and all embedded + /// messages are set. + /// + public override bool IsInitialized + { + get + { + // Check that all required fields are present. + foreach (FieldDescriptor field in DescriptorForType.Fields) + { + if (field.IsRequired && !HasField(field)) + { + return false; + } + } + + // Check that embedded messages are initialized. + foreach (KeyValuePair entry in AllFields) + { + FieldDescriptor field = entry.Key; + if (field.MappedType == MappedType.Message) + { + if (field.IsRepeated) + { + // We know it's an IList, but not the exact type - so + // IEnumerable is the best we can do. (C# generics aren't covariant yet.) + foreach (IMessageLite element in (IEnumerable) entry.Value) + { + if (!element.IsInitialized) + { + return false; + } + } + } + else + { + if (!((IMessageLite) entry.Value).IsInitialized) + { + return false; + } + } + } + } + return true; + } + } + + public override sealed string ToString() + { + return TextFormat.PrintToString(this); + } + + public override sealed void PrintTo(TextWriter writer) + { + TextFormat.Print(this, writer); + } + + /// + /// Serializes the message and writes it to the given output stream. + /// This does not flush or close the stream. + /// + /// + /// Protocol Buffers are not self-delimiting. Therefore, if you write + /// any more data to the stream after the message, you must somehow ensure + /// that the parser on the receiving end does not interpret this as being + /// part of the protocol message. One way of doing this is by writing the size + /// of the message before the data, then making sure you limit the input to + /// that size when receiving the data. Alternatively, use WriteDelimitedTo(Stream). + /// + public override void WriteTo(ICodedOutputStream output) + { + foreach (KeyValuePair entry in AllFields) + { + FieldDescriptor field = entry.Key; + if (field.IsRepeated) + { + // We know it's an IList, but not the exact type - so + // IEnumerable is the best we can do. (C# generics aren't covariant yet.) + IEnumerable valueList = (IEnumerable) entry.Value; + if (field.IsPacked) + { + output.WritePackedArray(field.FieldType, field.FieldNumber, field.Name, valueList); + } + else + { + output.WriteArray(field.FieldType, field.FieldNumber, field.Name, valueList); + } + } + else + { + output.WriteField(field.FieldType, field.FieldNumber, field.Name, entry.Value); + } + } + + UnknownFieldSet unknownFields = UnknownFields; + if (DescriptorForType.Options.MessageSetWireFormat) + { + unknownFields.WriteAsMessageSetTo(output); + } + else + { + unknownFields.WriteTo(output); + } + } + + /// + /// Returns the number of bytes required to encode this message. + /// The result is only computed on the first call and memoized after that. + /// + public override int SerializedSize + { + get + { + if (memoizedSize != null) + { + return memoizedSize.Value; + } + + int size = 0; + foreach (KeyValuePair entry in AllFields) + { + FieldDescriptor field = entry.Key; + if (field.IsRepeated) + { + IEnumerable valueList = (IEnumerable) entry.Value; + if (field.IsPacked) + { + int dataSize = 0; + foreach (object element in valueList) + { + dataSize += CodedOutputStream.ComputeFieldSizeNoTag(field.FieldType, element); + } + size += dataSize; + size += CodedOutputStream.ComputeTagSize(field.FieldNumber); + size += CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + else + { + foreach (object element in valueList) + { + size += CodedOutputStream.ComputeFieldSize(field.FieldType, field.FieldNumber, element); + } + } + } + else + { + size += CodedOutputStream.ComputeFieldSize(field.FieldType, field.FieldNumber, entry.Value); + } + } + + UnknownFieldSet unknownFields = UnknownFields; + if (DescriptorForType.Options.MessageSetWireFormat) + { + size += unknownFields.SerializedSizeAsMessageSet; + } + else + { + size += unknownFields.SerializedSize; + } + + memoizedSize = size; + return size; + } + } + + /// + /// Compares the specified object with this message for equality. + /// Returns true iff the given object is a message of the same type + /// (as defined by DescriptorForType) and has identical values + /// for all its fields. + /// + public override bool Equals(object other) + { + if (other == this) + { + return true; + } + IMessage otherMessage = other as IMessage; + if (otherMessage == null || otherMessage.DescriptorForType != DescriptorForType) + { + return false; + } + return Dictionaries.Equals(AllFields, otherMessage.AllFields) && + UnknownFields.Equals(otherMessage.UnknownFields); + } + + /// + /// Returns the hash code value for this message. + /// TODO(jonskeet): Specify the hash algorithm, but better than the Java one! + /// + public override int GetHashCode() + { + int hash = 41; + hash = (19*hash) + DescriptorForType.GetHashCode(); + hash = (53*hash) + Dictionaries.GetHashCode(AllFields); + hash = (29*hash) + UnknownFields.GetHashCode(); + return hash; + } + + #region Explicit Members + + IBuilder IMessage.WeakCreateBuilderForType() + { + return CreateBuilderForType(); + } + + IBuilder IMessage.WeakToBuilder() + { + return ToBuilder(); + } + + IMessage IMessage.WeakDefaultInstanceForType + { + get { return DefaultInstanceForType; } + } + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/AbstractMessageLite.cs b/csharp/src/ProtocolBuffers/AbstractMessageLite.cs new file mode 100644 index 00000000..1cdead2e --- /dev/null +++ b/csharp/src/ProtocolBuffers/AbstractMessageLite.cs @@ -0,0 +1,140 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers +{ + /// + /// Implementation of the non-generic IMessage interface as far as possible. + /// + public abstract partial class AbstractMessageLite : IMessageLite + where TMessage : AbstractMessageLite + where TBuilder : AbstractBuilderLite + { + public abstract TBuilder CreateBuilderForType(); + + public abstract TBuilder ToBuilder(); + + public abstract TMessage DefaultInstanceForType { get; } + + public abstract bool IsInitialized { get; } + + public abstract void WriteTo(ICodedOutputStream output); + + public abstract int SerializedSize { get; } + + //public override bool Equals(object other) { + //} + + //public override int GetHashCode() { + //} + + public abstract void PrintTo(TextWriter writer); + + #region IMessageLite Members + + /// + /// Serializes the message to a ByteString. This is a trivial wrapper + /// around WriteTo(ICodedOutputStream). + /// + public ByteString ToByteString() + { + ByteString.CodedBuilder output = new ByteString.CodedBuilder(SerializedSize); + WriteTo(output.CodedOutput); + return output.Build(); + } + + /// + /// Serializes the message to a byte array. This is a trivial wrapper + /// around WriteTo(ICodedOutputStream). + /// + public byte[] ToByteArray() + { + byte[] result = new byte[SerializedSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(result); + WriteTo(output); + output.CheckNoSpaceLeft(); + return result; + } + + /// + /// Serializes the message and writes it to the given stream. + /// This is just a wrapper around WriteTo(CodedOutputStream). This + /// does not flush or close the stream. + /// + /// + public void WriteTo(Stream output) + { + CodedOutputStream codedOutput = CodedOutputStream.CreateInstance(output); + WriteTo(codedOutput); + codedOutput.Flush(); + } + + /// + /// Like WriteTo(Stream) but writes the size of the message as a varint before + /// writing the data. This allows more data to be written to the stream after the + /// message without the need to delimit the message data yourself. Use + /// IBuilder.MergeDelimitedFrom(Stream) or the static method + /// YourMessageType.ParseDelimitedFrom(Stream) to parse messages written by this method. + /// + /// + public void WriteDelimitedTo(Stream output) + { + CodedOutputStream codedOutput = CodedOutputStream.CreateInstance(output); + codedOutput.WriteRawVarint32((uint) SerializedSize); + WriteTo(codedOutput); + codedOutput.Flush(); + } + + IBuilderLite IMessageLite.WeakCreateBuilderForType() + { + return CreateBuilderForType(); + } + + IBuilderLite IMessageLite.WeakToBuilder() + { + return ToBuilder(); + } + + IMessageLite IMessageLite.WeakDefaultInstanceForType + { + get { return DefaultInstanceForType; } + } + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ByteArray.cs b/csharp/src/ProtocolBuffers/ByteArray.cs new file mode 100644 index 00000000..3c51b7b0 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ByteArray.cs @@ -0,0 +1,92 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers +{ + /// + /// Provides a utility routine to copy small arrays much more quickly than Buffer.BlockCopy + /// + internal static class ByteArray + { + /// + /// The threshold above which you should use Buffer.BlockCopy rather than ByteArray.Copy + /// + private const int CopyThreshold = 12; + + /// + /// Determines which copy routine to use based on the number of bytes to be copied. + /// + public static void Copy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int count) + { + if (count > CopyThreshold) + { + Buffer.BlockCopy(src, srcOffset, dst, dstOffset, count); + } + else + { + ByteCopy(src, srcOffset, dst, dstOffset, count); + } + } + + /// + /// Copy the bytes provided with a for loop, faster when there are only a few bytes to copy + /// + public static void ByteCopy(byte[] src, int srcOffset, byte[] dst, int dstOffset, int count) + { + int stop = srcOffset + count; + for (int i = srcOffset; i < stop; i++) + { + dst[dstOffset++] = src[i]; + } + } + + /// + /// Reverses the order of bytes in the array + /// + public static void Reverse(byte[] bytes) + { + byte temp; + for (int first = 0, last = bytes.Length - 1; first < last; first++, last--) + { + temp = bytes[first]; + bytes[first] = bytes[last]; + bytes[last] = temp; + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ByteString.cs b/csharp/src/ProtocolBuffers/ByteString.cs new file mode 100644 index 00000000..434865b7 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ByteString.cs @@ -0,0 +1,305 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace Google.ProtocolBuffers +{ + /// + /// Immutable array of bytes. + /// TODO(jonskeet): Implement the common collection interfaces? + /// + public sealed class ByteString : IEnumerable, IEquatable + { + private static readonly ByteString empty = new ByteString(new byte[0]); + + private readonly byte[] bytes; + + /// + /// Unsafe operations that can cause IO Failure and/or other catestrophic side-effects. + /// + public static class Unsafe + { + /// + /// Constructs a new ByteString from the given byte array. The array is + /// *not* copied, and must not be modified after this constructor is called. + /// + public static ByteString FromBytes(byte[] bytes) + { + return new ByteString(bytes); + } + + /// + /// Provides direct, unrestricted access to the bytes contained in this instance. + /// You must not modify or resize the byte array returned by this method. + /// + public static byte[] GetBuffer(ByteString bytes) + { + return bytes.bytes; + } + } + + /// + /// Internal use only. Ensure that the provided array is not mutated and belongs to this instance. + /// + internal static ByteString AttachBytes(byte[] bytes) + { + return new ByteString(bytes); + } + + /// + /// Constructs a new ByteString from the given byte array. The array is + /// *not* copied, and must not be modified after this constructor is called. + /// + private ByteString(byte[] bytes) + { + this.bytes = bytes; + } + + /// + /// Returns an empty ByteString. + /// + public static ByteString Empty + { + get { return empty; } + } + + /// + /// Returns the length of this ByteString in bytes. + /// + public int Length + { + get { return bytes.Length; } + } + + public bool IsEmpty + { + get { return Length == 0; } + } + + public byte[] ToByteArray() + { + return (byte[]) bytes.Clone(); + } + + public string ToBase64() + { + return Convert.ToBase64String(bytes); + } + + /// + /// Constructs a ByteString from the Base64 Encoded String. + /// + public static ByteString FromBase64(string bytes) + { + // By handling the empty string explicitly, we not only optimize but we fix a + // problem on CF 2.0. See issue 61 for details. + return bytes == "" ? Empty : new ByteString(Convert.FromBase64String(bytes)); + } + + /// + /// Constructs a ByteString from the given array. The contents + /// are copied, so further modifications to the array will not + /// be reflected in the returned ByteString. + /// + public static ByteString CopyFrom(byte[] bytes) + { + return new ByteString((byte[]) bytes.Clone()); + } + + /// + /// Constructs a ByteString from a portion of a byte array. + /// + public static ByteString CopyFrom(byte[] bytes, int offset, int count) + { + byte[] portion = new byte[count]; + ByteArray.Copy(bytes, offset, portion, 0, count); + return new ByteString(portion); + } + + /// + /// Creates a new ByteString by encoding the specified text with + /// the given encoding. + /// + public static ByteString CopyFrom(string text, Encoding encoding) + { + return new ByteString(encoding.GetBytes(text)); + } + + /// + /// Creates a new ByteString by encoding the specified text in UTF-8. + /// + public static ByteString CopyFromUtf8(string text) + { + return CopyFrom(text, Encoding.UTF8); + } + + /// + /// Retuns the byte at the given index. + /// + public byte this[int index] + { + get { return bytes[index]; } + } + + public string ToString(Encoding encoding) + { + return encoding.GetString(bytes, 0, bytes.Length); + } + + public string ToStringUtf8() + { + return ToString(Encoding.UTF8); + } + + public IEnumerator GetEnumerator() + { + return ((IEnumerable) bytes).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + /// + /// Creates a CodedInputStream from this ByteString's data. + /// + public CodedInputStream CreateCodedInput() + { + // We trust CodedInputStream not to reveal the provided byte array or modify it + return CodedInputStream.CreateInstance(bytes); + } + + // TODO(jonskeet): CopyTo if it turns out to be required + + public override bool Equals(object obj) + { + ByteString other = obj as ByteString; + if (obj == null) + { + return false; + } + return Equals(other); + } + + public override int GetHashCode() + { + int ret = 23; + foreach (byte b in bytes) + { + ret = (ret << 8) | b; + } + return ret; + } + + public bool Equals(ByteString other) + { + if (other.bytes.Length != bytes.Length) + { + return false; + } + for (int i = 0; i < bytes.Length; i++) + { + if (other.bytes[i] != bytes[i]) + { + return false; + } + } + return true; + } + + /// + /// Builder for ByteStrings which allows them to be created without extra + /// copying being involved. This has to be a nested type in order to have access + /// to the private ByteString constructor. + /// + internal sealed class CodedBuilder + { + private readonly CodedOutputStream output; + private readonly byte[] buffer; + + internal CodedBuilder(int size) + { + buffer = new byte[size]; + output = CodedOutputStream.CreateInstance(buffer); + } + + internal ByteString Build() + { + output.CheckNoSpaceLeft(); + + // We can be confident that the CodedOutputStream will not modify the + // underlying bytes anymore because it already wrote all of them. So, + // no need to make a copy. + return new ByteString(buffer); + } + + internal CodedOutputStream CodedOutput + { + get { return output; } + } + } + + /// + /// Used internally by CodedOutputStream to avoid creating a copy for the write + /// + internal void WriteRawBytesTo(CodedOutputStream outputStream) + { + outputStream.WriteRawBytes(bytes, 0, bytes.Length); + } + + /// + /// Copies the entire byte array to the destination array provided at the offset specified. + /// + public void CopyTo(byte[] array, int position) + { + ByteArray.Copy(bytes, 0, array, position, bytes.Length); + } + + /// + /// Writes the entire byte array to the provided stream + /// + public void WriteTo(Stream outputStream) + { + outputStream.Write(bytes, 0, bytes.Length); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/CodedInputStream.cs b/csharp/src/ProtocolBuffers/CodedInputStream.cs new file mode 100644 index 00000000..773e8c18 --- /dev/null +++ b/csharp/src/ProtocolBuffers/CodedInputStream.cs @@ -0,0 +1,1864 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Readings and decodes protocol message fields. + /// + /// + /// This class contains two kinds of methods: methods that read specific + /// protocol message constructs and field types (e.g. ReadTag and + /// ReadInt32) and methods that read low-level values (e.g. + /// ReadRawVarint32 and ReadRawBytes). If you are reading encoded protocol + /// messages, you should use the former methods, but if you are reading some + /// other format of your own design, use the latter. The names of the former + /// methods are taken from the protocol buffer type names, not .NET types. + /// (Hence ReadFloat instead of ReadSingle, and ReadBool instead of ReadBoolean.) + /// + /// TODO(jonskeet): Consider whether recursion and size limits shouldn't be readonly, + /// set at construction time. + /// + public sealed class CodedInputStream : ICodedInputStream + { + private readonly byte[] buffer; + private int bufferSize; + private int bufferSizeAfterLimit = 0; + private int bufferPos = 0; + private readonly Stream input; + private uint lastTag = 0; + + private uint nextTag = 0; + private bool hasNextTag = false; + + internal const int DefaultRecursionLimit = 64; + internal const int DefaultSizeLimit = 64 << 20; // 64MB + public const int BufferSize = 4096; + + /// + /// The total number of bytes read before the current buffer. The + /// total bytes read up to the current position can be computed as + /// totalBytesRetired + bufferPos. + /// + private int totalBytesRetired = 0; + + /// + /// The absolute position of the end of the current message. + /// + private int currentLimit = int.MaxValue; + + /// + /// + /// + private int recursionDepth = 0; + + private int recursionLimit = DefaultRecursionLimit; + + /// + /// + /// + private int sizeLimit = DefaultSizeLimit; + + #region Construction + + /// + /// Creates a new CodedInputStream reading data from the given + /// stream. + /// + public static CodedInputStream CreateInstance(Stream input) + { + return new CodedInputStream(input); + } + /// + /// Creates a new CodedInputStream reading data from the given + /// stream and a pre-allocated memory buffer. + /// + public static CodedInputStream CreateInstance(Stream input, byte[] buffer) + { + return new CodedInputStream(input, buffer); + } + + /// + /// Creates a new CodedInputStream reading data from the given + /// byte array. + /// + public static CodedInputStream CreateInstance(byte[] buf) + { + return new CodedInputStream(buf, 0, buf.Length); + } + + /// + /// Creates a new CodedInputStream that reads from the given + /// byte array slice. + /// + public static CodedInputStream CreateInstance(byte[] buf, int offset, int length) + { + return new CodedInputStream(buf, offset, length); + } + + private CodedInputStream(byte[] buffer, int offset, int length) + { + this.buffer = buffer; + this.bufferPos = offset; + this.bufferSize = offset + length; + this.input = null; + } + + private CodedInputStream(Stream input) + { + this.buffer = new byte[BufferSize]; + this.bufferSize = 0; + this.input = input; + } + + private CodedInputStream(Stream input, byte[] buffer) + { + this.buffer = buffer; + this.bufferSize = 0; + this.input = input; + } + #endregion + + /// + /// Returns the current position in the input stream, or the position in the input buffer + /// + public long Position + { + get + { + if (input != null) + { + return input.Position - ((bufferSize + bufferSizeAfterLimit) - bufferPos); + } + return bufferPos; + } + } + + + void ICodedInputStream.ReadMessageStart() { } + void ICodedInputStream.ReadMessageEnd() { } + + #region Validation + + /// + /// Verifies that the last call to ReadTag() returned the given tag value. + /// This is used to verify that a nested group ended with the correct + /// end tag. + /// + /// The last + /// tag read was not the one specified + [CLSCompliant(false)] + public void CheckLastTagWas(uint value) + { + if (lastTag != value) + { + throw InvalidProtocolBufferException.InvalidEndTag(); + } + } + + #endregion + + #region Reading of tags etc + + /// + /// Attempt to peek at the next field tag. + /// + [CLSCompliant(false)] + public bool PeekNextTag(out uint fieldTag, out string fieldName) + { + if (hasNextTag) + { + fieldName = null; + fieldTag = nextTag; + return true; + } + + uint savedLast = lastTag; + hasNextTag = ReadTag(out nextTag, out fieldName); + lastTag = savedLast; + fieldTag = nextTag; + return hasNextTag; + } + + /// + /// Attempt to read a field tag, returning false if we have reached the end + /// of the input data. + /// + /// The 'tag' of the field (id * 8 + wire-format) + /// Not Supported - For protobuffer streams, this parameter is always null + /// true if the next fieldTag was read + [CLSCompliant(false)] + public bool ReadTag(out uint fieldTag, out string fieldName) + { + fieldName = null; + + if (hasNextTag) + { + fieldTag = nextTag; + lastTag = fieldTag; + hasNextTag = false; + return true; + } + + if (IsAtEnd) + { + fieldTag = 0; + lastTag = fieldTag; + return false; + } + + fieldTag = ReadRawVarint32(); + lastTag = fieldTag; + if (lastTag == 0) + { + // If we actually read zero, that's not a valid tag. + throw InvalidProtocolBufferException.InvalidTag(); + } + return true; + } + + /// + /// Read a double field from the stream. + /// + public bool ReadDouble(ref double value) + { + value = FrameworkPortability.Int64ToDouble((long) ReadRawLittleEndian64()); + return true; + } + + /// + /// Read a float field from the stream. + /// + public bool ReadFloat(ref float value) + { + if (BitConverter.IsLittleEndian && 4 <= bufferSize - bufferPos) + { + value = BitConverter.ToSingle(buffer, bufferPos); + bufferPos += 4; + } + else + { + byte[] rawBytes = ReadRawBytes(4); + if (!BitConverter.IsLittleEndian) + { + ByteArray.Reverse(rawBytes); + } + value = BitConverter.ToSingle(rawBytes, 0); + } + return true; + } + + /// + /// Read a uint64 field from the stream. + /// + [CLSCompliant(false)] + public bool ReadUInt64(ref ulong value) + { + value = ReadRawVarint64(); + return true; + } + + /// + /// Read an int64 field from the stream. + /// + public bool ReadInt64(ref long value) + { + value = (long) ReadRawVarint64(); + return true; + } + + /// + /// Read an int32 field from the stream. + /// + public bool ReadInt32(ref int value) + { + value = (int) ReadRawVarint32(); + return true; + } + + /// + /// Read a fixed64 field from the stream. + /// + [CLSCompliant(false)] + public bool ReadFixed64(ref ulong value) + { + value = ReadRawLittleEndian64(); + return true; + } + + /// + /// Read a fixed32 field from the stream. + /// + [CLSCompliant(false)] + public bool ReadFixed32(ref uint value) + { + value = ReadRawLittleEndian32(); + return true; + } + + /// + /// Read a bool field from the stream. + /// + public bool ReadBool(ref bool value) + { + value = ReadRawVarint32() != 0; + return true; + } + + /// + /// Reads a string field from the stream. + /// + public bool ReadString(ref string value) + { + int size = (int) ReadRawVarint32(); + // No need to read any data for an empty string. + if (size == 0) + { + value = ""; + return true; + } + if (size <= bufferSize - bufferPos) + { + // Fast path: We already have the bytes in a contiguous buffer, so + // just copy directly from it. + String result = Encoding.UTF8.GetString(buffer, bufferPos, size); + bufferPos += size; + value = result; + return true; + } + // Slow path: Build a byte array first then copy it. + value = Encoding.UTF8.GetString(ReadRawBytes(size), 0, size); + return true; + } + + /// + /// Reads a group field value from the stream. + /// + public void ReadGroup(int fieldNumber, IBuilderLite builder, + ExtensionRegistry extensionRegistry) + { + if (recursionDepth >= recursionLimit) + { + throw InvalidProtocolBufferException.RecursionLimitExceeded(); + } + ++recursionDepth; + builder.WeakMergeFrom(this, extensionRegistry); + CheckLastTagWas(WireFormat.MakeTag(fieldNumber, WireFormat.WireType.EndGroup)); + --recursionDepth; + } + + /// + /// Reads a group field value from the stream and merges it into the given + /// UnknownFieldSet. + /// + [Obsolete] + public void ReadUnknownGroup(int fieldNumber, IBuilderLite builder) + { + if (recursionDepth >= recursionLimit) + { + throw InvalidProtocolBufferException.RecursionLimitExceeded(); + } + ++recursionDepth; + builder.WeakMergeFrom(this); + CheckLastTagWas(WireFormat.MakeTag(fieldNumber, WireFormat.WireType.EndGroup)); + --recursionDepth; + } + + /// + /// Reads an embedded message field value from the stream. + /// + public void ReadMessage(IBuilderLite builder, ExtensionRegistry extensionRegistry) + { + int length = (int) ReadRawVarint32(); + if (recursionDepth >= recursionLimit) + { + throw InvalidProtocolBufferException.RecursionLimitExceeded(); + } + int oldLimit = PushLimit(length); + ++recursionDepth; + builder.WeakMergeFrom(this, extensionRegistry); + CheckLastTagWas(0); + --recursionDepth; + PopLimit(oldLimit); + } + + /// + /// Reads a bytes field value from the stream. + /// + public bool ReadBytes(ref ByteString value) + { + int size = (int) ReadRawVarint32(); + if (size <= bufferSize - bufferPos && size > 0) + { + // Fast path: We already have the bytes in a contiguous buffer, so + // just copy directly from it. + ByteString result = ByteString.CopyFrom(buffer, bufferPos, size); + bufferPos += size; + value = result; + return true; + } + else + { + // Slow path: Build a byte array and attach it to a new ByteString. + value = ByteString.AttachBytes(ReadRawBytes(size)); + return true; + } + } + + /// + /// Reads a uint32 field value from the stream. + /// + [CLSCompliant(false)] + public bool ReadUInt32(ref uint value) + { + value = ReadRawVarint32(); + return true; + } + + /// + /// Reads an enum field value from the stream. The caller is responsible + /// for converting the numeric value to an actual enum. + /// + public bool ReadEnum(ref IEnumLite value, out object unknown, IEnumLiteMap mapping) + { + int rawValue = (int) ReadRawVarint32(); + + value = mapping.FindValueByNumber(rawValue); + if (value != null) + { + unknown = null; + return true; + } + unknown = rawValue; + return false; + } + + /// + /// Reads an enum field value from the stream. If the enum is valid for type T, + /// then the ref value is set and it returns true. Otherwise the unknown output + /// value is set and this method returns false. + /// + [CLSCompliant(false)] + public bool ReadEnum(ref T value, out object unknown) + where T : struct, IComparable, IFormattable + { + int number = (int) ReadRawVarint32(); + if (EnumParser.TryConvert(number, ref value)) + { + unknown = null; + return true; + } + unknown = number; + return false; + } + + /// + /// Reads an sfixed32 field value from the stream. + /// + public bool ReadSFixed32(ref int value) + { + value = (int) ReadRawLittleEndian32(); + return true; + } + + /// + /// Reads an sfixed64 field value from the stream. + /// + public bool ReadSFixed64(ref long value) + { + value = (long) ReadRawLittleEndian64(); + return true; + } + + /// + /// Reads an sint32 field value from the stream. + /// + public bool ReadSInt32(ref int value) + { + value = DecodeZigZag32(ReadRawVarint32()); + return true; + } + + /// + /// Reads an sint64 field value from the stream. + /// + public bool ReadSInt64(ref long value) + { + value = DecodeZigZag64(ReadRawVarint64()); + return true; + } + + private bool BeginArray(uint fieldTag, out bool isPacked, out int oldLimit) + { + isPacked = WireFormat.GetTagWireType(fieldTag) == WireFormat.WireType.LengthDelimited; + + if (isPacked) + { + int length = (int) (ReadRawVarint32() & int.MaxValue); + if (length > 0) + { + oldLimit = PushLimit(length); + return true; + } + oldLimit = -1; + return false; //packed but empty + } + + oldLimit = -1; + return true; + } + + /// + /// Returns true if the next tag is also part of the same unpacked array. + /// + private bool ContinueArray(uint currentTag) + { + string ignore; + uint next; + if (PeekNextTag(out next, out ignore)) + { + if (next == currentTag) + { + hasNextTag = false; + return true; + } + } + return false; + } + + /// + /// Returns true if the next tag is also part of the same array, which may or may not be packed. + /// + private bool ContinueArray(uint currentTag, bool packed, int oldLimit) + { + if (packed) + { + if (ReachedLimit) + { + PopLimit(oldLimit); + return false; + } + return true; + } + + string ignore; + uint next; + if (PeekNextTag(out next, out ignore)) + { + if (next == currentTag) + { + hasNextTag = false; + return true; + } + } + return false; + } + + [CLSCompliant(false)] + public void ReadPrimitiveArray(FieldType fieldType, uint fieldTag, string fieldName, ICollection list) + { + WireFormat.WireType normal = WireFormat.GetWireType(fieldType); + WireFormat.WireType wformat = WireFormat.GetTagWireType(fieldTag); + + // 2.3 allows packed form even if the field is not declared packed. + if (normal != wformat && wformat == WireFormat.WireType.LengthDelimited) + { + int length = (int) (ReadRawVarint32() & int.MaxValue); + int limit = PushLimit(length); + while (!ReachedLimit) + { + Object value = null; + if (ReadPrimitiveField(fieldType, ref value)) + { + list.Add(value); + } + } + PopLimit(limit); + } + else + { + Object value = null; + do + { + if (ReadPrimitiveField(fieldType, ref value)) + { + list.Add(value); + } + } while (ContinueArray(fieldTag)); + } + } + + [CLSCompliant(false)] + public void ReadStringArray(uint fieldTag, string fieldName, ICollection list) + { + string tmp = null; + do + { + ReadString(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag)); + } + + [CLSCompliant(false)] + public void ReadBytesArray(uint fieldTag, string fieldName, ICollection list) + { + ByteString tmp = null; + do + { + ReadBytes(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag)); + } + + [CLSCompliant(false)] + public void ReadBoolArray(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + bool tmp = false; + do + { + ReadBool(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadInt32Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + int tmp = 0; + do + { + ReadInt32(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadSInt32Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + int tmp = 0; + do + { + ReadSInt32(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadUInt32Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + uint tmp = 0; + do + { + ReadUInt32(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadFixed32Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + uint tmp = 0; + do + { + ReadFixed32(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadSFixed32Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + int tmp = 0; + do + { + ReadSFixed32(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadInt64Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + long tmp = 0; + do + { + ReadInt64(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadSInt64Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + long tmp = 0; + do + { + ReadSInt64(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadUInt64Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + ulong tmp = 0; + do + { + ReadUInt64(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadFixed64Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + ulong tmp = 0; + do + { + ReadFixed64(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadSFixed64Array(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + long tmp = 0; + do + { + ReadSFixed64(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadDoubleArray(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + double tmp = 0; + do + { + ReadDouble(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadFloatArray(uint fieldTag, string fieldName, ICollection list) + { + bool isPacked; + int holdLimit; + if (BeginArray(fieldTag, out isPacked, out holdLimit)) + { + float tmp = 0; + do + { + ReadFloat(ref tmp); + list.Add(tmp); + } while (ContinueArray(fieldTag, isPacked, holdLimit)); + } + } + + [CLSCompliant(false)] + public void ReadEnumArray(uint fieldTag, string fieldName, ICollection list, + out ICollection unknown, IEnumLiteMap mapping) + { + unknown = null; + object unkval; + IEnumLite value = null; + WireFormat.WireType wformat = WireFormat.GetTagWireType(fieldTag); + + // 2.3 allows packed form even if the field is not declared packed. + if (wformat == WireFormat.WireType.LengthDelimited) + { + int length = (int) (ReadRawVarint32() & int.MaxValue); + int limit = PushLimit(length); + while (!ReachedLimit) + { + if (ReadEnum(ref value, out unkval, mapping)) + { + list.Add(value); + } + else + { + if (unknown == null) + { + unknown = new List(); + } + unknown.Add(unkval); + } + } + PopLimit(limit); + } + else + { + do + { + if (ReadEnum(ref value, out unkval, mapping)) + { + list.Add(value); + } + else + { + if (unknown == null) + { + unknown = new List(); + } + unknown.Add(unkval); + } + } while (ContinueArray(fieldTag)); + } + } + + [CLSCompliant(false)] + public void ReadEnumArray(uint fieldTag, string fieldName, ICollection list, + out ICollection unknown) + where T : struct, IComparable, IFormattable + { + unknown = null; + object unkval; + T value = default(T); + WireFormat.WireType wformat = WireFormat.GetTagWireType(fieldTag); + + // 2.3 allows packed form even if the field is not declared packed. + if (wformat == WireFormat.WireType.LengthDelimited) + { + int length = (int) (ReadRawVarint32() & int.MaxValue); + int limit = PushLimit(length); + while (!ReachedLimit) + { + if (ReadEnum(ref value, out unkval)) + { + list.Add(value); + } + else + { + if (unknown == null) + { + unknown = new List(); + } + unknown.Add(unkval); + } + } + PopLimit(limit); + } + else + { + do + { + if (ReadEnum(ref value, out unkval)) + { + list.Add(value); + } + else + { + if (unknown == null) + { + unknown = new List(); + } + unknown.Add(unkval); + } + } while (ContinueArray(fieldTag)); + } + } + + [CLSCompliant(false)] + public void ReadMessageArray(uint fieldTag, string fieldName, ICollection list, T messageType, + ExtensionRegistry registry) where T : IMessageLite + { + do + { + IBuilderLite builder = messageType.WeakCreateBuilderForType(); + ReadMessage(builder, registry); + list.Add((T) builder.WeakBuildPartial()); + } while (ContinueArray(fieldTag)); + } + + [CLSCompliant(false)] + public void ReadGroupArray(uint fieldTag, string fieldName, ICollection list, T messageType, + ExtensionRegistry registry) where T : IMessageLite + { + do + { + IBuilderLite builder = messageType.WeakCreateBuilderForType(); + ReadGroup(WireFormat.GetTagFieldNumber(fieldTag), builder, registry); + list.Add((T) builder.WeakBuildPartial()); + } while (ContinueArray(fieldTag)); + } + + /// + /// Reads a field of any primitive type. Enums, groups and embedded + /// messages are not handled by this method. + /// + public bool ReadPrimitiveField(FieldType fieldType, ref object value) + { + switch (fieldType) + { + case FieldType.Double: + { + double tmp = 0; + if (ReadDouble(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.Float: + { + float tmp = 0; + if (ReadFloat(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.Int64: + { + long tmp = 0; + if (ReadInt64(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.UInt64: + { + ulong tmp = 0; + if (ReadUInt64(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.Int32: + { + int tmp = 0; + if (ReadInt32(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.Fixed64: + { + ulong tmp = 0; + if (ReadFixed64(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.Fixed32: + { + uint tmp = 0; + if (ReadFixed32(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.Bool: + { + bool tmp = false; + if (ReadBool(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.String: + { + string tmp = null; + if (ReadString(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.Bytes: + { + ByteString tmp = null; + if (ReadBytes(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.UInt32: + { + uint tmp = 0; + if (ReadUInt32(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.SFixed32: + { + int tmp = 0; + if (ReadSFixed32(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.SFixed64: + { + long tmp = 0; + if (ReadSFixed64(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.SInt32: + { + int tmp = 0; + if (ReadSInt32(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.SInt64: + { + long tmp = 0; + if (ReadSInt64(ref tmp)) + { + value = tmp; + return true; + } + return false; + } + case FieldType.Group: + throw new ArgumentException("ReadPrimitiveField() cannot handle nested groups."); + case FieldType.Message: + throw new ArgumentException("ReadPrimitiveField() cannot handle embedded messages."); + // We don't handle enums because we don't know what to do if the + // value is not recognized. + case FieldType.Enum: + throw new ArgumentException("ReadPrimitiveField() cannot handle enums."); + default: + throw new ArgumentOutOfRangeException("Invalid field type " + fieldType); + } + } + + #endregion + + #region Underlying reading primitives + + /// + /// Same code as ReadRawVarint32, but read each byte individually, checking for + /// buffer overflow. + /// + private uint SlowReadRawVarint32() + { + int tmp = ReadRawByte(); + if (tmp < 128) + { + return (uint) tmp; + } + int result = tmp & 0x7f; + if ((tmp = ReadRawByte()) < 128) + { + result |= tmp << 7; + } + else + { + result |= (tmp & 0x7f) << 7; + if ((tmp = ReadRawByte()) < 128) + { + result |= tmp << 14; + } + else + { + result |= (tmp & 0x7f) << 14; + if ((tmp = ReadRawByte()) < 128) + { + result |= tmp << 21; + } + else + { + result |= (tmp & 0x7f) << 21; + result |= (tmp = ReadRawByte()) << 28; + if (tmp >= 128) + { + // Discard upper 32 bits. + for (int i = 0; i < 5; i++) + { + if (ReadRawByte() < 128) + { + return (uint) result; + } + } + throw InvalidProtocolBufferException.MalformedVarint(); + } + } + } + } + return (uint) result; + } + + /// + /// Read a raw Varint from the stream. If larger than 32 bits, discard the upper bits. + /// This method is optimised for the case where we've got lots of data in the buffer. + /// That means we can check the size just once, then just read directly from the buffer + /// without constant rechecking of the buffer length. + /// + [CLSCompliant(false)] + public uint ReadRawVarint32() + { + if (bufferPos + 5 > bufferSize) + { + return SlowReadRawVarint32(); + } + + int tmp = buffer[bufferPos++]; + if (tmp < 128) + { + return (uint) tmp; + } + int result = tmp & 0x7f; + if ((tmp = buffer[bufferPos++]) < 128) + { + result |= tmp << 7; + } + else + { + result |= (tmp & 0x7f) << 7; + if ((tmp = buffer[bufferPos++]) < 128) + { + result |= tmp << 14; + } + else + { + result |= (tmp & 0x7f) << 14; + if ((tmp = buffer[bufferPos++]) < 128) + { + result |= tmp << 21; + } + else + { + result |= (tmp & 0x7f) << 21; + result |= (tmp = buffer[bufferPos++]) << 28; + if (tmp >= 128) + { + // Discard upper 32 bits. + // Note that this has to use ReadRawByte() as we only ensure we've + // got at least 5 bytes at the start of the method. This lets us + // use the fast path in more cases, and we rarely hit this section of code. + for (int i = 0; i < 5; i++) + { + if (ReadRawByte() < 128) + { + return (uint) result; + } + } + throw InvalidProtocolBufferException.MalformedVarint(); + } + } + } + } + return (uint) result; + } + + /// + /// Reads a varint from the input one byte at a time, so that it does not + /// read any bytes after the end of the varint. If you simply wrapped the + /// stream in a CodedInputStream and used ReadRawVarint32(Stream)} + /// then you would probably end up reading past the end of the varint since + /// CodedInputStream buffers its input. + /// + /// + /// + [CLSCompliant(false)] + public static uint ReadRawVarint32(Stream input) + { + int result = 0; + int offset = 0; + for (; offset < 32; offset += 7) + { + int b = input.ReadByte(); + if (b == -1) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + result |= (b & 0x7f) << offset; + if ((b & 0x80) == 0) + { + return (uint) result; + } + } + // Keep reading up to 64 bits. + for (; offset < 64; offset += 7) + { + int b = input.ReadByte(); + if (b == -1) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + if ((b & 0x80) == 0) + { + return (uint) result; + } + } + throw InvalidProtocolBufferException.MalformedVarint(); + } + + /// + /// Read a raw varint from the stream. + /// + [CLSCompliant(false)] + public ulong ReadRawVarint64() + { + int shift = 0; + ulong result = 0; + while (shift < 64) + { + byte b = ReadRawByte(); + result |= (ulong) (b & 0x7F) << shift; + if ((b & 0x80) == 0) + { + return result; + } + shift += 7; + } + throw InvalidProtocolBufferException.MalformedVarint(); + } + + /// + /// Read a 32-bit little-endian integer from the stream. + /// + [CLSCompliant(false)] + public uint ReadRawLittleEndian32() + { + uint b1 = ReadRawByte(); + uint b2 = ReadRawByte(); + uint b3 = ReadRawByte(); + uint b4 = ReadRawByte(); + return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24); + } + + /// + /// Read a 64-bit little-endian integer from the stream. + /// + [CLSCompliant(false)] + public ulong ReadRawLittleEndian64() + { + ulong b1 = ReadRawByte(); + ulong b2 = ReadRawByte(); + ulong b3 = ReadRawByte(); + ulong b4 = ReadRawByte(); + ulong b5 = ReadRawByte(); + ulong b6 = ReadRawByte(); + ulong b7 = ReadRawByte(); + ulong b8 = ReadRawByte(); + return b1 | (b2 << 8) | (b3 << 16) | (b4 << 24) + | (b5 << 32) | (b6 << 40) | (b7 << 48) | (b8 << 56); + } + + #endregion + + /// + /// Decode a 32-bit value with ZigZag encoding. + /// + /// + /// ZigZag encodes signed integers into values that can be efficiently + /// encoded with varint. (Otherwise, negative values must be + /// sign-extended to 64 bits to be varint encoded, thus always taking + /// 10 bytes on the wire.) + /// + [CLSCompliant(false)] + public static int DecodeZigZag32(uint n) + { + return (int) (n >> 1) ^ -(int) (n & 1); + } + + /// + /// Decode a 32-bit value with ZigZag encoding. + /// + /// + /// ZigZag encodes signed integers into values that can be efficiently + /// encoded with varint. (Otherwise, negative values must be + /// sign-extended to 64 bits to be varint encoded, thus always taking + /// 10 bytes on the wire.) + /// + [CLSCompliant(false)] + public static long DecodeZigZag64(ulong n) + { + return (long) (n >> 1) ^ -(long) (n & 1); + } + + /// + /// Set the maximum message recursion depth. + /// + /// + /// In order to prevent malicious + /// messages from causing stack overflows, CodedInputStream limits + /// how deeply messages may be nested. The default limit is 64. + /// + public int SetRecursionLimit(int limit) + { + if (limit < 0) + { + throw new ArgumentOutOfRangeException("Recursion limit cannot be negative: " + limit); + } + int oldLimit = recursionLimit; + recursionLimit = limit; + return oldLimit; + } + + /// + /// Set the maximum message size. + /// + /// + /// In order to prevent malicious messages from exhausting memory or + /// causing integer overflows, CodedInputStream limits how large a message may be. + /// The default limit is 64MB. You should set this limit as small + /// as you can without harming your app's functionality. Note that + /// size limits only apply when reading from an InputStream, not + /// when constructed around a raw byte array (nor with ByteString.NewCodedInput). + /// If you want to read several messages from a single CodedInputStream, you + /// can call ResetSizeCounter() after each message to avoid hitting the + /// size limit. + /// + public int SetSizeLimit(int limit) + { + if (limit < 0) + { + throw new ArgumentOutOfRangeException("Size limit cannot be negative: " + limit); + } + int oldLimit = sizeLimit; + sizeLimit = limit; + return oldLimit; + } + + #region Internal reading and buffer management + + /// + /// Resets the current size counter to zero (see SetSizeLimit). + /// + public void ResetSizeCounter() + { + totalBytesRetired = 0; + } + + /// + /// Sets currentLimit to (current position) + byteLimit. This is called + /// when descending into a length-delimited embedded message. The previous + /// limit is returned. + /// + /// The old limit. + public int PushLimit(int byteLimit) + { + if (byteLimit < 0) + { + throw InvalidProtocolBufferException.NegativeSize(); + } + byteLimit += totalBytesRetired + bufferPos; + int oldLimit = currentLimit; + if (byteLimit > oldLimit) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + currentLimit = byteLimit; + + RecomputeBufferSizeAfterLimit(); + + return oldLimit; + } + + private void RecomputeBufferSizeAfterLimit() + { + bufferSize += bufferSizeAfterLimit; + int bufferEnd = totalBytesRetired + bufferSize; + if (bufferEnd > currentLimit) + { + // Limit is in current buffer. + bufferSizeAfterLimit = bufferEnd - currentLimit; + bufferSize -= bufferSizeAfterLimit; + } + else + { + bufferSizeAfterLimit = 0; + } + } + + /// + /// Discards the current limit, returning the previous limit. + /// + public void PopLimit(int oldLimit) + { + currentLimit = oldLimit; + RecomputeBufferSizeAfterLimit(); + } + + /// + /// Returns whether or not all the data before the limit has been read. + /// + /// + public bool ReachedLimit + { + get + { + if (currentLimit == int.MaxValue) + { + return false; + } + int currentAbsolutePosition = totalBytesRetired + bufferPos; + return currentAbsolutePosition >= currentLimit; + } + } + + /// + /// Returns true if the stream has reached the end of the input. This is the + /// case if either the end of the underlying input source has been reached or + /// the stream has reached a limit created using PushLimit. + /// + public bool IsAtEnd + { + get { return bufferPos == bufferSize && !RefillBuffer(false); } + } + + /// + /// Called when buffer is empty to read more bytes from the + /// input. If is true, RefillBuffer() gurantees that + /// either there will be at least one byte in the buffer when it returns + /// or it will throw an exception. If is false, + /// RefillBuffer() returns false if no more bytes were available. + /// + /// + /// + private bool RefillBuffer(bool mustSucceed) + { + if (bufferPos < bufferSize) + { + throw new InvalidOperationException("RefillBuffer() called when buffer wasn't empty."); + } + + if (totalBytesRetired + bufferSize == currentLimit) + { + // Oops, we hit a limit. + if (mustSucceed) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + else + { + return false; + } + } + + totalBytesRetired += bufferSize; + + bufferPos = 0; + bufferSize = (input == null) ? 0 : input.Read(buffer, 0, buffer.Length); + if (bufferSize < 0) + { + throw new InvalidOperationException("Stream.Read returned a negative count"); + } + if (bufferSize == 0) + { + if (mustSucceed) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + else + { + return false; + } + } + else + { + RecomputeBufferSizeAfterLimit(); + int totalBytesRead = + totalBytesRetired + bufferSize + bufferSizeAfterLimit; + if (totalBytesRead > sizeLimit || totalBytesRead < 0) + { + throw InvalidProtocolBufferException.SizeLimitExceeded(); + } + return true; + } + } + + /// + /// Read one byte from the input. + /// + /// + /// the end of the stream or the current limit was reached + /// + public byte ReadRawByte() + { + if (bufferPos == bufferSize) + { + RefillBuffer(true); + } + return buffer[bufferPos++]; + } + + /// + /// Read a fixed size of bytes from the input. + /// + /// + /// the end of the stream or the current limit was reached + /// + public byte[] ReadRawBytes(int size) + { + if (size < 0) + { + throw InvalidProtocolBufferException.NegativeSize(); + } + + if (totalBytesRetired + bufferPos + size > currentLimit) + { + // Read to the end of the stream anyway. + SkipRawBytes(currentLimit - totalBytesRetired - bufferPos); + // Then fail. + throw InvalidProtocolBufferException.TruncatedMessage(); + } + + if (size <= bufferSize - bufferPos) + { + // We have all the bytes we need already. + byte[] bytes = new byte[size]; + ByteArray.Copy(buffer, bufferPos, bytes, 0, size); + bufferPos += size; + return bytes; + } + else if (size < buffer.Length) + { + // Reading more bytes than are in the buffer, but not an excessive number + // of bytes. We can safely allocate the resulting array ahead of time. + + // First copy what we have. + byte[] bytes = new byte[size]; + int pos = bufferSize - bufferPos; + ByteArray.Copy(buffer, bufferPos, bytes, 0, pos); + bufferPos = bufferSize; + + // We want to use RefillBuffer() and then copy from the buffer into our + // byte array rather than reading directly into our byte array because + // the input may be unbuffered. + RefillBuffer(true); + + while (size - pos > bufferSize) + { + Buffer.BlockCopy(buffer, 0, bytes, pos, bufferSize); + pos += bufferSize; + bufferPos = bufferSize; + RefillBuffer(true); + } + + ByteArray.Copy(buffer, 0, bytes, pos, size - pos); + bufferPos = size - pos; + + return bytes; + } + else + { + // The size is very large. For security reasons, we can't allocate the + // entire byte array yet. The size comes directly from the input, so a + // maliciously-crafted message could provide a bogus very large size in + // order to trick the app into allocating a lot of memory. We avoid this + // by allocating and reading only a small chunk at a time, so that the + // malicious message must actually *be* extremely large to cause + // problems. Meanwhile, we limit the allowed size of a message elsewhere. + + // Remember the buffer markers since we'll have to copy the bytes out of + // it later. + int originalBufferPos = bufferPos; + int originalBufferSize = bufferSize; + + // Mark the current buffer consumed. + totalBytesRetired += bufferSize; + bufferPos = 0; + bufferSize = 0; + + // Read all the rest of the bytes we need. + int sizeLeft = size - (originalBufferSize - originalBufferPos); + List chunks = new List(); + + while (sizeLeft > 0) + { + byte[] chunk = new byte[Math.Min(sizeLeft, buffer.Length)]; + int pos = 0; + while (pos < chunk.Length) + { + int n = (input == null) ? -1 : input.Read(chunk, pos, chunk.Length - pos); + if (n <= 0) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + totalBytesRetired += n; + pos += n; + } + sizeLeft -= chunk.Length; + chunks.Add(chunk); + } + + // OK, got everything. Now concatenate it all into one buffer. + byte[] bytes = new byte[size]; + + // Start by copying the leftover bytes from this.buffer. + int newPos = originalBufferSize - originalBufferPos; + ByteArray.Copy(buffer, originalBufferPos, bytes, 0, newPos); + + // And now all the chunks. + foreach (byte[] chunk in chunks) + { + Buffer.BlockCopy(chunk, 0, bytes, newPos, chunk.Length); + newPos += chunk.Length; + } + + // Done. + return bytes; + } + } + + /// + /// Reads and discards a single field, given its tag value. + /// + /// false if the tag is an end-group tag, in which case + /// nothing is skipped. Otherwise, returns true. + [CLSCompliant(false)] + public bool SkipField() + { + uint tag = lastTag; + switch (WireFormat.GetTagWireType(tag)) + { + case WireFormat.WireType.Varint: + ReadRawVarint64(); + return true; + case WireFormat.WireType.Fixed64: + ReadRawLittleEndian64(); + return true; + case WireFormat.WireType.LengthDelimited: + SkipRawBytes((int) ReadRawVarint32()); + return true; + case WireFormat.WireType.StartGroup: + SkipMessage(); + CheckLastTagWas( + WireFormat.MakeTag(WireFormat.GetTagFieldNumber(tag), + WireFormat.WireType.EndGroup)); + return true; + case WireFormat.WireType.EndGroup: + return false; + case WireFormat.WireType.Fixed32: + ReadRawLittleEndian32(); + return true; + default: + throw InvalidProtocolBufferException.InvalidWireType(); + } + } + + /// + /// Reads and discards an entire message. This will read either until EOF + /// or until an endgroup tag, whichever comes first. + /// + public void SkipMessage() + { + uint tag; + string name; + while (ReadTag(out tag, out name)) + { + if (!SkipField()) + { + return; + } + } + } + + /// + /// Reads and discards bytes. + /// + /// the end of the stream + /// or the current limit was reached + public void SkipRawBytes(int size) + { + if (size < 0) + { + throw InvalidProtocolBufferException.NegativeSize(); + } + + if (totalBytesRetired + bufferPos + size > currentLimit) + { + // Read to the end of the stream anyway. + SkipRawBytes(currentLimit - totalBytesRetired - bufferPos); + // Then fail. + throw InvalidProtocolBufferException.TruncatedMessage(); + } + + if (size <= bufferSize - bufferPos) + { + // We have all the bytes we need already. + bufferPos += size; + } + else + { + // Skipping more bytes than are in the buffer. First skip what we have. + int pos = bufferSize - bufferPos; + + // ROK 5/7/2013 Issue #54: should retire all bytes in buffer (bufferSize) + // totalBytesRetired += pos; + totalBytesRetired += bufferSize; + + bufferPos = 0; + bufferSize = 0; + + // Then skip directly from the InputStream for the rest. + if (pos < size) + { + if (input == null) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + SkipImpl(size - pos); + totalBytesRetired += size - pos; + } + } + } + + /// + /// Abstraction of skipping to cope with streams which can't really skip. + /// + private void SkipImpl(int amountToSkip) + { + if (input.CanSeek) + { + long previousPosition = input.Position; + input.Position += amountToSkip; + if (input.Position != previousPosition + amountToSkip) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + } + else + { + byte[] skipBuffer = new byte[1024]; + while (amountToSkip > 0) + { + int bytesRead = input.Read(skipBuffer, 0, skipBuffer.Length); + if (bytesRead <= 0) + { + throw InvalidProtocolBufferException.TruncatedMessage(); + } + amountToSkip -= bytesRead; + } + } + } + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs b/csharp/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs new file mode 100644 index 00000000..ca6662a4 --- /dev/null +++ b/csharp/src/ProtocolBuffers/CodedOutputStream.ComputeSize.cs @@ -0,0 +1,653 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Globalization; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + // This part of CodedOutputStream provides all the static entry points that are used + // by generated code and internally to compute the size of messages prior to being + // written to an instance of CodedOutputStream. + public sealed partial class CodedOutputStream + { + private const int LittleEndian64Size = 8; + private const int LittleEndian32Size = 4; + + /// + /// Compute the number of bytes that would be needed to encode a + /// double field, including the tag. + /// + public static int ComputeDoubleSize(int fieldNumber, double value) + { + return ComputeTagSize(fieldNumber) + LittleEndian64Size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// float field, including the tag. + /// + public static int ComputeFloatSize(int fieldNumber, float value) + { + return ComputeTagSize(fieldNumber) + LittleEndian32Size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// uint64 field, including the tag. + /// + [CLSCompliant(false)] + public static int ComputeUInt64Size(int fieldNumber, ulong value) + { + return ComputeTagSize(fieldNumber) + ComputeRawVarint64Size(value); + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// int64 field, including the tag. + /// + public static int ComputeInt64Size(int fieldNumber, long value) + { + return ComputeTagSize(fieldNumber) + ComputeRawVarint64Size((ulong) value); + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// int32 field, including the tag. + /// + public static int ComputeInt32Size(int fieldNumber, int value) + { + if (value >= 0) + { + return ComputeTagSize(fieldNumber) + ComputeRawVarint32Size((uint) value); + } + else + { + // Must sign-extend. + return ComputeTagSize(fieldNumber) + 10; + } + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// fixed64 field, including the tag. + /// + [CLSCompliant(false)] + public static int ComputeFixed64Size(int fieldNumber, ulong value) + { + return ComputeTagSize(fieldNumber) + LittleEndian64Size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// fixed32 field, including the tag. + /// + [CLSCompliant(false)] + public static int ComputeFixed32Size(int fieldNumber, uint value) + { + return ComputeTagSize(fieldNumber) + LittleEndian32Size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// bool field, including the tag. + /// + public static int ComputeBoolSize(int fieldNumber, bool value) + { + return ComputeTagSize(fieldNumber) + 1; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// string field, including the tag. + /// + public static int ComputeStringSize(int fieldNumber, String value) + { + int byteArraySize = Encoding.UTF8.GetByteCount(value); + return ComputeTagSize(fieldNumber) + + ComputeRawVarint32Size((uint) byteArraySize) + + byteArraySize; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// group field, including the tag. + /// + public static int ComputeGroupSize(int fieldNumber, IMessageLite value) + { + return ComputeTagSize(fieldNumber)*2 + value.SerializedSize; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// group field represented by an UnknownFieldSet, including the tag. + /// + [Obsolete] + public static int ComputeUnknownGroupSize(int fieldNumber, + IMessageLite value) + { + return ComputeTagSize(fieldNumber)*2 + value.SerializedSize; + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// embedded message field, including the tag. + /// + public static int ComputeMessageSize(int fieldNumber, IMessageLite value) + { + int size = value.SerializedSize; + return ComputeTagSize(fieldNumber) + ComputeRawVarint32Size((uint) size) + size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// bytes field, including the tag. + /// + public static int ComputeBytesSize(int fieldNumber, ByteString value) + { + return ComputeTagSize(fieldNumber) + + ComputeRawVarint32Size((uint) value.Length) + + value.Length; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// uint32 field, including the tag. + /// + [CLSCompliant(false)] + public static int ComputeUInt32Size(int fieldNumber, uint value) + { + return ComputeTagSize(fieldNumber) + ComputeRawVarint32Size(value); + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// enum field, including the tag. The caller is responsible for + /// converting the enum value to its numeric value. + /// + public static int ComputeEnumSize(int fieldNumber, int value) + { + return ComputeTagSize(fieldNumber) + ComputeEnumSizeNoTag(value); + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// sfixed32 field, including the tag. + /// + public static int ComputeSFixed32Size(int fieldNumber, int value) + { + return ComputeTagSize(fieldNumber) + LittleEndian32Size; + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// sfixed64 field, including the tag. + /// + public static int ComputeSFixed64Size(int fieldNumber, long value) + { + return ComputeTagSize(fieldNumber) + LittleEndian64Size; + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// sint32 field, including the tag. + /// + public static int ComputeSInt32Size(int fieldNumber, int value) + { + return ComputeTagSize(fieldNumber) + ComputeRawVarint32Size(EncodeZigZag32(value)); + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// sint64 field, including the tag. + /// + public static int ComputeSInt64Size(int fieldNumber, long value) + { + return ComputeTagSize(fieldNumber) + ComputeRawVarint64Size(EncodeZigZag64(value)); + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// double field, including the tag. + /// + public static int ComputeDoubleSizeNoTag(double value) + { + return LittleEndian64Size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// float field, including the tag. + /// + public static int ComputeFloatSizeNoTag(float value) + { + return LittleEndian32Size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// uint64 field, including the tag. + /// + [CLSCompliant(false)] + public static int ComputeUInt64SizeNoTag(ulong value) + { + return ComputeRawVarint64Size(value); + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// int64 field, including the tag. + /// + public static int ComputeInt64SizeNoTag(long value) + { + return ComputeRawVarint64Size((ulong) value); + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// int32 field, including the tag. + /// + public static int ComputeInt32SizeNoTag(int value) + { + if (value >= 0) + { + return ComputeRawVarint32Size((uint) value); + } + else + { + // Must sign-extend. + return 10; + } + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// fixed64 field, including the tag. + /// + [CLSCompliant(false)] + public static int ComputeFixed64SizeNoTag(ulong value) + { + return LittleEndian64Size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// fixed32 field, including the tag. + /// + [CLSCompliant(false)] + public static int ComputeFixed32SizeNoTag(uint value) + { + return LittleEndian32Size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// bool field, including the tag. + /// + public static int ComputeBoolSizeNoTag(bool value) + { + return 1; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// string field, including the tag. + /// + public static int ComputeStringSizeNoTag(String value) + { + int byteArraySize = Encoding.UTF8.GetByteCount(value); + return ComputeRawVarint32Size((uint) byteArraySize) + + byteArraySize; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// group field, including the tag. + /// + public static int ComputeGroupSizeNoTag(IMessageLite value) + { + return value.SerializedSize; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// group field represented by an UnknownFieldSet, including the tag. + /// + [Obsolete] + public static int ComputeUnknownGroupSizeNoTag(IMessageLite value) + { + return value.SerializedSize; + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// embedded message field, including the tag. + /// + public static int ComputeMessageSizeNoTag(IMessageLite value) + { + int size = value.SerializedSize; + return ComputeRawVarint32Size((uint) size) + size; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// bytes field, including the tag. + /// + public static int ComputeBytesSizeNoTag(ByteString value) + { + return ComputeRawVarint32Size((uint) value.Length) + + value.Length; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// uint32 field, including the tag. + /// + [CLSCompliant(false)] + public static int ComputeUInt32SizeNoTag(uint value) + { + return ComputeRawVarint32Size(value); + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// enum field, including the tag. The caller is responsible for + /// converting the enum value to its numeric value. + /// + public static int ComputeEnumSizeNoTag(int value) + { + return ComputeInt32SizeNoTag(value); + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// sfixed32 field, including the tag. + /// + public static int ComputeSFixed32SizeNoTag(int value) + { + return LittleEndian32Size; + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// sfixed64 field, including the tag. + /// + public static int ComputeSFixed64SizeNoTag(long value) + { + return LittleEndian64Size; + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// sint32 field, including the tag. + /// + public static int ComputeSInt32SizeNoTag(int value) + { + return ComputeRawVarint32Size(EncodeZigZag32(value)); + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// sint64 field, including the tag. + /// + public static int ComputeSInt64SizeNoTag(long value) + { + return ComputeRawVarint64Size(EncodeZigZag64(value)); + } + + /* + * Compute the number of bytes that would be needed to encode a + * MessageSet extension to the stream. For historical reasons, + * the wire format differs from normal fields. + */ + + /// + /// Compute the number of bytes that would be needed to encode a + /// MessageSet extension to the stream. For historical reasons, + /// the wire format differs from normal fields. + /// + public static int ComputeMessageSetExtensionSize(int fieldNumber, IMessageLite value) + { + return ComputeTagSize(WireFormat.MessageSetField.Item)*2 + + ComputeUInt32Size(WireFormat.MessageSetField.TypeID, (uint) fieldNumber) + + ComputeMessageSize(WireFormat.MessageSetField.Message, value); + } + + /// + /// Compute the number of bytes that would be needed to encode an + /// unparsed MessageSet extension field to the stream. For + /// historical reasons, the wire format differs from normal fields. + /// + public static int ComputeRawMessageSetExtensionSize(int fieldNumber, ByteString value) + { + return ComputeTagSize(WireFormat.MessageSetField.Item)*2 + + ComputeUInt32Size(WireFormat.MessageSetField.TypeID, (uint) fieldNumber) + + ComputeBytesSize(WireFormat.MessageSetField.Message, value); + } + + /// + /// Compute the number of bytes that would be needed to encode a varint. + /// + [CLSCompliant(false)] + public static int ComputeRawVarint32Size(uint value) + { + if ((value & (0xffffffff << 7)) == 0) + { + return 1; + } + if ((value & (0xffffffff << 14)) == 0) + { + return 2; + } + if ((value & (0xffffffff << 21)) == 0) + { + return 3; + } + if ((value & (0xffffffff << 28)) == 0) + { + return 4; + } + return 5; + } + + /// + /// Compute the number of bytes that would be needed to encode a varint. + /// + [CLSCompliant(false)] + public static int ComputeRawVarint64Size(ulong value) + { + if ((value & (0xffffffffffffffffL << 7)) == 0) + { + return 1; + } + if ((value & (0xffffffffffffffffL << 14)) == 0) + { + return 2; + } + if ((value & (0xffffffffffffffffL << 21)) == 0) + { + return 3; + } + if ((value & (0xffffffffffffffffL << 28)) == 0) + { + return 4; + } + if ((value & (0xffffffffffffffffL << 35)) == 0) + { + return 5; + } + if ((value & (0xffffffffffffffffL << 42)) == 0) + { + return 6; + } + if ((value & (0xffffffffffffffffL << 49)) == 0) + { + return 7; + } + if ((value & (0xffffffffffffffffL << 56)) == 0) + { + return 8; + } + if ((value & (0xffffffffffffffffL << 63)) == 0) + { + return 9; + } + return 10; + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// field of arbitrary type, including the tag, to the stream. + /// + public static int ComputeFieldSize(FieldType fieldType, int fieldNumber, Object value) + { + switch (fieldType) + { + case FieldType.Double: + return ComputeDoubleSize(fieldNumber, (double) value); + case FieldType.Float: + return ComputeFloatSize(fieldNumber, (float) value); + case FieldType.Int64: + return ComputeInt64Size(fieldNumber, (long) value); + case FieldType.UInt64: + return ComputeUInt64Size(fieldNumber, (ulong) value); + case FieldType.Int32: + return ComputeInt32Size(fieldNumber, (int) value); + case FieldType.Fixed64: + return ComputeFixed64Size(fieldNumber, (ulong) value); + case FieldType.Fixed32: + return ComputeFixed32Size(fieldNumber, (uint) value); + case FieldType.Bool: + return ComputeBoolSize(fieldNumber, (bool) value); + case FieldType.String: + return ComputeStringSize(fieldNumber, (string) value); + case FieldType.Group: + return ComputeGroupSize(fieldNumber, (IMessageLite) value); + case FieldType.Message: + return ComputeMessageSize(fieldNumber, (IMessageLite) value); + case FieldType.Bytes: + return ComputeBytesSize(fieldNumber, (ByteString) value); + case FieldType.UInt32: + return ComputeUInt32Size(fieldNumber, (uint) value); + case FieldType.SFixed32: + return ComputeSFixed32Size(fieldNumber, (int) value); + case FieldType.SFixed64: + return ComputeSFixed64Size(fieldNumber, (long) value); + case FieldType.SInt32: + return ComputeSInt32Size(fieldNumber, (int) value); + case FieldType.SInt64: + return ComputeSInt64Size(fieldNumber, (long) value); + case FieldType.Enum: + if (value is Enum) + { + return ComputeEnumSize(fieldNumber, Convert.ToInt32(value)); + } + else + { + return ComputeEnumSize(fieldNumber, ((IEnumLite) value).Number); + } + default: + throw new ArgumentOutOfRangeException("Invalid field type " + fieldType); + } + } + + /// + /// Compute the number of bytes that would be needed to encode a + /// field of arbitrary type, excluding the tag, to the stream. + /// + public static int ComputeFieldSizeNoTag(FieldType fieldType, Object value) + { + switch (fieldType) + { + case FieldType.Double: + return ComputeDoubleSizeNoTag((double) value); + case FieldType.Float: + return ComputeFloatSizeNoTag((float) value); + case FieldType.Int64: + return ComputeInt64SizeNoTag((long) value); + case FieldType.UInt64: + return ComputeUInt64SizeNoTag((ulong) value); + case FieldType.Int32: + return ComputeInt32SizeNoTag((int) value); + case FieldType.Fixed64: + return ComputeFixed64SizeNoTag((ulong) value); + case FieldType.Fixed32: + return ComputeFixed32SizeNoTag((uint) value); + case FieldType.Bool: + return ComputeBoolSizeNoTag((bool) value); + case FieldType.String: + return ComputeStringSizeNoTag((string) value); + case FieldType.Group: + return ComputeGroupSizeNoTag((IMessageLite) value); + case FieldType.Message: + return ComputeMessageSizeNoTag((IMessageLite) value); + case FieldType.Bytes: + return ComputeBytesSizeNoTag((ByteString) value); + case FieldType.UInt32: + return ComputeUInt32SizeNoTag((uint) value); + case FieldType.SFixed32: + return ComputeSFixed32SizeNoTag((int) value); + case FieldType.SFixed64: + return ComputeSFixed64SizeNoTag((long) value); + case FieldType.SInt32: + return ComputeSInt32SizeNoTag((int) value); + case FieldType.SInt64: + return ComputeSInt64SizeNoTag((long) value); + case FieldType.Enum: + if (value is Enum) + { + return ComputeEnumSizeNoTag(Convert.ToInt32(value)); + } + else + { + return ComputeEnumSizeNoTag(((IEnumLite) value).Number); + } + default: + throw new ArgumentOutOfRangeException("Invalid field type " + fieldType); + } + } + + /// + /// Compute the number of bytes that would be needed to encode a tag. + /// + public static int ComputeTagSize(int fieldNumber) + { + return ComputeRawVarint32Size(WireFormat.MakeTag(fieldNumber, 0)); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/CodedOutputStream.cs b/csharp/src/ProtocolBuffers/CodedOutputStream.cs new file mode 100644 index 00000000..d267b75e --- /dev/null +++ b/csharp/src/ProtocolBuffers/CodedOutputStream.cs @@ -0,0 +1,1341 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Encodes and writes protocol message fields. + /// + /// + /// This class contains two kinds of methods: methods that write specific + /// protocol message constructs and field types (e.g. WriteTag and + /// WriteInt32) and methods that write low-level values (e.g. + /// WriteRawVarint32 and WriteRawBytes). If you are writing encoded protocol + /// messages, you should use the former methods, but if you are writing some + /// other format of your own design, use the latter. The names of the former + /// methods are taken from the protocol buffer type names, not .NET types. + /// (Hence WriteFloat instead of WriteSingle, and WriteBool instead of WriteBoolean.) + /// + public sealed partial class CodedOutputStream : ICodedOutputStream + { + /// + /// The buffer size used by CreateInstance(Stream). + /// + public static readonly int DefaultBufferSize = 4096; + + private readonly byte[] buffer; + private readonly int limit; + private int position; + private readonly Stream output; + + #region Construction + + private CodedOutputStream(byte[] buffer, int offset, int length) + { + this.output = null; + this.buffer = buffer; + this.position = offset; + this.limit = offset + length; + } + + private CodedOutputStream(Stream output, byte[] buffer) + { + this.output = output; + this.buffer = buffer; + this.position = 0; + this.limit = buffer.Length; + } + + /// + /// Creates a new CodedOutputStream which write to the given stream. + /// + public static CodedOutputStream CreateInstance(Stream output) + { + return CreateInstance(output, DefaultBufferSize); + } + + /// + /// Creates a new CodedOutputStream which write to the given stream and uses + /// the specified buffer size. + /// + public static CodedOutputStream CreateInstance(Stream output, int bufferSize) + { + return new CodedOutputStream(output, new byte[bufferSize]); + } + + /// + /// Creates a new CodedOutputStream that writes directly to the given + /// byte array. If more bytes are written than fit in the array, + /// OutOfSpaceException will be thrown. + /// + public static CodedOutputStream CreateInstance(byte[] flatArray) + { + return CreateInstance(flatArray, 0, flatArray.Length); + } + + /// + /// Creates a new CodedOutputStream that writes directly to the given + /// byte array slice. If more bytes are written than fit in the array, + /// OutOfSpaceException will be thrown. + /// + public static CodedOutputStream CreateInstance(byte[] flatArray, int offset, int length) + { + return new CodedOutputStream(flatArray, offset, length); + } + + #endregion + + /// + /// Returns the current position in the stream, or the position in the output buffer + /// + public long Position + { + get + { + if (output != null) + { + return output.Position + position; + } + return position; + } + } + + void ICodedOutputStream.WriteMessageStart() { } + void ICodedOutputStream.WriteMessageEnd() { Flush(); } + + #region Writing of unknown fields + + [Obsolete] + public void WriteUnknownGroup(int fieldNumber, IMessageLite value) + { + WriteTag(fieldNumber, WireFormat.WireType.StartGroup); + value.WriteTo(this); + WriteTag(fieldNumber, WireFormat.WireType.EndGroup); + } + + public void WriteUnknownBytes(int fieldNumber, ByteString value) + { + WriteBytes(fieldNumber, null /*not used*/, value); + } + + [CLSCompliant(false)] + public void WriteUnknownField(int fieldNumber, WireFormat.WireType wireType, ulong value) + { + if (wireType == WireFormat.WireType.Varint) + { + WriteUInt64(fieldNumber, null /*not used*/, value); + } + else if (wireType == WireFormat.WireType.Fixed32) + { + WriteFixed32(fieldNumber, null /*not used*/, (uint) value); + } + else if (wireType == WireFormat.WireType.Fixed64) + { + WriteFixed64(fieldNumber, null /*not used*/, value); + } + else + { + throw InvalidProtocolBufferException.InvalidWireType(); + } + } + + #endregion + + #region Writing of tags and fields + + public void WriteField(FieldType fieldType, int fieldNumber, string fieldName, object value) + { + switch (fieldType) + { + case FieldType.String: + WriteString(fieldNumber, fieldName, (string) value); + break; + case FieldType.Message: + WriteMessage(fieldNumber, fieldName, (IMessageLite) value); + break; + case FieldType.Group: + WriteGroup(fieldNumber, fieldName, (IMessageLite) value); + break; + case FieldType.Bytes: + WriteBytes(fieldNumber, fieldName, (ByteString) value); + break; + case FieldType.Bool: + WriteBool(fieldNumber, fieldName, (bool) value); + break; + case FieldType.Enum: + if (value is Enum) + { + WriteEnum(fieldNumber, fieldName, (int) value, null /*not used*/); + } + else + { + WriteEnum(fieldNumber, fieldName, ((IEnumLite) value).Number, null /*not used*/); + } + break; + case FieldType.Int32: + WriteInt32(fieldNumber, fieldName, (int) value); + break; + case FieldType.Int64: + WriteInt64(fieldNumber, fieldName, (long) value); + break; + case FieldType.UInt32: + WriteUInt32(fieldNumber, fieldName, (uint) value); + break; + case FieldType.UInt64: + WriteUInt64(fieldNumber, fieldName, (ulong) value); + break; + case FieldType.SInt32: + WriteSInt32(fieldNumber, fieldName, (int) value); + break; + case FieldType.SInt64: + WriteSInt64(fieldNumber, fieldName, (long) value); + break; + case FieldType.Fixed32: + WriteFixed32(fieldNumber, fieldName, (uint) value); + break; + case FieldType.Fixed64: + WriteFixed64(fieldNumber, fieldName, (ulong) value); + break; + case FieldType.SFixed32: + WriteSFixed32(fieldNumber, fieldName, (int) value); + break; + case FieldType.SFixed64: + WriteSFixed64(fieldNumber, fieldName, (long) value); + break; + case FieldType.Double: + WriteDouble(fieldNumber, fieldName, (double) value); + break; + case FieldType.Float: + WriteFloat(fieldNumber, fieldName, (float) value); + break; + } + } + + /// + /// Writes a double field value, including tag, to the stream. + /// + public void WriteDouble(int fieldNumber, string fieldName, double value) + { + WriteTag(fieldNumber, WireFormat.WireType.Fixed64); + WriteDoubleNoTag(value); + } + + /// + /// Writes a float field value, including tag, to the stream. + /// + public void WriteFloat(int fieldNumber, string fieldName, float value) + { + WriteTag(fieldNumber, WireFormat.WireType.Fixed32); + WriteFloatNoTag(value); + } + + /// + /// Writes a uint64 field value, including tag, to the stream. + /// + [CLSCompliant(false)] + public void WriteUInt64(int fieldNumber, string fieldName, ulong value) + { + WriteTag(fieldNumber, WireFormat.WireType.Varint); + WriteRawVarint64(value); + } + + /// + /// Writes an int64 field value, including tag, to the stream. + /// + public void WriteInt64(int fieldNumber, string fieldName, long value) + { + WriteTag(fieldNumber, WireFormat.WireType.Varint); + WriteRawVarint64((ulong) value); + } + + /// + /// Writes an int32 field value, including tag, to the stream. + /// + public void WriteInt32(int fieldNumber, string fieldName, int value) + { + WriteTag(fieldNumber, WireFormat.WireType.Varint); + if (value >= 0) + { + WriteRawVarint32((uint) value); + } + else + { + // Must sign-extend. + WriteRawVarint64((ulong) value); + } + } + + /// + /// Writes a fixed64 field value, including tag, to the stream. + /// + [CLSCompliant(false)] + public void WriteFixed64(int fieldNumber, string fieldName, ulong value) + { + WriteTag(fieldNumber, WireFormat.WireType.Fixed64); + WriteRawLittleEndian64(value); + } + + /// + /// Writes a fixed32 field value, including tag, to the stream. + /// + [CLSCompliant(false)] + public void WriteFixed32(int fieldNumber, string fieldName, uint value) + { + WriteTag(fieldNumber, WireFormat.WireType.Fixed32); + WriteRawLittleEndian32(value); + } + + /// + /// Writes a bool field value, including tag, to the stream. + /// + public void WriteBool(int fieldNumber, string fieldName, bool value) + { + WriteTag(fieldNumber, WireFormat.WireType.Varint); + WriteRawByte(value ? (byte) 1 : (byte) 0); + } + + /// + /// Writes a string field value, including tag, to the stream. + /// + public void WriteString(int fieldNumber, string fieldName, string value) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + // Optimise the case where we have enough space to write + // the string directly to the buffer, which should be common. + int length = Encoding.UTF8.GetByteCount(value); + WriteRawVarint32((uint) length); + if (limit - position >= length) + { + Encoding.UTF8.GetBytes(value, 0, value.Length, buffer, position); + position += length; + } + else + { + byte[] bytes = Encoding.UTF8.GetBytes(value); + WriteRawBytes(bytes); + } + } + + /// + /// Writes a group field value, including tag, to the stream. + /// + public void WriteGroup(int fieldNumber, string fieldName, IMessageLite value) + { + WriteTag(fieldNumber, WireFormat.WireType.StartGroup); + value.WriteTo(this); + WriteTag(fieldNumber, WireFormat.WireType.EndGroup); + } + + public void WriteMessage(int fieldNumber, string fieldName, IMessageLite value) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) value.SerializedSize); + value.WriteTo(this); + } + + public void WriteBytes(int fieldNumber, string fieldName, ByteString value) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) value.Length); + value.WriteRawBytesTo(this); + } + + [CLSCompliant(false)] + public void WriteUInt32(int fieldNumber, string fieldName, uint value) + { + WriteTag(fieldNumber, WireFormat.WireType.Varint); + WriteRawVarint32(value); + } + + public void WriteEnum(int fieldNumber, string fieldName, int value, object rawValue) + { + WriteTag(fieldNumber, WireFormat.WireType.Varint); + WriteInt32NoTag(value); + } + + public void WriteSFixed32(int fieldNumber, string fieldName, int value) + { + WriteTag(fieldNumber, WireFormat.WireType.Fixed32); + WriteRawLittleEndian32((uint) value); + } + + public void WriteSFixed64(int fieldNumber, string fieldName, long value) + { + WriteTag(fieldNumber, WireFormat.WireType.Fixed64); + WriteRawLittleEndian64((ulong) value); + } + + public void WriteSInt32(int fieldNumber, string fieldName, int value) + { + WriteTag(fieldNumber, WireFormat.WireType.Varint); + WriteRawVarint32(EncodeZigZag32(value)); + } + + public void WriteSInt64(int fieldNumber, string fieldName, long value) + { + WriteTag(fieldNumber, WireFormat.WireType.Varint); + WriteRawVarint64(EncodeZigZag64(value)); + } + + public void WriteMessageSetExtension(int fieldNumber, string fieldName, IMessageLite value) + { + WriteTag(WireFormat.MessageSetField.Item, WireFormat.WireType.StartGroup); + WriteUInt32(WireFormat.MessageSetField.TypeID, "type_id", (uint) fieldNumber); + WriteMessage(WireFormat.MessageSetField.Message, "message", value); + WriteTag(WireFormat.MessageSetField.Item, WireFormat.WireType.EndGroup); + } + + public void WriteMessageSetExtension(int fieldNumber, string fieldName, ByteString value) + { + WriteTag(WireFormat.MessageSetField.Item, WireFormat.WireType.StartGroup); + WriteUInt32(WireFormat.MessageSetField.TypeID, "type_id", (uint) fieldNumber); + WriteBytes(WireFormat.MessageSetField.Message, "message", value); + WriteTag(WireFormat.MessageSetField.Item, WireFormat.WireType.EndGroup); + } + + #endregion + + #region Writing of values without tags + + public void WriteFieldNoTag(FieldType fieldType, object value) + { + switch (fieldType) + { + case FieldType.String: + WriteStringNoTag((string) value); + break; + case FieldType.Message: + WriteMessageNoTag((IMessageLite) value); + break; + case FieldType.Group: + WriteGroupNoTag((IMessageLite) value); + break; + case FieldType.Bytes: + WriteBytesNoTag((ByteString) value); + break; + case FieldType.Bool: + WriteBoolNoTag((bool) value); + break; + case FieldType.Enum: + if (value is Enum) + { + WriteEnumNoTag((int) value); + } + else + { + WriteEnumNoTag(((IEnumLite) value).Number); + } + break; + case FieldType.Int32: + WriteInt32NoTag((int) value); + break; + case FieldType.Int64: + WriteInt64NoTag((long) value); + break; + case FieldType.UInt32: + WriteUInt32NoTag((uint) value); + break; + case FieldType.UInt64: + WriteUInt64NoTag((ulong) value); + break; + case FieldType.SInt32: + WriteSInt32NoTag((int) value); + break; + case FieldType.SInt64: + WriteSInt64NoTag((long) value); + break; + case FieldType.Fixed32: + WriteFixed32NoTag((uint) value); + break; + case FieldType.Fixed64: + WriteFixed64NoTag((ulong) value); + break; + case FieldType.SFixed32: + WriteSFixed32NoTag((int) value); + break; + case FieldType.SFixed64: + WriteSFixed64NoTag((long) value); + break; + case FieldType.Double: + WriteDoubleNoTag((double) value); + break; + case FieldType.Float: + WriteFloatNoTag((float) value); + break; + } + } + + /// + /// Writes a double field value, including tag, to the stream. + /// + public void WriteDoubleNoTag(double value) + { + WriteRawLittleEndian64((ulong)FrameworkPortability.DoubleToInt64(value)); + } + + /// + /// Writes a float field value, without a tag, to the stream. + /// + public void WriteFloatNoTag(float value) + { + byte[] rawBytes = BitConverter.GetBytes(value); + if (!BitConverter.IsLittleEndian) + { + ByteArray.Reverse(rawBytes); + } + + if (limit - position >= 4) + { + buffer[position++] = rawBytes[0]; + buffer[position++] = rawBytes[1]; + buffer[position++] = rawBytes[2]; + buffer[position++] = rawBytes[3]; + } + else + { + WriteRawBytes(rawBytes, 0, 4); + } + } + + /// + /// Writes a uint64 field value, without a tag, to the stream. + /// + [CLSCompliant(false)] + public void WriteUInt64NoTag(ulong value) + { + WriteRawVarint64(value); + } + + /// + /// Writes an int64 field value, without a tag, to the stream. + /// + public void WriteInt64NoTag(long value) + { + WriteRawVarint64((ulong) value); + } + + /// + /// Writes an int32 field value, without a tag, to the stream. + /// + public void WriteInt32NoTag(int value) + { + if (value >= 0) + { + WriteRawVarint32((uint) value); + } + else + { + // Must sign-extend. + WriteRawVarint64((ulong) value); + } + } + + /// + /// Writes a fixed64 field value, without a tag, to the stream. + /// + [CLSCompliant(false)] + public void WriteFixed64NoTag(ulong value) + { + WriteRawLittleEndian64(value); + } + + /// + /// Writes a fixed32 field value, without a tag, to the stream. + /// + [CLSCompliant(false)] + public void WriteFixed32NoTag(uint value) + { + WriteRawLittleEndian32(value); + } + + /// + /// Writes a bool field value, without a tag, to the stream. + /// + public void WriteBoolNoTag(bool value) + { + WriteRawByte(value ? (byte) 1 : (byte) 0); + } + + /// + /// Writes a string field value, without a tag, to the stream. + /// + public void WriteStringNoTag(string value) + { + // Optimise the case where we have enough space to write + // the string directly to the buffer, which should be common. + int length = Encoding.UTF8.GetByteCount(value); + WriteRawVarint32((uint) length); + if (limit - position >= length) + { + Encoding.UTF8.GetBytes(value, 0, value.Length, buffer, position); + position += length; + } + else + { + byte[] bytes = Encoding.UTF8.GetBytes(value); + WriteRawBytes(bytes); + } + } + + /// + /// Writes a group field value, without a tag, to the stream. + /// + public void WriteGroupNoTag(IMessageLite value) + { + value.WriteTo(this); + } + + public void WriteMessageNoTag(IMessageLite value) + { + WriteRawVarint32((uint) value.SerializedSize); + value.WriteTo(this); + } + + public void WriteBytesNoTag(ByteString value) + { + WriteRawVarint32((uint) value.Length); + value.WriteRawBytesTo(this); + } + + [CLSCompliant(false)] + public void WriteUInt32NoTag(uint value) + { + WriteRawVarint32(value); + } + + public void WriteEnumNoTag(int value) + { + WriteInt32NoTag(value); + } + + public void WriteSFixed32NoTag(int value) + { + WriteRawLittleEndian32((uint) value); + } + + public void WriteSFixed64NoTag(long value) + { + WriteRawLittleEndian64((ulong) value); + } + + public void WriteSInt32NoTag(int value) + { + WriteRawVarint32(EncodeZigZag32(value)); + } + + public void WriteSInt64NoTag(long value) + { + WriteRawVarint64(EncodeZigZag64(value)); + } + + #endregion + + #region Write array members + + public void WriteArray(FieldType fieldType, int fieldNumber, string fieldName, IEnumerable list) + { + foreach (object element in list) + { + WriteField(fieldType, fieldNumber, fieldName, element); + } + } + + public void WriteGroupArray(int fieldNumber, string fieldName, IEnumerable list) + where T : IMessageLite + { + foreach (IMessageLite value in list) + { + WriteGroup(fieldNumber, fieldName, value); + } + } + + public void WriteMessageArray(int fieldNumber, string fieldName, IEnumerable list) + where T : IMessageLite + { + foreach (IMessageLite value in list) + { + WriteMessage(fieldNumber, fieldName, value); + } + } + + public void WriteStringArray(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteString(fieldNumber, fieldName, value); + } + } + + public void WriteBytesArray(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteBytes(fieldNumber, fieldName, value); + } + } + + public void WriteBoolArray(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteBool(fieldNumber, fieldName, value); + } + } + + public void WriteInt32Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteInt32(fieldNumber, fieldName, value); + } + } + + public void WriteSInt32Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteSInt32(fieldNumber, fieldName, value); + } + } + + public void WriteUInt32Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteUInt32(fieldNumber, fieldName, value); + } + } + + public void WriteFixed32Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteFixed32(fieldNumber, fieldName, value); + } + } + + public void WriteSFixed32Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteSFixed32(fieldNumber, fieldName, value); + } + } + + public void WriteInt64Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteInt64(fieldNumber, fieldName, value); + } + } + + public void WriteSInt64Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteSInt64(fieldNumber, fieldName, value); + } + } + + public void WriteUInt64Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteUInt64(fieldNumber, fieldName, value); + } + } + + public void WriteFixed64Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteFixed64(fieldNumber, fieldName, value); + } + } + + public void WriteSFixed64Array(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteSFixed64(fieldNumber, fieldName, value); + } + } + + public void WriteDoubleArray(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteDouble(fieldNumber, fieldName, value); + } + } + + public void WriteFloatArray(int fieldNumber, string fieldName, IEnumerable list) + { + foreach (var value in list) + { + WriteFloat(fieldNumber, fieldName, value); + } + } + + [CLSCompliant(false)] + public void WriteEnumArray(int fieldNumber, string fieldName, IEnumerable list) + where T : struct, IComparable, IFormattable + { + if (list is ICastArray) + { + foreach (int value in ((ICastArray) list).CastArray()) + { + WriteEnum(fieldNumber, fieldName, value, null /*unused*/); + } + } + else + { + foreach (object value in list) + { + WriteEnum(fieldNumber, fieldName, (int) value, null /*unused*/); + } + } + } + + #endregion + + #region Write packed array members + + public void WritePackedArray(FieldType fieldType, int fieldNumber, string fieldName, IEnumerable list) + { + int calculatedSize = 0; + foreach (object element in list) + { + calculatedSize += ComputeFieldSizeNoTag(fieldType, element); + } + + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + + foreach (object element in list) + { + WriteFieldNoTag(fieldType, element); + } + } + + public void WritePackedGroupArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + where T : IMessageLite + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (IMessageLite value in list) + { + WriteGroupNoTag(value); + } + } + + public void WritePackedMessageArray(int fieldNumber, string fieldName, int calculatedSize, + IEnumerable list) + where T : IMessageLite + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (IMessageLite value in list) + { + WriteMessageNoTag(value); + } + } + + public void WritePackedStringArray(int fieldNumber, string fieldName, int calculatedSize, + IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteStringNoTag(value); + } + } + + public void WritePackedBytesArray(int fieldNumber, string fieldName, int calculatedSize, + IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteBytesNoTag(value); + } + } + + public void WritePackedBoolArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteBoolNoTag(value); + } + } + + public void WritePackedInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteInt32NoTag(value); + } + } + + public void WritePackedSInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteSInt32NoTag(value); + } + } + + public void WritePackedUInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteUInt32NoTag(value); + } + } + + public void WritePackedFixed32Array(int fieldNumber, string fieldName, int calculatedSize, + IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteFixed32NoTag(value); + } + } + + public void WritePackedSFixed32Array(int fieldNumber, string fieldName, int calculatedSize, + IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteSFixed32NoTag(value); + } + } + + public void WritePackedInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteInt64NoTag(value); + } + } + + public void WritePackedSInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteSInt64NoTag(value); + } + } + + public void WritePackedUInt64Array(int fieldNumber, string fieldName, int calculatedSize, + IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteUInt64NoTag(value); + } + } + + public void WritePackedFixed64Array(int fieldNumber, string fieldName, int calculatedSize, + IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteFixed64NoTag(value); + } + } + + public void WritePackedSFixed64Array(int fieldNumber, string fieldName, int calculatedSize, + IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteSFixed64NoTag(value); + } + } + + public void WritePackedDoubleArray(int fieldNumber, string fieldName, int calculatedSize, + IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteDoubleNoTag(value); + } + } + + public void WritePackedFloatArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + foreach (var value in list) + { + WriteFloatNoTag(value); + } + } + + [CLSCompliant(false)] + public void WritePackedEnumArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + where T : struct, IComparable, IFormattable + { + WriteTag(fieldNumber, WireFormat.WireType.LengthDelimited); + WriteRawVarint32((uint) calculatedSize); + if (list is ICastArray) + { + foreach (int value in ((ICastArray) list).CastArray()) + { + WriteEnumNoTag(value); + } + } + else + { + foreach (object value in list) + { + WriteEnumNoTag((int) value); + } + } + } + + #endregion + + #region Underlying writing primitives + + /// + /// Encodes and writes a tag. + /// + [CLSCompliant(false)] + public void WriteTag(int fieldNumber, WireFormat.WireType type) + { + WriteRawVarint32(WireFormat.MakeTag(fieldNumber, type)); + } + + /// + /// Writes a 32 bit value as a varint. The fast route is taken when + /// there's enough buffer space left to whizz through without checking + /// for each byte; otherwise, we resort to calling WriteRawByte each time. + /// + [CLSCompliant(false)] + public void WriteRawVarint32(uint value) + { + while (value > 127 && position < limit) + { + buffer[position++] = (byte) ((value & 0x7F) | 0x80); + value >>= 7; + } + while (value > 127) + { + WriteRawByte((byte) ((value & 0x7F) | 0x80)); + value >>= 7; + } + if (position < limit) + { + buffer[position++] = (byte) value; + } + else + { + WriteRawByte((byte) value); + } + } + + [CLSCompliant(false)] + public void WriteRawVarint64(ulong value) + { + while (value > 127 && position < limit) + { + buffer[position++] = (byte) ((value & 0x7F) | 0x80); + value >>= 7; + } + while (value > 127) + { + WriteRawByte((byte) ((value & 0x7F) | 0x80)); + value >>= 7; + } + if (position < limit) + { + buffer[position++] = (byte) value; + } + else + { + WriteRawByte((byte) value); + } + } + + [CLSCompliant(false)] + public void WriteRawLittleEndian32(uint value) + { + if (position + 4 > limit) + { + WriteRawByte((byte) value); + WriteRawByte((byte) (value >> 8)); + WriteRawByte((byte) (value >> 16)); + WriteRawByte((byte) (value >> 24)); + } + else + { + buffer[position++] = ((byte) value); + buffer[position++] = ((byte) (value >> 8)); + buffer[position++] = ((byte) (value >> 16)); + buffer[position++] = ((byte) (value >> 24)); + } + } + + [CLSCompliant(false)] + public void WriteRawLittleEndian64(ulong value) + { + if (position + 8 > limit) + { + WriteRawByte((byte) value); + WriteRawByte((byte) (value >> 8)); + WriteRawByte((byte) (value >> 16)); + WriteRawByte((byte) (value >> 24)); + WriteRawByte((byte) (value >> 32)); + WriteRawByte((byte) (value >> 40)); + WriteRawByte((byte) (value >> 48)); + WriteRawByte((byte) (value >> 56)); + } + else + { + buffer[position++] = ((byte) value); + buffer[position++] = ((byte) (value >> 8)); + buffer[position++] = ((byte) (value >> 16)); + buffer[position++] = ((byte) (value >> 24)); + buffer[position++] = ((byte) (value >> 32)); + buffer[position++] = ((byte) (value >> 40)); + buffer[position++] = ((byte) (value >> 48)); + buffer[position++] = ((byte) (value >> 56)); + } + } + + public void WriteRawByte(byte value) + { + if (position == limit) + { + RefreshBuffer(); + } + + buffer[position++] = value; + } + + [CLSCompliant(false)] + public void WriteRawByte(uint value) + { + WriteRawByte((byte) value); + } + + /// + /// Writes out an array of bytes. + /// + public void WriteRawBytes(byte[] value) + { + WriteRawBytes(value, 0, value.Length); + } + + /// + /// Writes out part of an array of bytes. + /// + public void WriteRawBytes(byte[] value, int offset, int length) + { + if (limit - position >= length) + { + ByteArray.Copy(value, offset, buffer, position, length); + // We have room in the current buffer. + position += length; + } + else + { + // Write extends past current buffer. Fill the rest of this buffer and + // flush. + int bytesWritten = limit - position; + ByteArray.Copy(value, offset, buffer, position, bytesWritten); + offset += bytesWritten; + length -= bytesWritten; + position = limit; + RefreshBuffer(); + + // Now deal with the rest. + // Since we have an output stream, this is our buffer + // and buffer offset == 0 + if (length <= limit) + { + // Fits in new buffer. + ByteArray.Copy(value, offset, buffer, 0, length); + position = length; + } + else + { + // Write is very big. Let's do it all at once. + output.Write(value, offset, length); + } + } + } + + #endregion + + /// + /// Encode a 32-bit value with ZigZag encoding. + /// + /// + /// ZigZag encodes signed integers into values that can be efficiently + /// encoded with varint. (Otherwise, negative values must be + /// sign-extended to 64 bits to be varint encoded, thus always taking + /// 10 bytes on the wire.) + /// + [CLSCompliant(false)] + public static uint EncodeZigZag32(int n) + { + // Note: the right-shift must be arithmetic + return (uint) ((n << 1) ^ (n >> 31)); + } + + /// + /// Encode a 64-bit value with ZigZag encoding. + /// + /// + /// ZigZag encodes signed integers into values that can be efficiently + /// encoded with varint. (Otherwise, negative values must be + /// sign-extended to 64 bits to be varint encoded, thus always taking + /// 10 bytes on the wire.) + /// + [CLSCompliant(false)] + public static ulong EncodeZigZag64(long n) + { + return (ulong) ((n << 1) ^ (n >> 63)); + } + + private void RefreshBuffer() + { + if (output == null) + { + // We're writing to a single buffer. + throw new OutOfSpaceException(); + } + + // Since we have an output stream, this is our buffer + // and buffer offset == 0 + output.Write(buffer, 0, position); + position = 0; + } + + /// + /// Indicates that a CodedOutputStream wrapping a flat byte array + /// ran out of space. + /// + public sealed class OutOfSpaceException : IOException + { + internal OutOfSpaceException() + : base("CodedOutputStream was writing to a flat byte array and ran out of space.") + { + } + } + + public void Flush() + { + if (output != null) + { + RefreshBuffer(); + } + } + + /// + /// Verifies that SpaceLeft returns zero. It's common to create a byte array + /// that is exactly big enough to hold a message, then write to it with + /// a CodedOutputStream. Calling CheckNoSpaceLeft after writing verifies that + /// the message was actually as big as expected, which can help bugs. + /// + public void CheckNoSpaceLeft() + { + if (SpaceLeft != 0) + { + throw new InvalidOperationException("Did not write as much data as expected."); + } + } + + /// + /// If writing to a flat array, returns the space left in the array. Otherwise, + /// throws an InvalidOperationException. + /// + public int SpaceLeft + { + get + { + if (output == null) + { + return limit - position; + } + else + { + throw new InvalidOperationException( + "SpaceLeft can only be called on CodedOutputStreams that are " + + "writing to a flat array."); + } + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Collections/Dictionaries.cs b/csharp/src/ProtocolBuffers/Collections/Dictionaries.cs new file mode 100644 index 00000000..1f3791b1 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Collections/Dictionaries.cs @@ -0,0 +1,122 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Google.ProtocolBuffers.Collections +{ + /// + /// Utility class for dictionaries. + /// + public static class Dictionaries + { + /// + /// Compares two dictionaries for equality. Each value is compared with equality using Equals + /// for non-IEnumerable implementations, and using EnumerableEquals otherwise. + /// TODO(jonskeet): This is clearly pretty slow, and involves lots of boxing/unboxing... + /// + public static bool Equals(IDictionary left, IDictionary right) + { + if (left.Count != right.Count) + { + return false; + } + foreach (KeyValuePair leftEntry in left) + { + TValue rightValue; + if (!right.TryGetValue(leftEntry.Key, out rightValue)) + { + return false; + } + + IEnumerable leftEnumerable = leftEntry.Value as IEnumerable; + IEnumerable rightEnumerable = rightValue as IEnumerable; + if (leftEnumerable == null || rightEnumerable == null) + { + if (!Equals(leftEntry.Value, rightValue)) + { + return false; + } + } + else + { + if (!Enumerables.Equals(leftEnumerable, rightEnumerable)) + { + return false; + } + } + } + return true; + } + + public static IDictionary AsReadOnly(IDictionary dictionary) + { + return dictionary.IsReadOnly ? dictionary : new ReadOnlyDictionary(dictionary); + } + + /// + /// Creates a hashcode for a dictionary by XORing the hashcodes of all the fields + /// and values. (By XORing, we avoid ordering issues.) + /// TODO(jonskeet): Currently XORs other stuff too, and assumes non-null values. + /// + public static int GetHashCode(IDictionary dictionary) + { + int ret = 31; + foreach (KeyValuePair entry in dictionary) + { + int hash = entry.Key.GetHashCode() ^ GetDeepHashCode(entry.Value); + ret ^= hash; + } + return ret; + } + + /// + /// Determines the hash of a value by either taking it directly or hashing all the elements + /// for IEnumerable implementations. + /// + private static int GetDeepHashCode(object value) + { + IEnumerable iterable = value as IEnumerable; + if (iterable == null) + { + return value.GetHashCode(); + } + int hash = 29; + foreach (object element in iterable) + { + hash = hash*37 + element.GetHashCode(); + } + return hash; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Collections/Enumerables.cs b/csharp/src/ProtocolBuffers/Collections/Enumerables.cs new file mode 100644 index 00000000..7ad9a832 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Collections/Enumerables.cs @@ -0,0 +1,74 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections; + +namespace Google.ProtocolBuffers.Collections +{ + /// + /// Utility class for IEnumerable (and potentially the generic version in the future). + /// + public static class Enumerables + { + public static bool Equals(IEnumerable left, IEnumerable right) + { + IEnumerator leftEnumerator = left.GetEnumerator(); + try + { + foreach (object rightObject in right) + { + if (!leftEnumerator.MoveNext()) + { + return false; + } + if (!Equals(leftEnumerator.Current, rightObject)) + { + return false; + } + } + if (leftEnumerator.MoveNext()) + { + return false; + } + } + finally + { + IDisposable leftEnumeratorDisposable = leftEnumerator as IDisposable; + if (leftEnumeratorDisposable != null) + { + leftEnumeratorDisposable.Dispose(); + } + } + return true; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Collections/IPopsicleList.cs b/csharp/src/ProtocolBuffers/Collections/IPopsicleList.cs new file mode 100644 index 00000000..a1a75815 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Collections/IPopsicleList.cs @@ -0,0 +1,58 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System.Collections.Generic; + +namespace Google.ProtocolBuffers.Collections +{ + /// + /// A list which has an Add method which accepts an IEnumerable[T]. + /// This allows whole collections to be added easily using collection initializers. + /// It causes a potential overload confusion if T : IEnumerable[T], but in + /// practice that won't happen in protocol buffers. + /// + /// This is only currently implemented by PopsicleList, and it's likely + /// to stay that way - hence the name. More genuinely descriptive names are + /// horribly ugly. (At least, the ones the author could think of...) + /// The element type of the list + public interface IPopsicleList : IList + { + void Add(IEnumerable collection); + } + + /// + /// Used to efficiently cast the elements of enumerations + /// + internal interface ICastArray + { + IEnumerable CastArray(); + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Collections/Lists.cs b/csharp/src/ProtocolBuffers/Collections/Lists.cs new file mode 100644 index 00000000..a24e1d9b --- /dev/null +++ b/csharp/src/ProtocolBuffers/Collections/Lists.cs @@ -0,0 +1,110 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Google.ProtocolBuffers.Collections +{ + /// + /// Utility non-generic class for calling into Lists{T} using type inference. + /// + public static class Lists + { + /// + /// Returns a read-only view of the specified list. + /// + public static IList AsReadOnly(IList list) + { + return Lists.AsReadOnly(list); + } + + public static bool Equals(IList left, IList right) + { + if (left == right) + { + return true; + } + if (left == null || right == null) + { + return false; + } + if (left.Count != right.Count) + { + return false; + } + IEqualityComparer comparer = EqualityComparer.Default; + for (int i = 0; i < left.Count; i++) + { + if (!comparer.Equals(left[i], right[i])) + { + return false; + } + } + return true; + } + + public static int GetHashCode(IList list) + { + int hash = 31; + foreach (T element in list) + { + hash = hash*29 + element.GetHashCode(); + } + return hash; + } + } + + /// + /// Utility class for dealing with lists. + /// + public static class Lists + { + private static readonly ReadOnlyCollection empty = new ReadOnlyCollection(new T[0]); + + /// + /// Returns an immutable empty list. + /// + public static ReadOnlyCollection Empty + { + get { return empty; } + } + + /// + /// Returns either the original reference if it's already read-only, + /// or a new ReadOnlyCollection wrapping the original list. + /// + public static IList AsReadOnly(IList list) + { + return list.IsReadOnly ? list : new ReadOnlyCollection(list); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Collections/PopsicleList.cs b/csharp/src/ProtocolBuffers/Collections/PopsicleList.cs new file mode 100644 index 00000000..3de97f89 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Collections/PopsicleList.cs @@ -0,0 +1,208 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Google.ProtocolBuffers.Collections +{ + /// + /// Proxies calls to a , but allows the list + /// to be made read-only (with the method), + /// after which any modifying methods throw . + /// + public sealed class PopsicleList : IPopsicleList, ICastArray + { + private static readonly bool CheckForNull = default(T) == null; + private static readonly T[] EmptySet = new T[0]; + + private List items; + private bool readOnly; + + /// + /// Makes this list read-only ("freezes the popsicle"). From this + /// point on, mutating methods (Clear, Add etc) will throw a + /// NotSupportedException. There is no way of "defrosting" the list afterwards. + /// + public void MakeReadOnly() + { + readOnly = true; + } + + public int IndexOf(T item) + { + return items == null ? -1 : items.IndexOf(item); + } + + public void Insert(int index, T item) + { + ValidateModification(); + if (CheckForNull) + { + ThrowHelper.ThrowIfNull(item); + } + items.Insert(index, item); + } + + public void RemoveAt(int index) + { + ValidateModification(); + items.RemoveAt(index); + } + + public T this[int index] + { + get + { + if (items == null) + { + throw new ArgumentOutOfRangeException(); + } + return items[index]; + } + set + { + ValidateModification(); + if (CheckForNull) + { + ThrowHelper.ThrowIfNull(value); + } + items[index] = value; + } + } + + public void Add(T item) + { + ValidateModification(); + if (CheckForNull) + { + ThrowHelper.ThrowIfNull(item); + } + items.Add(item); + } + + public void Clear() + { + ValidateModification(); + items.Clear(); + } + + public bool Contains(T item) + { + return items == null ? false : items.Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (items != null) + { + items.CopyTo(array, arrayIndex); + } + } + + public int Count + { + get { return items == null ? 0 : items.Count; } + } + + public bool IsReadOnly + { + get { return readOnly; } + } + + public bool Remove(T item) + { + ValidateModification(); + return items.Remove(item); + } + + public IEnumerator GetEnumerator() + { + IEnumerable tenum = (IEnumerable)items ?? EmptySet; + return tenum.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(IEnumerable collection) + { + ValidateModification(); + ThrowHelper.ThrowIfNull(collection); + + if (!CheckForNull || collection is PopsicleList) + { + items.AddRange(collection); + } + else + { + // Assumption, it's ok to enumerate collections more than once. + if (collection is ICollection) + { + ThrowHelper.ThrowIfAnyNull(collection); + items.AddRange(collection); + } + else + { + foreach (T item in collection) + { + ThrowHelper.ThrowIfNull(item); + items.Add(item); + } + } + } + } + + private void ValidateModification() + { + if (readOnly) + { + throw new NotSupportedException("List is read-only"); + } + if (items == null) + { + items = new List(); + } + } + + IEnumerable ICastArray.CastArray() + { + if (items == null) + { + return PopsicleList.EmptySet; + } + return (TItemType[]) (object) items.ToArray(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Collections/ReadOnlyDictionary.cs b/csharp/src/ProtocolBuffers/Collections/ReadOnlyDictionary.cs new file mode 100644 index 00000000..b0bc55ff --- /dev/null +++ b/csharp/src/ProtocolBuffers/Collections/ReadOnlyDictionary.cs @@ -0,0 +1,146 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Google.ProtocolBuffers.Collections +{ + /// + /// Read-only wrapper around another dictionary. + /// + public sealed class ReadOnlyDictionary : IDictionary + { + private readonly IDictionary wrapped; + + public ReadOnlyDictionary(IDictionary wrapped) + { + this.wrapped = wrapped; + } + + public void Add(TKey key, TValue value) + { + throw new InvalidOperationException(); + } + + public bool ContainsKey(TKey key) + { + return wrapped.ContainsKey(key); + } + + public ICollection Keys + { + get { return wrapped.Keys; } + } + + public bool Remove(TKey key) + { + throw new InvalidOperationException(); + } + + public bool TryGetValue(TKey key, out TValue value) + { + return wrapped.TryGetValue(key, out value); + } + + public ICollection Values + { + get { return wrapped.Values; } + } + + public TValue this[TKey key] + { + get { return wrapped[key]; } + set { throw new InvalidOperationException(); } + } + + public void Add(KeyValuePair item) + { + throw new InvalidOperationException(); + } + + public void Clear() + { + throw new InvalidOperationException(); + } + + public bool Contains(KeyValuePair item) + { + return wrapped.Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + wrapped.CopyTo(array, arrayIndex); + } + + public int Count + { + get { return wrapped.Count; } + } + + public bool IsReadOnly + { + get { return true; } + } + + public bool Remove(KeyValuePair item) + { + throw new InvalidOperationException(); + } + + public IEnumerator> GetEnumerator() + { + return wrapped.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return ((IEnumerable) wrapped).GetEnumerator(); + } + + public override bool Equals(object obj) + { + return wrapped.Equals(obj); + } + + public override int GetHashCode() + { + return wrapped.GetHashCode(); + } + + public override string ToString() + { + return wrapped.ToString(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/CustomSerialization.cs b/csharp/src/ProtocolBuffers/CustomSerialization.cs new file mode 100644 index 00000000..ae9fca22 --- /dev/null +++ b/csharp/src/ProtocolBuffers/CustomSerialization.cs @@ -0,0 +1,201 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 entire source file is not supported on some platform + */ +#if !NOSERIALIZABLE +using System; +using System.Security.Permissions; +using System.Runtime.Serialization; +using System.Security; + +namespace Google.ProtocolBuffers +{ + /* + * Specialized handing of *all* message types. Messages are serialized into a byte[] and stored + * into the SerializationInfo, and are then reconstituted by an IObjectReference class after + * deserialization. IDeserializationCallback is supported on both the Builder and Message. + */ + [Serializable] + partial class AbstractMessageLite : ISerializable + { + [SecurityCritical] + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] + void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) + { + info.SetType(typeof(SerializationSurrogate)); + info.AddValue("message", ToByteArray()); + info.AddValue("initialized", IsInitialized); + } + + [Serializable] + private sealed class SerializationSurrogate : IObjectReference, ISerializable + { + static readonly TBuilder TemplateInstance = (TBuilder)Activator.CreateInstance(typeof(TBuilder)); + private readonly byte[] _message; + private readonly bool _initialized; + + private SerializationSurrogate(SerializationInfo info, StreamingContext context) + { + _message = (byte[])info.GetValue("message", typeof(byte[])); + _initialized = info.GetBoolean("initialized"); + } + + [SecurityCritical] + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] + object IObjectReference.GetRealObject(StreamingContext context) + { + ExtensionRegistry registry = context.Context as ExtensionRegistry; + TBuilder builder = TemplateInstance.DefaultInstanceForType.CreateBuilderForType(); + builder.MergeFrom(_message, registry ?? ExtensionRegistry.Empty); + + IDeserializationCallback callback = builder as IDeserializationCallback; + if(callback != null) + { + callback.OnDeserialization(context); + } + + TMessage message = _initialized ? builder.Build() : builder.BuildPartial(); + callback = message as IDeserializationCallback; + if (callback != null) + { + callback.OnDeserialization(context); + } + + return message; + } + + [SecurityCritical] + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] + void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) + { + info.AddValue("message", _message); + } + } + } + + [Serializable] + partial class AbstractBuilderLite : ISerializable + { + [SecurityCritical] + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] + void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) + { + info.SetType(typeof(SerializationSurrogate)); + info.AddValue("message", Clone().BuildPartial().ToByteArray()); + } + + [Serializable] + private sealed class SerializationSurrogate : IObjectReference, ISerializable + { + static readonly TBuilder TemplateInstance = (TBuilder)Activator.CreateInstance(typeof(TBuilder)); + private readonly byte[] _message; + + private SerializationSurrogate(SerializationInfo info, StreamingContext context) + { + _message = (byte[])info.GetValue("message", typeof(byte[])); + } + + [SecurityCritical] + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] + object IObjectReference.GetRealObject(StreamingContext context) + { + ExtensionRegistry registry = context.Context as ExtensionRegistry; + TBuilder builder = TemplateInstance.DefaultInstanceForType.CreateBuilderForType(); + builder.MergeFrom(_message, registry ?? ExtensionRegistry.Empty); + + IDeserializationCallback callback = builder as IDeserializationCallback; + if(callback != null) + { + callback.OnDeserialization(context); + } + + return builder; + } + + [SecurityCritical] + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] + void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) + { + info.AddValue("message", _message); + } + } + } + + /* + * Spread some attribute love around, keeping this all here so we don't use conditional compliation + * in every one of these classes. If we introduce a new platform that also does not support this + * we can control it all from this source file. + */ + + [Serializable] + partial class GeneratedMessageLite { } + + [Serializable] + partial class ExtendableMessageLite { } + + [Serializable] + partial class AbstractMessage { } + + [Serializable] + partial class GeneratedMessage { } + + [Serializable] + partial class ExtendableMessage { } + + [Serializable] + partial class GeneratedBuilderLite { } + + [Serializable] + partial class ExtendableBuilderLite { } + + [Serializable] + partial class AbstractBuilder { } + + [Serializable] + partial class GeneratedBuilder { } + + [Serializable] + partial class ExtendableBuilder { } + + [Serializable] + partial class DynamicMessage + { + [Serializable] + partial class Builder { } + } +} +#endif \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Delegates.cs b/csharp/src/ProtocolBuffers/Delegates.cs new file mode 100644 index 00000000..3b62bc0c --- /dev/null +++ b/csharp/src/ProtocolBuffers/Delegates.cs @@ -0,0 +1,54 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers +{ + /// + /// Delegate to return a stream when asked, used by MessageStreamIterator. + /// + public delegate Stream StreamProvider(); + + // These delegate declarations mirror the ones in .NET 3.5 for the sake of familiarity. + internal delegate TResult Func(); + + internal delegate TResult Func(T arg); + + internal delegate TResult Func(T1 arg1, T2 arg2); + + internal delegate void Action(T1 arg1, T2 arg2); +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs b/csharp/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs new file mode 100644 index 00000000..9a77d6e0 --- /dev/null +++ b/csharp/src/ProtocolBuffers/DescriptorProtos/CSharpOptions.cs @@ -0,0 +1,1887 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.DescriptorProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class CSharpOptions { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CSharpFileOptions); + registry.Add(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CSharpFieldOptions); + registry.Add(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CsharpServiceOptions); + registry.Add(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CsharpMethodOptions); + } + #endregion + #region Extensions + public const int CSharpFileOptionsFieldNumber = 1000; + public static pb::GeneratedExtensionBase CSharpFileOptions; + public const int CSharpFieldOptionsFieldNumber = 1000; + public static pb::GeneratedExtensionBase CSharpFieldOptions; + public const int CsharpServiceOptionsFieldNumber = 1000; + public static pb::GeneratedExtensionBase CsharpServiceOptions; + public const int CsharpMethodOptionsFieldNumber = 1000; + public static pb::GeneratedExtensionBase CsharpMethodOptions; + #endregion + + #region Static variables + internal static pbd::MessageDescriptor internal__static_google_protobuf_CSharpFileOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_CSharpFileOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_CSharpFieldOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_CSharpFieldOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_CSharpServiceOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_CSharpServiceOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_CSharpMethodOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_CSharpMethodOptions__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static CSharpOptions() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8SD2dvb2ds", + "ZS5wcm90b2J1ZhogZ29vZ2xlL3Byb3RvYnVmL2Rlc2NyaXB0b3IucHJvdG8i", + "pwQKEUNTaGFycEZpbGVPcHRpb25zEhEKCW5hbWVzcGFjZRgBIAEoCRIaChJ1", + "bWJyZWxsYV9jbGFzc25hbWUYAiABKAkSHAoOcHVibGljX2NsYXNzZXMYAyAB", + "KAg6BHRydWUSFgoObXVsdGlwbGVfZmlsZXMYBCABKAgSFAoMbmVzdF9jbGFz", + "c2VzGAUgASgIEhYKDmNvZGVfY29udHJhY3RzGAYgASgIEiQKHGV4cGFuZF9u", + "YW1lc3BhY2VfZGlyZWN0b3JpZXMYByABKAgSHAoOY2xzX2NvbXBsaWFuY2UY", + "CCABKAg6BHRydWUSHwoQYWRkX3NlcmlhbGl6YWJsZRgJIAEoCDoFZmFsc2US", + "IwoVZ2VuZXJhdGVfcHJpdmF0ZV9jdG9yGAogASgIOgR0cnVlEhwKDmZpbGVf", + "ZXh0ZW5zaW9uGN0BIAEoCToDLmNzEhsKEnVtYnJlbGxhX25hbWVzcGFjZRje", + "ASABKAkSHAoQb3V0cHV0X2RpcmVjdG9yeRjfASABKAk6AS4SJgoWaWdub3Jl", + "X2dvb2dsZV9wcm90b2J1ZhjgASABKAg6BWZhbHNlEkkKFnNlcnZpY2VfZ2Vu", + "ZXJhdG9yX3R5cGUY4QEgASgOMiIuZ29vZ2xlLnByb3RvYnVmLkNTaGFycFNl", + "cnZpY2VUeXBlOgROT05FEikKGWdlbmVyYXRlZF9jb2RlX2F0dHJpYnV0ZXMY", + "4gEgASgIOgVmYWxzZSIrChJDU2hhcnBGaWVsZE9wdGlvbnMSFQoNcHJvcGVy", + "dHlfbmFtZRgBIAEoCSIsChRDU2hhcnBTZXJ2aWNlT3B0aW9ucxIUCgxpbnRl", + "cmZhY2VfaWQYASABKAkiKgoTQ1NoYXJwTWV0aG9kT3B0aW9ucxITCgtkaXNw", + "YXRjaF9pZBgBIAEoBSpLChFDU2hhcnBTZXJ2aWNlVHlwZRIICgROT05FEAAS", + "CwoHR0VORVJJQxABEg0KCUlOVEVSRkFDRRACEhAKDElSUENESVNQQVRDSBAD", + "Ol4KE2NzaGFycF9maWxlX29wdGlvbnMSHC5nb29nbGUucHJvdG9idWYuRmls", + "ZU9wdGlvbnMY6AcgASgLMiIuZ29vZ2xlLnByb3RvYnVmLkNTaGFycEZpbGVP", + "cHRpb25zOmEKFGNzaGFycF9maWVsZF9vcHRpb25zEh0uZ29vZ2xlLnByb3Rv", + "YnVmLkZpZWxkT3B0aW9ucxjoByABKAsyIy5nb29nbGUucHJvdG9idWYuQ1No", + "YXJwRmllbGRPcHRpb25zOmcKFmNzaGFycF9zZXJ2aWNlX29wdGlvbnMSHy5n", + "b29nbGUucHJvdG9idWYuU2VydmljZU9wdGlvbnMY6AcgASgLMiUuZ29vZ2xl", + "LnByb3RvYnVmLkNTaGFycFNlcnZpY2VPcHRpb25zOmQKFWNzaGFycF9tZXRo", + "b2Rfb3B0aW9ucxIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zGOgH", + "IAEoCzIkLmdvb2dsZS5wcm90b2J1Zi5DU2hhcnBNZXRob2RPcHRpb25z")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_google_protobuf_CSharpFileOptions__Descriptor = Descriptor.MessageTypes[0]; + internal__static_google_protobuf_CSharpFileOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_CSharpFileOptions__Descriptor, + new string[] { "Namespace", "UmbrellaClassname", "PublicClasses", "MultipleFiles", "NestClasses", "CodeContracts", "ExpandNamespaceDirectories", "ClsCompliance", "AddSerializable", "GeneratePrivateCtor", "FileExtension", "UmbrellaNamespace", "OutputDirectory", "IgnoreGoogleProtobuf", "ServiceGeneratorType", "GeneratedCodeAttributes", }); + internal__static_google_protobuf_CSharpFieldOptions__Descriptor = Descriptor.MessageTypes[1]; + internal__static_google_protobuf_CSharpFieldOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_CSharpFieldOptions__Descriptor, + new string[] { "PropertyName", }); + internal__static_google_protobuf_CSharpServiceOptions__Descriptor = Descriptor.MessageTypes[2]; + internal__static_google_protobuf_CSharpServiceOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_CSharpServiceOptions__Descriptor, + new string[] { "InterfaceId", }); + internal__static_google_protobuf_CSharpMethodOptions__Descriptor = Descriptor.MessageTypes[3]; + internal__static_google_protobuf_CSharpMethodOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_CSharpMethodOptions__Descriptor, + new string[] { "DispatchId", }); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CSharpFileOptions = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CSharpFieldOptions = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor.Extensions[1]); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CsharpServiceOptions = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor.Extensions[2]); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.CsharpMethodOptions = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor.Extensions[3]); + return null; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum CSharpServiceType { + NONE = 0, + GENERIC = 1, + INTERFACE = 2, + IRPCDISPATCH = 3, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CSharpFileOptions : pb::GeneratedMessage { + private CSharpFileOptions() { } + private static readonly CSharpFileOptions defaultInstance = new CSharpFileOptions().MakeReadOnly(); + private static readonly string[] _cSharpFileOptionsFieldNames = new string[] { "add_serializable", "cls_compliance", "code_contracts", "expand_namespace_directories", "file_extension", "generate_private_ctor", "generated_code_attributes", "ignore_google_protobuf", "multiple_files", "namespace", "nest_classes", "output_directory", "public_classes", "service_generator_type", "umbrella_classname", "umbrella_namespace" }; + private static readonly uint[] _cSharpFileOptionsFieldTags = new uint[] { 72, 64, 48, 56, 1770, 80, 1808, 1792, 32, 10, 40, 1786, 24, 1800, 18, 1778 }; + public static CSharpFileOptions DefaultInstance { + get { return defaultInstance; } + } + + public override CSharpFileOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CSharpFileOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpFileOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpFileOptions__FieldAccessorTable; } + } + + public const int NamespaceFieldNumber = 1; + private bool hasNamespace; + private string namespace_ = ""; + public bool HasNamespace { + get { return hasNamespace; } + } + public string Namespace { + get { return namespace_; } + } + + public const int UmbrellaClassnameFieldNumber = 2; + private bool hasUmbrellaClassname; + private string umbrellaClassname_ = ""; + public bool HasUmbrellaClassname { + get { return hasUmbrellaClassname; } + } + public string UmbrellaClassname { + get { return umbrellaClassname_; } + } + + public const int PublicClassesFieldNumber = 3; + private bool hasPublicClasses; + private bool publicClasses_ = true; + public bool HasPublicClasses { + get { return hasPublicClasses; } + } + public bool PublicClasses { + get { return publicClasses_; } + } + + public const int MultipleFilesFieldNumber = 4; + private bool hasMultipleFiles; + private bool multipleFiles_; + public bool HasMultipleFiles { + get { return hasMultipleFiles; } + } + public bool MultipleFiles { + get { return multipleFiles_; } + } + + public const int NestClassesFieldNumber = 5; + private bool hasNestClasses; + private bool nestClasses_; + public bool HasNestClasses { + get { return hasNestClasses; } + } + public bool NestClasses { + get { return nestClasses_; } + } + + public const int CodeContractsFieldNumber = 6; + private bool hasCodeContracts; + private bool codeContracts_; + public bool HasCodeContracts { + get { return hasCodeContracts; } + } + public bool CodeContracts { + get { return codeContracts_; } + } + + public const int ExpandNamespaceDirectoriesFieldNumber = 7; + private bool hasExpandNamespaceDirectories; + private bool expandNamespaceDirectories_; + public bool HasExpandNamespaceDirectories { + get { return hasExpandNamespaceDirectories; } + } + public bool ExpandNamespaceDirectories { + get { return expandNamespaceDirectories_; } + } + + public const int ClsComplianceFieldNumber = 8; + private bool hasClsCompliance; + private bool clsCompliance_ = true; + public bool HasClsCompliance { + get { return hasClsCompliance; } + } + public bool ClsCompliance { + get { return clsCompliance_; } + } + + public const int AddSerializableFieldNumber = 9; + private bool hasAddSerializable; + private bool addSerializable_; + public bool HasAddSerializable { + get { return hasAddSerializable; } + } + public bool AddSerializable { + get { return addSerializable_; } + } + + public const int GeneratePrivateCtorFieldNumber = 10; + private bool hasGeneratePrivateCtor; + private bool generatePrivateCtor_ = true; + public bool HasGeneratePrivateCtor { + get { return hasGeneratePrivateCtor; } + } + public bool GeneratePrivateCtor { + get { return generatePrivateCtor_; } + } + + public const int FileExtensionFieldNumber = 221; + private bool hasFileExtension; + private string fileExtension_ = ".cs"; + public bool HasFileExtension { + get { return hasFileExtension; } + } + public string FileExtension { + get { return fileExtension_; } + } + + public const int UmbrellaNamespaceFieldNumber = 222; + private bool hasUmbrellaNamespace; + private string umbrellaNamespace_ = ""; + public bool HasUmbrellaNamespace { + get { return hasUmbrellaNamespace; } + } + public string UmbrellaNamespace { + get { return umbrellaNamespace_; } + } + + public const int OutputDirectoryFieldNumber = 223; + private bool hasOutputDirectory; + private string outputDirectory_ = "."; + public bool HasOutputDirectory { + get { return hasOutputDirectory; } + } + public string OutputDirectory { + get { return outputDirectory_; } + } + + public const int IgnoreGoogleProtobufFieldNumber = 224; + private bool hasIgnoreGoogleProtobuf; + private bool ignoreGoogleProtobuf_; + public bool HasIgnoreGoogleProtobuf { + get { return hasIgnoreGoogleProtobuf; } + } + public bool IgnoreGoogleProtobuf { + get { return ignoreGoogleProtobuf_; } + } + + public const int ServiceGeneratorTypeFieldNumber = 225; + private bool hasServiceGeneratorType; + private global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.NONE; + public bool HasServiceGeneratorType { + get { return hasServiceGeneratorType; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType ServiceGeneratorType { + get { return serviceGeneratorType_; } + } + + public const int GeneratedCodeAttributesFieldNumber = 226; + private bool hasGeneratedCodeAttributes; + private bool generatedCodeAttributes_; + public bool HasGeneratedCodeAttributes { + get { return hasGeneratedCodeAttributes; } + } + public bool GeneratedCodeAttributes { + get { return generatedCodeAttributes_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _cSharpFileOptionsFieldNames; + if (hasNamespace) { + output.WriteString(1, field_names[9], Namespace); + } + if (hasUmbrellaClassname) { + output.WriteString(2, field_names[14], UmbrellaClassname); + } + if (hasPublicClasses) { + output.WriteBool(3, field_names[12], PublicClasses); + } + if (hasMultipleFiles) { + output.WriteBool(4, field_names[8], MultipleFiles); + } + if (hasNestClasses) { + output.WriteBool(5, field_names[10], NestClasses); + } + if (hasCodeContracts) { + output.WriteBool(6, field_names[2], CodeContracts); + } + if (hasExpandNamespaceDirectories) { + output.WriteBool(7, field_names[3], ExpandNamespaceDirectories); + } + if (hasClsCompliance) { + output.WriteBool(8, field_names[1], ClsCompliance); + } + if (hasAddSerializable) { + output.WriteBool(9, field_names[0], AddSerializable); + } + if (hasGeneratePrivateCtor) { + output.WriteBool(10, field_names[5], GeneratePrivateCtor); + } + if (hasFileExtension) { + output.WriteString(221, field_names[4], FileExtension); + } + if (hasUmbrellaNamespace) { + output.WriteString(222, field_names[15], UmbrellaNamespace); + } + if (hasOutputDirectory) { + output.WriteString(223, field_names[11], OutputDirectory); + } + if (hasIgnoreGoogleProtobuf) { + output.WriteBool(224, field_names[7], IgnoreGoogleProtobuf); + } + if (hasServiceGeneratorType) { + output.WriteEnum(225, field_names[13], (int) ServiceGeneratorType, ServiceGeneratorType); + } + if (hasGeneratedCodeAttributes) { + output.WriteBool(226, field_names[6], GeneratedCodeAttributes); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasNamespace) { + size += pb::CodedOutputStream.ComputeStringSize(1, Namespace); + } + if (hasUmbrellaClassname) { + size += pb::CodedOutputStream.ComputeStringSize(2, UmbrellaClassname); + } + if (hasPublicClasses) { + size += pb::CodedOutputStream.ComputeBoolSize(3, PublicClasses); + } + if (hasMultipleFiles) { + size += pb::CodedOutputStream.ComputeBoolSize(4, MultipleFiles); + } + if (hasNestClasses) { + size += pb::CodedOutputStream.ComputeBoolSize(5, NestClasses); + } + if (hasCodeContracts) { + size += pb::CodedOutputStream.ComputeBoolSize(6, CodeContracts); + } + if (hasExpandNamespaceDirectories) { + size += pb::CodedOutputStream.ComputeBoolSize(7, ExpandNamespaceDirectories); + } + if (hasClsCompliance) { + size += pb::CodedOutputStream.ComputeBoolSize(8, ClsCompliance); + } + if (hasAddSerializable) { + size += pb::CodedOutputStream.ComputeBoolSize(9, AddSerializable); + } + if (hasGeneratePrivateCtor) { + size += pb::CodedOutputStream.ComputeBoolSize(10, GeneratePrivateCtor); + } + if (hasFileExtension) { + size += pb::CodedOutputStream.ComputeStringSize(221, FileExtension); + } + if (hasUmbrellaNamespace) { + size += pb::CodedOutputStream.ComputeStringSize(222, UmbrellaNamespace); + } + if (hasOutputDirectory) { + size += pb::CodedOutputStream.ComputeStringSize(223, OutputDirectory); + } + if (hasIgnoreGoogleProtobuf) { + size += pb::CodedOutputStream.ComputeBoolSize(224, IgnoreGoogleProtobuf); + } + if (hasServiceGeneratorType) { + size += pb::CodedOutputStream.ComputeEnumSize(225, (int) ServiceGeneratorType); + } + if (hasGeneratedCodeAttributes) { + size += pb::CodedOutputStream.ComputeBoolSize(226, GeneratedCodeAttributes); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static CSharpFileOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CSharpFileOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CSharpFileOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CSharpFileOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CSharpFileOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CSharpFileOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CSharpFileOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CSharpFileOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CSharpFileOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CSharpFileOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CSharpFileOptions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CSharpFileOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CSharpFileOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CSharpFileOptions result; + + private CSharpFileOptions PrepareBuilder() { + if (resultIsReadOnly) { + CSharpFileOptions original = result; + result = new CSharpFileOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CSharpFileOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions.Descriptor; } + } + + public override CSharpFileOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions.DefaultInstance; } + } + + public override CSharpFileOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CSharpFileOptions) { + return MergeFrom((CSharpFileOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CSharpFileOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpFileOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasNamespace) { + Namespace = other.Namespace; + } + if (other.HasUmbrellaClassname) { + UmbrellaClassname = other.UmbrellaClassname; + } + if (other.HasPublicClasses) { + PublicClasses = other.PublicClasses; + } + if (other.HasMultipleFiles) { + MultipleFiles = other.MultipleFiles; + } + if (other.HasNestClasses) { + NestClasses = other.NestClasses; + } + if (other.HasCodeContracts) { + CodeContracts = other.CodeContracts; + } + if (other.HasExpandNamespaceDirectories) { + ExpandNamespaceDirectories = other.ExpandNamespaceDirectories; + } + if (other.HasClsCompliance) { + ClsCompliance = other.ClsCompliance; + } + if (other.HasAddSerializable) { + AddSerializable = other.AddSerializable; + } + if (other.HasGeneratePrivateCtor) { + GeneratePrivateCtor = other.GeneratePrivateCtor; + } + if (other.HasFileExtension) { + FileExtension = other.FileExtension; + } + if (other.HasUmbrellaNamespace) { + UmbrellaNamespace = other.UmbrellaNamespace; + } + if (other.HasOutputDirectory) { + OutputDirectory = other.OutputDirectory; + } + if (other.HasIgnoreGoogleProtobuf) { + IgnoreGoogleProtobuf = other.IgnoreGoogleProtobuf; + } + if (other.HasServiceGeneratorType) { + ServiceGeneratorType = other.ServiceGeneratorType; + } + if (other.HasGeneratedCodeAttributes) { + GeneratedCodeAttributes = other.GeneratedCodeAttributes; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_cSharpFileOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _cSharpFileOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasNamespace = input.ReadString(ref result.namespace_); + break; + } + case 18: { + result.hasUmbrellaClassname = input.ReadString(ref result.umbrellaClassname_); + break; + } + case 24: { + result.hasPublicClasses = input.ReadBool(ref result.publicClasses_); + break; + } + case 32: { + result.hasMultipleFiles = input.ReadBool(ref result.multipleFiles_); + break; + } + case 40: { + result.hasNestClasses = input.ReadBool(ref result.nestClasses_); + break; + } + case 48: { + result.hasCodeContracts = input.ReadBool(ref result.codeContracts_); + break; + } + case 56: { + result.hasExpandNamespaceDirectories = input.ReadBool(ref result.expandNamespaceDirectories_); + break; + } + case 64: { + result.hasClsCompliance = input.ReadBool(ref result.clsCompliance_); + break; + } + case 72: { + result.hasAddSerializable = input.ReadBool(ref result.addSerializable_); + break; + } + case 80: { + result.hasGeneratePrivateCtor = input.ReadBool(ref result.generatePrivateCtor_); + break; + } + case 1770: { + result.hasFileExtension = input.ReadString(ref result.fileExtension_); + break; + } + case 1778: { + result.hasUmbrellaNamespace = input.ReadString(ref result.umbrellaNamespace_); + break; + } + case 1786: { + result.hasOutputDirectory = input.ReadString(ref result.outputDirectory_); + break; + } + case 1792: { + result.hasIgnoreGoogleProtobuf = input.ReadBool(ref result.ignoreGoogleProtobuf_); + break; + } + case 1800: { + object unknown; + if(input.ReadEnum(ref result.serviceGeneratorType_, out unknown)) { + result.hasServiceGeneratorType = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(225, (ulong)(int)unknown); + } + break; + } + case 1808: { + result.hasGeneratedCodeAttributes = input.ReadBool(ref result.generatedCodeAttributes_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasNamespace { + get { return result.hasNamespace; } + } + public string Namespace { + get { return result.Namespace; } + set { SetNamespace(value); } + } + public Builder SetNamespace(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasNamespace = true; + result.namespace_ = value; + return this; + } + public Builder ClearNamespace() { + PrepareBuilder(); + result.hasNamespace = false; + result.namespace_ = ""; + return this; + } + + public bool HasUmbrellaClassname { + get { return result.hasUmbrellaClassname; } + } + public string UmbrellaClassname { + get { return result.UmbrellaClassname; } + set { SetUmbrellaClassname(value); } + } + public Builder SetUmbrellaClassname(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasUmbrellaClassname = true; + result.umbrellaClassname_ = value; + return this; + } + public Builder ClearUmbrellaClassname() { + PrepareBuilder(); + result.hasUmbrellaClassname = false; + result.umbrellaClassname_ = ""; + return this; + } + + public bool HasPublicClasses { + get { return result.hasPublicClasses; } + } + public bool PublicClasses { + get { return result.PublicClasses; } + set { SetPublicClasses(value); } + } + public Builder SetPublicClasses(bool value) { + PrepareBuilder(); + result.hasPublicClasses = true; + result.publicClasses_ = value; + return this; + } + public Builder ClearPublicClasses() { + PrepareBuilder(); + result.hasPublicClasses = false; + result.publicClasses_ = true; + return this; + } + + public bool HasMultipleFiles { + get { return result.hasMultipleFiles; } + } + public bool MultipleFiles { + get { return result.MultipleFiles; } + set { SetMultipleFiles(value); } + } + public Builder SetMultipleFiles(bool value) { + PrepareBuilder(); + result.hasMultipleFiles = true; + result.multipleFiles_ = value; + return this; + } + public Builder ClearMultipleFiles() { + PrepareBuilder(); + result.hasMultipleFiles = false; + result.multipleFiles_ = false; + return this; + } + + public bool HasNestClasses { + get { return result.hasNestClasses; } + } + public bool NestClasses { + get { return result.NestClasses; } + set { SetNestClasses(value); } + } + public Builder SetNestClasses(bool value) { + PrepareBuilder(); + result.hasNestClasses = true; + result.nestClasses_ = value; + return this; + } + public Builder ClearNestClasses() { + PrepareBuilder(); + result.hasNestClasses = false; + result.nestClasses_ = false; + return this; + } + + public bool HasCodeContracts { + get { return result.hasCodeContracts; } + } + public bool CodeContracts { + get { return result.CodeContracts; } + set { SetCodeContracts(value); } + } + public Builder SetCodeContracts(bool value) { + PrepareBuilder(); + result.hasCodeContracts = true; + result.codeContracts_ = value; + return this; + } + public Builder ClearCodeContracts() { + PrepareBuilder(); + result.hasCodeContracts = false; + result.codeContracts_ = false; + return this; + } + + public bool HasExpandNamespaceDirectories { + get { return result.hasExpandNamespaceDirectories; } + } + public bool ExpandNamespaceDirectories { + get { return result.ExpandNamespaceDirectories; } + set { SetExpandNamespaceDirectories(value); } + } + public Builder SetExpandNamespaceDirectories(bool value) { + PrepareBuilder(); + result.hasExpandNamespaceDirectories = true; + result.expandNamespaceDirectories_ = value; + return this; + } + public Builder ClearExpandNamespaceDirectories() { + PrepareBuilder(); + result.hasExpandNamespaceDirectories = false; + result.expandNamespaceDirectories_ = false; + return this; + } + + public bool HasClsCompliance { + get { return result.hasClsCompliance; } + } + public bool ClsCompliance { + get { return result.ClsCompliance; } + set { SetClsCompliance(value); } + } + public Builder SetClsCompliance(bool value) { + PrepareBuilder(); + result.hasClsCompliance = true; + result.clsCompliance_ = value; + return this; + } + public Builder ClearClsCompliance() { + PrepareBuilder(); + result.hasClsCompliance = false; + result.clsCompliance_ = true; + return this; + } + + public bool HasAddSerializable { + get { return result.hasAddSerializable; } + } + public bool AddSerializable { + get { return result.AddSerializable; } + set { SetAddSerializable(value); } + } + public Builder SetAddSerializable(bool value) { + PrepareBuilder(); + result.hasAddSerializable = true; + result.addSerializable_ = value; + return this; + } + public Builder ClearAddSerializable() { + PrepareBuilder(); + result.hasAddSerializable = false; + result.addSerializable_ = false; + return this; + } + + public bool HasGeneratePrivateCtor { + get { return result.hasGeneratePrivateCtor; } + } + public bool GeneratePrivateCtor { + get { return result.GeneratePrivateCtor; } + set { SetGeneratePrivateCtor(value); } + } + public Builder SetGeneratePrivateCtor(bool value) { + PrepareBuilder(); + result.hasGeneratePrivateCtor = true; + result.generatePrivateCtor_ = value; + return this; + } + public Builder ClearGeneratePrivateCtor() { + PrepareBuilder(); + result.hasGeneratePrivateCtor = false; + result.generatePrivateCtor_ = true; + return this; + } + + public bool HasFileExtension { + get { return result.hasFileExtension; } + } + public string FileExtension { + get { return result.FileExtension; } + set { SetFileExtension(value); } + } + public Builder SetFileExtension(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasFileExtension = true; + result.fileExtension_ = value; + return this; + } + public Builder ClearFileExtension() { + PrepareBuilder(); + result.hasFileExtension = false; + result.fileExtension_ = ".cs"; + return this; + } + + public bool HasUmbrellaNamespace { + get { return result.hasUmbrellaNamespace; } + } + public string UmbrellaNamespace { + get { return result.UmbrellaNamespace; } + set { SetUmbrellaNamespace(value); } + } + public Builder SetUmbrellaNamespace(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasUmbrellaNamespace = true; + result.umbrellaNamespace_ = value; + return this; + } + public Builder ClearUmbrellaNamespace() { + PrepareBuilder(); + result.hasUmbrellaNamespace = false; + result.umbrellaNamespace_ = ""; + return this; + } + + public bool HasOutputDirectory { + get { return result.hasOutputDirectory; } + } + public string OutputDirectory { + get { return result.OutputDirectory; } + set { SetOutputDirectory(value); } + } + public Builder SetOutputDirectory(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOutputDirectory = true; + result.outputDirectory_ = value; + return this; + } + public Builder ClearOutputDirectory() { + PrepareBuilder(); + result.hasOutputDirectory = false; + result.outputDirectory_ = "."; + return this; + } + + public bool HasIgnoreGoogleProtobuf { + get { return result.hasIgnoreGoogleProtobuf; } + } + public bool IgnoreGoogleProtobuf { + get { return result.IgnoreGoogleProtobuf; } + set { SetIgnoreGoogleProtobuf(value); } + } + public Builder SetIgnoreGoogleProtobuf(bool value) { + PrepareBuilder(); + result.hasIgnoreGoogleProtobuf = true; + result.ignoreGoogleProtobuf_ = value; + return this; + } + public Builder ClearIgnoreGoogleProtobuf() { + PrepareBuilder(); + result.hasIgnoreGoogleProtobuf = false; + result.ignoreGoogleProtobuf_ = false; + return this; + } + + public bool HasServiceGeneratorType { + get { return result.hasServiceGeneratorType; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType ServiceGeneratorType { + get { return result.ServiceGeneratorType; } + set { SetServiceGeneratorType(value); } + } + public Builder SetServiceGeneratorType(global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType value) { + PrepareBuilder(); + result.hasServiceGeneratorType = true; + result.serviceGeneratorType_ = value; + return this; + } + public Builder ClearServiceGeneratorType() { + PrepareBuilder(); + result.hasServiceGeneratorType = false; + result.serviceGeneratorType_ = global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceType.NONE; + return this; + } + + public bool HasGeneratedCodeAttributes { + get { return result.hasGeneratedCodeAttributes; } + } + public bool GeneratedCodeAttributes { + get { return result.GeneratedCodeAttributes; } + set { SetGeneratedCodeAttributes(value); } + } + public Builder SetGeneratedCodeAttributes(bool value) { + PrepareBuilder(); + result.hasGeneratedCodeAttributes = true; + result.generatedCodeAttributes_ = value; + return this; + } + public Builder ClearGeneratedCodeAttributes() { + PrepareBuilder(); + result.hasGeneratedCodeAttributes = false; + result.generatedCodeAttributes_ = false; + return this; + } + } + static CSharpFileOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CSharpFieldOptions : pb::GeneratedMessage { + private CSharpFieldOptions() { } + private static readonly CSharpFieldOptions defaultInstance = new CSharpFieldOptions().MakeReadOnly(); + private static readonly string[] _cSharpFieldOptionsFieldNames = new string[] { "property_name" }; + private static readonly uint[] _cSharpFieldOptionsFieldTags = new uint[] { 10 }; + public static CSharpFieldOptions DefaultInstance { + get { return defaultInstance; } + } + + public override CSharpFieldOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CSharpFieldOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpFieldOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpFieldOptions__FieldAccessorTable; } + } + + public const int PropertyNameFieldNumber = 1; + private bool hasPropertyName; + private string propertyName_ = ""; + public bool HasPropertyName { + get { return hasPropertyName; } + } + public string PropertyName { + get { return propertyName_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _cSharpFieldOptionsFieldNames; + if (hasPropertyName) { + output.WriteString(1, field_names[0], PropertyName); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPropertyName) { + size += pb::CodedOutputStream.ComputeStringSize(1, PropertyName); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static CSharpFieldOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CSharpFieldOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CSharpFieldOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CSharpFieldOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CSharpFieldOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CSharpFieldOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CSharpFieldOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CSharpFieldOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CSharpFieldOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CSharpFieldOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CSharpFieldOptions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CSharpFieldOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CSharpFieldOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CSharpFieldOptions result; + + private CSharpFieldOptions PrepareBuilder() { + if (resultIsReadOnly) { + CSharpFieldOptions original = result; + result = new CSharpFieldOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CSharpFieldOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions.Descriptor; } + } + + public override CSharpFieldOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions.DefaultInstance; } + } + + public override CSharpFieldOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CSharpFieldOptions) { + return MergeFrom((CSharpFieldOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CSharpFieldOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpFieldOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasPropertyName) { + PropertyName = other.PropertyName; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_cSharpFieldOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _cSharpFieldOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasPropertyName = input.ReadString(ref result.propertyName_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasPropertyName { + get { return result.hasPropertyName; } + } + public string PropertyName { + get { return result.PropertyName; } + set { SetPropertyName(value); } + } + public Builder SetPropertyName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasPropertyName = true; + result.propertyName_ = value; + return this; + } + public Builder ClearPropertyName() { + PrepareBuilder(); + result.hasPropertyName = false; + result.propertyName_ = ""; + return this; + } + } + static CSharpFieldOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CSharpServiceOptions : pb::GeneratedMessage { + private CSharpServiceOptions() { } + private static readonly CSharpServiceOptions defaultInstance = new CSharpServiceOptions().MakeReadOnly(); + private static readonly string[] _cSharpServiceOptionsFieldNames = new string[] { "interface_id" }; + private static readonly uint[] _cSharpServiceOptionsFieldTags = new uint[] { 10 }; + public static CSharpServiceOptions DefaultInstance { + get { return defaultInstance; } + } + + public override CSharpServiceOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CSharpServiceOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpServiceOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpServiceOptions__FieldAccessorTable; } + } + + public const int InterfaceIdFieldNumber = 1; + private bool hasInterfaceId; + private string interfaceId_ = ""; + public bool HasInterfaceId { + get { return hasInterfaceId; } + } + public string InterfaceId { + get { return interfaceId_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _cSharpServiceOptionsFieldNames; + if (hasInterfaceId) { + output.WriteString(1, field_names[0], InterfaceId); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasInterfaceId) { + size += pb::CodedOutputStream.ComputeStringSize(1, InterfaceId); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static CSharpServiceOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CSharpServiceOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CSharpServiceOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CSharpServiceOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CSharpServiceOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CSharpServiceOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CSharpServiceOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CSharpServiceOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CSharpServiceOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CSharpServiceOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CSharpServiceOptions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CSharpServiceOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CSharpServiceOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CSharpServiceOptions result; + + private CSharpServiceOptions PrepareBuilder() { + if (resultIsReadOnly) { + CSharpServiceOptions original = result; + result = new CSharpServiceOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CSharpServiceOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions.Descriptor; } + } + + public override CSharpServiceOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions.DefaultInstance; } + } + + public override CSharpServiceOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CSharpServiceOptions) { + return MergeFrom((CSharpServiceOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CSharpServiceOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpServiceOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasInterfaceId) { + InterfaceId = other.InterfaceId; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_cSharpServiceOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _cSharpServiceOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasInterfaceId = input.ReadString(ref result.interfaceId_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasInterfaceId { + get { return result.hasInterfaceId; } + } + public string InterfaceId { + get { return result.InterfaceId; } + set { SetInterfaceId(value); } + } + public Builder SetInterfaceId(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasInterfaceId = true; + result.interfaceId_ = value; + return this; + } + public Builder ClearInterfaceId() { + PrepareBuilder(); + result.hasInterfaceId = false; + result.interfaceId_ = ""; + return this; + } + } + static CSharpServiceOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class CSharpMethodOptions : pb::GeneratedMessage { + private CSharpMethodOptions() { } + private static readonly CSharpMethodOptions defaultInstance = new CSharpMethodOptions().MakeReadOnly(); + private static readonly string[] _cSharpMethodOptionsFieldNames = new string[] { "dispatch_id" }; + private static readonly uint[] _cSharpMethodOptionsFieldTags = new uint[] { 8 }; + public static CSharpMethodOptions DefaultInstance { + get { return defaultInstance; } + } + + public override CSharpMethodOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override CSharpMethodOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpMethodOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.internal__static_google_protobuf_CSharpMethodOptions__FieldAccessorTable; } + } + + public const int DispatchIdFieldNumber = 1; + private bool hasDispatchId; + private int dispatchId_; + public bool HasDispatchId { + get { return hasDispatchId; } + } + public int DispatchId { + get { return dispatchId_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _cSharpMethodOptionsFieldNames; + if (hasDispatchId) { + output.WriteInt32(1, field_names[0], DispatchId); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasDispatchId) { + size += pb::CodedOutputStream.ComputeInt32Size(1, DispatchId); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static CSharpMethodOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CSharpMethodOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CSharpMethodOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static CSharpMethodOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static CSharpMethodOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CSharpMethodOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static CSharpMethodOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static CSharpMethodOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static CSharpMethodOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static CSharpMethodOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private CSharpMethodOptions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(CSharpMethodOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(CSharpMethodOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private CSharpMethodOptions result; + + private CSharpMethodOptions PrepareBuilder() { + if (resultIsReadOnly) { + CSharpMethodOptions original = result; + result = new CSharpMethodOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override CSharpMethodOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions.Descriptor; } + } + + public override CSharpMethodOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions.DefaultInstance; } + } + + public override CSharpMethodOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is CSharpMethodOptions) { + return MergeFrom((CSharpMethodOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(CSharpMethodOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.CSharpMethodOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasDispatchId) { + DispatchId = other.DispatchId; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_cSharpMethodOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _cSharpMethodOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasDispatchId = input.ReadInt32(ref result.dispatchId_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasDispatchId { + get { return result.hasDispatchId; } + } + public int DispatchId { + get { return result.DispatchId; } + set { SetDispatchId(value); } + } + public Builder SetDispatchId(int value) { + PrepareBuilder(); + result.hasDispatchId = true; + result.dispatchId_ = value; + return this; + } + public Builder ClearDispatchId() { + PrepareBuilder(); + result.hasDispatchId = false; + result.dispatchId_ = 0; + return this; + } + } + static CSharpMethodOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs b/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs new file mode 100644 index 00000000..c319c60e --- /dev/null +++ b/csharp/src/ProtocolBuffers/DescriptorProtos/DescriptorProtoFile.cs @@ -0,0 +1,9110 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.DescriptorProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class DescriptorProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_google_protobuf_FileDescriptorSet__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_FileDescriptorProto__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_DescriptorProto__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_DescriptorProto__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_DescriptorProto_ExtensionRange__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_FieldDescriptorProto__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_EnumDescriptorProto__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_EnumValueDescriptorProto__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_ServiceDescriptorProto__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_MethodDescriptorProto__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_FileOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FileOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_MessageOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_MessageOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_FieldOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_FieldOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_EnumOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_EnumValueOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_ServiceOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_ServiceOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_MethodOptions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_MethodOptions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_UninterpretedOption__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_UninterpretedOption_NamePart__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_SourceCodeInfo__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_google_protobuf_SourceCodeInfo_Location__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static DescriptorProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiBnb29nbGUvcHJvdG9idWYvZGVzY3JpcHRvci5wcm90bxIPZ29vZ2xlLnBy", + "b3RvYnVmIkcKEUZpbGVEZXNjcmlwdG9yU2V0EjIKBGZpbGUYASADKAsyJC5n", + "b29nbGUucHJvdG9idWYuRmlsZURlc2NyaXB0b3JQcm90byKXAwoTRmlsZURl", + "c2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEg8KB3BhY2thZ2UYAiABKAkS", + "EgoKZGVwZW5kZW5jeRgDIAMoCRI2CgxtZXNzYWdlX3R5cGUYBCADKAsyIC5n", + "b29nbGUucHJvdG9idWYuRGVzY3JpcHRvclByb3RvEjcKCWVudW1fdHlwZRgF", + "IAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5FbnVtRGVzY3JpcHRvclByb3RvEjgK", + "B3NlcnZpY2UYBiADKAsyJy5nb29nbGUucHJvdG9idWYuU2VydmljZURlc2Ny", + "aXB0b3JQcm90bxI4CglleHRlbnNpb24YByADKAsyJS5nb29nbGUucHJvdG9i", + "dWYuRmllbGREZXNjcmlwdG9yUHJvdG8SLQoHb3B0aW9ucxgIIAEoCzIcLmdv", + "b2dsZS5wcm90b2J1Zi5GaWxlT3B0aW9ucxI5ChBzb3VyY2VfY29kZV9pbmZv", + "GAkgASgLMh8uZ29vZ2xlLnByb3RvYnVmLlNvdXJjZUNvZGVJbmZvIqkDCg9E", + "ZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRI0CgVmaWVsZBgCIAMoCzIl", + "Lmdvb2dsZS5wcm90b2J1Zi5GaWVsZERlc2NyaXB0b3JQcm90bxI4CglleHRl", + "bnNpb24YBiADKAsyJS5nb29nbGUucHJvdG9idWYuRmllbGREZXNjcmlwdG9y", + "UHJvdG8SNQoLbmVzdGVkX3R5cGUYAyADKAsyIC5nb29nbGUucHJvdG9idWYu", + "RGVzY3JpcHRvclByb3RvEjcKCWVudW1fdHlwZRgEIAMoCzIkLmdvb2dsZS5w", + "cm90b2J1Zi5FbnVtRGVzY3JpcHRvclByb3RvEkgKD2V4dGVuc2lvbl9yYW5n", + "ZRgFIAMoCzIvLmdvb2dsZS5wcm90b2J1Zi5EZXNjcmlwdG9yUHJvdG8uRXh0", + "ZW5zaW9uUmFuZ2USMAoHb3B0aW9ucxgHIAEoCzIfLmdvb2dsZS5wcm90b2J1", + "Zi5NZXNzYWdlT3B0aW9ucxosCg5FeHRlbnNpb25SYW5nZRINCgVzdGFydBgB", + "IAEoBRILCgNlbmQYAiABKAUilAUKFEZpZWxkRGVzY3JpcHRvclByb3RvEgwK", + "BG5hbWUYASABKAkSDgoGbnVtYmVyGAMgASgFEjoKBWxhYmVsGAQgASgOMisu", + "Z29vZ2xlLnByb3RvYnVmLkZpZWxkRGVzY3JpcHRvclByb3RvLkxhYmVsEjgK", + "BHR5cGUYBSABKA4yKi5nb29nbGUucHJvdG9idWYuRmllbGREZXNjcmlwdG9y", + "UHJvdG8uVHlwZRIRCgl0eXBlX25hbWUYBiABKAkSEAoIZXh0ZW5kZWUYAiAB", + "KAkSFQoNZGVmYXVsdF92YWx1ZRgHIAEoCRIuCgdvcHRpb25zGAggASgLMh0u", + "Z29vZ2xlLnByb3RvYnVmLkZpZWxkT3B0aW9ucyK2AgoEVHlwZRIPCgtUWVBF", + "X0RPVUJMRRABEg4KClRZUEVfRkxPQVQQAhIOCgpUWVBFX0lOVDY0EAMSDwoL", + "VFlQRV9VSU5UNjQQBBIOCgpUWVBFX0lOVDMyEAUSEAoMVFlQRV9GSVhFRDY0", + "EAYSEAoMVFlQRV9GSVhFRDMyEAcSDQoJVFlQRV9CT09MEAgSDwoLVFlQRV9T", + "VFJJTkcQCRIOCgpUWVBFX0dST1VQEAoSEAoMVFlQRV9NRVNTQUdFEAsSDgoK", + "VFlQRV9CWVRFUxAMEg8KC1RZUEVfVUlOVDMyEA0SDQoJVFlQRV9FTlVNEA4S", + "EQoNVFlQRV9TRklYRUQzMhAPEhEKDVRZUEVfU0ZJWEVENjQQEBIPCgtUWVBF", + "X1NJTlQzMhAREg8KC1RZUEVfU0lOVDY0EBIiQwoFTGFiZWwSEgoOTEFCRUxf", + "T1BUSU9OQUwQARISCg5MQUJFTF9SRVFVSVJFRBACEhIKDkxBQkVMX1JFUEVB", + "VEVEEAMijAEKE0VudW1EZXNjcmlwdG9yUHJvdG8SDAoEbmFtZRgBIAEoCRI4", + "CgV2YWx1ZRgCIAMoCzIpLmdvb2dsZS5wcm90b2J1Zi5FbnVtVmFsdWVEZXNj", + "cmlwdG9yUHJvdG8SLQoHb3B0aW9ucxgDIAEoCzIcLmdvb2dsZS5wcm90b2J1", + "Zi5FbnVtT3B0aW9ucyJsChhFbnVtVmFsdWVEZXNjcmlwdG9yUHJvdG8SDAoE", + "bmFtZRgBIAEoCRIOCgZudW1iZXIYAiABKAUSMgoHb3B0aW9ucxgDIAEoCzIh", + "Lmdvb2dsZS5wcm90b2J1Zi5FbnVtVmFsdWVPcHRpb25zIpABChZTZXJ2aWNl", + "RGVzY3JpcHRvclByb3RvEgwKBG5hbWUYASABKAkSNgoGbWV0aG9kGAIgAygL", + "MiYuZ29vZ2xlLnByb3RvYnVmLk1ldGhvZERlc2NyaXB0b3JQcm90bxIwCgdv", + "cHRpb25zGAMgASgLMh8uZ29vZ2xlLnByb3RvYnVmLlNlcnZpY2VPcHRpb25z", + "In8KFU1ldGhvZERlc2NyaXB0b3JQcm90bxIMCgRuYW1lGAEgASgJEhIKCmlu", + "cHV0X3R5cGUYAiABKAkSEwoLb3V0cHV0X3R5cGUYAyABKAkSLwoHb3B0aW9u", + "cxgEIAEoCzIeLmdvb2dsZS5wcm90b2J1Zi5NZXRob2RPcHRpb25zItUDCgtG", + "aWxlT3B0aW9ucxIUCgxqYXZhX3BhY2thZ2UYASABKAkSHAoUamF2YV9vdXRl", + "cl9jbGFzc25hbWUYCCABKAkSIgoTamF2YV9tdWx0aXBsZV9maWxlcxgKIAEo", + "CDoFZmFsc2USLAodamF2YV9nZW5lcmF0ZV9lcXVhbHNfYW5kX2hhc2gYFCAB", + "KAg6BWZhbHNlEkYKDG9wdGltaXplX2ZvchgJIAEoDjIpLmdvb2dsZS5wcm90", + "b2J1Zi5GaWxlT3B0aW9ucy5PcHRpbWl6ZU1vZGU6BVNQRUVEEiIKE2NjX2dl", + "bmVyaWNfc2VydmljZXMYECABKAg6BWZhbHNlEiQKFWphdmFfZ2VuZXJpY19z", + "ZXJ2aWNlcxgRIAEoCDoFZmFsc2USIgoTcHlfZ2VuZXJpY19zZXJ2aWNlcxgS", + "IAEoCDoFZmFsc2USQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQu", + "Z29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24iOgoMT3B0aW1p", + "emVNb2RlEgkKBVNQRUVEEAESDQoJQ09ERV9TSVpFEAISEAoMTElURV9SVU5U", + "SU1FEAMqCQjoBxCAgICAAiK4AQoOTWVzc2FnZU9wdGlvbnMSJgoXbWVzc2Fn", + "ZV9zZXRfd2lyZV9mb3JtYXQYASABKAg6BWZhbHNlEi4KH25vX3N0YW5kYXJk", + "X2Rlc2NyaXB0b3JfYWNjZXNzb3IYAiABKAg6BWZhbHNlEkMKFHVuaW50ZXJw", + "cmV0ZWRfb3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVy", + "cHJldGVkT3B0aW9uKgkI6AcQgICAgAIilAIKDEZpZWxkT3B0aW9ucxI6CgVj", + "dHlwZRgBIAEoDjIjLmdvb2dsZS5wcm90b2J1Zi5GaWVsZE9wdGlvbnMuQ1R5", + "cGU6BlNUUklORxIOCgZwYWNrZWQYAiABKAgSGQoKZGVwcmVjYXRlZBgDIAEo", + "CDoFZmFsc2USHAoUZXhwZXJpbWVudGFsX21hcF9rZXkYCSABKAkSQwoUdW5p", + "bnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVu", + "aW50ZXJwcmV0ZWRPcHRpb24iLwoFQ1R5cGUSCgoGU1RSSU5HEAASCAoEQ09S", + "RBABEhAKDFNUUklOR19QSUVDRRACKgkI6AcQgICAgAIiXQoLRW51bU9wdGlv", + "bnMSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y5wcgAygLMiQuZ29vZ2xlLnBy", + "b3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24qCQjoBxCAgICAAiJiChBFbnVt", + "VmFsdWVPcHRpb25zEkMKFHVuaW50ZXJwcmV0ZWRfb3B0aW9uGOcHIAMoCzIk", + "Lmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0aW9uKgkI6AcQgICA", + "gAIiYAoOU2VydmljZU9wdGlvbnMSQwoUdW5pbnRlcnByZXRlZF9vcHRpb24Y", + "5wcgAygLMiQuZ29vZ2xlLnByb3RvYnVmLlVuaW50ZXJwcmV0ZWRPcHRpb24q", + "CQjoBxCAgICAAiJfCg1NZXRob2RPcHRpb25zEkMKFHVuaW50ZXJwcmV0ZWRf", + "b3B0aW9uGOcHIAMoCzIkLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVk", + "T3B0aW9uKgkI6AcQgICAgAIingIKE1VuaW50ZXJwcmV0ZWRPcHRpb24SOwoE", + "bmFtZRgCIAMoCzItLmdvb2dsZS5wcm90b2J1Zi5VbmludGVycHJldGVkT3B0", + "aW9uLk5hbWVQYXJ0EhgKEGlkZW50aWZpZXJfdmFsdWUYAyABKAkSGgoScG9z", + "aXRpdmVfaW50X3ZhbHVlGAQgASgEEhoKEm5lZ2F0aXZlX2ludF92YWx1ZRgF", + "IAEoAxIUCgxkb3VibGVfdmFsdWUYBiABKAESFAoMc3RyaW5nX3ZhbHVlGAcg", + "ASgMEhcKD2FnZ3JlZ2F0ZV92YWx1ZRgIIAEoCRozCghOYW1lUGFydBIRCglu", + "YW1lX3BhcnQYASACKAkSFAoMaXNfZXh0ZW5zaW9uGAIgAigIInwKDlNvdXJj", + "ZUNvZGVJbmZvEjoKCGxvY2F0aW9uGAEgAygLMiguZ29vZ2xlLnByb3RvYnVm", + "LlNvdXJjZUNvZGVJbmZvLkxvY2F0aW9uGi4KCExvY2F0aW9uEhAKBHBhdGgY", + "ASADKAVCAhABEhAKBHNwYW4YAiADKAVCAhABQikKE2NvbS5nb29nbGUucHJv", + "dG9idWZCEERlc2NyaXB0b3JQcm90b3NIAQ==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_google_protobuf_FileDescriptorSet__Descriptor = Descriptor.MessageTypes[0]; + internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FileDescriptorSet__Descriptor, + new string[] { "File", }); + internal__static_google_protobuf_FileDescriptorProto__Descriptor = Descriptor.MessageTypes[1]; + internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FileDescriptorProto__Descriptor, + new string[] { "Name", "Package", "Dependency", "MessageType", "EnumType", "Service", "Extension", "Options", "SourceCodeInfo", }); + internal__static_google_protobuf_DescriptorProto__Descriptor = Descriptor.MessageTypes[2]; + internal__static_google_protobuf_DescriptorProto__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_DescriptorProto__Descriptor, + new string[] { "Name", "Field", "Extension", "NestedType", "EnumType", "ExtensionRange", "Options", }); + internal__static_google_protobuf_DescriptorProto_ExtensionRange__Descriptor = internal__static_google_protobuf_DescriptorProto__Descriptor.NestedTypes[0]; + internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_DescriptorProto_ExtensionRange__Descriptor, + new string[] { "Start", "End", }); + internal__static_google_protobuf_FieldDescriptorProto__Descriptor = Descriptor.MessageTypes[3]; + internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FieldDescriptorProto__Descriptor, + new string[] { "Name", "Number", "Label", "Type", "TypeName", "Extendee", "DefaultValue", "Options", }); + internal__static_google_protobuf_EnumDescriptorProto__Descriptor = Descriptor.MessageTypes[4]; + internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_EnumDescriptorProto__Descriptor, + new string[] { "Name", "Value", "Options", }); + internal__static_google_protobuf_EnumValueDescriptorProto__Descriptor = Descriptor.MessageTypes[5]; + internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_EnumValueDescriptorProto__Descriptor, + new string[] { "Name", "Number", "Options", }); + internal__static_google_protobuf_ServiceDescriptorProto__Descriptor = Descriptor.MessageTypes[6]; + internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_ServiceDescriptorProto__Descriptor, + new string[] { "Name", "Method", "Options", }); + internal__static_google_protobuf_MethodDescriptorProto__Descriptor = Descriptor.MessageTypes[7]; + internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_MethodDescriptorProto__Descriptor, + new string[] { "Name", "InputType", "OutputType", "Options", }); + internal__static_google_protobuf_FileOptions__Descriptor = Descriptor.MessageTypes[8]; + internal__static_google_protobuf_FileOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FileOptions__Descriptor, + new string[] { "JavaPackage", "JavaOuterClassname", "JavaMultipleFiles", "JavaGenerateEqualsAndHash", "OptimizeFor", "CcGenericServices", "JavaGenericServices", "PyGenericServices", "UninterpretedOption", }); + internal__static_google_protobuf_MessageOptions__Descriptor = Descriptor.MessageTypes[9]; + internal__static_google_protobuf_MessageOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_MessageOptions__Descriptor, + new string[] { "MessageSetWireFormat", "NoStandardDescriptorAccessor", "UninterpretedOption", }); + internal__static_google_protobuf_FieldOptions__Descriptor = Descriptor.MessageTypes[10]; + internal__static_google_protobuf_FieldOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_FieldOptions__Descriptor, + new string[] { "Ctype", "Packed", "Deprecated", "ExperimentalMapKey", "UninterpretedOption", }); + internal__static_google_protobuf_EnumOptions__Descriptor = Descriptor.MessageTypes[11]; + internal__static_google_protobuf_EnumOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_EnumOptions__Descriptor, + new string[] { "UninterpretedOption", }); + internal__static_google_protobuf_EnumValueOptions__Descriptor = Descriptor.MessageTypes[12]; + internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_EnumValueOptions__Descriptor, + new string[] { "UninterpretedOption", }); + internal__static_google_protobuf_ServiceOptions__Descriptor = Descriptor.MessageTypes[13]; + internal__static_google_protobuf_ServiceOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_ServiceOptions__Descriptor, + new string[] { "UninterpretedOption", }); + internal__static_google_protobuf_MethodOptions__Descriptor = Descriptor.MessageTypes[14]; + internal__static_google_protobuf_MethodOptions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_MethodOptions__Descriptor, + new string[] { "UninterpretedOption", }); + internal__static_google_protobuf_UninterpretedOption__Descriptor = Descriptor.MessageTypes[15]; + internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_UninterpretedOption__Descriptor, + new string[] { "Name", "IdentifierValue", "PositiveIntValue", "NegativeIntValue", "DoubleValue", "StringValue", "AggregateValue", }); + internal__static_google_protobuf_UninterpretedOption_NamePart__Descriptor = internal__static_google_protobuf_UninterpretedOption__Descriptor.NestedTypes[0]; + internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_UninterpretedOption_NamePart__Descriptor, + new string[] { "NamePart_", "IsExtension", }); + internal__static_google_protobuf_SourceCodeInfo__Descriptor = Descriptor.MessageTypes[16]; + internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_SourceCodeInfo__Descriptor, + new string[] { "Location", }); + internal__static_google_protobuf_SourceCodeInfo_Location__Descriptor = internal__static_google_protobuf_SourceCodeInfo__Descriptor.NestedTypes[0]; + internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_google_protobuf_SourceCodeInfo_Location__Descriptor, + new string[] { "Path", "Span", }); + return null; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FileDescriptorSet : pb::GeneratedMessage { + private FileDescriptorSet() { } + private static readonly FileDescriptorSet defaultInstance = new FileDescriptorSet().MakeReadOnly(); + private static readonly string[] _fileDescriptorSetFieldNames = new string[] { "file" }; + private static readonly uint[] _fileDescriptorSetFieldTags = new uint[] { 10 }; + public static FileDescriptorSet DefaultInstance { + get { return defaultInstance; } + } + + public override FileDescriptorSet DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FileDescriptorSet ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorSet__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorSet__FieldAccessorTable; } + } + + public const int FileFieldNumber = 1; + private pbc::PopsicleList file_ = new pbc::PopsicleList(); + public scg::IList FileList { + get { return file_; } + } + public int FileCount { + get { return file_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto GetFile(int index) { + return file_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto element in FileList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fileDescriptorSetFieldNames; + if (file_.Count > 0) { + output.WriteMessageArray(1, field_names[0], file_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto element in FileList) { + size += pb::CodedOutputStream.ComputeMessageSize(1, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FileDescriptorSet ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FileDescriptorSet ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FileDescriptorSet ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FileDescriptorSet ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FileDescriptorSet ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FileDescriptorSet ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FileDescriptorSet ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FileDescriptorSet ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FileDescriptorSet ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FileDescriptorSet ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FileDescriptorSet MakeReadOnly() { + file_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FileDescriptorSet prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FileDescriptorSet cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FileDescriptorSet result; + + private FileDescriptorSet PrepareBuilder() { + if (resultIsReadOnly) { + FileDescriptorSet original = result; + result = new FileDescriptorSet(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FileDescriptorSet MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet.Descriptor; } + } + + public override FileDescriptorSet DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet.DefaultInstance; } + } + + public override FileDescriptorSet BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FileDescriptorSet) { + return MergeFrom((FileDescriptorSet) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FileDescriptorSet other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorSet.DefaultInstance) return this; + PrepareBuilder(); + if (other.file_.Count != 0) { + result.file_.Add(other.file_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fileDescriptorSetFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fileDescriptorSetFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadMessageArray(tag, field_name, result.file_, global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList FileList { + get { return PrepareBuilder().file_; } + } + public int FileCount { + get { return result.FileCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto GetFile(int index) { + return result.GetFile(index); + } + public Builder SetFile(int index, global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.file_[index] = value; + return this; + } + public Builder SetFile(int index, global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.file_[index] = builderForValue.Build(); + return this; + } + public Builder AddFile(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.file_.Add(value); + return this; + } + public Builder AddFile(global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.file_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeFile(scg::IEnumerable values) { + PrepareBuilder(); + result.file_.Add(values); + return this; + } + public Builder ClearFile() { + PrepareBuilder(); + result.file_.Clear(); + return this; + } + } + static FileDescriptorSet() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FileDescriptorProto : pb::GeneratedMessage { + private FileDescriptorProto() { } + private static readonly FileDescriptorProto defaultInstance = new FileDescriptorProto().MakeReadOnly(); + private static readonly string[] _fileDescriptorProtoFieldNames = new string[] { "dependency", "enum_type", "extension", "message_type", "name", "options", "package", "service", "source_code_info" }; + private static readonly uint[] _fileDescriptorProtoFieldTags = new uint[] { 26, 42, 58, 34, 10, 66, 18, 50, 74 }; + public static FileDescriptorProto DefaultInstance { + get { return defaultInstance; } + } + + public override FileDescriptorProto DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FileDescriptorProto ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorProto__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileDescriptorProto__FieldAccessorTable; } + } + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int PackageFieldNumber = 2; + private bool hasPackage; + private string package_ = ""; + public bool HasPackage { + get { return hasPackage; } + } + public string Package { + get { return package_; } + } + + public const int DependencyFieldNumber = 3; + private pbc::PopsicleList dependency_ = new pbc::PopsicleList(); + public scg::IList DependencyList { + get { return pbc::Lists.AsReadOnly(dependency_); } + } + public int DependencyCount { + get { return dependency_.Count; } + } + public string GetDependency(int index) { + return dependency_[index]; + } + + public const int MessageTypeFieldNumber = 4; + private pbc::PopsicleList messageType_ = new pbc::PopsicleList(); + public scg::IList MessageTypeList { + get { return messageType_; } + } + public int MessageTypeCount { + get { return messageType_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto GetMessageType(int index) { + return messageType_[index]; + } + + public const int EnumTypeFieldNumber = 5; + private pbc::PopsicleList enumType_ = new pbc::PopsicleList(); + public scg::IList EnumTypeList { + get { return enumType_; } + } + public int EnumTypeCount { + get { return enumType_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto GetEnumType(int index) { + return enumType_[index]; + } + + public const int ServiceFieldNumber = 6; + private pbc::PopsicleList service_ = new pbc::PopsicleList(); + public scg::IList ServiceList { + get { return service_; } + } + public int ServiceCount { + get { return service_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto GetService(int index) { + return service_[index]; + } + + public const int ExtensionFieldNumber = 7; + private pbc::PopsicleList extension_ = new pbc::PopsicleList(); + public scg::IList ExtensionList { + get { return extension_; } + } + public int ExtensionCount { + get { return extension_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto GetExtension(int index) { + return extension_[index]; + } + + public const int OptionsFieldNumber = 8; + private bool hasOptions; + private global::Google.ProtocolBuffers.DescriptorProtos.FileOptions options_; + public bool HasOptions { + get { return hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions Options { + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance; } + } + + public const int SourceCodeInfoFieldNumber = 9; + private bool hasSourceCodeInfo; + private global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo sourceCodeInfo_; + public bool HasSourceCodeInfo { + get { return hasSourceCodeInfo; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo SourceCodeInfo { + get { return sourceCodeInfo_ ?? global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.DefaultInstance; } + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in MessageTypeList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto element in EnumTypeList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto element in ServiceList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) { + if (!element.IsInitialized) return false; + } + if (HasOptions) { + if (!Options.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fileDescriptorProtoFieldNames; + if (hasName) { + output.WriteString(1, field_names[4], Name); + } + if (hasPackage) { + output.WriteString(2, field_names[6], Package); + } + if (dependency_.Count > 0) { + output.WriteStringArray(3, field_names[0], dependency_); + } + if (messageType_.Count > 0) { + output.WriteMessageArray(4, field_names[3], messageType_); + } + if (enumType_.Count > 0) { + output.WriteMessageArray(5, field_names[1], enumType_); + } + if (service_.Count > 0) { + output.WriteMessageArray(6, field_names[7], service_); + } + if (extension_.Count > 0) { + output.WriteMessageArray(7, field_names[2], extension_); + } + if (hasOptions) { + output.WriteMessage(8, field_names[5], Options); + } + if (hasSourceCodeInfo) { + output.WriteMessage(9, field_names[8], SourceCodeInfo); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + if (hasPackage) { + size += pb::CodedOutputStream.ComputeStringSize(2, Package); + } + { + int dataSize = 0; + foreach (string element in DependencyList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * dependency_.Count; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in MessageTypeList) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto element in EnumTypeList) { + size += pb::CodedOutputStream.ComputeMessageSize(5, element); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto element in ServiceList) { + size += pb::CodedOutputStream.ComputeMessageSize(6, element); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) { + size += pb::CodedOutputStream.ComputeMessageSize(7, element); + } + if (hasOptions) { + size += pb::CodedOutputStream.ComputeMessageSize(8, Options); + } + if (hasSourceCodeInfo) { + size += pb::CodedOutputStream.ComputeMessageSize(9, SourceCodeInfo); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FileDescriptorProto ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FileDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FileDescriptorProto ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FileDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FileDescriptorProto ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FileDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FileDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FileDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FileDescriptorProto ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FileDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FileDescriptorProto MakeReadOnly() { + dependency_.MakeReadOnly(); + messageType_.MakeReadOnly(); + enumType_.MakeReadOnly(); + service_.MakeReadOnly(); + extension_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FileDescriptorProto prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FileDescriptorProto cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FileDescriptorProto result; + + private FileDescriptorProto PrepareBuilder() { + if (resultIsReadOnly) { + FileDescriptorProto original = result; + result = new FileDescriptorProto(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FileDescriptorProto MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.Descriptor; } + } + + public override FileDescriptorProto DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.DefaultInstance; } + } + + public override FileDescriptorProto BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FileDescriptorProto) { + return MergeFrom((FileDescriptorProto) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FileDescriptorProto other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.HasPackage) { + Package = other.Package; + } + if (other.dependency_.Count != 0) { + result.dependency_.Add(other.dependency_); + } + if (other.messageType_.Count != 0) { + result.messageType_.Add(other.messageType_); + } + if (other.enumType_.Count != 0) { + result.enumType_.Add(other.enumType_); + } + if (other.service_.Count != 0) { + result.service_.Add(other.service_); + } + if (other.extension_.Count != 0) { + result.extension_.Add(other.extension_); + } + if (other.HasOptions) { + MergeOptions(other.Options); + } + if (other.HasSourceCodeInfo) { + MergeSourceCodeInfo(other.SourceCodeInfo); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fileDescriptorProtoFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fileDescriptorProtoFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 18: { + result.hasPackage = input.ReadString(ref result.package_); + break; + } + case 26: { + input.ReadStringArray(tag, field_name, result.dependency_); + break; + } + case 34: { + input.ReadMessageArray(tag, field_name, result.messageType_, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 42: { + input.ReadMessageArray(tag, field_name, result.enumType_, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 50: { + input.ReadMessageArray(tag, field_name, result.service_, global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 58: { + input.ReadMessageArray(tag, field_name, result.extension_, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 66: { + global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.CreateBuilder(); + if (result.hasOptions) { + subBuilder.MergeFrom(Options); + } + input.ReadMessage(subBuilder, extensionRegistry); + Options = subBuilder.BuildPartial(); + break; + } + case 74: { + global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.CreateBuilder(); + if (result.hasSourceCodeInfo) { + subBuilder.MergeFrom(SourceCodeInfo); + } + input.ReadMessage(subBuilder, extensionRegistry); + SourceCodeInfo = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasPackage { + get { return result.hasPackage; } + } + public string Package { + get { return result.Package; } + set { SetPackage(value); } + } + public Builder SetPackage(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasPackage = true; + result.package_ = value; + return this; + } + public Builder ClearPackage() { + PrepareBuilder(); + result.hasPackage = false; + result.package_ = ""; + return this; + } + + public pbc::IPopsicleList DependencyList { + get { return PrepareBuilder().dependency_; } + } + public int DependencyCount { + get { return result.DependencyCount; } + } + public string GetDependency(int index) { + return result.GetDependency(index); + } + public Builder SetDependency(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.dependency_[index] = value; + return this; + } + public Builder AddDependency(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.dependency_.Add(value); + return this; + } + public Builder AddRangeDependency(scg::IEnumerable values) { + PrepareBuilder(); + result.dependency_.Add(values); + return this; + } + public Builder ClearDependency() { + PrepareBuilder(); + result.dependency_.Clear(); + return this; + } + + public pbc::IPopsicleList MessageTypeList { + get { return PrepareBuilder().messageType_; } + } + public int MessageTypeCount { + get { return result.MessageTypeCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto GetMessageType(int index) { + return result.GetMessageType(index); + } + public Builder SetMessageType(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.messageType_[index] = value; + return this; + } + public Builder SetMessageType(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.messageType_[index] = builderForValue.Build(); + return this; + } + public Builder AddMessageType(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.messageType_.Add(value); + return this; + } + public Builder AddMessageType(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.messageType_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeMessageType(scg::IEnumerable values) { + PrepareBuilder(); + result.messageType_.Add(values); + return this; + } + public Builder ClearMessageType() { + PrepareBuilder(); + result.messageType_.Clear(); + return this; + } + + public pbc::IPopsicleList EnumTypeList { + get { return PrepareBuilder().enumType_; } + } + public int EnumTypeCount { + get { return result.EnumTypeCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto GetEnumType(int index) { + return result.GetEnumType(index); + } + public Builder SetEnumType(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.enumType_[index] = value; + return this; + } + public Builder SetEnumType(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.enumType_[index] = builderForValue.Build(); + return this; + } + public Builder AddEnumType(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.enumType_.Add(value); + return this; + } + public Builder AddEnumType(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.enumType_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeEnumType(scg::IEnumerable values) { + PrepareBuilder(); + result.enumType_.Add(values); + return this; + } + public Builder ClearEnumType() { + PrepareBuilder(); + result.enumType_.Clear(); + return this; + } + + public pbc::IPopsicleList ServiceList { + get { return PrepareBuilder().service_; } + } + public int ServiceCount { + get { return result.ServiceCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto GetService(int index) { + return result.GetService(index); + } + public Builder SetService(int index, global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.service_[index] = value; + return this; + } + public Builder SetService(int index, global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.service_[index] = builderForValue.Build(); + return this; + } + public Builder AddService(global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.service_.Add(value); + return this; + } + public Builder AddService(global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.service_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeService(scg::IEnumerable values) { + PrepareBuilder(); + result.service_.Add(values); + return this; + } + public Builder ClearService() { + PrepareBuilder(); + result.service_.Clear(); + return this; + } + + public pbc::IPopsicleList ExtensionList { + get { return PrepareBuilder().extension_; } + } + public int ExtensionCount { + get { return result.ExtensionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto GetExtension(int index) { + return result.GetExtension(index); + } + public Builder SetExtension(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.extension_[index] = value; + return this; + } + public Builder SetExtension(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.extension_[index] = builderForValue.Build(); + return this; + } + public Builder AddExtension(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.extension_.Add(value); + return this; + } + public Builder AddExtension(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.extension_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeExtension(scg::IEnumerable values) { + PrepareBuilder(); + result.extension_.Add(values); + return this; + } + public Builder ClearExtension() { + PrepareBuilder(); + result.extension_.Clear(); + return this; + } + + public bool HasOptions { + get { return result.hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions Options { + get { return result.Options; } + set { SetOptions(value); } + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = value; + return this; + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = builderForValue.Build(); + return this; + } + public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptions && + result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance) { + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + } else { + result.options_ = value; + } + result.hasOptions = true; + return this; + } + public Builder ClearOptions() { + PrepareBuilder(); + result.hasOptions = false; + result.options_ = null; + return this; + } + + public bool HasSourceCodeInfo { + get { return result.hasSourceCodeInfo; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo SourceCodeInfo { + get { return result.SourceCodeInfo; } + set { SetSourceCodeInfo(value); } + } + public Builder SetSourceCodeInfo(global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasSourceCodeInfo = true; + result.sourceCodeInfo_ = value; + return this; + } + public Builder SetSourceCodeInfo(global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasSourceCodeInfo = true; + result.sourceCodeInfo_ = builderForValue.Build(); + return this; + } + public Builder MergeSourceCodeInfo(global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasSourceCodeInfo && + result.sourceCodeInfo_ != global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.DefaultInstance) { + result.sourceCodeInfo_ = global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.CreateBuilder(result.sourceCodeInfo_).MergeFrom(value).BuildPartial(); + } else { + result.sourceCodeInfo_ = value; + } + result.hasSourceCodeInfo = true; + return this; + } + public Builder ClearSourceCodeInfo() { + PrepareBuilder(); + result.hasSourceCodeInfo = false; + result.sourceCodeInfo_ = null; + return this; + } + } + static FileDescriptorProto() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class DescriptorProto : pb::GeneratedMessage { + private DescriptorProto() { } + private static readonly DescriptorProto defaultInstance = new DescriptorProto().MakeReadOnly(); + private static readonly string[] _descriptorProtoFieldNames = new string[] { "enum_type", "extension", "extension_range", "field", "name", "nested_type", "options" }; + private static readonly uint[] _descriptorProtoFieldTags = new uint[] { 34, 50, 42, 18, 10, 26, 58 }; + public static DescriptorProto DefaultInstance { + get { return defaultInstance; } + } + + public override DescriptorProto DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override DescriptorProto ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ExtensionRange : pb::GeneratedMessage { + private ExtensionRange() { } + private static readonly ExtensionRange defaultInstance = new ExtensionRange().MakeReadOnly(); + private static readonly string[] _extensionRangeFieldNames = new string[] { "end", "start" }; + private static readonly uint[] _extensionRangeFieldTags = new uint[] { 16, 8 }; + public static ExtensionRange DefaultInstance { + get { return defaultInstance; } + } + + public override ExtensionRange DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ExtensionRange ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ExtensionRange__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_DescriptorProto_ExtensionRange__FieldAccessorTable; } + } + + public const int StartFieldNumber = 1; + private bool hasStart; + private int start_; + public bool HasStart { + get { return hasStart; } + } + public int Start { + get { return start_; } + } + + public const int EndFieldNumber = 2; + private bool hasEnd; + private int end_; + public bool HasEnd { + get { return hasEnd; } + } + public int End { + get { return end_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _extensionRangeFieldNames; + if (hasStart) { + output.WriteInt32(1, field_names[1], Start); + } + if (hasEnd) { + output.WriteInt32(2, field_names[0], End); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasStart) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Start); + } + if (hasEnd) { + size += pb::CodedOutputStream.ComputeInt32Size(2, End); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ExtensionRange ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ExtensionRange ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ExtensionRange ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ExtensionRange ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ExtensionRange ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ExtensionRange ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ExtensionRange ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ExtensionRange ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ExtensionRange ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ExtensionRange ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ExtensionRange MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ExtensionRange prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ExtensionRange cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ExtensionRange result; + + private ExtensionRange PrepareBuilder() { + if (resultIsReadOnly) { + ExtensionRange original = result; + result = new ExtensionRange(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ExtensionRange MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.Descriptor; } + } + + public override ExtensionRange DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.DefaultInstance; } + } + + public override ExtensionRange BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ExtensionRange) { + return MergeFrom((ExtensionRange) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ExtensionRange other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasStart) { + Start = other.Start; + } + if (other.HasEnd) { + End = other.End; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_extensionRangeFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _extensionRangeFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasStart = input.ReadInt32(ref result.start_); + break; + } + case 16: { + result.hasEnd = input.ReadInt32(ref result.end_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasStart { + get { return result.hasStart; } + } + public int Start { + get { return result.Start; } + set { SetStart(value); } + } + public Builder SetStart(int value) { + PrepareBuilder(); + result.hasStart = true; + result.start_ = value; + return this; + } + public Builder ClearStart() { + PrepareBuilder(); + result.hasStart = false; + result.start_ = 0; + return this; + } + + public bool HasEnd { + get { return result.hasEnd; } + } + public int End { + get { return result.End; } + set { SetEnd(value); } + } + public Builder SetEnd(int value) { + PrepareBuilder(); + result.hasEnd = true; + result.end_ = value; + return this; + } + public Builder ClearEnd() { + PrepareBuilder(); + result.hasEnd = false; + result.end_ = 0; + return this; + } + } + static ExtensionRange() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int FieldFieldNumber = 2; + private pbc::PopsicleList field_ = new pbc::PopsicleList(); + public scg::IList FieldList { + get { return field_; } + } + public int FieldCount { + get { return field_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto GetField(int index) { + return field_[index]; + } + + public const int ExtensionFieldNumber = 6; + private pbc::PopsicleList extension_ = new pbc::PopsicleList(); + public scg::IList ExtensionList { + get { return extension_; } + } + public int ExtensionCount { + get { return extension_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto GetExtension(int index) { + return extension_[index]; + } + + public const int NestedTypeFieldNumber = 3; + private pbc::PopsicleList nestedType_ = new pbc::PopsicleList(); + public scg::IList NestedTypeList { + get { return nestedType_; } + } + public int NestedTypeCount { + get { return nestedType_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto GetNestedType(int index) { + return nestedType_[index]; + } + + public const int EnumTypeFieldNumber = 4; + private pbc::PopsicleList enumType_ = new pbc::PopsicleList(); + public scg::IList EnumTypeList { + get { return enumType_; } + } + public int EnumTypeCount { + get { return enumType_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto GetEnumType(int index) { + return enumType_[index]; + } + + public const int ExtensionRangeFieldNumber = 5; + private pbc::PopsicleList extensionRange_ = new pbc::PopsicleList(); + public scg::IList ExtensionRangeList { + get { return extensionRange_; } + } + public int ExtensionRangeCount { + get { return extensionRange_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange GetExtensionRange(int index) { + return extensionRange_[index]; + } + + public const int OptionsFieldNumber = 7; + private bool hasOptions; + private global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions options_; + public bool HasOptions { + get { return hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions Options { + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance; } + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in FieldList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in NestedTypeList) { + if (!element.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto element in EnumTypeList) { + if (!element.IsInitialized) return false; + } + if (HasOptions) { + if (!Options.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _descriptorProtoFieldNames; + if (hasName) { + output.WriteString(1, field_names[4], Name); + } + if (field_.Count > 0) { + output.WriteMessageArray(2, field_names[3], field_); + } + if (nestedType_.Count > 0) { + output.WriteMessageArray(3, field_names[5], nestedType_); + } + if (enumType_.Count > 0) { + output.WriteMessageArray(4, field_names[0], enumType_); + } + if (extensionRange_.Count > 0) { + output.WriteMessageArray(5, field_names[2], extensionRange_); + } + if (extension_.Count > 0) { + output.WriteMessageArray(6, field_names[1], extension_); + } + if (hasOptions) { + output.WriteMessage(7, field_names[6], Options); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in FieldList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto element in ExtensionList) { + size += pb::CodedOutputStream.ComputeMessageSize(6, element); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto element in NestedTypeList) { + size += pb::CodedOutputStream.ComputeMessageSize(3, element); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto element in EnumTypeList) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange element in ExtensionRangeList) { + size += pb::CodedOutputStream.ComputeMessageSize(5, element); + } + if (hasOptions) { + size += pb::CodedOutputStream.ComputeMessageSize(7, Options); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static DescriptorProto ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DescriptorProto ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DescriptorProto ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DescriptorProto ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DescriptorProto ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DescriptorProto ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private DescriptorProto MakeReadOnly() { + field_.MakeReadOnly(); + extension_.MakeReadOnly(); + nestedType_.MakeReadOnly(); + enumType_.MakeReadOnly(); + extensionRange_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DescriptorProto prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(DescriptorProto cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private DescriptorProto result; + + private DescriptorProto PrepareBuilder() { + if (resultIsReadOnly) { + DescriptorProto original = result; + result = new DescriptorProto(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override DescriptorProto MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Descriptor; } + } + + public override DescriptorProto DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.DefaultInstance; } + } + + public override DescriptorProto BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DescriptorProto) { + return MergeFrom((DescriptorProto) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DescriptorProto other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.field_.Count != 0) { + result.field_.Add(other.field_); + } + if (other.extension_.Count != 0) { + result.extension_.Add(other.extension_); + } + if (other.nestedType_.Count != 0) { + result.nestedType_.Add(other.nestedType_); + } + if (other.enumType_.Count != 0) { + result.enumType_.Add(other.enumType_); + } + if (other.extensionRange_.Count != 0) { + result.extensionRange_.Add(other.extensionRange_); + } + if (other.HasOptions) { + MergeOptions(other.Options); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_descriptorProtoFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _descriptorProtoFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.field_, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 26: { + input.ReadMessageArray(tag, field_name, result.nestedType_, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 34: { + input.ReadMessageArray(tag, field_name, result.enumType_, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 42: { + input.ReadMessageArray(tag, field_name, result.extensionRange_, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.DefaultInstance, extensionRegistry); + break; + } + case 50: { + input.ReadMessageArray(tag, field_name, result.extension_, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 58: { + global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.CreateBuilder(); + if (result.hasOptions) { + subBuilder.MergeFrom(Options); + } + input.ReadMessage(subBuilder, extensionRegistry); + Options = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public pbc::IPopsicleList FieldList { + get { return PrepareBuilder().field_; } + } + public int FieldCount { + get { return result.FieldCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto GetField(int index) { + return result.GetField(index); + } + public Builder SetField(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field_[index] = value; + return this; + } + public Builder SetField(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.field_[index] = builderForValue.Build(); + return this; + } + public Builder AddField(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.field_.Add(value); + return this; + } + public Builder AddField(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.field_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeField(scg::IEnumerable values) { + PrepareBuilder(); + result.field_.Add(values); + return this; + } + public Builder ClearField() { + PrepareBuilder(); + result.field_.Clear(); + return this; + } + + public pbc::IPopsicleList ExtensionList { + get { return PrepareBuilder().extension_; } + } + public int ExtensionCount { + get { return result.ExtensionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto GetExtension(int index) { + return result.GetExtension(index); + } + public Builder SetExtension(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.extension_[index] = value; + return this; + } + public Builder SetExtension(int index, global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.extension_[index] = builderForValue.Build(); + return this; + } + public Builder AddExtension(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.extension_.Add(value); + return this; + } + public Builder AddExtension(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.extension_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeExtension(scg::IEnumerable values) { + PrepareBuilder(); + result.extension_.Add(values); + return this; + } + public Builder ClearExtension() { + PrepareBuilder(); + result.extension_.Clear(); + return this; + } + + public pbc::IPopsicleList NestedTypeList { + get { return PrepareBuilder().nestedType_; } + } + public int NestedTypeCount { + get { return result.NestedTypeCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto GetNestedType(int index) { + return result.GetNestedType(index); + } + public Builder SetNestedType(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.nestedType_[index] = value; + return this; + } + public Builder SetNestedType(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.nestedType_[index] = builderForValue.Build(); + return this; + } + public Builder AddNestedType(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.nestedType_.Add(value); + return this; + } + public Builder AddNestedType(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.nestedType_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeNestedType(scg::IEnumerable values) { + PrepareBuilder(); + result.nestedType_.Add(values); + return this; + } + public Builder ClearNestedType() { + PrepareBuilder(); + result.nestedType_.Clear(); + return this; + } + + public pbc::IPopsicleList EnumTypeList { + get { return PrepareBuilder().enumType_; } + } + public int EnumTypeCount { + get { return result.EnumTypeCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto GetEnumType(int index) { + return result.GetEnumType(index); + } + public Builder SetEnumType(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.enumType_[index] = value; + return this; + } + public Builder SetEnumType(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.enumType_[index] = builderForValue.Build(); + return this; + } + public Builder AddEnumType(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.enumType_.Add(value); + return this; + } + public Builder AddEnumType(global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.enumType_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeEnumType(scg::IEnumerable values) { + PrepareBuilder(); + result.enumType_.Add(values); + return this; + } + public Builder ClearEnumType() { + PrepareBuilder(); + result.enumType_.Clear(); + return this; + } + + public pbc::IPopsicleList ExtensionRangeList { + get { return PrepareBuilder().extensionRange_; } + } + public int ExtensionRangeCount { + get { return result.ExtensionRangeCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange GetExtensionRange(int index) { + return result.GetExtensionRange(index); + } + public Builder SetExtensionRange(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.extensionRange_[index] = value; + return this; + } + public Builder SetExtensionRange(int index, global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.extensionRange_[index] = builderForValue.Build(); + return this; + } + public Builder AddExtensionRange(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.extensionRange_.Add(value); + return this; + } + public Builder AddExtensionRange(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProto.Types.ExtensionRange.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.extensionRange_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeExtensionRange(scg::IEnumerable values) { + PrepareBuilder(); + result.extensionRange_.Add(values); + return this; + } + public Builder ClearExtensionRange() { + PrepareBuilder(); + result.extensionRange_.Clear(); + return this; + } + + public bool HasOptions { + get { return result.hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions Options { + get { return result.Options; } + set { SetOptions(value); } + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = value; + return this; + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = builderForValue.Build(); + return this; + } + public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptions && + result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance) { + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + } else { + result.options_ = value; + } + result.hasOptions = true; + return this; + } + public Builder ClearOptions() { + PrepareBuilder(); + result.hasOptions = false; + result.options_ = null; + return this; + } + } + static DescriptorProto() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FieldDescriptorProto : pb::GeneratedMessage { + private FieldDescriptorProto() { } + private static readonly FieldDescriptorProto defaultInstance = new FieldDescriptorProto().MakeReadOnly(); + private static readonly string[] _fieldDescriptorProtoFieldNames = new string[] { "default_value", "extendee", "label", "name", "number", "options", "type", "type_name" }; + private static readonly uint[] _fieldDescriptorProtoFieldTags = new uint[] { 58, 18, 32, 10, 24, 66, 40, 50 }; + public static FieldDescriptorProto DefaultInstance { + get { return defaultInstance; } + } + + public override FieldDescriptorProto DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FieldDescriptorProto ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FieldDescriptorProto__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FieldDescriptorProto__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public 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, + } + + public enum Label { + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + } + + } + #endregion + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int NumberFieldNumber = 3; + private bool hasNumber; + private int number_; + public bool HasNumber { + get { return hasNumber; } + } + public int Number { + get { return number_; } + } + + public const int LabelFieldNumber = 4; + private bool hasLabel; + private global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label label_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL; + public bool HasLabel { + get { return hasLabel; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label Label { + get { return label_; } + } + + public const int TypeFieldNumber = 5; + private bool hasType; + private global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type type_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE; + public bool HasType { + get { return hasType; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type Type { + get { return type_; } + } + + public const int TypeNameFieldNumber = 6; + private bool hasTypeName; + private string typeName_ = ""; + public bool HasTypeName { + get { return hasTypeName; } + } + public string TypeName { + get { return typeName_; } + } + + public const int ExtendeeFieldNumber = 2; + private bool hasExtendee; + private string extendee_ = ""; + public bool HasExtendee { + get { return hasExtendee; } + } + public string Extendee { + get { return extendee_; } + } + + public const int DefaultValueFieldNumber = 7; + private bool hasDefaultValue; + private string defaultValue_ = ""; + public bool HasDefaultValue { + get { return hasDefaultValue; } + } + public string DefaultValue { + get { return defaultValue_; } + } + + public const int OptionsFieldNumber = 8; + private bool hasOptions; + private global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions options_; + public bool HasOptions { + get { return hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions Options { + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (HasOptions) { + if (!Options.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fieldDescriptorProtoFieldNames; + if (hasName) { + output.WriteString(1, field_names[3], Name); + } + if (hasExtendee) { + output.WriteString(2, field_names[1], Extendee); + } + if (hasNumber) { + output.WriteInt32(3, field_names[4], Number); + } + if (hasLabel) { + output.WriteEnum(4, field_names[2], (int) Label, Label); + } + if (hasType) { + output.WriteEnum(5, field_names[6], (int) Type, Type); + } + if (hasTypeName) { + output.WriteString(6, field_names[7], TypeName); + } + if (hasDefaultValue) { + output.WriteString(7, field_names[0], DefaultValue); + } + if (hasOptions) { + output.WriteMessage(8, field_names[5], Options); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + if (hasNumber) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Number); + } + if (hasLabel) { + size += pb::CodedOutputStream.ComputeEnumSize(4, (int) Label); + } + if (hasType) { + size += pb::CodedOutputStream.ComputeEnumSize(5, (int) Type); + } + if (hasTypeName) { + size += pb::CodedOutputStream.ComputeStringSize(6, TypeName); + } + if (hasExtendee) { + size += pb::CodedOutputStream.ComputeStringSize(2, Extendee); + } + if (hasDefaultValue) { + size += pb::CodedOutputStream.ComputeStringSize(7, DefaultValue); + } + if (hasOptions) { + size += pb::CodedOutputStream.ComputeMessageSize(8, Options); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FieldDescriptorProto ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FieldDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FieldDescriptorProto ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FieldDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FieldDescriptorProto ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FieldDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FieldDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FieldDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FieldDescriptorProto ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FieldDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FieldDescriptorProto MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FieldDescriptorProto prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FieldDescriptorProto cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FieldDescriptorProto result; + + private FieldDescriptorProto PrepareBuilder() { + if (resultIsReadOnly) { + FieldDescriptorProto original = result; + result = new FieldDescriptorProto(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FieldDescriptorProto MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Descriptor; } + } + + public override FieldDescriptorProto DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.DefaultInstance; } + } + + public override FieldDescriptorProto BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FieldDescriptorProto) { + return MergeFrom((FieldDescriptorProto) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FieldDescriptorProto other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.HasNumber) { + Number = other.Number; + } + if (other.HasLabel) { + Label = other.Label; + } + if (other.HasType) { + Type = other.Type; + } + if (other.HasTypeName) { + TypeName = other.TypeName; + } + if (other.HasExtendee) { + Extendee = other.Extendee; + } + if (other.HasDefaultValue) { + DefaultValue = other.DefaultValue; + } + if (other.HasOptions) { + MergeOptions(other.Options); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fieldDescriptorProtoFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fieldDescriptorProtoFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 18: { + result.hasExtendee = input.ReadString(ref result.extendee_); + break; + } + case 24: { + result.hasNumber = input.ReadInt32(ref result.number_); + break; + } + case 32: { + object unknown; + if(input.ReadEnum(ref result.label_, out unknown)) { + result.hasLabel = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(4, (ulong)(int)unknown); + } + break; + } + case 40: { + object unknown; + if(input.ReadEnum(ref result.type_, out unknown)) { + result.hasType = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(5, (ulong)(int)unknown); + } + break; + } + case 50: { + result.hasTypeName = input.ReadString(ref result.typeName_); + break; + } + case 58: { + result.hasDefaultValue = input.ReadString(ref result.defaultValue_); + break; + } + case 66: { + global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.CreateBuilder(); + if (result.hasOptions) { + subBuilder.MergeFrom(Options); + } + input.ReadMessage(subBuilder, extensionRegistry); + Options = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasNumber { + get { return result.hasNumber; } + } + public int Number { + get { return result.Number; } + set { SetNumber(value); } + } + public Builder SetNumber(int value) { + PrepareBuilder(); + result.hasNumber = true; + result.number_ = value; + return this; + } + public Builder ClearNumber() { + PrepareBuilder(); + result.hasNumber = false; + result.number_ = 0; + return this; + } + + public bool HasLabel { + get { return result.hasLabel; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label Label { + get { return result.Label; } + set { SetLabel(value); } + } + public Builder SetLabel(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label value) { + PrepareBuilder(); + result.hasLabel = true; + result.label_ = value; + return this; + } + public Builder ClearLabel() { + PrepareBuilder(); + result.hasLabel = false; + result.label_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Label.LABEL_OPTIONAL; + return this; + } + + public bool HasType { + get { return result.hasType; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type Type { + get { return result.Type; } + set { SetType(value); } + } + public Builder SetType(global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type value) { + PrepareBuilder(); + result.hasType = true; + result.type_ = value; + return this; + } + public Builder ClearType() { + PrepareBuilder(); + result.hasType = false; + result.type_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldDescriptorProto.Types.Type.TYPE_DOUBLE; + return this; + } + + public bool HasTypeName { + get { return result.hasTypeName; } + } + public string TypeName { + get { return result.TypeName; } + set { SetTypeName(value); } + } + public Builder SetTypeName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasTypeName = true; + result.typeName_ = value; + return this; + } + public Builder ClearTypeName() { + PrepareBuilder(); + result.hasTypeName = false; + result.typeName_ = ""; + return this; + } + + public bool HasExtendee { + get { return result.hasExtendee; } + } + public string Extendee { + get { return result.Extendee; } + set { SetExtendee(value); } + } + public Builder SetExtendee(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasExtendee = true; + result.extendee_ = value; + return this; + } + public Builder ClearExtendee() { + PrepareBuilder(); + result.hasExtendee = false; + result.extendee_ = ""; + return this; + } + + public bool HasDefaultValue { + get { return result.hasDefaultValue; } + } + public string DefaultValue { + get { return result.DefaultValue; } + set { SetDefaultValue(value); } + } + public Builder SetDefaultValue(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultValue = true; + result.defaultValue_ = value; + return this; + } + public Builder ClearDefaultValue() { + PrepareBuilder(); + result.hasDefaultValue = false; + result.defaultValue_ = ""; + return this; + } + + public bool HasOptions { + get { return result.hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions Options { + get { return result.Options; } + set { SetOptions(value); } + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = value; + return this; + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = builderForValue.Build(); + return this; + } + public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptions && + result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance) { + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + } else { + result.options_ = value; + } + result.hasOptions = true; + return this; + } + public Builder ClearOptions() { + PrepareBuilder(); + result.hasOptions = false; + result.options_ = null; + return this; + } + } + static FieldDescriptorProto() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class EnumDescriptorProto : pb::GeneratedMessage { + private EnumDescriptorProto() { } + private static readonly EnumDescriptorProto defaultInstance = new EnumDescriptorProto().MakeReadOnly(); + private static readonly string[] _enumDescriptorProtoFieldNames = new string[] { "name", "options", "value" }; + private static readonly uint[] _enumDescriptorProtoFieldTags = new uint[] { 10, 26, 18 }; + public static EnumDescriptorProto DefaultInstance { + get { return defaultInstance; } + } + + public override EnumDescriptorProto DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override EnumDescriptorProto ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumDescriptorProto__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumDescriptorProto__FieldAccessorTable; } + } + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int ValueFieldNumber = 2; + private pbc::PopsicleList value_ = new pbc::PopsicleList(); + public scg::IList ValueList { + get { return value_; } + } + public int ValueCount { + get { return value_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto GetValue(int index) { + return value_[index]; + } + + public const int OptionsFieldNumber = 3; + private bool hasOptions; + private global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions options_; + public bool HasOptions { + get { return hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions Options { + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance; } + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto element in ValueList) { + if (!element.IsInitialized) return false; + } + if (HasOptions) { + if (!Options.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _enumDescriptorProtoFieldNames; + if (hasName) { + output.WriteString(1, field_names[0], Name); + } + if (value_.Count > 0) { + output.WriteMessageArray(2, field_names[2], value_); + } + if (hasOptions) { + output.WriteMessage(3, field_names[1], Options); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto element in ValueList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + if (hasOptions) { + size += pb::CodedOutputStream.ComputeMessageSize(3, Options); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static EnumDescriptorProto ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static EnumDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static EnumDescriptorProto ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static EnumDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static EnumDescriptorProto ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static EnumDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static EnumDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static EnumDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static EnumDescriptorProto ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static EnumDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private EnumDescriptorProto MakeReadOnly() { + value_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(EnumDescriptorProto prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(EnumDescriptorProto cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private EnumDescriptorProto result; + + private EnumDescriptorProto PrepareBuilder() { + if (resultIsReadOnly) { + EnumDescriptorProto original = result; + result = new EnumDescriptorProto(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override EnumDescriptorProto MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.Descriptor; } + } + + public override EnumDescriptorProto DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.DefaultInstance; } + } + + public override EnumDescriptorProto BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is EnumDescriptorProto) { + return MergeFrom((EnumDescriptorProto) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(EnumDescriptorProto other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.value_.Count != 0) { + result.value_.Add(other.value_); + } + if (other.HasOptions) { + MergeOptions(other.Options); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_enumDescriptorProtoFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _enumDescriptorProtoFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.value_, global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 26: { + global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.CreateBuilder(); + if (result.hasOptions) { + subBuilder.MergeFrom(Options); + } + input.ReadMessage(subBuilder, extensionRegistry); + Options = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public pbc::IPopsicleList ValueList { + get { return PrepareBuilder().value_; } + } + public int ValueCount { + get { return result.ValueCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto GetValue(int index) { + return result.GetValue(index); + } + public Builder SetValue(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.value_[index] = value; + return this; + } + public Builder SetValue(int index, global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.value_[index] = builderForValue.Build(); + return this; + } + public Builder AddValue(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.value_.Add(value); + return this; + } + public Builder AddValue(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.value_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeValue(scg::IEnumerable values) { + PrepareBuilder(); + result.value_.Add(values); + return this; + } + public Builder ClearValue() { + PrepareBuilder(); + result.value_.Clear(); + return this; + } + + public bool HasOptions { + get { return result.hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions Options { + get { return result.Options; } + set { SetOptions(value); } + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = value; + return this; + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = builderForValue.Build(); + return this; + } + public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptions && + result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance) { + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + } else { + result.options_ = value; + } + result.hasOptions = true; + return this; + } + public Builder ClearOptions() { + PrepareBuilder(); + result.hasOptions = false; + result.options_ = null; + return this; + } + } + static EnumDescriptorProto() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class EnumValueDescriptorProto : pb::GeneratedMessage { + private EnumValueDescriptorProto() { } + private static readonly EnumValueDescriptorProto defaultInstance = new EnumValueDescriptorProto().MakeReadOnly(); + private static readonly string[] _enumValueDescriptorProtoFieldNames = new string[] { "name", "number", "options" }; + private static readonly uint[] _enumValueDescriptorProtoFieldTags = new uint[] { 10, 16, 26 }; + public static EnumValueDescriptorProto DefaultInstance { + get { return defaultInstance; } + } + + public override EnumValueDescriptorProto DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override EnumValueDescriptorProto ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumValueDescriptorProto__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumValueDescriptorProto__FieldAccessorTable; } + } + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int NumberFieldNumber = 2; + private bool hasNumber; + private int number_; + public bool HasNumber { + get { return hasNumber; } + } + public int Number { + get { return number_; } + } + + public const int OptionsFieldNumber = 3; + private bool hasOptions; + private global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions options_; + public bool HasOptions { + get { return hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions Options { + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (HasOptions) { + if (!Options.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _enumValueDescriptorProtoFieldNames; + if (hasName) { + output.WriteString(1, field_names[0], Name); + } + if (hasNumber) { + output.WriteInt32(2, field_names[1], Number); + } + if (hasOptions) { + output.WriteMessage(3, field_names[2], Options); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + if (hasNumber) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Number); + } + if (hasOptions) { + size += pb::CodedOutputStream.ComputeMessageSize(3, Options); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static EnumValueDescriptorProto ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static EnumValueDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static EnumValueDescriptorProto ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static EnumValueDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static EnumValueDescriptorProto ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static EnumValueDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static EnumValueDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static EnumValueDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static EnumValueDescriptorProto ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static EnumValueDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private EnumValueDescriptorProto MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(EnumValueDescriptorProto prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(EnumValueDescriptorProto cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private EnumValueDescriptorProto result; + + private EnumValueDescriptorProto PrepareBuilder() { + if (resultIsReadOnly) { + EnumValueDescriptorProto original = result; + result = new EnumValueDescriptorProto(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override EnumValueDescriptorProto MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.Descriptor; } + } + + public override EnumValueDescriptorProto DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.DefaultInstance; } + } + + public override EnumValueDescriptorProto BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is EnumValueDescriptorProto) { + return MergeFrom((EnumValueDescriptorProto) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(EnumValueDescriptorProto other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumValueDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.HasNumber) { + Number = other.Number; + } + if (other.HasOptions) { + MergeOptions(other.Options); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_enumValueDescriptorProtoFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _enumValueDescriptorProtoFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 16: { + result.hasNumber = input.ReadInt32(ref result.number_); + break; + } + case 26: { + global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.CreateBuilder(); + if (result.hasOptions) { + subBuilder.MergeFrom(Options); + } + input.ReadMessage(subBuilder, extensionRegistry); + Options = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasNumber { + get { return result.hasNumber; } + } + public int Number { + get { return result.Number; } + set { SetNumber(value); } + } + public Builder SetNumber(int value) { + PrepareBuilder(); + result.hasNumber = true; + result.number_ = value; + return this; + } + public Builder ClearNumber() { + PrepareBuilder(); + result.hasNumber = false; + result.number_ = 0; + return this; + } + + public bool HasOptions { + get { return result.hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions Options { + get { return result.Options; } + set { SetOptions(value); } + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = value; + return this; + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = builderForValue.Build(); + return this; + } + public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptions && + result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance) { + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + } else { + result.options_ = value; + } + result.hasOptions = true; + return this; + } + public Builder ClearOptions() { + PrepareBuilder(); + result.hasOptions = false; + result.options_ = null; + return this; + } + } + static EnumValueDescriptorProto() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ServiceDescriptorProto : pb::GeneratedMessage { + private ServiceDescriptorProto() { } + private static readonly ServiceDescriptorProto defaultInstance = new ServiceDescriptorProto().MakeReadOnly(); + private static readonly string[] _serviceDescriptorProtoFieldNames = new string[] { "method", "name", "options" }; + private static readonly uint[] _serviceDescriptorProtoFieldTags = new uint[] { 18, 10, 26 }; + public static ServiceDescriptorProto DefaultInstance { + get { return defaultInstance; } + } + + public override ServiceDescriptorProto DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ServiceDescriptorProto ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_ServiceDescriptorProto__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_ServiceDescriptorProto__FieldAccessorTable; } + } + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int MethodFieldNumber = 2; + private pbc::PopsicleList method_ = new pbc::PopsicleList(); + public scg::IList MethodList { + get { return method_; } + } + public int MethodCount { + get { return method_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto GetMethod(int index) { + return method_[index]; + } + + public const int OptionsFieldNumber = 3; + private bool hasOptions; + private global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions options_; + public bool HasOptions { + get { return hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions Options { + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance; } + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto element in MethodList) { + if (!element.IsInitialized) return false; + } + if (HasOptions) { + if (!Options.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _serviceDescriptorProtoFieldNames; + if (hasName) { + output.WriteString(1, field_names[1], Name); + } + if (method_.Count > 0) { + output.WriteMessageArray(2, field_names[0], method_); + } + if (hasOptions) { + output.WriteMessage(3, field_names[2], Options); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto element in MethodList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + if (hasOptions) { + size += pb::CodedOutputStream.ComputeMessageSize(3, Options); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ServiceDescriptorProto ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ServiceDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ServiceDescriptorProto ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ServiceDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ServiceDescriptorProto ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ServiceDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ServiceDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ServiceDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ServiceDescriptorProto ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ServiceDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ServiceDescriptorProto MakeReadOnly() { + method_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ServiceDescriptorProto prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ServiceDescriptorProto cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ServiceDescriptorProto result; + + private ServiceDescriptorProto PrepareBuilder() { + if (resultIsReadOnly) { + ServiceDescriptorProto original = result; + result = new ServiceDescriptorProto(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ServiceDescriptorProto MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.Descriptor; } + } + + public override ServiceDescriptorProto DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.DefaultInstance; } + } + + public override ServiceDescriptorProto BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ServiceDescriptorProto) { + return MergeFrom((ServiceDescriptorProto) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ServiceDescriptorProto other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.ServiceDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.method_.Count != 0) { + result.method_.Add(other.method_); + } + if (other.HasOptions) { + MergeOptions(other.Options); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_serviceDescriptorProtoFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _serviceDescriptorProtoFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.method_, global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.DefaultInstance, extensionRegistry); + break; + } + case 26: { + global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.CreateBuilder(); + if (result.hasOptions) { + subBuilder.MergeFrom(Options); + } + input.ReadMessage(subBuilder, extensionRegistry); + Options = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public pbc::IPopsicleList MethodList { + get { return PrepareBuilder().method_; } + } + public int MethodCount { + get { return result.MethodCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto GetMethod(int index) { + return result.GetMethod(index); + } + public Builder SetMethod(int index, global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.method_[index] = value; + return this; + } + public Builder SetMethod(int index, global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.method_[index] = builderForValue.Build(); + return this; + } + public Builder AddMethod(global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.method_.Add(value); + return this; + } + public Builder AddMethod(global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.method_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeMethod(scg::IEnumerable values) { + PrepareBuilder(); + result.method_.Add(values); + return this; + } + public Builder ClearMethod() { + PrepareBuilder(); + result.method_.Clear(); + return this; + } + + public bool HasOptions { + get { return result.hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions Options { + get { return result.Options; } + set { SetOptions(value); } + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = value; + return this; + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = builderForValue.Build(); + return this; + } + public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptions && + result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance) { + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + } else { + result.options_ = value; + } + result.hasOptions = true; + return this; + } + public Builder ClearOptions() { + PrepareBuilder(); + result.hasOptions = false; + result.options_ = null; + return this; + } + } + static ServiceDescriptorProto() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class MethodDescriptorProto : pb::GeneratedMessage { + private MethodDescriptorProto() { } + private static readonly MethodDescriptorProto defaultInstance = new MethodDescriptorProto().MakeReadOnly(); + private static readonly string[] _methodDescriptorProtoFieldNames = new string[] { "input_type", "name", "options", "output_type" }; + private static readonly uint[] _methodDescriptorProtoFieldTags = new uint[] { 18, 10, 34, 26 }; + public static MethodDescriptorProto DefaultInstance { + get { return defaultInstance; } + } + + public override MethodDescriptorProto DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override MethodDescriptorProto ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MethodDescriptorProto__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MethodDescriptorProto__FieldAccessorTable; } + } + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int InputTypeFieldNumber = 2; + private bool hasInputType; + private string inputType_ = ""; + public bool HasInputType { + get { return hasInputType; } + } + public string InputType { + get { return inputType_; } + } + + public const int OutputTypeFieldNumber = 3; + private bool hasOutputType; + private string outputType_ = ""; + public bool HasOutputType { + get { return hasOutputType; } + } + public string OutputType { + get { return outputType_; } + } + + public const int OptionsFieldNumber = 4; + private bool hasOptions; + private global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions options_; + public bool HasOptions { + get { return hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions Options { + get { return options_ ?? global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (HasOptions) { + if (!Options.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _methodDescriptorProtoFieldNames; + if (hasName) { + output.WriteString(1, field_names[1], Name); + } + if (hasInputType) { + output.WriteString(2, field_names[0], InputType); + } + if (hasOutputType) { + output.WriteString(3, field_names[3], OutputType); + } + if (hasOptions) { + output.WriteMessage(4, field_names[2], Options); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + if (hasInputType) { + size += pb::CodedOutputStream.ComputeStringSize(2, InputType); + } + if (hasOutputType) { + size += pb::CodedOutputStream.ComputeStringSize(3, OutputType); + } + if (hasOptions) { + size += pb::CodedOutputStream.ComputeMessageSize(4, Options); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static MethodDescriptorProto ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MethodDescriptorProto ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MethodDescriptorProto ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MethodDescriptorProto ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MethodDescriptorProto ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MethodDescriptorProto ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static MethodDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static MethodDescriptorProto ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static MethodDescriptorProto ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MethodDescriptorProto ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private MethodDescriptorProto MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(MethodDescriptorProto prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(MethodDescriptorProto cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private MethodDescriptorProto result; + + private MethodDescriptorProto PrepareBuilder() { + if (resultIsReadOnly) { + MethodDescriptorProto original = result; + result = new MethodDescriptorProto(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override MethodDescriptorProto MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.Descriptor; } + } + + public override MethodDescriptorProto DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.DefaultInstance; } + } + + public override MethodDescriptorProto BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is MethodDescriptorProto) { + return MergeFrom((MethodDescriptorProto) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(MethodDescriptorProto other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.MethodDescriptorProto.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.HasInputType) { + InputType = other.InputType; + } + if (other.HasOutputType) { + OutputType = other.OutputType; + } + if (other.HasOptions) { + MergeOptions(other.Options); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_methodDescriptorProtoFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _methodDescriptorProtoFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 18: { + result.hasInputType = input.ReadString(ref result.inputType_); + break; + } + case 26: { + result.hasOutputType = input.ReadString(ref result.outputType_); + break; + } + case 34: { + global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.Builder subBuilder = global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.CreateBuilder(); + if (result.hasOptions) { + subBuilder.MergeFrom(Options); + } + input.ReadMessage(subBuilder, extensionRegistry); + Options = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasInputType { + get { return result.hasInputType; } + } + public string InputType { + get { return result.InputType; } + set { SetInputType(value); } + } + public Builder SetInputType(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasInputType = true; + result.inputType_ = value; + return this; + } + public Builder ClearInputType() { + PrepareBuilder(); + result.hasInputType = false; + result.inputType_ = ""; + return this; + } + + public bool HasOutputType { + get { return result.hasOutputType; } + } + public string OutputType { + get { return result.OutputType; } + set { SetOutputType(value); } + } + public Builder SetOutputType(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOutputType = true; + result.outputType_ = value; + return this; + } + public Builder ClearOutputType() { + PrepareBuilder(); + result.hasOutputType = false; + result.outputType_ = ""; + return this; + } + + public bool HasOptions { + get { return result.hasOptions; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions Options { + get { return result.Options; } + set { SetOptions(value); } + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = value; + return this; + } + public Builder SetOptions(global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptions = true; + result.options_ = builderForValue.Build(); + return this; + } + public Builder MergeOptions(global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptions && + result.options_ != global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance) { + result.options_ = global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.CreateBuilder(result.options_).MergeFrom(value).BuildPartial(); + } else { + result.options_ = value; + } + result.hasOptions = true; + return this; + } + public Builder ClearOptions() { + PrepareBuilder(); + result.hasOptions = false; + result.options_ = null; + return this; + } + } + static MethodDescriptorProto() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FileOptions : pb::ExtendableMessage { + private FileOptions() { } + private static readonly FileOptions defaultInstance = new FileOptions().MakeReadOnly(); + private static readonly string[] _fileOptionsFieldNames = new string[] { "cc_generic_services", "java_generate_equals_and_hash", "java_generic_services", "java_multiple_files", "java_outer_classname", "java_package", "optimize_for", "py_generic_services", "uninterpreted_option" }; + private static readonly uint[] _fileOptionsFieldTags = new uint[] { 128, 160, 136, 80, 66, 10, 72, 144, 7994 }; + public static FileOptions DefaultInstance { + get { return defaultInstance; } + } + + public override FileOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FileOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FileOptions__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3, + } + + } + #endregion + + public const int JavaPackageFieldNumber = 1; + private bool hasJavaPackage; + private string javaPackage_ = ""; + public bool HasJavaPackage { + get { return hasJavaPackage; } + } + public string JavaPackage { + get { return javaPackage_; } + } + + public const int JavaOuterClassnameFieldNumber = 8; + private bool hasJavaOuterClassname; + private string javaOuterClassname_ = ""; + public bool HasJavaOuterClassname { + get { return hasJavaOuterClassname; } + } + public string JavaOuterClassname { + get { return javaOuterClassname_; } + } + + public const int JavaMultipleFilesFieldNumber = 10; + private bool hasJavaMultipleFiles; + private bool javaMultipleFiles_; + public bool HasJavaMultipleFiles { + get { return hasJavaMultipleFiles; } + } + public bool JavaMultipleFiles { + get { return javaMultipleFiles_; } + } + + public const int JavaGenerateEqualsAndHashFieldNumber = 20; + private bool hasJavaGenerateEqualsAndHash; + private bool javaGenerateEqualsAndHash_; + public bool HasJavaGenerateEqualsAndHash { + get { return hasJavaGenerateEqualsAndHash; } + } + public bool JavaGenerateEqualsAndHash { + get { return javaGenerateEqualsAndHash_; } + } + + public const int OptimizeForFieldNumber = 9; + private bool hasOptimizeFor; + private global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode optimizeFor_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED; + public bool HasOptimizeFor { + get { return hasOptimizeFor; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode OptimizeFor { + get { return optimizeFor_; } + } + + public const int CcGenericServicesFieldNumber = 16; + private bool hasCcGenericServices; + private bool ccGenericServices_; + public bool HasCcGenericServices { + get { return hasCcGenericServices; } + } + public bool CcGenericServices { + get { return ccGenericServices_; } + } + + public const int JavaGenericServicesFieldNumber = 17; + private bool hasJavaGenericServices; + private bool javaGenericServices_; + public bool HasJavaGenericServices { + get { return hasJavaGenericServices; } + } + public bool JavaGenericServices { + get { return javaGenericServices_; } + } + + public const int PyGenericServicesFieldNumber = 18; + private bool hasPyGenericServices; + private bool pyGenericServices_; + public bool HasPyGenericServices { + get { return hasPyGenericServices; } + } + public bool PyGenericServices { + get { return pyGenericServices_; } + } + + public const int UninterpretedOptionFieldNumber = 999; + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fileOptionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasJavaPackage) { + output.WriteString(1, field_names[5], JavaPackage); + } + if (hasJavaOuterClassname) { + output.WriteString(8, field_names[4], JavaOuterClassname); + } + if (hasOptimizeFor) { + output.WriteEnum(9, field_names[6], (int) OptimizeFor, OptimizeFor); + } + if (hasJavaMultipleFiles) { + output.WriteBool(10, field_names[3], JavaMultipleFiles); + } + if (hasCcGenericServices) { + output.WriteBool(16, field_names[0], CcGenericServices); + } + if (hasJavaGenericServices) { + output.WriteBool(17, field_names[2], JavaGenericServices); + } + if (hasPyGenericServices) { + output.WriteBool(18, field_names[7], PyGenericServices); + } + if (hasJavaGenerateEqualsAndHash) { + output.WriteBool(20, field_names[1], JavaGenerateEqualsAndHash); + } + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, field_names[8], uninterpretedOption_); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasJavaPackage) { + size += pb::CodedOutputStream.ComputeStringSize(1, JavaPackage); + } + if (hasJavaOuterClassname) { + size += pb::CodedOutputStream.ComputeStringSize(8, JavaOuterClassname); + } + if (hasJavaMultipleFiles) { + size += pb::CodedOutputStream.ComputeBoolSize(10, JavaMultipleFiles); + } + if (hasJavaGenerateEqualsAndHash) { + size += pb::CodedOutputStream.ComputeBoolSize(20, JavaGenerateEqualsAndHash); + } + if (hasOptimizeFor) { + size += pb::CodedOutputStream.ComputeEnumSize(9, (int) OptimizeFor); + } + if (hasCcGenericServices) { + size += pb::CodedOutputStream.ComputeBoolSize(16, CcGenericServices); + } + if (hasJavaGenericServices) { + size += pb::CodedOutputStream.ComputeBoolSize(17, JavaGenericServices); + } + if (hasPyGenericServices) { + size += pb::CodedOutputStream.ComputeBoolSize(18, PyGenericServices); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FileOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FileOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FileOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FileOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FileOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FileOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FileOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FileOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FileOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FileOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FileOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FileOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FileOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FileOptions result; + + private FileOptions PrepareBuilder() { + if (resultIsReadOnly) { + FileOptions original = result; + result = new FileOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FileOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Descriptor; } + } + + public override FileOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance; } + } + + public override FileOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FileOptions) { + return MergeFrom((FileOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FileOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasJavaPackage) { + JavaPackage = other.JavaPackage; + } + if (other.HasJavaOuterClassname) { + JavaOuterClassname = other.JavaOuterClassname; + } + if (other.HasJavaMultipleFiles) { + JavaMultipleFiles = other.JavaMultipleFiles; + } + if (other.HasJavaGenerateEqualsAndHash) { + JavaGenerateEqualsAndHash = other.JavaGenerateEqualsAndHash; + } + if (other.HasOptimizeFor) { + OptimizeFor = other.OptimizeFor; + } + if (other.HasCcGenericServices) { + CcGenericServices = other.CcGenericServices; + } + if (other.HasJavaGenericServices) { + JavaGenericServices = other.JavaGenericServices; + } + if (other.HasPyGenericServices) { + PyGenericServices = other.PyGenericServices; + } + if (other.uninterpretedOption_.Count != 0) { + result.uninterpretedOption_.Add(other.uninterpretedOption_); + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fileOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fileOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasJavaPackage = input.ReadString(ref result.javaPackage_); + break; + } + case 66: { + result.hasJavaOuterClassname = input.ReadString(ref result.javaOuterClassname_); + break; + } + case 72: { + object unknown; + if(input.ReadEnum(ref result.optimizeFor_, out unknown)) { + result.hasOptimizeFor = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(9, (ulong)(int)unknown); + } + break; + } + case 80: { + result.hasJavaMultipleFiles = input.ReadBool(ref result.javaMultipleFiles_); + break; + } + case 128: { + result.hasCcGenericServices = input.ReadBool(ref result.ccGenericServices_); + break; + } + case 136: { + result.hasJavaGenericServices = input.ReadBool(ref result.javaGenericServices_); + break; + } + case 144: { + result.hasPyGenericServices = input.ReadBool(ref result.pyGenericServices_); + break; + } + case 160: { + result.hasJavaGenerateEqualsAndHash = input.ReadBool(ref result.javaGenerateEqualsAndHash_); + break; + } + case 7994: { + input.ReadMessageArray(tag, field_name, result.uninterpretedOption_, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasJavaPackage { + get { return result.hasJavaPackage; } + } + public string JavaPackage { + get { return result.JavaPackage; } + set { SetJavaPackage(value); } + } + public Builder SetJavaPackage(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasJavaPackage = true; + result.javaPackage_ = value; + return this; + } + public Builder ClearJavaPackage() { + PrepareBuilder(); + result.hasJavaPackage = false; + result.javaPackage_ = ""; + return this; + } + + public bool HasJavaOuterClassname { + get { return result.hasJavaOuterClassname; } + } + public string JavaOuterClassname { + get { return result.JavaOuterClassname; } + set { SetJavaOuterClassname(value); } + } + public Builder SetJavaOuterClassname(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasJavaOuterClassname = true; + result.javaOuterClassname_ = value; + return this; + } + public Builder ClearJavaOuterClassname() { + PrepareBuilder(); + result.hasJavaOuterClassname = false; + result.javaOuterClassname_ = ""; + return this; + } + + public bool HasJavaMultipleFiles { + get { return result.hasJavaMultipleFiles; } + } + public bool JavaMultipleFiles { + get { return result.JavaMultipleFiles; } + set { SetJavaMultipleFiles(value); } + } + public Builder SetJavaMultipleFiles(bool value) { + PrepareBuilder(); + result.hasJavaMultipleFiles = true; + result.javaMultipleFiles_ = value; + return this; + } + public Builder ClearJavaMultipleFiles() { + PrepareBuilder(); + result.hasJavaMultipleFiles = false; + result.javaMultipleFiles_ = false; + return this; + } + + public bool HasJavaGenerateEqualsAndHash { + get { return result.hasJavaGenerateEqualsAndHash; } + } + public bool JavaGenerateEqualsAndHash { + get { return result.JavaGenerateEqualsAndHash; } + set { SetJavaGenerateEqualsAndHash(value); } + } + public Builder SetJavaGenerateEqualsAndHash(bool value) { + PrepareBuilder(); + result.hasJavaGenerateEqualsAndHash = true; + result.javaGenerateEqualsAndHash_ = value; + return this; + } + public Builder ClearJavaGenerateEqualsAndHash() { + PrepareBuilder(); + result.hasJavaGenerateEqualsAndHash = false; + result.javaGenerateEqualsAndHash_ = false; + return this; + } + + public bool HasOptimizeFor { + get { return result.hasOptimizeFor; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode OptimizeFor { + get { return result.OptimizeFor; } + set { SetOptimizeFor(value); } + } + public Builder SetOptimizeFor(global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode value) { + PrepareBuilder(); + result.hasOptimizeFor = true; + result.optimizeFor_ = value; + return this; + } + public Builder ClearOptimizeFor() { + PrepareBuilder(); + result.hasOptimizeFor = false; + result.optimizeFor_ = global::Google.ProtocolBuffers.DescriptorProtos.FileOptions.Types.OptimizeMode.SPEED; + return this; + } + + public bool HasCcGenericServices { + get { return result.hasCcGenericServices; } + } + public bool CcGenericServices { + get { return result.CcGenericServices; } + set { SetCcGenericServices(value); } + } + public Builder SetCcGenericServices(bool value) { + PrepareBuilder(); + result.hasCcGenericServices = true; + result.ccGenericServices_ = value; + return this; + } + public Builder ClearCcGenericServices() { + PrepareBuilder(); + result.hasCcGenericServices = false; + result.ccGenericServices_ = false; + return this; + } + + public bool HasJavaGenericServices { + get { return result.hasJavaGenericServices; } + } + public bool JavaGenericServices { + get { return result.JavaGenericServices; } + set { SetJavaGenericServices(value); } + } + public Builder SetJavaGenericServices(bool value) { + PrepareBuilder(); + result.hasJavaGenericServices = true; + result.javaGenericServices_ = value; + return this; + } + public Builder ClearJavaGenericServices() { + PrepareBuilder(); + result.hasJavaGenericServices = false; + result.javaGenericServices_ = false; + return this; + } + + public bool HasPyGenericServices { + get { return result.hasPyGenericServices; } + } + public bool PyGenericServices { + get { return result.PyGenericServices; } + set { SetPyGenericServices(value); } + } + public Builder SetPyGenericServices(bool value) { + PrepareBuilder(); + result.hasPyGenericServices = true; + result.pyGenericServices_ = value; + return this; + } + public Builder ClearPyGenericServices() { + PrepareBuilder(); + result.hasPyGenericServices = false; + result.pyGenericServices_ = false; + return this; + } + + public pbc::IPopsicleList UninterpretedOptionList { + get { return PrepareBuilder().uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); + result.uninterpretedOption_.Add(values); + return this; + } + public Builder ClearUninterpretedOption() { + PrepareBuilder(); + result.uninterpretedOption_.Clear(); + return this; + } + } + static FileOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class MessageOptions : pb::ExtendableMessage { + private MessageOptions() { } + private static readonly MessageOptions defaultInstance = new MessageOptions().MakeReadOnly(); + private static readonly string[] _messageOptionsFieldNames = new string[] { "message_set_wire_format", "no_standard_descriptor_accessor", "uninterpreted_option" }; + private static readonly uint[] _messageOptionsFieldTags = new uint[] { 8, 16, 7994 }; + public static MessageOptions DefaultInstance { + get { return defaultInstance; } + } + + public override MessageOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override MessageOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MessageOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MessageOptions__FieldAccessorTable; } + } + + public const int MessageSetWireFormatFieldNumber = 1; + private bool hasMessageSetWireFormat; + private bool messageSetWireFormat_; + public bool HasMessageSetWireFormat { + get { return hasMessageSetWireFormat; } + } + public bool MessageSetWireFormat { + get { return messageSetWireFormat_; } + } + + public const int NoStandardDescriptorAccessorFieldNumber = 2; + private bool hasNoStandardDescriptorAccessor; + private bool noStandardDescriptorAccessor_; + public bool HasNoStandardDescriptorAccessor { + get { return hasNoStandardDescriptorAccessor; } + } + public bool NoStandardDescriptorAccessor { + get { return noStandardDescriptorAccessor_; } + } + + public const int UninterpretedOptionFieldNumber = 999; + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _messageOptionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasMessageSetWireFormat) { + output.WriteBool(1, field_names[0], MessageSetWireFormat); + } + if (hasNoStandardDescriptorAccessor) { + output.WriteBool(2, field_names[1], NoStandardDescriptorAccessor); + } + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, field_names[2], uninterpretedOption_); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasMessageSetWireFormat) { + size += pb::CodedOutputStream.ComputeBoolSize(1, MessageSetWireFormat); + } + if (hasNoStandardDescriptorAccessor) { + size += pb::CodedOutputStream.ComputeBoolSize(2, NoStandardDescriptorAccessor); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static MessageOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MessageOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MessageOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MessageOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MessageOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MessageOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static MessageOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static MessageOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static MessageOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MessageOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private MessageOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(MessageOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(MessageOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private MessageOptions result; + + private MessageOptions PrepareBuilder() { + if (resultIsReadOnly) { + MessageOptions original = result; + result = new MessageOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override MessageOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.Descriptor; } + } + + public override MessageOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance; } + } + + public override MessageOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is MessageOptions) { + return MergeFrom((MessageOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(MessageOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.MessageOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasMessageSetWireFormat) { + MessageSetWireFormat = other.MessageSetWireFormat; + } + if (other.HasNoStandardDescriptorAccessor) { + NoStandardDescriptorAccessor = other.NoStandardDescriptorAccessor; + } + if (other.uninterpretedOption_.Count != 0) { + result.uninterpretedOption_.Add(other.uninterpretedOption_); + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_messageOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _messageOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasMessageSetWireFormat = input.ReadBool(ref result.messageSetWireFormat_); + break; + } + case 16: { + result.hasNoStandardDescriptorAccessor = input.ReadBool(ref result.noStandardDescriptorAccessor_); + break; + } + case 7994: { + input.ReadMessageArray(tag, field_name, result.uninterpretedOption_, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasMessageSetWireFormat { + get { return result.hasMessageSetWireFormat; } + } + public bool MessageSetWireFormat { + get { return result.MessageSetWireFormat; } + set { SetMessageSetWireFormat(value); } + } + public Builder SetMessageSetWireFormat(bool value) { + PrepareBuilder(); + result.hasMessageSetWireFormat = true; + result.messageSetWireFormat_ = value; + return this; + } + public Builder ClearMessageSetWireFormat() { + PrepareBuilder(); + result.hasMessageSetWireFormat = false; + result.messageSetWireFormat_ = false; + return this; + } + + public bool HasNoStandardDescriptorAccessor { + get { return result.hasNoStandardDescriptorAccessor; } + } + public bool NoStandardDescriptorAccessor { + get { return result.NoStandardDescriptorAccessor; } + set { SetNoStandardDescriptorAccessor(value); } + } + public Builder SetNoStandardDescriptorAccessor(bool value) { + PrepareBuilder(); + result.hasNoStandardDescriptorAccessor = true; + result.noStandardDescriptorAccessor_ = value; + return this; + } + public Builder ClearNoStandardDescriptorAccessor() { + PrepareBuilder(); + result.hasNoStandardDescriptorAccessor = false; + result.noStandardDescriptorAccessor_ = false; + return this; + } + + public pbc::IPopsicleList UninterpretedOptionList { + get { return PrepareBuilder().uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); + result.uninterpretedOption_.Add(values); + return this; + } + public Builder ClearUninterpretedOption() { + PrepareBuilder(); + result.uninterpretedOption_.Clear(); + return this; + } + } + static MessageOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FieldOptions : pb::ExtendableMessage { + private FieldOptions() { } + private static readonly FieldOptions defaultInstance = new FieldOptions().MakeReadOnly(); + private static readonly string[] _fieldOptionsFieldNames = new string[] { "ctype", "deprecated", "experimental_map_key", "packed", "uninterpreted_option" }; + private static readonly uint[] _fieldOptionsFieldTags = new uint[] { 8, 24, 74, 16, 7994 }; + public static FieldOptions DefaultInstance { + get { return defaultInstance; } + } + + public override FieldOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FieldOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FieldOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_FieldOptions__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + } + + } + #endregion + + public const int CtypeFieldNumber = 1; + private bool hasCtype; + private global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType ctype_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType.STRING; + public bool HasCtype { + get { return hasCtype; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType Ctype { + get { return ctype_; } + } + + public const int PackedFieldNumber = 2; + private bool hasPacked; + private bool packed_; + public bool HasPacked { + get { return hasPacked; } + } + public bool Packed { + get { return packed_; } + } + + public const int DeprecatedFieldNumber = 3; + private bool hasDeprecated; + private bool deprecated_; + public bool HasDeprecated { + get { return hasDeprecated; } + } + public bool Deprecated { + get { return deprecated_; } + } + + public const int ExperimentalMapKeyFieldNumber = 9; + private bool hasExperimentalMapKey; + private string experimentalMapKey_ = ""; + public bool HasExperimentalMapKey { + get { return hasExperimentalMapKey; } + } + public string ExperimentalMapKey { + get { return experimentalMapKey_; } + } + + public const int UninterpretedOptionFieldNumber = 999; + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fieldOptionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasCtype) { + output.WriteEnum(1, field_names[0], (int) Ctype, Ctype); + } + if (hasPacked) { + output.WriteBool(2, field_names[3], Packed); + } + if (hasDeprecated) { + output.WriteBool(3, field_names[1], Deprecated); + } + if (hasExperimentalMapKey) { + output.WriteString(9, field_names[2], ExperimentalMapKey); + } + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, field_names[4], uninterpretedOption_); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasCtype) { + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) Ctype); + } + if (hasPacked) { + size += pb::CodedOutputStream.ComputeBoolSize(2, Packed); + } + if (hasDeprecated) { + size += pb::CodedOutputStream.ComputeBoolSize(3, Deprecated); + } + if (hasExperimentalMapKey) { + size += pb::CodedOutputStream.ComputeStringSize(9, ExperimentalMapKey); + } + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FieldOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FieldOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FieldOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FieldOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FieldOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FieldOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FieldOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FieldOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FieldOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FieldOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FieldOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FieldOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FieldOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FieldOptions result; + + private FieldOptions PrepareBuilder() { + if (resultIsReadOnly) { + FieldOptions original = result; + result = new FieldOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FieldOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Descriptor; } + } + + public override FieldOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance; } + } + + public override FieldOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FieldOptions) { + return MergeFrom((FieldOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FieldOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasCtype) { + Ctype = other.Ctype; + } + if (other.HasPacked) { + Packed = other.Packed; + } + if (other.HasDeprecated) { + Deprecated = other.Deprecated; + } + if (other.HasExperimentalMapKey) { + ExperimentalMapKey = other.ExperimentalMapKey; + } + if (other.uninterpretedOption_.Count != 0) { + result.uninterpretedOption_.Add(other.uninterpretedOption_); + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fieldOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fieldOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + object unknown; + if(input.ReadEnum(ref result.ctype_, out unknown)) { + result.hasCtype = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(1, (ulong)(int)unknown); + } + break; + } + case 16: { + result.hasPacked = input.ReadBool(ref result.packed_); + break; + } + case 24: { + result.hasDeprecated = input.ReadBool(ref result.deprecated_); + break; + } + case 74: { + result.hasExperimentalMapKey = input.ReadString(ref result.experimentalMapKey_); + break; + } + case 7994: { + input.ReadMessageArray(tag, field_name, result.uninterpretedOption_, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasCtype { + get { return result.hasCtype; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType Ctype { + get { return result.Ctype; } + set { SetCtype(value); } + } + public Builder SetCtype(global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType value) { + PrepareBuilder(); + result.hasCtype = true; + result.ctype_ = value; + return this; + } + public Builder ClearCtype() { + PrepareBuilder(); + result.hasCtype = false; + result.ctype_ = global::Google.ProtocolBuffers.DescriptorProtos.FieldOptions.Types.CType.STRING; + return this; + } + + public bool HasPacked { + get { return result.hasPacked; } + } + public bool Packed { + get { return result.Packed; } + set { SetPacked(value); } + } + public Builder SetPacked(bool value) { + PrepareBuilder(); + result.hasPacked = true; + result.packed_ = value; + return this; + } + public Builder ClearPacked() { + PrepareBuilder(); + result.hasPacked = false; + result.packed_ = false; + return this; + } + + public bool HasDeprecated { + get { return result.hasDeprecated; } + } + public bool Deprecated { + get { return result.Deprecated; } + set { SetDeprecated(value); } + } + public Builder SetDeprecated(bool value) { + PrepareBuilder(); + result.hasDeprecated = true; + result.deprecated_ = value; + return this; + } + public Builder ClearDeprecated() { + PrepareBuilder(); + result.hasDeprecated = false; + result.deprecated_ = false; + return this; + } + + public bool HasExperimentalMapKey { + get { return result.hasExperimentalMapKey; } + } + public string ExperimentalMapKey { + get { return result.ExperimentalMapKey; } + set { SetExperimentalMapKey(value); } + } + public Builder SetExperimentalMapKey(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasExperimentalMapKey = true; + result.experimentalMapKey_ = value; + return this; + } + public Builder ClearExperimentalMapKey() { + PrepareBuilder(); + result.hasExperimentalMapKey = false; + result.experimentalMapKey_ = ""; + return this; + } + + public pbc::IPopsicleList UninterpretedOptionList { + get { return PrepareBuilder().uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); + result.uninterpretedOption_.Add(values); + return this; + } + public Builder ClearUninterpretedOption() { + PrepareBuilder(); + result.uninterpretedOption_.Clear(); + return this; + } + } + static FieldOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class EnumOptions : pb::ExtendableMessage { + private EnumOptions() { } + private static readonly EnumOptions defaultInstance = new EnumOptions().MakeReadOnly(); + private static readonly string[] _enumOptionsFieldNames = new string[] { "uninterpreted_option" }; + private static readonly uint[] _enumOptionsFieldTags = new uint[] { 7994 }; + public static EnumOptions DefaultInstance { + get { return defaultInstance; } + } + + public override EnumOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override EnumOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumOptions__FieldAccessorTable; } + } + + public const int UninterpretedOptionFieldNumber = 999; + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _enumOptionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, field_names[0], uninterpretedOption_); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static EnumOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static EnumOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static EnumOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static EnumOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static EnumOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static EnumOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static EnumOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static EnumOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static EnumOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static EnumOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private EnumOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(EnumOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(EnumOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private EnumOptions result; + + private EnumOptions PrepareBuilder() { + if (resultIsReadOnly) { + EnumOptions original = result; + result = new EnumOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override EnumOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.Descriptor; } + } + + public override EnumOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance; } + } + + public override EnumOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is EnumOptions) { + return MergeFrom((EnumOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(EnumOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.uninterpretedOption_.Count != 0) { + result.uninterpretedOption_.Add(other.uninterpretedOption_); + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_enumOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _enumOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 7994: { + input.ReadMessageArray(tag, field_name, result.uninterpretedOption_, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList UninterpretedOptionList { + get { return PrepareBuilder().uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); + result.uninterpretedOption_.Add(values); + return this; + } + public Builder ClearUninterpretedOption() { + PrepareBuilder(); + result.uninterpretedOption_.Clear(); + return this; + } + } + static EnumOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class EnumValueOptions : pb::ExtendableMessage { + private EnumValueOptions() { } + private static readonly EnumValueOptions defaultInstance = new EnumValueOptions().MakeReadOnly(); + private static readonly string[] _enumValueOptionsFieldNames = new string[] { "uninterpreted_option" }; + private static readonly uint[] _enumValueOptionsFieldTags = new uint[] { 7994 }; + public static EnumValueOptions DefaultInstance { + get { return defaultInstance; } + } + + public override EnumValueOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override EnumValueOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumValueOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_EnumValueOptions__FieldAccessorTable; } + } + + public const int UninterpretedOptionFieldNumber = 999; + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _enumValueOptionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, field_names[0], uninterpretedOption_); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static EnumValueOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static EnumValueOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static EnumValueOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static EnumValueOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static EnumValueOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static EnumValueOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static EnumValueOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static EnumValueOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static EnumValueOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static EnumValueOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private EnumValueOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(EnumValueOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(EnumValueOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private EnumValueOptions result; + + private EnumValueOptions PrepareBuilder() { + if (resultIsReadOnly) { + EnumValueOptions original = result; + result = new EnumValueOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override EnumValueOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.Descriptor; } + } + + public override EnumValueOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance; } + } + + public override EnumValueOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is EnumValueOptions) { + return MergeFrom((EnumValueOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(EnumValueOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.EnumValueOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.uninterpretedOption_.Count != 0) { + result.uninterpretedOption_.Add(other.uninterpretedOption_); + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_enumValueOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _enumValueOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 7994: { + input.ReadMessageArray(tag, field_name, result.uninterpretedOption_, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList UninterpretedOptionList { + get { return PrepareBuilder().uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); + result.uninterpretedOption_.Add(values); + return this; + } + public Builder ClearUninterpretedOption() { + PrepareBuilder(); + result.uninterpretedOption_.Clear(); + return this; + } + } + static EnumValueOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ServiceOptions : pb::ExtendableMessage { + private ServiceOptions() { } + private static readonly ServiceOptions defaultInstance = new ServiceOptions().MakeReadOnly(); + private static readonly string[] _serviceOptionsFieldNames = new string[] { "uninterpreted_option" }; + private static readonly uint[] _serviceOptionsFieldTags = new uint[] { 7994 }; + public static ServiceOptions DefaultInstance { + get { return defaultInstance; } + } + + public override ServiceOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ServiceOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_ServiceOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_ServiceOptions__FieldAccessorTable; } + } + + public const int UninterpretedOptionFieldNumber = 999; + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _serviceOptionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, field_names[0], uninterpretedOption_); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ServiceOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ServiceOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ServiceOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ServiceOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ServiceOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ServiceOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ServiceOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ServiceOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ServiceOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ServiceOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ServiceOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ServiceOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ServiceOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ServiceOptions result; + + private ServiceOptions PrepareBuilder() { + if (resultIsReadOnly) { + ServiceOptions original = result; + result = new ServiceOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ServiceOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.Descriptor; } + } + + public override ServiceOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance; } + } + + public override ServiceOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ServiceOptions) { + return MergeFrom((ServiceOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ServiceOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.ServiceOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.uninterpretedOption_.Count != 0) { + result.uninterpretedOption_.Add(other.uninterpretedOption_); + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_serviceOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _serviceOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 7994: { + input.ReadMessageArray(tag, field_name, result.uninterpretedOption_, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList UninterpretedOptionList { + get { return PrepareBuilder().uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); + result.uninterpretedOption_.Add(values); + return this; + } + public Builder ClearUninterpretedOption() { + PrepareBuilder(); + result.uninterpretedOption_.Clear(); + return this; + } + } + static ServiceOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class MethodOptions : pb::ExtendableMessage { + private MethodOptions() { } + private static readonly MethodOptions defaultInstance = new MethodOptions().MakeReadOnly(); + private static readonly string[] _methodOptionsFieldNames = new string[] { "uninterpreted_option" }; + private static readonly uint[] _methodOptionsFieldTags = new uint[] { 7994 }; + public static MethodOptions DefaultInstance { + get { return defaultInstance; } + } + + public override MethodOptions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override MethodOptions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MethodOptions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_MethodOptions__FieldAccessorTable; } + } + + public const int UninterpretedOptionFieldNumber = 999; + private pbc::PopsicleList uninterpretedOption_ = new pbc::PopsicleList(); + public scg::IList UninterpretedOptionList { + get { return uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return uninterpretedOption_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return uninterpretedOption_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + if (!element.IsInitialized) return false; + } + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _methodOptionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (uninterpretedOption_.Count > 0) { + output.WriteMessageArray(999, field_names[0], uninterpretedOption_); + } + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption element in UninterpretedOptionList) { + size += pb::CodedOutputStream.ComputeMessageSize(999, element); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static MethodOptions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MethodOptions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MethodOptions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static MethodOptions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static MethodOptions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MethodOptions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static MethodOptions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static MethodOptions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static MethodOptions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static MethodOptions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private MethodOptions MakeReadOnly() { + uninterpretedOption_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(MethodOptions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(MethodOptions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private MethodOptions result; + + private MethodOptions PrepareBuilder() { + if (resultIsReadOnly) { + MethodOptions original = result; + result = new MethodOptions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override MethodOptions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.Descriptor; } + } + + public override MethodOptions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance; } + } + + public override MethodOptions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is MethodOptions) { + return MergeFrom((MethodOptions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(MethodOptions other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.MethodOptions.DefaultInstance) return this; + PrepareBuilder(); + if (other.uninterpretedOption_.Count != 0) { + result.uninterpretedOption_.Add(other.uninterpretedOption_); + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_methodOptionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _methodOptionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 7994: { + input.ReadMessageArray(tag, field_name, result.uninterpretedOption_, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList UninterpretedOptionList { + get { return PrepareBuilder().uninterpretedOption_; } + } + public int UninterpretedOptionCount { + get { return result.UninterpretedOptionCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption GetUninterpretedOption(int index) { + return result.GetUninterpretedOption(index); + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_[index] = value; + return this; + } + public Builder SetUninterpretedOption(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_[index] = builderForValue.Build(); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.uninterpretedOption_.Add(value); + return this; + } + public Builder AddUninterpretedOption(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.uninterpretedOption_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeUninterpretedOption(scg::IEnumerable values) { + PrepareBuilder(); + result.uninterpretedOption_.Add(values); + return this; + } + public Builder ClearUninterpretedOption() { + PrepareBuilder(); + result.uninterpretedOption_.Clear(); + return this; + } + } + static MethodOptions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class UninterpretedOption : pb::GeneratedMessage { + private UninterpretedOption() { } + private static readonly UninterpretedOption defaultInstance = new UninterpretedOption().MakeReadOnly(); + private static readonly string[] _uninterpretedOptionFieldNames = new string[] { "aggregate_value", "double_value", "identifier_value", "name", "negative_int_value", "positive_int_value", "string_value" }; + private static readonly uint[] _uninterpretedOptionFieldTags = new uint[] { 66, 49, 26, 18, 40, 32, 58 }; + public static UninterpretedOption DefaultInstance { + get { return defaultInstance; } + } + + public override UninterpretedOption DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override UninterpretedOption ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NamePart : pb::GeneratedMessage { + private NamePart() { } + private static readonly NamePart defaultInstance = new NamePart().MakeReadOnly(); + private static readonly string[] _namePartFieldNames = new string[] { "is_extension", "name_part" }; + private static readonly uint[] _namePartFieldTags = new uint[] { 16, 10 }; + public static NamePart DefaultInstance { + get { return defaultInstance; } + } + + public override NamePart DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NamePart ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption_NamePart__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_UninterpretedOption_NamePart__FieldAccessorTable; } + } + + public const int NamePart_FieldNumber = 1; + private bool hasNamePart_; + private string namePart_ = ""; + public bool HasNamePart_ { + get { return hasNamePart_; } + } + public string NamePart_ { + get { return namePart_; } + } + + public const int IsExtensionFieldNumber = 2; + private bool hasIsExtension; + private bool isExtension_; + public bool HasIsExtension { + get { return hasIsExtension; } + } + public bool IsExtension { + get { return isExtension_; } + } + + public override bool IsInitialized { + get { + if (!hasNamePart_) return false; + if (!hasIsExtension) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _namePartFieldNames; + if (hasNamePart_) { + output.WriteString(1, field_names[1], NamePart_); + } + if (hasIsExtension) { + output.WriteBool(2, field_names[0], IsExtension); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasNamePart_) { + size += pb::CodedOutputStream.ComputeStringSize(1, NamePart_); + } + if (hasIsExtension) { + size += pb::CodedOutputStream.ComputeBoolSize(2, IsExtension); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static NamePart ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NamePart ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NamePart ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NamePart ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NamePart ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NamePart ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NamePart ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NamePart ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NamePart ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NamePart ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NamePart MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NamePart prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NamePart cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NamePart result; + + private NamePart PrepareBuilder() { + if (resultIsReadOnly) { + NamePart original = result; + result = new NamePart(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NamePart MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.Descriptor; } + } + + public override NamePart DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.DefaultInstance; } + } + + public override NamePart BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NamePart) { + return MergeFrom((NamePart) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NamePart other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasNamePart_) { + NamePart_ = other.NamePart_; + } + if (other.HasIsExtension) { + IsExtension = other.IsExtension; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_namePartFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _namePartFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasNamePart_ = input.ReadString(ref result.namePart_); + break; + } + case 16: { + result.hasIsExtension = input.ReadBool(ref result.isExtension_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasNamePart_ { + get { return result.hasNamePart_; } + } + public string NamePart_ { + get { return result.NamePart_; } + set { SetNamePart_(value); } + } + public Builder SetNamePart_(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasNamePart_ = true; + result.namePart_ = value; + return this; + } + public Builder ClearNamePart_() { + PrepareBuilder(); + result.hasNamePart_ = false; + result.namePart_ = ""; + return this; + } + + public bool HasIsExtension { + get { return result.hasIsExtension; } + } + public bool IsExtension { + get { return result.IsExtension; } + set { SetIsExtension(value); } + } + public Builder SetIsExtension(bool value) { + PrepareBuilder(); + result.hasIsExtension = true; + result.isExtension_ = value; + return this; + } + public Builder ClearIsExtension() { + PrepareBuilder(); + result.hasIsExtension = false; + result.isExtension_ = false; + return this; + } + } + static NamePart() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int NameFieldNumber = 2; + private pbc::PopsicleList name_ = new pbc::PopsicleList(); + public scg::IList NameList { + get { return name_; } + } + public int NameCount { + get { return name_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart GetName(int index) { + return name_[index]; + } + + public const int IdentifierValueFieldNumber = 3; + private bool hasIdentifierValue; + private string identifierValue_ = ""; + public bool HasIdentifierValue { + get { return hasIdentifierValue; } + } + public string IdentifierValue { + get { return identifierValue_; } + } + + public const int PositiveIntValueFieldNumber = 4; + private bool hasPositiveIntValue; + private ulong positiveIntValue_; + public bool HasPositiveIntValue { + get { return hasPositiveIntValue; } + } + [global::System.CLSCompliant(false)] + public ulong PositiveIntValue { + get { return positiveIntValue_; } + } + + public const int NegativeIntValueFieldNumber = 5; + private bool hasNegativeIntValue; + private long negativeIntValue_; + public bool HasNegativeIntValue { + get { return hasNegativeIntValue; } + } + public long NegativeIntValue { + get { return negativeIntValue_; } + } + + public const int DoubleValueFieldNumber = 6; + private bool hasDoubleValue; + private double doubleValue_; + public bool HasDoubleValue { + get { return hasDoubleValue; } + } + public double DoubleValue { + get { return doubleValue_; } + } + + public const int StringValueFieldNumber = 7; + private bool hasStringValue; + private pb::ByteString stringValue_ = pb::ByteString.Empty; + public bool HasStringValue { + get { return hasStringValue; } + } + public pb::ByteString StringValue { + get { return stringValue_; } + } + + public const int AggregateValueFieldNumber = 8; + private bool hasAggregateValue; + private string aggregateValue_ = ""; + public bool HasAggregateValue { + get { return hasAggregateValue; } + } + public string AggregateValue { + get { return aggregateValue_; } + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart element in NameList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _uninterpretedOptionFieldNames; + if (name_.Count > 0) { + output.WriteMessageArray(2, field_names[3], name_); + } + if (hasIdentifierValue) { + output.WriteString(3, field_names[2], IdentifierValue); + } + if (hasPositiveIntValue) { + output.WriteUInt64(4, field_names[5], PositiveIntValue); + } + if (hasNegativeIntValue) { + output.WriteInt64(5, field_names[4], NegativeIntValue); + } + if (hasDoubleValue) { + output.WriteDouble(6, field_names[1], DoubleValue); + } + if (hasStringValue) { + output.WriteBytes(7, field_names[6], StringValue); + } + if (hasAggregateValue) { + output.WriteString(8, field_names[0], AggregateValue); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart element in NameList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + if (hasIdentifierValue) { + size += pb::CodedOutputStream.ComputeStringSize(3, IdentifierValue); + } + if (hasPositiveIntValue) { + size += pb::CodedOutputStream.ComputeUInt64Size(4, PositiveIntValue); + } + if (hasNegativeIntValue) { + size += pb::CodedOutputStream.ComputeInt64Size(5, NegativeIntValue); + } + if (hasDoubleValue) { + size += pb::CodedOutputStream.ComputeDoubleSize(6, DoubleValue); + } + if (hasStringValue) { + size += pb::CodedOutputStream.ComputeBytesSize(7, StringValue); + } + if (hasAggregateValue) { + size += pb::CodedOutputStream.ComputeStringSize(8, AggregateValue); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static UninterpretedOption ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static UninterpretedOption ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static UninterpretedOption ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static UninterpretedOption ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static UninterpretedOption ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private UninterpretedOption MakeReadOnly() { + name_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(UninterpretedOption prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(UninterpretedOption cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private UninterpretedOption result; + + private UninterpretedOption PrepareBuilder() { + if (resultIsReadOnly) { + UninterpretedOption original = result; + result = new UninterpretedOption(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override UninterpretedOption MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Descriptor; } + } + + public override UninterpretedOption DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance; } + } + + public override UninterpretedOption BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is UninterpretedOption) { + return MergeFrom((UninterpretedOption) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(UninterpretedOption other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.DefaultInstance) return this; + PrepareBuilder(); + if (other.name_.Count != 0) { + result.name_.Add(other.name_); + } + if (other.HasIdentifierValue) { + IdentifierValue = other.IdentifierValue; + } + if (other.HasPositiveIntValue) { + PositiveIntValue = other.PositiveIntValue; + } + if (other.HasNegativeIntValue) { + NegativeIntValue = other.NegativeIntValue; + } + if (other.HasDoubleValue) { + DoubleValue = other.DoubleValue; + } + if (other.HasStringValue) { + StringValue = other.StringValue; + } + if (other.HasAggregateValue) { + AggregateValue = other.AggregateValue; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_uninterpretedOptionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _uninterpretedOptionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.name_, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.DefaultInstance, extensionRegistry); + break; + } + case 26: { + result.hasIdentifierValue = input.ReadString(ref result.identifierValue_); + break; + } + case 32: { + result.hasPositiveIntValue = input.ReadUInt64(ref result.positiveIntValue_); + break; + } + case 40: { + result.hasNegativeIntValue = input.ReadInt64(ref result.negativeIntValue_); + break; + } + case 49: { + result.hasDoubleValue = input.ReadDouble(ref result.doubleValue_); + break; + } + case 58: { + result.hasStringValue = input.ReadBytes(ref result.stringValue_); + break; + } + case 66: { + result.hasAggregateValue = input.ReadString(ref result.aggregateValue_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList NameList { + get { return PrepareBuilder().name_; } + } + public int NameCount { + get { return result.NameCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart GetName(int index) { + return result.GetName(index); + } + public Builder SetName(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.name_[index] = value; + return this; + } + public Builder SetName(int index, global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.name_[index] = builderForValue.Build(); + return this; + } + public Builder AddName(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.name_.Add(value); + return this; + } + public Builder AddName(global::Google.ProtocolBuffers.DescriptorProtos.UninterpretedOption.Types.NamePart.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.name_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeName(scg::IEnumerable values) { + PrepareBuilder(); + result.name_.Add(values); + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.name_.Clear(); + return this; + } + + public bool HasIdentifierValue { + get { return result.hasIdentifierValue; } + } + public string IdentifierValue { + get { return result.IdentifierValue; } + set { SetIdentifierValue(value); } + } + public Builder SetIdentifierValue(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasIdentifierValue = true; + result.identifierValue_ = value; + return this; + } + public Builder ClearIdentifierValue() { + PrepareBuilder(); + result.hasIdentifierValue = false; + result.identifierValue_ = ""; + return this; + } + + public bool HasPositiveIntValue { + get { return result.hasPositiveIntValue; } + } + [global::System.CLSCompliant(false)] + public ulong PositiveIntValue { + get { return result.PositiveIntValue; } + set { SetPositiveIntValue(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetPositiveIntValue(ulong value) { + PrepareBuilder(); + result.hasPositiveIntValue = true; + result.positiveIntValue_ = value; + return this; + } + public Builder ClearPositiveIntValue() { + PrepareBuilder(); + result.hasPositiveIntValue = false; + result.positiveIntValue_ = 0UL; + return this; + } + + public bool HasNegativeIntValue { + get { return result.hasNegativeIntValue; } + } + public long NegativeIntValue { + get { return result.NegativeIntValue; } + set { SetNegativeIntValue(value); } + } + public Builder SetNegativeIntValue(long value) { + PrepareBuilder(); + result.hasNegativeIntValue = true; + result.negativeIntValue_ = value; + return this; + } + public Builder ClearNegativeIntValue() { + PrepareBuilder(); + result.hasNegativeIntValue = false; + result.negativeIntValue_ = 0L; + return this; + } + + public bool HasDoubleValue { + get { return result.hasDoubleValue; } + } + public double DoubleValue { + get { return result.DoubleValue; } + set { SetDoubleValue(value); } + } + public Builder SetDoubleValue(double value) { + PrepareBuilder(); + result.hasDoubleValue = true; + result.doubleValue_ = value; + return this; + } + public Builder ClearDoubleValue() { + PrepareBuilder(); + result.hasDoubleValue = false; + result.doubleValue_ = 0D; + return this; + } + + public bool HasStringValue { + get { return result.hasStringValue; } + } + public pb::ByteString StringValue { + get { return result.StringValue; } + set { SetStringValue(value); } + } + public Builder SetStringValue(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasStringValue = true; + result.stringValue_ = value; + return this; + } + public Builder ClearStringValue() { + PrepareBuilder(); + result.hasStringValue = false; + result.stringValue_ = pb::ByteString.Empty; + return this; + } + + public bool HasAggregateValue { + get { return result.hasAggregateValue; } + } + public string AggregateValue { + get { return result.AggregateValue; } + set { SetAggregateValue(value); } + } + public Builder SetAggregateValue(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasAggregateValue = true; + result.aggregateValue_ = value; + return this; + } + public Builder ClearAggregateValue() { + PrepareBuilder(); + result.hasAggregateValue = false; + result.aggregateValue_ = ""; + return this; + } + } + static UninterpretedOption() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SourceCodeInfo : pb::GeneratedMessage { + private SourceCodeInfo() { } + private static readonly SourceCodeInfo defaultInstance = new SourceCodeInfo().MakeReadOnly(); + private static readonly string[] _sourceCodeInfoFieldNames = new string[] { "location" }; + private static readonly uint[] _sourceCodeInfoFieldTags = new uint[] { 10 }; + public static SourceCodeInfo DefaultInstance { + get { return defaultInstance; } + } + + public override SourceCodeInfo DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SourceCodeInfo ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Location : pb::GeneratedMessage { + private Location() { } + private static readonly Location defaultInstance = new Location().MakeReadOnly(); + private static readonly string[] _locationFieldNames = new string[] { "path", "span" }; + private static readonly uint[] _locationFieldTags = new uint[] { 10, 18 }; + public static Location DefaultInstance { + get { return defaultInstance; } + } + + public override Location DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Location ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo_Location__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.internal__static_google_protobuf_SourceCodeInfo_Location__FieldAccessorTable; } + } + + public const int PathFieldNumber = 1; + private int pathMemoizedSerializedSize; + private pbc::PopsicleList path_ = new pbc::PopsicleList(); + public scg::IList PathList { + get { return pbc::Lists.AsReadOnly(path_); } + } + public int PathCount { + get { return path_.Count; } + } + public int GetPath(int index) { + return path_[index]; + } + + public const int SpanFieldNumber = 2; + private int spanMemoizedSerializedSize; + private pbc::PopsicleList span_ = new pbc::PopsicleList(); + public scg::IList SpanList { + get { return pbc::Lists.AsReadOnly(span_); } + } + public int SpanCount { + get { return span_.Count; } + } + public int GetSpan(int index) { + return span_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _locationFieldNames; + if (path_.Count > 0) { + output.WritePackedInt32Array(1, field_names[0], pathMemoizedSerializedSize, path_); + } + if (span_.Count > 0) { + output.WritePackedInt32Array(2, field_names[1], spanMemoizedSerializedSize, span_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in PathList) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + if (path_.Count != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + pathMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (int element in SpanList) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + if (span_.Count != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + spanMemoizedSerializedSize = dataSize; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Location ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Location ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Location ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Location ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Location ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Location ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Location ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Location ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Location ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Location ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Location MakeReadOnly() { + path_.MakeReadOnly(); + span_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Location prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Location cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Location result; + + private Location PrepareBuilder() { + if (resultIsReadOnly) { + Location original = result; + result = new Location(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Location MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location.Descriptor; } + } + + public override Location DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location.DefaultInstance; } + } + + public override Location BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Location) { + return MergeFrom((Location) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Location other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location.DefaultInstance) return this; + PrepareBuilder(); + if (other.path_.Count != 0) { + result.path_.Add(other.path_); + } + if (other.span_.Count != 0) { + result.span_.Add(other.span_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_locationFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _locationFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: + case 8: { + input.ReadInt32Array(tag, field_name, result.path_); + break; + } + case 18: + case 16: { + input.ReadInt32Array(tag, field_name, result.span_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList PathList { + get { return PrepareBuilder().path_; } + } + public int PathCount { + get { return result.PathCount; } + } + public int GetPath(int index) { + return result.GetPath(index); + } + public Builder SetPath(int index, int value) { + PrepareBuilder(); + result.path_[index] = value; + return this; + } + public Builder AddPath(int value) { + PrepareBuilder(); + result.path_.Add(value); + return this; + } + public Builder AddRangePath(scg::IEnumerable values) { + PrepareBuilder(); + result.path_.Add(values); + return this; + } + public Builder ClearPath() { + PrepareBuilder(); + result.path_.Clear(); + return this; + } + + public pbc::IPopsicleList SpanList { + get { return PrepareBuilder().span_; } + } + public int SpanCount { + get { return result.SpanCount; } + } + public int GetSpan(int index) { + return result.GetSpan(index); + } + public Builder SetSpan(int index, int value) { + PrepareBuilder(); + result.span_[index] = value; + return this; + } + public Builder AddSpan(int value) { + PrepareBuilder(); + result.span_.Add(value); + return this; + } + public Builder AddRangeSpan(scg::IEnumerable values) { + PrepareBuilder(); + result.span_.Add(values); + return this; + } + public Builder ClearSpan() { + PrepareBuilder(); + result.span_.Clear(); + return this; + } + } + static Location() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int LocationFieldNumber = 1; + private pbc::PopsicleList location_ = new pbc::PopsicleList(); + public scg::IList LocationList { + get { return location_; } + } + public int LocationCount { + get { return location_.Count; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location GetLocation(int index) { + return location_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _sourceCodeInfoFieldNames; + if (location_.Count > 0) { + output.WriteMessageArray(1, field_names[0], location_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location element in LocationList) { + size += pb::CodedOutputStream.ComputeMessageSize(1, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SourceCodeInfo ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SourceCodeInfo ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SourceCodeInfo ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SourceCodeInfo ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SourceCodeInfo ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SourceCodeInfo ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SourceCodeInfo ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SourceCodeInfo ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SourceCodeInfo ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SourceCodeInfo ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SourceCodeInfo MakeReadOnly() { + location_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SourceCodeInfo prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SourceCodeInfo cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SourceCodeInfo result; + + private SourceCodeInfo PrepareBuilder() { + if (resultIsReadOnly) { + SourceCodeInfo original = result; + result = new SourceCodeInfo(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SourceCodeInfo MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Descriptor; } + } + + public override SourceCodeInfo DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.DefaultInstance; } + } + + public override SourceCodeInfo BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SourceCodeInfo) { + return MergeFrom((SourceCodeInfo) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SourceCodeInfo other) { + if (other == global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.DefaultInstance) return this; + PrepareBuilder(); + if (other.location_.Count != 0) { + result.location_.Add(other.location_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_sourceCodeInfoFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _sourceCodeInfoFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadMessageArray(tag, field_name, result.location_, global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList LocationList { + get { return PrepareBuilder().location_; } + } + public int LocationCount { + get { return result.LocationCount; } + } + public global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location GetLocation(int index) { + return result.GetLocation(index); + } + public Builder SetLocation(int index, global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.location_[index] = value; + return this; + } + public Builder SetLocation(int index, global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.location_[index] = builderForValue.Build(); + return this; + } + public Builder AddLocation(global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.location_.Add(value); + return this; + } + public Builder AddLocation(global::Google.ProtocolBuffers.DescriptorProtos.SourceCodeInfo.Types.Location.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.location_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeLocation(scg::IEnumerable values) { + PrepareBuilder(); + result.location_.Add(values); + return this; + } + public Builder ClearLocation() { + PrepareBuilder(); + result.location_.Clear(); + return this; + } + } + static SourceCodeInfo() { + object.ReferenceEquals(global::Google.ProtocolBuffers.DescriptorProtos.DescriptorProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffers/DescriptorProtos/IDescriptorProto.cs b/csharp/src/ProtocolBuffers/DescriptorProtos/IDescriptorProto.cs new file mode 100644 index 00000000..c894d324 --- /dev/null +++ b/csharp/src/ProtocolBuffers/DescriptorProtos/IDescriptorProto.cs @@ -0,0 +1,52 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +namespace Google.ProtocolBuffers.DescriptorProtos +{ + /// + /// Interface implemented by all DescriptorProtos. The generator doesn't + /// emit the interface implementation claim, so PartialClasses.cs contains + /// partial class declarations for each of them. + /// + /// The associated options protocol buffer type + public interface IDescriptorProto + { + /// + /// The brief name of the descriptor's target. + /// + string Name { get; } + + /// + /// The options for this descriptor. + /// + TOptions Options { get; } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs b/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs new file mode 100644 index 00000000..adc2afb0 --- /dev/null +++ b/csharp/src/ProtocolBuffers/DescriptorProtos/PartialClasses.cs @@ -0,0 +1,65 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. + +// This file just contains partial classes for each of the +// autogenerated classes, so that they implement +// IDescriptorProto +namespace Google.ProtocolBuffers.DescriptorProtos +{ + public partial class DescriptorProto : IDescriptorProto + { + } + + public partial class EnumDescriptorProto : IDescriptorProto + { + } + + public partial class EnumValueDescriptorProto : IDescriptorProto + { + } + + public partial class FieldDescriptorProto : IDescriptorProto + { + } + + public partial class FileDescriptorProto : IDescriptorProto + { + } + + public partial class MethodDescriptorProto : IDescriptorProto + { + } + + public partial class ServiceDescriptorProto : IDescriptorProto + { + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/DescriptorBase.cs b/csharp/src/ProtocolBuffers/Descriptors/DescriptorBase.cs new file mode 100644 index 00000000..59006f80 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/DescriptorBase.cs @@ -0,0 +1,115 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Base class for nearly all descriptors, providing common functionality. + /// + /// Type of the protocol buffer form of this descriptor + /// Type of the options protocol buffer for this descriptor + public abstract class DescriptorBase : IDescriptor + where TProto : IMessage, IDescriptorProto + { + private TProto proto; + private readonly FileDescriptor file; + private readonly string fullName; + + protected DescriptorBase(TProto proto, FileDescriptor file, string fullName) + { + this.proto = proto; + this.file = file; + this.fullName = fullName; + } + + internal virtual void ReplaceProto(TProto newProto) + { + this.proto = newProto; + } + + protected static string ComputeFullName(FileDescriptor file, MessageDescriptor parent, string name) + { + if (parent != null) + { + return parent.FullName + "." + name; + } + if (file.Package.Length > 0) + { + return file.Package + "." + name; + } + return name; + } + + IMessage IDescriptor.Proto + { + get { return proto; } + } + + /// + /// Returns the protocol buffer form of this descriptor. + /// + public TProto Proto + { + get { return proto; } + } + + public TOptions Options + { + get { return proto.Options; } + } + + /// + /// The fully qualified name of the descriptor's target. + /// + public string FullName + { + get { return fullName; } + } + + /// + /// The brief name of the descriptor's target. + /// + public string Name + { + get { return proto.Name; } + } + + /// + /// The file this descriptor was declared in. + /// + public FileDescriptor File + { + get { return file; } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/DescriptorPool.cs b/csharp/src/ProtocolBuffers/Descriptors/DescriptorPool.cs new file mode 100644 index 00000000..ae819801 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/DescriptorPool.cs @@ -0,0 +1,352 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Contains lookup tables containing all the descriptors defined in a particular file. + /// + internal sealed class DescriptorPool + { + private readonly IDictionary descriptorsByName = + new Dictionary(); + + private readonly IDictionary fieldsByNumber = + new Dictionary(); + + private readonly IDictionary enumValuesByNumber = + new Dictionary(); + + private readonly DescriptorPool[] dependencies; + + internal DescriptorPool(FileDescriptor[] dependencyFiles) + { + dependencies = new DescriptorPool[dependencyFiles.Length]; + for (int i = 0; i < dependencyFiles.Length; i++) + { + dependencies[i] = dependencyFiles[i].DescriptorPool; + } + + foreach (FileDescriptor dependency in dependencyFiles) + { + AddPackage(dependency.Package, dependency); + } + } + + /// + /// Finds a symbol of the given name within the pool. + /// + /// The type of symbol to look for + /// Fully-qualified name to look up + /// The symbol with the given name and type, + /// or null if the symbol doesn't exist or has the wrong type + internal T FindSymbol(string fullName) where T : class, IDescriptor + { + IDescriptor result; + descriptorsByName.TryGetValue(fullName, out result); + T descriptor = result as T; + if (descriptor != null) + { + return descriptor; + } + + foreach (DescriptorPool dependency in dependencies) + { + dependency.descriptorsByName.TryGetValue(fullName, out result); + descriptor = result as T; + if (descriptor != null) + { + return descriptor; + } + } + + return null; + } + + /// + /// 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). + /// + 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); + } + + /// + /// Adds a symbol to the symbol table. + /// + /// The symbol already existed + /// in the symbol table. + 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); + + /// + /// Verifies that the descriptor's name is valid (i.e. it contains + /// only letters, digits and underscores, and does not start with a digit). + /// + /// + 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."); + } + } + + /// + /// Returns the field with the given number in the given descriptor, + /// or null if it can't be found. + /// + 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; + } + + /// + /// Adds a field to the fieldsByNumber table. + /// + /// A field with the same + /// containing type and number already exists. + 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; + } + + /// + /// 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.) + /// + internal void AddEnumValueByNumber(EnumValueDescriptor enumValue) + { + DescriptorIntPair key = new DescriptorIntPair(enumValue.EnumDescriptor, enumValue.Number); + if (!enumValuesByNumber.ContainsKey(key)) + { + enumValuesByNumber[key] = enumValue; + } + } + + /// + /// 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. + /// + public 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(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(name); + break; + } + else + { + scopeToTry.Length = dotpos + 1; + + // Append firstPart and try to find. + scopeToTry.Append(firstPart); + result = FindSymbol(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(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; + } + } + + /// + /// Struct used to hold the keys for the fieldByNumber table. + /// + private struct DescriptorIntPair : IEquatable + { + 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/ProtocolBuffers/Descriptors/DescriptorUtil.cs b/csharp/src/ProtocolBuffers/Descriptors/DescriptorUtil.cs new file mode 100644 index 00000000..00efdbe8 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/DescriptorUtil.cs @@ -0,0 +1,64 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System.Collections.Generic; +using Google.ProtocolBuffers.Collections; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Internal class containing utility methods when working with descriptors. + /// + internal static class DescriptorUtil + { + /// + /// Equivalent to Func[TInput, int, TOutput] but usable in .NET 2.0. Only used to convert + /// arrays. + /// + internal delegate TOutput IndexedConverter(TInput element, int index); + + /// + /// Converts the given array into a read-only list, applying the specified conversion to + /// each input element. + /// + internal static IList ConvertAndMakeReadOnly(IList input, + IndexedConverter + converter) + { + TOutput[] array = new TOutput[input.Count]; + for (int i = 0; i < array.Length; i++) + { + array[i] = converter(input[i], i); + } + return Lists.AsReadOnly(array); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/DescriptorValidationException.cs b/csharp/src/ProtocolBuffers/Descriptors/DescriptorValidationException.cs new file mode 100644 index 00000000..d05d60d7 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/DescriptorValidationException.cs @@ -0,0 +1,90 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Thrown when building descriptors fails because the source DescriptorProtos + /// are not valid. + /// + public sealed class DescriptorValidationException : Exception + { + private readonly String name; + private readonly IMessage proto; + private readonly string description; + + /// + /// The full name of the descriptor where the error occurred. + /// + public String ProblemSymbolName + { + get { return name; } + } + + /// + /// The protocol message representation of the invalid descriptor. + /// + public IMessage ProblemProto + { + get { return proto; } + } + + /// + /// A human-readable description of the error. (The Message property + /// is made up of the descriptor's name and this description.) + /// + 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; + proto = problemDescriptor.Proto; + this.description = description; + } + + internal DescriptorValidationException(IDescriptor problemDescriptor, string description, Exception cause) : + base(problemDescriptor.FullName + ": " + description, cause) + { + name = problemDescriptor.FullName; + proto = problemDescriptor.Proto; + this.description = description; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs b/csharp/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs new file mode 100644 index 00000000..a0b81b69 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/EnumDescriptor.cs @@ -0,0 +1,126 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System.Collections.Generic; +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Descriptor for an enum type in a .proto file. + /// + public sealed class EnumDescriptor : IndexedDescriptorBase, + IEnumLiteMap + { + private readonly MessageDescriptor containingType; + private readonly IList values; + + internal EnumDescriptor(EnumDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index) + : base(proto, file, ComputeFullName(file, parent, proto.Name), index) + { + containingType = parent; + + if (proto.ValueCount == 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.ValueList, + (value, i) => new EnumValueDescriptor(value, file, this, i)); + + File.DescriptorPool.AddSymbol(this); + } + + /// + /// If this is a nested type, get the outer descriptor, otherwise null. + /// + public MessageDescriptor ContainingType + { + get { return containingType; } + } + + /// + /// An unmodifiable list of defined value descriptors for this enum. + /// + public IList Values + { + get { return values; } + } + + /// + /// Logic moved from FieldSet to continue current behavior + /// + public bool IsValidValue(IEnumLite value) + { + return value is EnumValueDescriptor && ((EnumValueDescriptor) value).EnumDescriptor == this; + } + + /// + /// Finds an enum value by number. If multiple enum values have the + /// same number, this returns the first defined value with that number. + /// + public EnumValueDescriptor FindValueByNumber(int number) + { + return File.DescriptorPool.FindEnumValueByNumber(this, number); + } + + IEnumLite IEnumLiteMap.FindValueByNumber(int number) + { + return FindValueByNumber(number); + } + + IEnumLite IEnumLiteMap.FindValueByName(string name) + { + return FindValueByName(name); + } + + /// + /// Finds an enum value by name. + /// + /// The unqualified name of the value (e.g. "FOO"). + /// The value's descriptor, or null if not found. + public EnumValueDescriptor FindValueByName(string name) + { + return File.DescriptorPool.FindSymbol(FullName + "." + name); + } + + internal override void ReplaceProto(EnumDescriptorProto newProto) + { + base.ReplaceProto(newProto); + for (int i = 0; i < values.Count; i++) + { + values[i].ReplaceProto(newProto.GetValue(i)); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs b/csharp/src/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs new file mode 100644 index 00000000..afb9cbbc --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/EnumValueDescriptor.cs @@ -0,0 +1,63 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Descriptor for a single enum value within an enum in a .proto file. + /// + public sealed class EnumValueDescriptor : IndexedDescriptorBase, + IEnumLite + { + private readonly EnumDescriptor enumDescriptor; + + internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescriptor file, + EnumDescriptor parent, int index) + : base(proto, file, parent.FullName + "." + proto.Name, index) + { + enumDescriptor = parent; + file.DescriptorPool.AddSymbol(this); + file.DescriptorPool.AddEnumValueByNumber(this); + } + + public int Number + { + get { return Proto.Number; } + } + + public EnumDescriptor EnumDescriptor + { + get { return enumDescriptor; } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs b/csharp/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs new file mode 100644 index 00000000..6d17ae2a --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/FieldDescriptor.cs @@ -0,0 +1,671 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections.Generic; +using System.Reflection; +using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Descriptor for a field or extension within a message in a .proto file. + /// + public sealed class FieldDescriptor : IndexedDescriptorBase, + IComparable, IFieldDescriptorLite + { + private readonly MessageDescriptor extensionScope; + private EnumDescriptor enumType; + private MessageDescriptor messageType; + private MessageDescriptor containingType; + private object defaultValue; + private FieldType fieldType; + private MappedType mappedType; + + private CSharpFieldOptions csharpFieldOptions; + private readonly object optionsLock = new object(); + + internal FieldDescriptor(FieldDescriptorProto proto, FileDescriptor file, + MessageDescriptor parent, int index, bool isExtension) + : base(proto, file, ComputeFullName(file, parent, proto.Name), index) + { + if (proto.HasType) + { + fieldType = GetFieldTypeFromProtoType(proto.Type); + mappedType = FieldTypeToMappedTypeMap[fieldType]; + } + + if (FieldNumber <= 0) + { + throw new DescriptorValidationException(this, + "Field numbers must be positive integers."); + } + + if (isExtension) + { + if (!proto.HasExtendee) + { + throw new DescriptorValidationException(this, + "FieldDescriptorProto.Extendee not set for extension field."); + } + containingType = null; // Will be filled in when cross-linking + if (parent != null) + { + extensionScope = parent; + } + else + { + extensionScope = null; + } + } + else + { + if (proto.HasExtendee) + { + throw new DescriptorValidationException(this, + "FieldDescriptorProto.Extendee set for non-extension field."); + } + containingType = parent; + extensionScope = null; + } + + file.DescriptorPool.AddSymbol(this); + } + + private CSharpFieldOptions BuildOrFakeCSharpOptions() + { + // TODO(jonskeet): Check if we could use FileDescriptorProto.Descriptor.Name - interesting bootstrap issues + if (File.Proto.Name == "google/protobuf/csharp_options.proto") + { + if (Name == "csharp_field_options") + { + return new CSharpFieldOptions.Builder {PropertyName = "CSharpFieldOptions"}.Build(); + } + if (Name == "csharp_file_options") + { + return new CSharpFieldOptions.Builder {PropertyName = "CSharpFileOptions"}.Build(); + } + } + CSharpFieldOptions.Builder builder = CSharpFieldOptions.CreateBuilder(); + if (Proto.Options.HasExtension(DescriptorProtos.CSharpOptions.CSharpFieldOptions)) + { + builder.MergeFrom(Proto.Options.GetExtension(DescriptorProtos.CSharpOptions.CSharpFieldOptions)); + } + if (!builder.HasPropertyName) + { + string fieldName = FieldType == FieldType.Group ? MessageType.Name : Name; + string propertyName = NameHelpers.UnderscoresToPascalCase(fieldName); + if (propertyName == ContainingType.Name) + { + propertyName += "_"; + } + builder.PropertyName = propertyName; + } + return builder.Build(); + } + + /// + /// Maps a field type as included in the .proto file to a FieldType. + /// + 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"); + } + } + + /// + /// Returns the default value for a mapped type. + /// + private static object GetDefaultValueForMappedType(MappedType type) + { + switch (type) + { + case MappedType.Int32: + return 0; + case MappedType.Int64: + return (long) 0; + case MappedType.UInt32: + return (uint) 0; + case MappedType.UInt64: + return (ulong) 0; + case MappedType.Single: + return (float) 0; + case MappedType.Double: + return (double) 0; + case MappedType.Boolean: + return false; + case MappedType.String: + return ""; + case MappedType.ByteString: + return ByteString.Empty; + case MappedType.Message: + return null; + case MappedType.Enum: + return null; + default: + throw new ArgumentException("Invalid type specified"); + } + } + + public bool IsRequired + { + get { return Proto.Label == FieldDescriptorProto.Types.Label.LABEL_REQUIRED; } + } + + public bool IsOptional + { + get { return Proto.Label == FieldDescriptorProto.Types.Label.LABEL_OPTIONAL; } + } + + public bool IsRepeated + { + get { return Proto.Label == FieldDescriptorProto.Types.Label.LABEL_REPEATED; } + } + + public bool IsPacked + { + get { return Proto.Options.Packed; } + } + + /// + /// Indicates whether or not the field had an explicitly-defined default value. + /// + public bool HasDefaultValue + { + get { return Proto.HasDefaultValue; } + } + + /// + /// The field's default value. Valid for all types except messages + /// and groups. For all other types, the object returned is of the + /// same class that would be returned by IMessage[this]. + /// For repeated fields this will always be an empty immutable list compatible with IList[object]. + /// For message fields it will always be null. For singular values, it will depend on the descriptor. + /// + public object DefaultValue + { + get + { + if (MappedType == MappedType.Message) + { + throw new InvalidOperationException( + "FieldDescriptor.DefaultValue called on an embedded message field."); + } + return defaultValue; + } + } + + /// + /// Indicates whether or not this field is an extension. + /// + public bool IsExtension + { + get { return Proto.HasExtendee; } + } + + /* + * Get the field's containing type. For extensions, this is the type being + * extended, not the location where the extension was defined. See + * {@link #getExtensionScope()}. + */ + + /// + /// Get the field's containing type. For extensions, this is the type being + /// extended, not the location where the extension was defined. See + /// . + /// + public MessageDescriptor ContainingType + { + get { return containingType; } + } + + /// + /// Returns the C#-specific options for this field descriptor. This will always be + /// completely filled in. + /// + public CSharpFieldOptions CSharpOptions + { + get + { + lock (optionsLock) + { + if (csharpFieldOptions == null) + { + csharpFieldOptions = BuildOrFakeCSharpOptions(); + } + } + return csharpFieldOptions; + } + } + + /// + /// For extensions defined nested within message types, gets + /// the outer type. Not valid for non-extension fields. + /// + /// + /// + /// message Foo { + /// extensions 1000 to max; + /// } + /// extend Foo { + /// optional int32 baz = 1234; + /// } + /// message Bar { + /// extend Foo { + /// optional int32 qux = 4321; + /// } + /// } + /// + /// The containing type for both baz and qux is Foo. + /// However, the extension scope for baz is null while + /// the extension scope for qux is Bar. + /// + public MessageDescriptor ExtensionScope + { + get + { + if (!IsExtension) + { + throw new InvalidOperationException("This field is not an extension."); + } + return extensionScope; + } + } + + public MappedType MappedType + { + get { return mappedType; } + } + + public FieldType FieldType + { + get { return fieldType; } + } + + public bool IsCLSCompliant + { + get + { + return mappedType != MappedType.UInt32 && + mappedType != MappedType.UInt64 && + !NameHelpers.UnderscoresToPascalCase(Name).StartsWith("_"); + } + } + + public int FieldNumber + { + get { return Proto.Number; } + } + + /// + /// Compares this descriptor with another one, ordering in "canonical" order + /// which simply means ascending order by field number. + /// must be a field of the same type, i.e. the of + /// both fields must be the same. + /// + 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; + } + + /// + /// Compares this descriptor with another one, ordering in "canonical" order + /// which simply means ascending order by field number. + /// must be a field of the same type, i.e. the of + /// both fields must be the same. + /// + public int CompareTo(IFieldDescriptorLite other) + { + return FieldNumber - other.FieldNumber; + } + + IEnumLiteMap IFieldDescriptorLite.EnumType + { + get { return EnumType; } + } + + bool IFieldDescriptorLite.MessageSetWireFormat + { + get { return ContainingType.Options.MessageSetWireFormat; } + } + + /// + /// For enum fields, returns the field's type. + /// + public EnumDescriptor EnumType + { + get + { + if (MappedType != MappedType.Enum) + { + throw new InvalidOperationException("EnumType is only valid for enum fields."); + } + return enumType; + } + } + + /// + /// For embedded message and group fields, returns the field's type. + /// + public MessageDescriptor MessageType + { + get + { + if (MappedType != MappedType.Message) + { + throw new InvalidOperationException("MessageType is only valid for enum fields."); + } + return messageType; + } + } + + /// + /// Immutable mapping from field type to mapped type. Built using the attributes on + /// FieldType values. + /// + public static readonly IDictionary FieldTypeToMappedTypeMap = MapFieldTypes(); + + private static IDictionary MapFieldTypes() + { + var map = new Dictionary(); + foreach (FieldInfo field in typeof(FieldType).GetFields(BindingFlags.Static | BindingFlags.Public)) + { + FieldType fieldType = (FieldType) field.GetValue(null); + FieldMappingAttribute mapping = + (FieldMappingAttribute) field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0]; + map[fieldType] = mapping.MappedType; + } + return Dictionaries.AsReadOnly(map); + } + + /// + /// Look up and cross-link all field types etc. + /// + internal void CrossLink() + { + if (Proto.HasExtendee) + { + IDescriptor extendee = File.DescriptorPool.LookupSymbol(Proto.Extendee, this); + if (!(extendee is MessageDescriptor)) + { + throw new DescriptorValidationException(this, "\"" + Proto.Extendee + "\" is not a message type."); + } + containingType = (MessageDescriptor) extendee; + + if (!containingType.IsExtensionNumber(FieldNumber)) + { + throw new DescriptorValidationException(this, + "\"" + containingType.FullName + "\" does not declare " + + FieldNumber + " as an extension number."); + } + } + + if (Proto.HasTypeName) + { + IDescriptor typeDescriptor = + File.DescriptorPool.LookupSymbol(Proto.TypeName, this); + + if (!Proto.HasType) + { + // Choose field type based on symbol. + if (typeDescriptor is MessageDescriptor) + { + fieldType = FieldType.Message; + mappedType = MappedType.Message; + } + else if (typeDescriptor is EnumDescriptor) + { + fieldType = FieldType.Enum; + mappedType = MappedType.Enum; + } + else + { + throw new DescriptorValidationException(this, "\"" + Proto.TypeName + "\" is not a type."); + } + } + + if (MappedType == MappedType.Message) + { + if (!(typeDescriptor is MessageDescriptor)) + { + throw new DescriptorValidationException(this, + "\"" + Proto.TypeName + "\" is not a message type."); + } + messageType = (MessageDescriptor) typeDescriptor; + + if (Proto.HasDefaultValue) + { + throw new DescriptorValidationException(this, "Messages can't have default values."); + } + } + else if (MappedType == Descriptors.MappedType.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 (MappedType == MappedType.Message || MappedType == MappedType.Enum) + { + throw new DescriptorValidationException(this, "Field with message or enum type missing type_name."); + } + } + + // We don't attempt to parse the default value until here because for + // enums we need the enum type's descriptor. + if (Proto.HasDefaultValue) + { + if (IsRepeated) + { + throw new DescriptorValidationException(this, "Repeated fields cannot have default values."); + } + + try + { + switch (FieldType) + { + case FieldType.Int32: + case FieldType.SInt32: + case FieldType.SFixed32: + defaultValue = TextFormat.ParseInt32(Proto.DefaultValue); + break; + case FieldType.UInt32: + case FieldType.Fixed32: + defaultValue = TextFormat.ParseUInt32(Proto.DefaultValue); + break; + case FieldType.Int64: + case FieldType.SInt64: + case FieldType.SFixed64: + defaultValue = TextFormat.ParseInt64(Proto.DefaultValue); + break; + case FieldType.UInt64: + case FieldType.Fixed64: + defaultValue = TextFormat.ParseUInt64(Proto.DefaultValue); + break; + case FieldType.Float: + defaultValue = TextFormat.ParseFloat(Proto.DefaultValue); + break; + case FieldType.Double: + defaultValue = TextFormat.ParseDouble(Proto.DefaultValue); + break; + case FieldType.Bool: + if (Proto.DefaultValue == "true") + { + defaultValue = true; + } + else if (Proto.DefaultValue == "false") + { + defaultValue = false; + } + else + { + throw new FormatException("Boolean values must be \"true\" or \"false\""); + } + break; + case FieldType.String: + defaultValue = Proto.DefaultValue; + break; + case FieldType.Bytes: + try + { + defaultValue = TextFormat.UnescapeBytes(Proto.DefaultValue); + } + catch (FormatException e) + { + throw new DescriptorValidationException(this, + "Couldn't parse default value: " + e.Message); + } + break; + case FieldType.Enum: + defaultValue = enumType.FindValueByName(Proto.DefaultValue); + if (defaultValue == null) + { + throw new DescriptorValidationException(this, + "Unknown enum default value: \"" + + Proto.DefaultValue + "\""); + } + break; + case FieldType.Message: + case FieldType.Group: + throw new DescriptorValidationException(this, "Message type had default value."); + } + } + catch (FormatException e) + { + DescriptorValidationException validationException = + new DescriptorValidationException(this, + "Could not parse default value: \"" + Proto.DefaultValue + + "\"", e); + throw validationException; + } + } + else + { + // Determine the default default for this field. + if (IsRepeated) + { + defaultValue = Lists.Empty; + } + else + { + switch (MappedType) + { + case MappedType.Enum: + // We guarantee elsewhere that an enum type always has at least + // one possible value. + defaultValue = enumType.Values[0]; + break; + case MappedType.Message: + defaultValue = null; + break; + default: + defaultValue = GetDefaultValueForMappedType(MappedType); + break; + } + } + } + + if (!IsExtension) + { + File.DescriptorPool.AddFieldByNumber(this); + } + + if (containingType != null && containingType.Options.MessageSetWireFormat) + { + if (IsExtension) + { + if (!IsOptional || FieldType != FieldType.Message) + { + throw new DescriptorValidationException(this, + "Extensions of MessageSets must be optional messages."); + } + } + else + { + throw new DescriptorValidationException(this, "MessageSets cannot have fields, only extensions."); + } + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs b/csharp/src/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs new file mode 100644 index 00000000..fc58d046 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/FieldMappingAttribute.cs @@ -0,0 +1,86 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections.Generic; +using System.Reflection; +using Google.ProtocolBuffers.Collections; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Defined specifically for the enumeration, + /// this allows each field type to specify the mapped type and wire type. + /// + [CLSCompliant(false)] + [AttributeUsage(AttributeTargets.Field)] + public sealed class FieldMappingAttribute : Attribute + { + public FieldMappingAttribute(MappedType mappedType, WireFormat.WireType wireType) + { + MappedType = mappedType; + WireType = wireType; + } + + public MappedType MappedType { get; private set; } + public WireFormat.WireType WireType { get; private set; } + + + /// + /// Immutable mapping from field type to mapped type. Built using the attributes on + /// FieldType values. + /// + private static readonly IDictionary FieldTypeToMappedTypeMap = MapFieldTypes(); + + private static IDictionary MapFieldTypes() + { + var map = new Dictionary(); + foreach (FieldInfo field in typeof(FieldType).GetFields(BindingFlags.Static | BindingFlags.Public)) + { + FieldType fieldType = (FieldType) field.GetValue(null); + FieldMappingAttribute mapping = + (FieldMappingAttribute) field.GetCustomAttributes(typeof(FieldMappingAttribute), false)[0]; + map[fieldType] = mapping; + } + return Dictionaries.AsReadOnly(map); + } + + internal static MappedType MappedTypeFromFieldType(FieldType type) + { + return FieldTypeToMappedTypeMap[type].MappedType; + } + + internal static WireFormat.WireType WireTypeFromFieldType(FieldType type, bool packed) + { + return packed ? WireFormat.WireType.LengthDelimited : FieldTypeToMappedTypeMap[type].WireType; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/FieldType.cs b/csharp/src/ProtocolBuffers/Descriptors/FieldType.cs new file mode 100644 index 00000000..056d3d45 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/FieldType.cs @@ -0,0 +1,60 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// 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. + /// + public enum FieldType + { + [FieldMapping(MappedType.Double, WireFormat.WireType.Fixed64)] Double, + [FieldMapping(MappedType.Single, WireFormat.WireType.Fixed32)] Float, + [FieldMapping(MappedType.Int64, WireFormat.WireType.Varint)] Int64, + [FieldMapping(MappedType.UInt64, WireFormat.WireType.Varint)] UInt64, + [FieldMapping(MappedType.Int32, WireFormat.WireType.Varint)] Int32, + [FieldMapping(MappedType.UInt64, WireFormat.WireType.Fixed64)] Fixed64, + [FieldMapping(MappedType.UInt32, WireFormat.WireType.Fixed32)] Fixed32, + [FieldMapping(MappedType.Boolean, WireFormat.WireType.Varint)] Bool, + [FieldMapping(MappedType.String, WireFormat.WireType.LengthDelimited)] String, + [FieldMapping(MappedType.Message, WireFormat.WireType.StartGroup)] Group, + [FieldMapping(MappedType.Message, WireFormat.WireType.LengthDelimited)] Message, + [FieldMapping(MappedType.ByteString, WireFormat.WireType.LengthDelimited)] Bytes, + [FieldMapping(MappedType.UInt32, WireFormat.WireType.Varint)] UInt32, + [FieldMapping(MappedType.Int32, WireFormat.WireType.Fixed32)] SFixed32, + [FieldMapping(MappedType.Int64, WireFormat.WireType.Fixed64)] SFixed64, + [FieldMapping(MappedType.Int32, WireFormat.WireType.Varint)] SInt32, + [FieldMapping(MappedType.Int64, WireFormat.WireType.Varint)] SInt64, + [FieldMapping(MappedType.Enum, WireFormat.WireType.Varint)] Enum + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/FileDescriptor.cs b/csharp/src/ProtocolBuffers/Descriptors/FileDescriptor.cs new file mode 100644 index 00000000..d7075e35 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/FileDescriptor.cs @@ -0,0 +1,498 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; +using Google.ProtocolBuffers.DescriptorProtos; +using FileOptions = Google.ProtocolBuffers.DescriptorProtos.FileOptions; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// 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. + /// + public sealed class FileDescriptor : IDescriptor + { + private FileDescriptorProto proto; + private readonly IList messageTypes; + private readonly IList enumTypes; + private readonly IList services; + private readonly IList extensions; + private readonly IList dependencies; + private readonly DescriptorPool pool; + private CSharpFileOptions csharpFileOptions; + private readonly object optionsLock = new object(); + + private FileDescriptor(FileDescriptorProto proto, FileDescriptor[] dependencies, DescriptorPool pool) + { + this.pool = pool; + this.proto = proto; + this.dependencies = new ReadOnlyCollection((FileDescriptor[]) dependencies.Clone()); + + pool.AddPackage(Package, this); + + messageTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.MessageTypeList, + (message, index) => + new MessageDescriptor(message, this, null, index)); + + enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumTypeList, + (enumType, index) => + new EnumDescriptor(enumType, this, null, index)); + + services = DescriptorUtil.ConvertAndMakeReadOnly(proto.ServiceList, + (service, index) => + new ServiceDescriptor(service, this, index)); + + extensions = DescriptorUtil.ConvertAndMakeReadOnly(proto.ExtensionList, + (field, index) => + new FieldDescriptor(field, this, null, index, true)); + } + + + /// + /// Allows a file descriptor to be configured with a set of external options, e.g. from the + /// command-line arguments to protogen. + /// + public void ConfigureWithDefaultOptions(CSharpFileOptions options) + { + csharpFileOptions = BuildOrFakeWithDefaultOptions(options); + } + + static readonly char[] PathSeperators = new char[] { '/', '\\' }; + private CSharpFileOptions BuildOrFakeWithDefaultOptions(CSharpFileOptions defaultOptions) + { + // Fix for being able to relocate these files to any directory structure + if (proto.Package == "google.protobuf") + { + int ixslash = proto.Name.LastIndexOfAny(PathSeperators); + string filename = ixslash < 0 ? proto.Name : proto.Name.Substring(ixslash + 1); + // TODO(jonskeet): Check if we could use FileDescriptorProto.Descriptor.Name - interesting bootstrap issues) + if (filename == "descriptor.proto") + { + return new CSharpFileOptions.Builder + { + Namespace = "Google.ProtocolBuffers.DescriptorProtos", + UmbrellaClassname = "DescriptorProtoFile", + NestClasses = false, + MultipleFiles = false, + PublicClasses = true, + OutputDirectory = defaultOptions.OutputDirectory, + IgnoreGoogleProtobuf = defaultOptions.IgnoreGoogleProtobuf + }.Build(); + } + if (filename == "csharp_options.proto") + { + return new CSharpFileOptions.Builder + { + Namespace = "Google.ProtocolBuffers.DescriptorProtos", + UmbrellaClassname = "CSharpOptions", + NestClasses = false, + MultipleFiles = false, + PublicClasses = true, + OutputDirectory = defaultOptions.OutputDirectory, + IgnoreGoogleProtobuf = defaultOptions.IgnoreGoogleProtobuf + }.Build(); + } + } + CSharpFileOptions.Builder builder = defaultOptions.ToBuilder(); + if (proto.Options.HasExtension(DescriptorProtos.CSharpOptions.CSharpFileOptions)) + { + builder.MergeFrom(proto.Options.GetExtension(DescriptorProtos.CSharpOptions.CSharpFileOptions)); + } + if (!builder.HasNamespace) + { + builder.Namespace = Package; + } + if (!builder.HasUmbrellaClassname) + { + int lastSlash = Name.LastIndexOf('/'); + string baseName = Name.Substring(lastSlash + 1); + builder.UmbrellaClassname = NameHelpers.UnderscoresToPascalCase(NameHelpers.StripProto(baseName)); + } + + // Auto-fix for name collision by placing umbrella class into a new namespace. This + // still won't fix the collisions with nesting enabled; however, you have to turn that on explicitly anyway. + if (!builder.NestClasses && !builder.HasUmbrellaNamespace) + { + bool collision = false; + foreach (IDescriptor d in MessageTypes) + { + collision |= d.Name == builder.UmbrellaClassname; + } + foreach (IDescriptor d in Services) + { + collision |= d.Name == builder.UmbrellaClassname; + } + foreach (IDescriptor d in EnumTypes) + { + collision |= d.Name == builder.UmbrellaClassname; + } + if (collision) + { + builder.UmbrellaNamespace = "Proto"; + } + } + + return builder.Build(); + } + + /// + /// The descriptor in its protocol message representation. + /// + public FileDescriptorProto Proto + { + get { return proto; } + } + + /// + /// The defined in descriptor.proto. + /// + public FileOptions Options + { + get { return proto.Options; } + } + + /// + /// Returns the C#-specific options for this file descriptor. This will always be + /// completely filled in. + /// + public CSharpFileOptions CSharpOptions + { + get + { + lock (optionsLock) + { + if (csharpFileOptions == null) + { + csharpFileOptions = BuildOrFakeWithDefaultOptions(CSharpFileOptions.DefaultInstance); + } + } + return csharpFileOptions; + } + } + + /// + /// The file name. + /// + public string Name + { + get { return proto.Name; } + } + + /// + /// The package as declared in the .proto file. This may or may not + /// be equivalent to the .NET namespace of the generated classes. + /// + public string Package + { + get { return proto.Package; } + } + + /// + /// Unmodifiable list of top-level message types declared in this file. + /// + public IList MessageTypes + { + get { return messageTypes; } + } + + /// + /// Unmodifiable list of top-level enum types declared in this file. + /// + public IList EnumTypes + { + get { return enumTypes; } + } + + /// + /// Unmodifiable list of top-level services declared in this file. + /// + public IList Services + { + get { return services; } + } + + /// + /// Unmodifiable list of top-level extensions declared in this file. + /// + public IList Extensions + { + get { return extensions; } + } + + /// + /// Unmodifiable list of this file's dependencies (imports). + /// + public IList Dependencies + { + get { return dependencies; } + } + + /// + /// Implementation of IDescriptor.FullName - just returns the same as Name. + /// + string IDescriptor.FullName + { + get { return Name; } + } + + /// + /// Implementation of IDescriptor.File - just returns this descriptor. + /// + FileDescriptor IDescriptor.File + { + get { return this; } + } + + /// + /// Protocol buffer describing this descriptor. + /// + IMessage IDescriptor.Proto + { + get { return Proto; } + } + + /// + /// Pool containing symbol descriptors. + /// + internal DescriptorPool DescriptorPool + { + get { return pool; } + } + + /// + /// Finds a type (message, enum, service or extension) in the file by name. Does not find nested types. + /// + /// The unqualified type name to look for. + /// The type of descriptor to look for (or ITypeDescriptor for any) + /// The type's descriptor, or null if not found. + public T FindTypeByName(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(name); + if (result != null && result.File == this) + { + return result; + } + return null; + } + + /// + /// Builds a FileDescriptor from its protocol buffer representation. + /// + /// The protocol message form of the FileDescriptor. + /// 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. + /// If 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. + public static FileDescriptor BuildFrom(FileDescriptorProto proto, FileDescriptor[] dependencies) + { + // 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); + + 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(); + } + + foreach (FieldDescriptor extension in extensions) + { + extension.CrossLink(); + } + + foreach (MessageDescriptor message in messageTypes) + { + message.CheckRequiredFields(); + } + } + + /// + /// This method is to be called by generated code only. It is equivalent + /// to BuildFrom except that the FileDescriptorProto is encoded in + /// protocol buffer wire format. This overload is maintained for backward + /// compatibility with source code generated before the custom options were available + /// (and working). + /// + public static FileDescriptor InternalBuildGeneratedFileFrom(byte[] descriptorData, FileDescriptor[] dependencies) + { + return InternalBuildGeneratedFileFrom(descriptorData, dependencies, x => null); + } + + /// + /// This delegate should be used by generated code only. When calling + /// FileDescriptor.InternalBuildGeneratedFileFrom, the caller can provide + /// a callback which assigns the global variables defined in the generated code + /// which point at parts of the FileDescriptor. The callback returns an + /// Extension Registry which contains any extensions which might be used in + /// the descriptor - that is, extensions of the various "Options" messages defined + /// in descriptor.proto. The callback may also return null to indicate that + /// no extensions are used in the descriptor. + /// + /// + /// + public delegate ExtensionRegistry InternalDescriptorAssigner(FileDescriptor descriptor); + + public static FileDescriptor InternalBuildGeneratedFileFrom(byte[] descriptorData, + FileDescriptor[] dependencies, + InternalDescriptorAssigner descriptorAssigner) + { + FileDescriptorProto proto; + try + { + proto = FileDescriptorProto.ParseFrom(descriptorData); + } + catch (InvalidProtocolBufferException e) + { + throw new ArgumentException("Failed to parse protocol buffer descriptor for generated code.", e); + } + + FileDescriptor result; + try + { + result = BuildFrom(proto, dependencies); + } + catch (DescriptorValidationException e) + { + throw new ArgumentException("Invalid embedded descriptor for \"" + proto.Name + "\".", e); + } + + ExtensionRegistry registry = descriptorAssigner(result); + + if (registry != null) + { + // We must re-parse the proto using the registry. + try + { + proto = FileDescriptorProto.ParseFrom(descriptorData, registry); + } + catch (InvalidProtocolBufferException e) + { + throw new ArgumentException("Failed to parse protocol buffer descriptor for generated code.", e); + } + + result.ReplaceProto(proto); + } + return result; + } + + /// + /// Replace our FileDescriptorProto with the given one, which is + /// identical except that it might contain extensions that weren't present + /// in the original. This method is needed for bootstrapping when a file + /// defines custom options. The options may be defined in the file itself, + /// so we can't actually parse them until we've constructed the descriptors, + /// but to construct the decsriptors we have to have parsed the descriptor + /// protos. So, we have to parse the descriptor protos a second time after + /// constructing the descriptors. + /// + private void ReplaceProto(FileDescriptorProto newProto) + { + proto = newProto; + + for (int i = 0; i < messageTypes.Count; i++) + { + messageTypes[i].ReplaceProto(proto.GetMessageType(i)); + } + + for (int i = 0; i < enumTypes.Count; i++) + { + enumTypes[i].ReplaceProto(proto.GetEnumType(i)); + } + + for (int i = 0; i < services.Count; i++) + { + services[i].ReplaceProto(proto.GetService(i)); + } + + for (int i = 0; i < extensions.Count; i++) + { + extensions[i].ReplaceProto(proto.GetExtension(i)); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/IDescriptor.cs b/csharp/src/ProtocolBuffers/Descriptors/IDescriptor.cs new file mode 100644 index 00000000..899c1560 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/IDescriptor.cs @@ -0,0 +1,55 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// The non-generic form of the IDescriptor interface. Useful for describing a general + /// descriptor. + /// + public interface IDescriptor + { + string Name { get; } + string FullName { get; } + FileDescriptor File { get; } + IMessage Proto { get; } + } + + /// + /// Strongly-typed form of the IDescriptor interface. + /// + /// Protocol buffer type underlying this descriptor type + public interface IDescriptor : IDescriptor where TProto : IMessage + { + new TProto Proto { get; } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs b/csharp/src/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs new file mode 100644 index 00000000..bdb4eb82 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/IndexedDescriptorBase.cs @@ -0,0 +1,64 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Base class for descriptors which are also indexed. This is all of them other than + /// . + /// + public abstract class IndexedDescriptorBase : DescriptorBase + where TProto : IMessage, IDescriptorProto + { + private readonly int index; + + protected IndexedDescriptorBase(TProto proto, FileDescriptor file, string fullName, int index) + : base(proto, file, fullName) + { + this.index = index; + } + + /// + /// The index of this descriptor within its parent descriptor. + /// + /// + /// 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.) + /// + public int Index + { + get { return index; } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/MappedType.cs b/csharp/src/ProtocolBuffers/Descriptors/MappedType.cs new file mode 100644 index 00000000..0a555307 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/MappedType.cs @@ -0,0 +1,52 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Type as it's mapped onto a .NET type. + /// + public enum MappedType + { + Int32, + Int64, + UInt32, + UInt64, + Single, + Double, + Boolean, + String, + ByteString, + Message, + Enum + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/MessageDescriptor.cs b/csharp/src/ProtocolBuffers/Descriptors/MessageDescriptor.cs new file mode 100644 index 00000000..d438c0ff --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/MessageDescriptor.cs @@ -0,0 +1,288 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections.Generic; +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Describes a message type. + /// + public sealed class MessageDescriptor : IndexedDescriptorBase + { + private readonly MessageDescriptor containingType; + private readonly IList nestedTypes; + private readonly IList enumTypes; + private readonly IList fields; + private readonly IList extensions; + private bool hasRequiredFields; + + internal MessageDescriptor(DescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int typeIndex) + : base(proto, file, ComputeFullName(file, parent, proto.Name), typeIndex) + { + containingType = parent; + + nestedTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.NestedTypeList, + (type, index) => + new MessageDescriptor(type, file, this, index)); + + enumTypes = DescriptorUtil.ConvertAndMakeReadOnly(proto.EnumTypeList, + (type, index) => + new EnumDescriptor(type, file, this, index)); + + // TODO(jonskeet): Sort fields first? + fields = DescriptorUtil.ConvertAndMakeReadOnly(proto.FieldList, + (field, index) => + new FieldDescriptor(field, file, this, index, false)); + + extensions = DescriptorUtil.ConvertAndMakeReadOnly(proto.ExtensionList, + (field, index) => + new FieldDescriptor(field, file, this, index, true)); + + file.DescriptorPool.AddSymbol(this); + } + + /// + /// If this is a nested type, get the outer descriptor, otherwise null. + /// + public MessageDescriptor ContainingType + { + get { return containingType; } + } + + /// + /// An unmodifiable list of this message type's fields. + /// + public IList Fields + { + get { return fields; } + } + + /// + /// An unmodifiable list of this message type's extensions. + /// + public IList Extensions + { + get { return extensions; } + } + + /// + /// An unmodifiable list of this message type's nested types. + /// + public IList NestedTypes + { + get { return nestedTypes; } + } + + /// + /// An unmodifiable list of this message type's enum types. + /// + public IList EnumTypes + { + get { return enumTypes; } + } + + /// + /// Returns a pre-computed result as to whether this message + /// has required fields. This includes optional fields which are + /// message types which in turn have required fields, and any + /// extension fields. + /// + internal bool HasRequiredFields + { + get { return hasRequiredFields; } + } + + /// + /// Determines if the given field number is an extension. + /// + public bool IsExtensionNumber(int number) + { + foreach (DescriptorProto.Types.ExtensionRange range in Proto.ExtensionRangeList) + { + if (range.Start <= number && number < range.End) + { + return true; + } + } + return false; + } + + /// + /// Finds a field by field name. + /// + /// The unqualified name of the field (e.g. "foo"). + /// The field's descriptor, or null if not found. + public FieldDescriptor FindFieldByName(String name) + { + return File.DescriptorPool.FindSymbol(FullName + "." + name); + } + + /// + /// Finds a field by field number. + /// + /// The field number within this message type. + /// The field's descriptor, or null if not found. + public FieldDescriptor FindFieldByNumber(int number) + { + return File.DescriptorPool.FindFieldByNumber(this, number); + } + + /// + /// Finds a field by its property name, as it would be generated by protogen. + /// + /// The property name within this message type. + /// The field's descriptor, or null if not found. + public FieldDescriptor FindFieldByPropertyName(string propertyName) + { + // For reasonably short messages, this will be more efficient than a dictionary + // lookup. It also means we don't need to do things lazily with locks etc. + foreach (FieldDescriptor field in Fields) + { + if (field.CSharpOptions.PropertyName == propertyName) + { + return field; + } + } + return null; + } + + /// + /// Finds a nested descriptor by name. The is valid for fields, nested + /// message types and enums. + /// + /// The unqualified name of the descriptor, e.g. "Foo" + /// The descriptor, or null if not found. + public T FindDescriptor(string name) + where T : class, IDescriptor + { + return File.DescriptorPool.FindSymbol(FullName + "." + name); + } + + /// + /// Looks up and cross-links all fields, nested types, and extensions. + /// + internal void CrossLink() + { + foreach (MessageDescriptor message in nestedTypes) + { + message.CrossLink(); + } + + foreach (FieldDescriptor field in fields) + { + field.CrossLink(); + } + + foreach (FieldDescriptor extension in extensions) + { + extension.CrossLink(); + } + } + + internal void CheckRequiredFields() + { + IDictionary alreadySeen = new Dictionary(); + hasRequiredFields = CheckRequiredFields(alreadySeen); + } + + private bool CheckRequiredFields(IDictionary alreadySeen) + { + if (alreadySeen.ContainsKey(this)) + { + // The type is already in the cache. This means that either: + // a. The type has no required fields. + // b. We are in the midst of checking if the type has required fields, + // somewhere up the stack. In this case, we know that if the type + // has any required fields, they'll be found when we return to it, + // and the whole call to HasRequiredFields() will return true. + // Therefore, we don't have to check if this type has required fields + // here. + return false; + } + alreadySeen[this] = 0; // Value is irrelevant; we want set semantics + + // If the type allows extensions, an extension with message type could contain + // required fields, so we have to be conservative and assume such an + // extension exists. + if (Proto.ExtensionRangeCount != 0) + { + return true; + } + + foreach (FieldDescriptor field in Fields) + { + if (field.IsRequired) + { + return true; + } + if (field.MappedType == MappedType.Message) + { + if (field.MessageType.CheckRequiredFields(alreadySeen)) + { + return true; + } + } + } + return false; + } + + /// + /// See FileDescriptor.ReplaceProto + /// + internal override void ReplaceProto(DescriptorProto newProto) + { + base.ReplaceProto(newProto); + + for (int i = 0; i < nestedTypes.Count; i++) + { + nestedTypes[i].ReplaceProto(newProto.GetNestedType(i)); + } + + for (int i = 0; i < enumTypes.Count; i++) + { + enumTypes[i].ReplaceProto(newProto.GetEnumType(i)); + } + + for (int i = 0; i < fields.Count; i++) + { + fields[i].ReplaceProto(newProto.GetField(i)); + } + + for (int i = 0; i < extensions.Count; i++) + { + extensions[i].ReplaceProto(newProto.GetExtension(i)); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Descriptors/MethodDescriptor.cs b/csharp/src/ProtocolBuffers/Descriptors/MethodDescriptor.cs new file mode 100644 index 00000000..f9ede245 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/MethodDescriptor.cs @@ -0,0 +1,94 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Describes a single method in a service. + /// + public sealed class MethodDescriptor : IndexedDescriptorBase + { + private readonly ServiceDescriptor service; + private MessageDescriptor inputType; + private MessageDescriptor outputType; + + /// + /// The service this method belongs to. + /// + public ServiceDescriptor Service + { + get { return service; } + } + + /// + /// The method's input type. + /// + public MessageDescriptor InputType + { + get { return inputType; } + } + + /// + /// The method's input type. + /// + public MessageDescriptor OutputType + { + get { return outputType; } + } + + internal MethodDescriptor(MethodDescriptorProto proto, FileDescriptor file, + ServiceDescriptor parent, int index) + : base(proto, file, parent.FullName + "." + proto.Name, index) + { + service = parent; + file.DescriptorPool.AddSymbol(this); + } + + 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/ProtocolBuffers/Descriptors/PackageDescriptor.cs b/csharp/src/ProtocolBuffers/Descriptors/PackageDescriptor.cs new file mode 100644 index 00000000..02549f9c --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/PackageDescriptor.cs @@ -0,0 +1,73 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// 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. + /// + 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 IMessage Proto + { + get { return file.Proto; } + } + + 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/ProtocolBuffers/Descriptors/ServiceDescriptor.cs b/csharp/src/ProtocolBuffers/Descriptors/ServiceDescriptor.cs new file mode 100644 index 00000000..417c0838 --- /dev/null +++ b/csharp/src/ProtocolBuffers/Descriptors/ServiceDescriptor.cs @@ -0,0 +1,89 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections.Generic; +using Google.ProtocolBuffers.DescriptorProtos; + +namespace Google.ProtocolBuffers.Descriptors +{ + /// + /// Describes a service type. + /// + public sealed class ServiceDescriptor : IndexedDescriptorBase + { + private readonly IList methods; + + public ServiceDescriptor(ServiceDescriptorProto proto, FileDescriptor file, int index) + : base(proto, file, ComputeFullName(file, null, proto.Name), index) + { + methods = DescriptorUtil.ConvertAndMakeReadOnly(proto.MethodList, + (method, i) => new MethodDescriptor(method, file, this, i)); + + file.DescriptorPool.AddSymbol(this); + } + + /// + /// An unmodifiable list of methods in this service. + /// + public IList Methods + { + get { return methods; } + } + + /// + /// Finds a method by name. + /// + /// The unqualified name of the method (e.g. "Foo"). + /// The method's decsriptor, or null if not found. + public MethodDescriptor FindMethodByName(String name) + { + return File.DescriptorPool.FindSymbol(FullName + "." + name); + } + + internal void CrossLink() + { + foreach (MethodDescriptor method in methods) + { + method.CrossLink(); + } + } + + internal override void ReplaceProto(ServiceDescriptorProto newProto) + { + base.ReplaceProto(newProto); + for (int i = 0; i < methods.Count; i++) + { + methods[i].ReplaceProto(newProto.GetMethod(i)); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/DynamicMessage.cs b/csharp/src/ProtocolBuffers/DynamicMessage.cs new file mode 100644 index 00000000..e39efb12 --- /dev/null +++ b/csharp/src/ProtocolBuffers/DynamicMessage.cs @@ -0,0 +1,512 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// An implementation of IMessage that can represent arbitrary types, given a MessageaDescriptor. + /// + public sealed partial class DynamicMessage : AbstractMessage + { + private readonly MessageDescriptor type; + private readonly FieldSet fields; + private readonly UnknownFieldSet unknownFields; + private int memoizedSize = -1; + + /// + /// Creates a DynamicMessage with the given FieldSet. + /// + /// + /// + /// + private DynamicMessage(MessageDescriptor type, FieldSet fields, UnknownFieldSet unknownFields) + { + this.type = type; + this.fields = fields; + this.unknownFields = unknownFields; + } + + /// + /// Returns a DynamicMessage representing the default instance of the given type. + /// + /// + /// + public static DynamicMessage GetDefaultInstance(MessageDescriptor type) + { + return new DynamicMessage(type, FieldSet.DefaultInstance, UnknownFieldSet.DefaultInstance); + } + + /// + /// Parses a message of the given type from the given stream. + /// + public static DynamicMessage ParseFrom(MessageDescriptor type, ICodedInputStream input) + { + Builder builder = CreateBuilder(type); + Builder dynamicBuilder = builder.MergeFrom(input); + return dynamicBuilder.BuildParsed(); + } + + /// + /// Parse a message of the given type from the given stream and extension registry. + /// + /// + /// + /// + /// + public static DynamicMessage ParseFrom(MessageDescriptor type, ICodedInputStream input, + ExtensionRegistry extensionRegistry) + { + Builder builder = CreateBuilder(type); + Builder dynamicBuilder = builder.MergeFrom(input, extensionRegistry); + return dynamicBuilder.BuildParsed(); + } + + /// + /// Parses a message of the given type from the given stream. + /// + public static DynamicMessage ParseFrom(MessageDescriptor type, Stream input) + { + Builder builder = CreateBuilder(type); + Builder dynamicBuilder = builder.MergeFrom(input); + return dynamicBuilder.BuildParsed(); + } + + /// + /// Parse a message of the given type from the given stream and extension registry. + /// + /// + /// + /// + /// + public static DynamicMessage ParseFrom(MessageDescriptor type, Stream input, ExtensionRegistry extensionRegistry) + { + Builder builder = CreateBuilder(type); + Builder dynamicBuilder = builder.MergeFrom(input, extensionRegistry); + return dynamicBuilder.BuildParsed(); + } + + /// + /// Parse as a message of the given type and return it. + /// + public static DynamicMessage ParseFrom(MessageDescriptor type, ByteString data) + { + Builder builder = CreateBuilder(type); + Builder dynamicBuilder = builder.MergeFrom(data); + return dynamicBuilder.BuildParsed(); + } + + /// + /// Parse as a message of the given type and return it. + /// + public static DynamicMessage ParseFrom(MessageDescriptor type, ByteString data, + ExtensionRegistry extensionRegistry) + { + Builder builder = CreateBuilder(type); + Builder dynamicBuilder = builder.MergeFrom(data, extensionRegistry); + return dynamicBuilder.BuildParsed(); + } + + /// + /// Parse as a message of the given type and return it. + /// + public static DynamicMessage ParseFrom(MessageDescriptor type, byte[] data) + { + Builder builder = CreateBuilder(type); + Builder dynamicBuilder = builder.MergeFrom(data); + return dynamicBuilder.BuildParsed(); + } + + /// + /// Parse as a message of the given type and return it. + /// + public static DynamicMessage ParseFrom(MessageDescriptor type, byte[] data, ExtensionRegistry extensionRegistry) + { + Builder builder = CreateBuilder(type); + Builder dynamicBuilder = builder.MergeFrom(data, extensionRegistry); + return dynamicBuilder.BuildParsed(); + } + + /// + /// Constructs a builder for the given type. + /// + public static Builder CreateBuilder(MessageDescriptor type) + { + return new Builder(type); + } + + /// + /// Constructs a builder for a message of the same type as , + /// and initializes it with the same contents. + /// + /// + /// + public static Builder CreateBuilder(IMessage prototype) + { + return new Builder(prototype.DescriptorForType).MergeFrom(prototype); + } + + // ----------------------------------------------------------------- + // Implementation of IMessage interface. + + public override MessageDescriptor DescriptorForType + { + get { return type; } + } + + public override DynamicMessage DefaultInstanceForType + { + get { return GetDefaultInstance(type); } + } + + public override IDictionary AllFields + { + get { return fields.AllFieldDescriptors; } + } + + public override bool HasField(FieldDescriptor field) + { + VerifyContainingType(field); + return fields.HasField(field); + } + + public override object this[FieldDescriptor field] + { + get + { + VerifyContainingType(field); + object result = fields[field]; + if (result == null) + { + result = GetDefaultInstance(field.MessageType); + } + return result; + } + } + + public override int GetRepeatedFieldCount(FieldDescriptor field) + { + VerifyContainingType(field); + return fields.GetRepeatedFieldCount(field); + } + + public override object this[FieldDescriptor field, int index] + { + get + { + VerifyContainingType(field); + return fields[field, index]; + } + } + + public override UnknownFieldSet UnknownFields + { + get { return unknownFields; } + } + + public bool Initialized + { + get { return fields.IsInitializedWithRespectTo(type.Fields); } + } + + public override void WriteTo(ICodedOutputStream output) + { + fields.WriteTo(output); + if (type.Options.MessageSetWireFormat) + { + unknownFields.WriteAsMessageSetTo(output); + } + else + { + unknownFields.WriteTo(output); + } + } + + public override int SerializedSize + { + get + { + int size = memoizedSize; + if (size != -1) + { + return size; + } + + size = fields.SerializedSize; + if (type.Options.MessageSetWireFormat) + { + size += unknownFields.SerializedSizeAsMessageSet; + } + else + { + size += unknownFields.SerializedSize; + } + + memoizedSize = size; + return size; + } + } + + public override Builder CreateBuilderForType() + { + return new Builder(type); + } + + public override Builder ToBuilder() + { + return CreateBuilderForType().MergeFrom(this); + } + + /// + /// Verifies that the field is a field of this message. + /// + private void VerifyContainingType(FieldDescriptor field) + { + if (field.ContainingType != type) + { + throw new ArgumentException("FieldDescriptor does not match message type."); + } + } + + /// + /// Builder for dynamic messages. Instances are created with DynamicMessage.CreateBuilder. + /// + public sealed partial class Builder : AbstractBuilder + { + private readonly MessageDescriptor type; + private FieldSet fields; + private UnknownFieldSet unknownFields; + + internal Builder(MessageDescriptor type) + { + this.type = type; + this.fields = FieldSet.CreateInstance(); + this.unknownFields = UnknownFieldSet.DefaultInstance; + } + + protected override Builder ThisBuilder + { + get { return this; } + } + + public override Builder Clear() + { + fields.Clear(); + return this; + } + + public override Builder MergeFrom(IMessage other) + { + if (other.DescriptorForType != type) + { + throw new ArgumentException("MergeFrom(IMessage) can only merge messages of the same type."); + } + fields.MergeFrom(other); + MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(DynamicMessage other) + { + IMessage downcast = other; + return MergeFrom(downcast); + } + + public override DynamicMessage Build() + { + if (fields != null && !IsInitialized) + { + throw new UninitializedMessageException(new DynamicMessage(type, fields, unknownFields)); + } + return BuildPartial(); + } + + /// + /// Helper for DynamicMessage.ParseFrom() methods to call. Throws + /// InvalidProtocolBufferException + /// + /// + internal DynamicMessage BuildParsed() + { + if (!IsInitialized) + { + throw new UninitializedMessageException(new DynamicMessage(type, fields, unknownFields)). + AsInvalidProtocolBufferException(); + } + return BuildPartial(); + } + + public override DynamicMessage BuildPartial() + { + if (fields == null) + { + throw new InvalidOperationException("Build() has already been called on this Builder."); + } + fields.MakeImmutable(); + DynamicMessage result = new DynamicMessage(type, fields, unknownFields); + fields = null; + unknownFields = null; + return result; + } + + public override Builder Clone() + { + Builder result = new Builder(type); + result.fields.MergeFrom(fields); + return result; + } + + public override bool IsInitialized + { + get { return fields.IsInitializedWithRespectTo(type.Fields); } + } + + public override Builder MergeFrom(ICodedInputStream input, ExtensionRegistry extensionRegistry) + { + UnknownFieldSet.Builder unknownFieldsBuilder = UnknownFieldSet.CreateBuilder(unknownFields); + unknownFieldsBuilder.MergeFrom(input, extensionRegistry, this); + unknownFields = unknownFieldsBuilder.Build(); + return this; + } + + public override MessageDescriptor DescriptorForType + { + get { return type; } + } + + public override DynamicMessage DefaultInstanceForType + { + get { return GetDefaultInstance(type); } + } + + public override IDictionary AllFields + { + get { return fields.AllFieldDescriptors; } + } + + public override IBuilder CreateBuilderForField(FieldDescriptor field) + { + VerifyContainingType(field); + if (field.MappedType != MappedType.Message) + { + throw new ArgumentException("CreateBuilderForField is only valid for fields with message type."); + } + return new Builder(field.MessageType); + } + + public override bool HasField(FieldDescriptor field) + { + VerifyContainingType(field); + return fields.HasField(field); + } + + public override object this[FieldDescriptor field, int index] + { + get + { + VerifyContainingType(field); + return fields[field, index]; + } + set + { + VerifyContainingType(field); + fields[field, index] = value; + } + } + + public override object this[FieldDescriptor field] + { + get + { + VerifyContainingType(field); + object result = fields[field]; + if (result == null) + { + result = GetDefaultInstance(field.MessageType); + } + return result; + } + set + { + VerifyContainingType(field); + fields[field] = value; + } + } + + public override Builder ClearField(FieldDescriptor field) + { + VerifyContainingType(field); + fields.ClearField(field); + return this; + } + + public override int GetRepeatedFieldCount(FieldDescriptor field) + { + VerifyContainingType(field); + return fields.GetRepeatedFieldCount(field); + } + + public override Builder AddRepeatedField(FieldDescriptor field, object value) + { + VerifyContainingType(field); + fields.AddRepeatedField(field, value); + return this; + } + + public override UnknownFieldSet UnknownFields + { + get { return unknownFields; } + set { unknownFields = value; } + } + + /// + /// Verifies that the field is a field of this message. + /// + /// + private void VerifyContainingType(FieldDescriptor field) + { + if (field.ContainingType != type) + { + throw new ArgumentException("FieldDescriptor does not match message type."); + } + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/EnumLite.cs b/csharp/src/ProtocolBuffers/EnumLite.cs new file mode 100644 index 00000000..1301ec2a --- /dev/null +++ b/csharp/src/ProtocolBuffers/EnumLite.cs @@ -0,0 +1,234 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers +{ + /// + ///Interface for an enum value or value descriptor, to be used in FieldSet. + ///The lite library stores enum values directly in FieldSets but the full + ///library stores EnumValueDescriptors in order to better support reflection. + /// + public interface IEnumLite + { + int Number { get; } + string Name { get; } + } + + /// + ///Interface for an object which maps integers to {@link EnumLite}s. + ///{@link Descriptors.EnumDescriptor} implements this interface by mapping + ///numbers to {@link Descriptors.EnumValueDescriptor}s. Additionally, + ///every generated enum type has a static method internalGetValueMap() which + ///returns an implementation of this type that maps numbers to enum values. + /// + public interface IEnumLiteMap : IEnumLiteMap + where T : IEnumLite + { + new T FindValueByNumber(int number); + } + + public interface IEnumLiteMap + { + bool IsValidValue(IEnumLite value); + IEnumLite FindValueByNumber(int number); + IEnumLite FindValueByName(string name); + } + + public class EnumLiteMap : IEnumLiteMap + where TEnum : struct, IComparable, IFormattable + { + private struct EnumValue : IEnumLite + { + private readonly TEnum value; + + public EnumValue(TEnum value) + { + this.value = value; + } + + int IEnumLite.Number + { + get { return Convert.ToInt32(value); } + } + + string IEnumLite.Name + { + get { return value.ToString(); } + } + } + + public IEnumLite FindValueByNumber(int number) + { + TEnum val = default(TEnum); + if (EnumParser.TryConvert(number, ref val)) + { + return new EnumValue(val); + } + return null; + } + + public IEnumLite FindValueByName(string name) + { + TEnum val = default(TEnum); + if (EnumParser.TryConvert(name, ref val)) + { + return new EnumValue(val); + } + return null; + } + + public bool IsValidValue(IEnumLite value) + { + TEnum val = default(TEnum); + return EnumParser.TryConvert(value.Number, ref val); + } + } + + public static class EnumParser where T : struct, IComparable, IFormattable + { + private static readonly Dictionary _byNumber; + private static Dictionary _byName; + + static EnumParser() + { + int[] array; + try + { +#if CLIENTPROFILE + // It will actually be a T[], but the CLR will let us convert. + array = (int[])Enum.GetValues(typeof(T)); +#else + var temp = new List(); + foreach (var fld in typeof (T).GetFields(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static)) + { + if (fld.IsLiteral && fld.FieldType == typeof(T)) + { + temp.Add((T)fld.GetValue(null)); + } + } + array = (int[])(object)temp.ToArray(); +#endif + } + catch + { + _byNumber = null; + return; + } + + _byNumber = new Dictionary(array.Length); + foreach (int i in array) + { + _byNumber[i] = (T)(object)i; + } + } + + public static bool TryConvert(object input, ref T value) + { + if (input is int || input is T) + { + return TryConvert((int)input, ref value); + } + if (input is string) + { + return TryConvert((string)input, ref value); + } + return false; + } + + /// + /// Tries to convert an integer to its enum representation. This would take an out parameter, + /// but the caller uses ref, so this approach is simpler. + /// + public static bool TryConvert(int number, ref T value) + { + // null indicates an exception at construction, use native IsDefined. + if (_byNumber == null) + { + return Enum.IsDefined(typeof(T), number); + } + T converted; + if (_byNumber != null && _byNumber.TryGetValue(number, out converted)) + { + value = converted; + return true; + } + + return false; + } + + /// + /// Tries to convert a string to its enum representation. This would take an out parameter, + /// but the caller uses ref, so this approach is simpler. + /// + public static bool TryConvert(string name, ref T value) + { + // null indicates an exception at construction, use native IsDefined/Parse. + if (_byNumber == null) + { + if (Enum.IsDefined(typeof(T), name)) + { + value = (T)Enum.Parse(typeof(T), name, false); + return true; + } + return false; + } + + // known race, possible multiple threads each build their own copy; however, last writer will win + var map = _byName; + if (map == null) + { + map = new Dictionary(StringComparer.Ordinal); + foreach (var possible in _byNumber.Values) + { + map[possible.ToString()] = possible; + } + _byName = map; + } + + T converted; + if (map.TryGetValue(name, out converted)) + { + value = converted; + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ExtendableBuilder.cs b/csharp/src/ProtocolBuffers/ExtendableBuilder.cs new file mode 100644 index 00000000..111ff57e --- /dev/null +++ b/csharp/src/ProtocolBuffers/ExtendableBuilder.cs @@ -0,0 +1,213 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + public abstract partial class ExtendableBuilder : GeneratedBuilder + where TMessage : ExtendableMessage + where TBuilder : GeneratedBuilder, new() + { + protected ExtendableBuilder() + { + } + + /// + /// Checks if a singular extension is present + /// + public bool HasExtension(GeneratedExtensionBase extension) + { + return MessageBeingBuilt.HasExtension(extension); + } + + /// + /// Returns the number of elements in a repeated extension. + /// + public int GetExtensionCount(GeneratedExtensionBase> extension) + { + return MessageBeingBuilt.GetExtensionCount(extension); + } + + /// + /// Returns the value of an extension. + /// + public TExtension GetExtension(GeneratedExtensionBase extension) + { + return MessageBeingBuilt.GetExtension(extension); + } + + /// + /// Returns one element of a repeated extension. + /// + public TExtension GetExtension(GeneratedExtensionBase> extension, int index) + { + return MessageBeingBuilt.GetExtension(extension, index); + } + + /// + /// Sets the value of an extension. + /// + public TBuilder SetExtension(GeneratedExtensionBase extension, TExtension value) + { + ExtendableMessage message = MessageBeingBuilt; + message.VerifyExtensionContainingType(extension); + message.Extensions[extension.Descriptor] = extension.ToReflectionType(value); + return ThisBuilder; + } + + /// + /// Sets the value of one element of a repeated extension. + /// + public TBuilder SetExtension(GeneratedExtensionBase> extension, int index, + TExtension value) + { + ExtendableMessage message = MessageBeingBuilt; + message.VerifyExtensionContainingType(extension); + message.Extensions[extension.Descriptor, index] = extension.SingularToReflectionType(value); + return ThisBuilder; + } + + /// + /// Appends a value to a repeated extension. + /// + public TBuilder AddExtension(GeneratedExtensionBase> extension, TExtension value) + { + ExtendableMessage message = MessageBeingBuilt; + message.VerifyExtensionContainingType(extension); + message.Extensions.AddRepeatedField(extension.Descriptor, extension.SingularToReflectionType(value)); + return ThisBuilder; + } + + /// + /// Clears an extension. + /// + public TBuilder ClearExtension(GeneratedExtensionBase extension) + { + ExtendableMessage message = MessageBeingBuilt; + message.VerifyExtensionContainingType(extension); + message.Extensions.ClearField(extension.Descriptor); + return ThisBuilder; + } + + /// + /// Called by subclasses to parse an unknown field or an extension. + /// + /// true unless the tag is an end-group tag + [CLSCompliant(false)] + protected override bool ParseUnknownField(ICodedInputStream input, UnknownFieldSet.Builder unknownFields, + ExtensionRegistry extensionRegistry, uint tag, string fieldName) + { + return unknownFields.MergeFieldFrom(input, extensionRegistry, this, tag, fieldName); + } + + // --------------------------------------------------------------- + // Reflection + + + public override object this[FieldDescriptor field, int index] + { + set + { + if (field.IsExtension) + { + ExtendableMessage message = MessageBeingBuilt; + message.VerifyContainingType(field); + message.Extensions[field, index] = value; + } + else + { + base[field, index] = value; + } + } + } + + + public override object this[FieldDescriptor field] + { + set + { + if (field.IsExtension) + { + ExtendableMessage message = MessageBeingBuilt; + message.VerifyContainingType(field); + message.Extensions[field] = value; + } + else + { + base[field] = value; + } + } + } + + public override TBuilder ClearField(FieldDescriptor field) + { + if (field.IsExtension) + { + ExtendableMessage message = MessageBeingBuilt; + message.VerifyContainingType(field); + message.Extensions.ClearField(field); + return ThisBuilder; + } + else + { + return base.ClearField(field); + } + } + + public override TBuilder AddRepeatedField(FieldDescriptor field, object value) + { + if (field.IsExtension) + { + ExtendableMessage message = MessageBeingBuilt; + message.VerifyContainingType(field); + message.Extensions.AddRepeatedField(field, value); + return ThisBuilder; + } + else + { + return base.AddRepeatedField(field, value); + } + } + + protected void MergeExtensionFields(ExtendableMessage other) + { + MessageBeingBuilt.Extensions.MergeFrom(other.Extensions); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ExtendableBuilderLite.cs b/csharp/src/ProtocolBuffers/ExtendableBuilderLite.cs new file mode 100644 index 00000000..2a71aa4a --- /dev/null +++ b/csharp/src/ProtocolBuffers/ExtendableBuilderLite.cs @@ -0,0 +1,346 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + public abstract partial class ExtendableBuilderLite : GeneratedBuilderLite + where TMessage : ExtendableMessageLite + where TBuilder : GeneratedBuilderLite + { + protected ExtendableBuilderLite() + { + } + + /// + /// Checks if a singular extension is present + /// + public bool HasExtension(GeneratedExtensionLite extension) + { + return MessageBeingBuilt.HasExtension(extension); + } + + /// + /// Returns the number of elements in a repeated extension. + /// + public int GetExtensionCount(GeneratedExtensionLite> extension) + { + return MessageBeingBuilt.GetExtensionCount(extension); + } + + /// + /// Returns the value of an extension. + /// + public TExtension GetExtension(GeneratedExtensionLite extension) + { + return MessageBeingBuilt.GetExtension(extension); + } + + /// + /// Returns one element of a repeated extension. + /// + public TExtension GetExtension(GeneratedExtensionLite> extension, + int index) + { + return MessageBeingBuilt.GetExtension(extension, index); + } + + /// + /// Sets the value of an extension. + /// + public TBuilder SetExtension(GeneratedExtensionLite extension, + TExtension value) + { + ExtendableMessageLite message = MessageBeingBuilt; + message.VerifyExtensionContainingType(extension); + message.Extensions[extension.Descriptor] = extension.ToReflectionType(value); + return ThisBuilder; + } + + /// + /// Sets the value of one element of a repeated extension. + /// + public TBuilder SetExtension(GeneratedExtensionLite> extension, + int index, TExtension value) + { + ExtendableMessageLite message = MessageBeingBuilt; + message.VerifyExtensionContainingType(extension); + message.Extensions[extension.Descriptor, index] = extension.SingularToReflectionType(value); + return ThisBuilder; + } + + /// + /// Appends a value to a repeated extension. + /// + public TBuilder AddExtension(GeneratedExtensionLite> extension, + TExtension value) + { + ExtendableMessageLite message = MessageBeingBuilt; + message.VerifyExtensionContainingType(extension); + message.Extensions.AddRepeatedField(extension.Descriptor, extension.SingularToReflectionType(value)); + return ThisBuilder; + } + + /// + /// Clears an extension. + /// + public TBuilder ClearExtension(GeneratedExtensionLite extension) + { + ExtendableMessageLite message = MessageBeingBuilt; + message.VerifyExtensionContainingType(extension); + message.Extensions.ClearField(extension.Descriptor); + return ThisBuilder; + } + + /// + /// Called by subclasses to parse an unknown field or an extension. + /// + /// true unless the tag is an end-group tag + [CLSCompliant(false)] + protected override bool ParseUnknownField(ICodedInputStream input, + ExtensionRegistry extensionRegistry, uint tag, string fieldName) + { + FieldSet extensions = MessageBeingBuilt.Extensions; + + WireFormat.WireType wireType = WireFormat.GetTagWireType(tag); + int fieldNumber = WireFormat.GetTagFieldNumber(tag); + IGeneratedExtensionLite extension = extensionRegistry[DefaultInstanceForType, fieldNumber]; + + if (extension == null) //unknown field + { + return input.SkipField(); + } + + IFieldDescriptorLite field = extension.Descriptor; + + + // Unknown field or wrong wire type. Skip. + if (field == null) + { + return input.SkipField(); + } + WireFormat.WireType expectedType = field.IsPacked + ? WireFormat.WireType.LengthDelimited + : WireFormat.GetWireType(field.FieldType); + if (wireType != expectedType) + { + expectedType = WireFormat.GetWireType(field.FieldType); + if (wireType == expectedType) + { + //Allowed as of 2.3, this is unpacked data for a packed array + } + else if (field.IsRepeated && wireType == WireFormat.WireType.LengthDelimited && + (expectedType == WireFormat.WireType.Varint || expectedType == WireFormat.WireType.Fixed32 || + expectedType == WireFormat.WireType.Fixed64)) + { + //Allowed as of 2.3, this is packed data for an unpacked array + } + else + { + return input.SkipField(); + } + } + if (!field.IsRepeated && wireType != WireFormat.GetWireType(field.FieldType)) //invalid wire type + { + return input.SkipField(); + } + + switch (field.FieldType) + { + case FieldType.Group: + case FieldType.Message: + { + if (!field.IsRepeated) + { + IMessageLite message = extensions[extension.Descriptor] as IMessageLite; + IBuilderLite subBuilder = (message ?? extension.MessageDefaultInstance).WeakToBuilder(); + + if (field.FieldType == FieldType.Group) + { + input.ReadGroup(field.FieldNumber, subBuilder, extensionRegistry); + } + else + { + input.ReadMessage(subBuilder, extensionRegistry); + } + + extensions[field] = subBuilder.WeakBuild(); + } + else + { + List list = new List(); + if (field.FieldType == FieldType.Group) + { + input.ReadGroupArray(tag, fieldName, list, extension.MessageDefaultInstance, + extensionRegistry); + } + else + { + input.ReadMessageArray(tag, fieldName, list, extension.MessageDefaultInstance, + extensionRegistry); + } + + foreach (IMessageLite m in list) + { + extensions.AddRepeatedField(field, m); + } + return true; + } + break; + } + case FieldType.Enum: + { + if (!field.IsRepeated) + { + object unknown; + IEnumLite value = null; + if (input.ReadEnum(ref value, out unknown, field.EnumType)) + { + extensions[field] = value; + } + } + else + { + ICollection unknown; + List list = new List(); + input.ReadEnumArray(tag, fieldName, list, out unknown, field.EnumType); + + foreach (IEnumLite en in list) + { + extensions.AddRepeatedField(field, en); + } + } + break; + } + default: + { + if (!field.IsRepeated) + { + object value = null; + if (input.ReadPrimitiveField(field.FieldType, ref value)) + { + extensions[field] = value; + } + } + else + { + List list = new List(); + input.ReadPrimitiveArray(field.FieldType, tag, fieldName, list); + foreach (object oval in list) + { + extensions.AddRepeatedField(field, oval); + } + } + break; + } + } + + return true; + } + + #region Reflection + + public object this[IFieldDescriptorLite field, int index] + { + set + { + if (field.IsExtension) + { + ExtendableMessageLite message = MessageBeingBuilt; + message.Extensions[field, index] = value; + } + else + { + throw new NotSupportedException("Not supported in the lite runtime."); + } + } + } + + public object this[IFieldDescriptorLite field] + { + set + { + if (field.IsExtension) + { + ExtendableMessageLite message = MessageBeingBuilt; + message.Extensions[field] = value; + } + else + { + throw new NotSupportedException("Not supported in the lite runtime."); + } + } + } + + public TBuilder ClearField(IFieldDescriptorLite field) + { + if (field.IsExtension) + { + ExtendableMessageLite message = MessageBeingBuilt; + message.Extensions.ClearField(field); + return ThisBuilder; + } + else + { + throw new NotSupportedException("Not supported in the lite runtime."); + } + } + + public TBuilder AddRepeatedField(IFieldDescriptorLite field, object value) + { + if (field.IsExtension) + { + ExtendableMessageLite message = MessageBeingBuilt; + message.Extensions.AddRepeatedField(field, value); + return ThisBuilder; + } + else + { + throw new NotSupportedException("Not supported in the lite runtime."); + } + } + + protected void MergeExtensionFields(ExtendableMessageLite other) + { + MessageBeingBuilt.Extensions.MergeFrom(other.Extensions); + } + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ExtendableMessage.cs b/csharp/src/ProtocolBuffers/ExtendableMessage.cs new file mode 100644 index 00000000..71cd1b38 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ExtendableMessage.cs @@ -0,0 +1,274 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + public abstract partial class ExtendableMessage : GeneratedMessage + where TMessage : GeneratedMessage + where TBuilder : GeneratedBuilder, new() + { + protected ExtendableMessage() + { + } + + private readonly FieldSet extensions = FieldSet.CreateInstance(); + + /// + /// Access for the builder. + /// + internal FieldSet Extensions + { + get { return extensions; } + } + + /// + /// Checks if a singular extension is present. + /// + public bool HasExtension(GeneratedExtensionBase extension) + { + return extensions.HasField(extension.Descriptor); + } + + /// + /// Returns the number of elements in a repeated extension. + /// + public int GetExtensionCount(GeneratedExtensionBase> extension) + { + return extensions.GetRepeatedFieldCount(extension.Descriptor); + } + + /// + /// Returns the value of an extension. + /// + public TExtension GetExtension(GeneratedExtensionBase extension) + { + object value = extensions[extension.Descriptor]; + if (value == null) + { + return (TExtension) extension.MessageDefaultInstance; + } + else + { + return (TExtension) extension.FromReflectionType(value); + } + } + + /// + /// Returns one element of a repeated extension. + /// + public TExtension GetExtension(GeneratedExtensionBase> extension, int index) + { + return (TExtension) extension.SingularFromReflectionType(extensions[extension.Descriptor, index]); + } + + /// + /// Called to check if all extensions are initialized. + /// + protected bool ExtensionsAreInitialized + { + get { return extensions.IsInitialized; } + } + + public override bool IsInitialized + { + get { return base.IsInitialized && ExtensionsAreInitialized; } + } + + #region Reflection + + public override IDictionary AllFields + { + get + { + IDictionary result = GetMutableFieldMap(); + foreach (KeyValuePair entry in extensions.AllFields) + { + result[(FieldDescriptor) entry.Key] = entry.Value; + } + return Dictionaries.AsReadOnly(result); + } + } + + public override bool HasField(FieldDescriptor field) + { + if (field.IsExtension) + { + VerifyContainingType(field); + return extensions.HasField(field); + } + else + { + return base.HasField(field); + } + } + + public override object this[FieldDescriptor field] + { + get + { + if (field.IsExtension) + { + VerifyContainingType(field); + object value = extensions[field]; + if (value == null) + { + // Lacking an ExtensionRegistry, we have no way to determine the + // extension's real type, so we return a DynamicMessage. + // TODO(jonskeet): Work out what this means + return DynamicMessage.GetDefaultInstance(field.MessageType); + } + else + { + return value; + } + } + else + { + return base[field]; + } + } + } + + public override int GetRepeatedFieldCount(FieldDescriptor field) + { + if (field.IsExtension) + { + VerifyContainingType(field); + return extensions.GetRepeatedFieldCount(field); + } + else + { + return base.GetRepeatedFieldCount(field); + } + } + + public override object this[FieldDescriptor field, int index] + { + get + { + if (field.IsExtension) + { + VerifyContainingType(field); + return extensions[field, index]; + } + else + { + return base[field, index]; + } + } + } + + internal void VerifyContainingType(FieldDescriptor field) + { + if (field.ContainingType != DescriptorForType) + { + throw new ArgumentException("FieldDescriptor does not match message type."); + } + } + + #endregion + + /// + /// Used by subclasses to serialize extensions. Extension ranges may be + /// interleaves with field numbers, but we must write them in canonical + /// (sorted by field number) order. This class helps us to write individual + /// ranges of extensions at once. + /// + /// TODO(jonskeet): See if we can improve this in terms of readability. + /// + protected class ExtensionWriter + { + private readonly IEnumerator> iterator; + private readonly FieldSet extensions; + private KeyValuePair? next = null; + + internal ExtensionWriter(ExtendableMessage message) + { + extensions = message.extensions; + iterator = message.extensions.GetEnumerator(); + if (iterator.MoveNext()) + { + next = iterator.Current; + } + } + + public void WriteUntil(int end, ICodedOutputStream output) + { + while (next != null && next.Value.Key.FieldNumber < end) + { + extensions.WriteField(next.Value.Key, next.Value.Value, output); + if (iterator.MoveNext()) + { + next = iterator.Current; + } + else + { + next = null; + } + } + } + } + + protected ExtensionWriter CreateExtensionWriter(ExtendableMessage message) + { + return new ExtensionWriter(message); + } + + /// + /// Called by subclasses to compute the size of extensions. + /// + protected int ExtensionsSerializedSize + { + get { return extensions.SerializedSize; } + } + + internal void VerifyExtensionContainingType(GeneratedExtensionBase extension) + { + if (extension.Descriptor.ContainingType != DescriptorForType) + { + // This can only happen if someone uses unchecked operations. + throw new ArgumentException("Extension is for type \"" + extension.Descriptor.ContainingType.FullName + + "\" which does not match message type \"" + DescriptorForType.FullName + + "\"."); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ExtendableMessageLite.cs b/csharp/src/ProtocolBuffers/ExtendableMessageLite.cs new file mode 100644 index 00000000..e682475d --- /dev/null +++ b/csharp/src/ProtocolBuffers/ExtendableMessageLite.cs @@ -0,0 +1,221 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using Google.ProtocolBuffers.Collections; + +namespace Google.ProtocolBuffers +{ + public abstract partial class ExtendableMessageLite : GeneratedMessageLite + where TMessage : GeneratedMessageLite + where TBuilder : GeneratedBuilderLite + { + protected ExtendableMessageLite() + { + } + + private readonly FieldSet extensions = FieldSet.CreateInstance(); + + /// + /// Access for the builder. + /// + internal FieldSet Extensions + { + get { return extensions; } + } + + public override bool Equals(object obj) + { + ExtendableMessageLite other = obj as ExtendableMessageLite; + return !ReferenceEquals(null, other) && + Dictionaries.Equals(extensions.AllFields, other.extensions.AllFields); + } + + public override int GetHashCode() + { + return Dictionaries.GetHashCode(extensions.AllFields); + } + + /// + /// writes the extensions to the text stream + /// + public override void PrintTo(TextWriter writer) + { + foreach (KeyValuePair entry in extensions.AllFields) + { + string fn = string.Format("[{0}]", entry.Key.FullName); + if (entry.Key.IsRepeated) + { + foreach (object o in ((IEnumerable) entry.Value)) + { + PrintField(fn, true, o, writer); + } + } + else + { + PrintField(fn, true, entry.Value, writer); + } + } + } + + /// + /// Checks if a singular extension is present. + /// + public bool HasExtension(GeneratedExtensionLite extension) + { + VerifyExtensionContainingType(extension); + return extensions.HasField(extension.Descriptor); + } + + /// + /// Returns the number of elements in a repeated extension. + /// + public int GetExtensionCount(GeneratedExtensionLite> extension) + { + VerifyExtensionContainingType(extension); + return extensions.GetRepeatedFieldCount(extension.Descriptor); + } + + /// + /// Returns the value of an extension. + /// + public TExtension GetExtension(GeneratedExtensionLite extension) + { + VerifyExtensionContainingType(extension); + object value = extensions[extension.Descriptor]; + if (value == null) + { + return extension.DefaultValue; + } + else + { + return (TExtension) extension.FromReflectionType(value); + } + } + + /// + /// Returns one element of a repeated extension. + /// + public TExtension GetExtension(GeneratedExtensionLite> extension, + int index) + { + VerifyExtensionContainingType(extension); + return (TExtension) extension.SingularFromReflectionType(extensions[extension.Descriptor, index]); + } + + /// + /// Called to check if all extensions are initialized. + /// + protected bool ExtensionsAreInitialized + { + get { return extensions.IsInitialized; } + } + + public override bool IsInitialized + { + get { return ExtensionsAreInitialized; } + } + + /// + /// Used by subclasses to serialize extensions. Extension ranges may be + /// interleaves with field numbers, but we must write them in canonical + /// (sorted by field number) order. This class helps us to write individual + /// ranges of extensions at once. + /// + /// TODO(jonskeet): See if we can improve this in terms of readability. + /// + protected class ExtensionWriter + { + private readonly IEnumerator> iterator; + private readonly FieldSet extensions; + private KeyValuePair? next = null; + + internal ExtensionWriter(ExtendableMessageLite message) + { + extensions = message.extensions; + iterator = message.extensions.GetEnumerator(); + if (iterator.MoveNext()) + { + next = iterator.Current; + } + } + + public void WriteUntil(int end, ICodedOutputStream output) + { + while (next != null && next.Value.Key.FieldNumber < end) + { + extensions.WriteField(next.Value.Key, next.Value.Value, output); + if (iterator.MoveNext()) + { + next = iterator.Current; + } + else + { + next = null; + } + } + } + } + + protected ExtensionWriter CreateExtensionWriter(ExtendableMessageLite message) + { + return new ExtensionWriter(message); + } + + /// + /// Called by subclasses to compute the size of extensions. + /// + protected int ExtensionsSerializedSize + { + get { return extensions.SerializedSize; } + } + + internal void VerifyExtensionContainingType(GeneratedExtensionLite extension) + { + if (!ReferenceEquals(extension.ContainingTypeDefaultInstance, DefaultInstanceForType)) + { + // This can only happen if someone uses unchecked operations. + throw new ArgumentException( + String.Format("Extension is for type \"{0}\" which does not match message type \"{1}\".", + extension.ContainingTypeDefaultInstance, DefaultInstanceForType + )); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ExtensionInfo.cs b/csharp/src/ProtocolBuffers/ExtensionInfo.cs new file mode 100644 index 00000000..4f11d3bb --- /dev/null +++ b/csharp/src/ProtocolBuffers/ExtensionInfo.cs @@ -0,0 +1,88 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + public sealed class ExtensionInfo : IGeneratedExtensionLite + { + /// + /// The extension's descriptor + /// + public FieldDescriptor Descriptor { get; private set; } + + IFieldDescriptorLite IGeneratedExtensionLite.Descriptor + { + get { return Descriptor; } + } + + /// + /// A default instance of the extensions's type, if it has a message type, + /// or null otherwise. + /// + public IMessageLite DefaultInstance { get; private set; } + + internal ExtensionInfo(FieldDescriptor descriptor) : this(descriptor, null) + { + } + + internal ExtensionInfo(FieldDescriptor descriptor, IMessageLite defaultInstance) + { + Descriptor = descriptor; + DefaultInstance = defaultInstance; + } + + #region IGeneratedExtensionLite Members + + int IGeneratedExtensionLite.Number + { + get { return Descriptor.FieldNumber; } + } + + object IGeneratedExtensionLite.ContainingType + { + get { return Descriptor.ContainingType; } + } + + IMessageLite IGeneratedExtensionLite.MessageDefaultInstance + { + get { return DefaultInstance; } + } + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ExtensionRegistry.cs b/csharp/src/ProtocolBuffers/ExtensionRegistry.cs new file mode 100644 index 00000000..7c9467b5 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ExtensionRegistry.cs @@ -0,0 +1,215 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// A table of known extensions, searchable by name or field number. When + /// parsing a protocol message that might have extensions, you must provide + /// an in which you have registered any extensions + /// that you want to be able to parse. Otherwise, those extensions will just + /// be treated like unknown fields. + /// + /// + /// For example, if you had the .proto file: + /// + /// option java_class = "MyProto"; + /// + /// message Foo { + /// extensions 1000 to max; + /// } + /// + /// extend Foo { + /// optional int32 bar; + /// } + /// + /// + /// Then you might write code like: + /// + /// + /// ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + /// registry.Add(MyProto.Bar); + /// MyProto.Foo message = MyProto.Foo.ParseFrom(input, registry); + /// + /// + /// + /// + /// You might wonder why this is necessary. Two alternatives might come to + /// mind. First, you might imagine a system where generated extensions are + /// automatically registered when their containing classes are loaded. This + /// is a popular technique, but is bad design; among other things, it creates a + /// situation where behavior can change depending on what classes happen to be + /// loaded. It also introduces a security vulnerability, because an + /// unprivileged class could cause its code to be called unexpectedly from a + /// privileged class by registering itself as an extension of the right type. + /// + /// Another option you might consider is lazy parsing: do not parse an + /// extension until it is first requested, at which point the caller must + /// provide a type to use. This introduces a different set of problems. First, + /// it would require a mutex lock any time an extension was accessed, which + /// would be slow. Second, corrupt data would not be detected until first + /// access, at which point it would be much harder to deal with it. Third, it + /// could violate the expectation that message objects are immutable, since the + /// type provided could be any arbitrary message class. An unprivileged user + /// could take advantage of this to inject a mutable object into a message + /// belonging to privileged code and create mischief. + /// + public sealed partial class ExtensionRegistry + { + /// + /// Finds an extension by fully-qualified field name, in the + /// proto namespace, i.e. result.Descriptor.FullName will match + /// if a match is found. A null + /// reference is returned if the extension can't be found. + /// + [Obsolete("Please use the FindByName method instead.", true)] + public ExtensionInfo this[string fullName] + { + get + { + foreach (IGeneratedExtensionLite ext in extensionsByNumber.Values) + { + if (StringComparer.Ordinal.Equals(ext.Descriptor.FullName, fullName)) + { + return ext as ExtensionInfo; + } + } + return null; + } + } + +#if !LITE + /// + /// Finds an extension by containing type and field number. + /// A null reference is returned if the extension can't be found. + /// + public ExtensionInfo this[MessageDescriptor containingType, int fieldNumber] + { + get + { + IGeneratedExtensionLite ret; + extensionsByNumber.TryGetValue(new ExtensionIntPair(containingType, fieldNumber), out ret); + return ret as ExtensionInfo; + } + } + + public ExtensionInfo FindByName(MessageDescriptor containingType, string fieldName) + { + return FindExtensionByName(containingType, fieldName) as ExtensionInfo; + } +#endif + + /// + /// Add an extension from a generated file to the registry. + /// + public void Add(GeneratedExtensionBase extension) + { + if (extension.Descriptor.MappedType == MappedType.Message) + { + Add(new ExtensionInfo(extension.Descriptor, extension.MessageDefaultInstance)); + } + else + { + Add(new ExtensionInfo(extension.Descriptor, null)); + } + } + + /// + /// Adds a non-message-type extension to the registry by descriptor. + /// + /// + public void Add(FieldDescriptor type) + { + if (type.MappedType == MappedType.Message) + { + throw new ArgumentException("ExtensionRegistry.Add() must be provided a default instance " + + "when adding an embedded message extension."); + } + Add(new ExtensionInfo(type, null)); + } + + /// + /// Adds a message-type-extension to the registry by descriptor. + /// + /// + /// + public void Add(FieldDescriptor type, IMessage defaultInstance) + { + if (type.MappedType != MappedType.Message) + { + throw new ArgumentException("ExtensionRegistry.Add() provided a default instance for a " + + "non-message extension."); + } + Add(new ExtensionInfo(type, defaultInstance)); + } + + private void Add(ExtensionInfo extension) + { + if (readOnly) + { + throw new InvalidOperationException("Cannot add entries to a read-only extension registry"); + } + if (!extension.Descriptor.IsExtension) + { + throw new ArgumentException("ExtensionRegistry.add() was given a FieldDescriptor for a " + + "regular (non-extension) field."); + } + + IGeneratedExtensionLite liteExtension = extension; + Add(liteExtension); + + FieldDescriptor field = extension.Descriptor; + if (field.ContainingType.Options.MessageSetWireFormat + && field.FieldType == FieldType.Message + && field.IsOptional + && field.ExtensionScope == field.MessageType) + { + // This is an extension of a MessageSet type defined within the extension + // type's own scope. For backwards-compatibility, allow it to be looked + // up by type name. + Dictionary map; + if (extensionsByName.TryGetValue(liteExtension.ContainingType, out map)) + { + map[field.MessageType.FullName] = extension; + } + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ExtensionRegistryLite.cs b/csharp/src/ProtocolBuffers/ExtensionRegistryLite.cs new file mode 100644 index 00000000..d1220e9c --- /dev/null +++ b/csharp/src/ProtocolBuffers/ExtensionRegistryLite.cs @@ -0,0 +1,220 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 ExtensionByNameMap = System.Collections.Generic.Dictionary>; +using ExtensionByIdMap = System.Collections.Generic.Dictionary; + +namespace Google.ProtocolBuffers +{ + /// + /// A table of known extensions, searchable by name or field number. When + /// parsing a protocol message that might have extensions, you must provide + /// an in which you have registered any extensions + /// that you want to be able to parse. Otherwise, those extensions will just + /// be treated like unknown fields. + /// + /// + /// For example, if you had the .proto file: + /// + /// option java_class = "MyProto"; + /// + /// message Foo { + /// extensions 1000 to max; + /// } + /// + /// extend Foo { + /// optional int32 bar; + /// } + /// + /// + /// Then you might write code like: + /// + /// + /// extensionRegistry registry = extensionRegistry.CreateInstance(); + /// registry.Add(MyProto.Bar); + /// MyProto.Foo message = MyProto.Foo.ParseFrom(input, registry); + /// + /// + /// + /// + /// You might wonder why this is necessary. Two alternatives might come to + /// mind. First, you might imagine a system where generated extensions are + /// automatically registered when their containing classes are loaded. This + /// is a popular technique, but is bad design; among other things, it creates a + /// situation where behavior can change depending on what classes happen to be + /// loaded. It also introduces a security vulnerability, because an + /// unprivileged class could cause its code to be called unexpectedly from a + /// privileged class by registering itself as an extension of the right type. + /// + /// Another option you might consider is lazy parsing: do not parse an + /// extension until it is first requested, at which point the caller must + /// provide a type to use. This introduces a different set of problems. First, + /// it would require a mutex lock any time an extension was accessed, which + /// would be slow. Second, corrupt data would not be detected until first + /// access, at which point it would be much harder to deal with it. Third, it + /// could violate the expectation that message objects are immutable, since the + /// type provided could be any arbitrary message class. An unprivileged user + /// could take advantage of this to inject a mutable object into a message + /// belonging to privileged code and create mischief. + /// + public sealed partial class ExtensionRegistry + { + private static readonly ExtensionRegistry empty = new ExtensionRegistry( + new ExtensionByNameMap(), + new ExtensionByIdMap(), + true); + + private readonly ExtensionByNameMap extensionsByName; + private readonly ExtensionByIdMap extensionsByNumber; + + private readonly bool readOnly; + + private ExtensionRegistry(ExtensionByNameMap byName, ExtensionByIdMap byNumber, bool readOnly) + { + this.extensionsByName = byName; + this.extensionsByNumber = byNumber; + this.readOnly = readOnly; + } + + /// + /// Construct a new, empty instance. + /// + public static ExtensionRegistry CreateInstance() + { + return new ExtensionRegistry(new ExtensionByNameMap(), new ExtensionByIdMap(), false); + } + + public ExtensionRegistry AsReadOnly() + { + return new ExtensionRegistry(extensionsByName, extensionsByNumber, true); + } + + /// + /// Get the unmodifiable singleton empty instance. + /// + public static ExtensionRegistry Empty + { + get { return empty; } + } + + /// + /// Finds an extension by containing type and field number. + /// A null reference is returned if the extension can't be found. + /// + public IGeneratedExtensionLite this[IMessageLite containingType, int fieldNumber] + { + get + { + IGeneratedExtensionLite ret; + extensionsByNumber.TryGetValue(new ExtensionIntPair(containingType, fieldNumber), out ret); + return ret; + } + } + + public IGeneratedExtensionLite FindByName(IMessageLite defaultInstanceOfType, string fieldName) + { + return FindExtensionByName(defaultInstanceOfType, fieldName); + } + + private IGeneratedExtensionLite FindExtensionByName(object forwhat, string fieldName) + { + IGeneratedExtensionLite extension = null; + Dictionary map; + if (extensionsByName.TryGetValue(forwhat, out map) && map.TryGetValue(fieldName, out extension)) + { + return extension; + } + return null; + } + + /// + /// Add an extension from a generated file to the registry. + /// + public void Add(IGeneratedExtensionLite extension) + { + if (readOnly) + { + throw new InvalidOperationException("Cannot add entries to a read-only extension registry"); + } + extensionsByNumber.Add(new ExtensionIntPair(extension.ContainingType, extension.Number), extension); + + Dictionary map; + if (!extensionsByName.TryGetValue(extension.ContainingType, out map)) + { + extensionsByName.Add(extension.ContainingType, map = new Dictionary()); + } + map[extension.Descriptor.Name] = extension; + map[extension.Descriptor.FullName] = extension; + } + + /// + /// Nested type just used to represent a pair of MessageDescriptor and int, as + /// the key into the "by number" map. + /// + internal struct ExtensionIntPair : IEquatable + { + private readonly object msgType; + private readonly int number; + + internal ExtensionIntPair(object msgType, int number) + { + this.msgType = msgType; + this.number = number; + } + + public override int GetHashCode() + { + return msgType.GetHashCode()*((1 << 16) - 1) + number; + } + + public override bool Equals(object obj) + { + if (!(obj is ExtensionIntPair)) + { + return false; + } + return Equals((ExtensionIntPair) obj); + } + + public bool Equals(ExtensionIntPair other) + { + return msgType.Equals(other.msgType) && number == other.number; + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs b/csharp/src/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs new file mode 100644 index 00000000..6ba039c1 --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldAccess/FieldAccessorTable.cs @@ -0,0 +1,126 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.FieldAccess +{ + /// + /// Provides access to fields in generated messages via reflection. + /// This type is public to allow it to be used by generated messages, which + /// create appropriate instances in the .proto file description class. + /// TODO(jonskeet): See if we can hide it somewhere... + /// + public sealed class FieldAccessorTable + where TMessage : IMessage + where TBuilder : IBuilder + { + private readonly IFieldAccessor[] accessors; + + private readonly MessageDescriptor descriptor; + + public MessageDescriptor Descriptor + { + get { return descriptor; } + } + + /// + /// Constructs a FieldAccessorTable for a particular message class. + /// Only one FieldAccessorTable should be constructed per class. + /// The property names should all actually correspond with the field descriptor's + /// CSharpOptions.PropertyName property, but bootstrapping issues currently + /// prevent us from using that. This may be addressed at a future time, in which case + /// we can keep this constructor for backwards compatibility, just ignoring the parameter. + /// TODO(jonskeet): Make it so. + /// + /// The type's descriptor + /// The Pascal-case names of all the field-based properties in the message. + public FieldAccessorTable(MessageDescriptor descriptor, String[] propertyNames) + { + this.descriptor = descriptor; + accessors = new IFieldAccessor[descriptor.Fields.Count]; + for (int i = 0; i < accessors.Length; i++) + { + accessors[i] = CreateAccessor(descriptor.Fields[i], propertyNames[i]); + } + } + + /// + /// Creates an accessor for a single field + /// + private static IFieldAccessor CreateAccessor(FieldDescriptor field, string name) + { + if (field.IsRepeated) + { + switch (field.MappedType) + { + case MappedType.Message: + return new RepeatedMessageAccessor(name); + case MappedType.Enum: + return new RepeatedEnumAccessor(field, name); + default: + return new RepeatedPrimitiveAccessor(name); + } + } + else + { + switch (field.MappedType) + { + case MappedType.Message: + return new SingleMessageAccessor(name); + case MappedType.Enum: + return new SingleEnumAccessor(field, name); + default: + return new SinglePrimitiveAccessor(name); + } + } + } + + internal IFieldAccessor this[FieldDescriptor field] + { + get + { + if (field.ContainingType != descriptor) + { + throw new ArgumentException("FieldDescriptor does not match message type."); + } + else if (field.IsExtension) + { + // If this type had extensions, it would subclass ExtendableMessage, + // which overrides the reflection interface to handle extensions. + throw new ArgumentException("This type does not have extensions."); + } + return accessors[field.Index]; + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/IFieldAccessor.cs b/csharp/src/ProtocolBuffers/FieldAccess/IFieldAccessor.cs new file mode 100644 index 00000000..39d3b85b --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldAccess/IFieldAccessor.cs @@ -0,0 +1,95 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. + +namespace Google.ProtocolBuffers.FieldAccess +{ + /// + /// Allows fields to be reflectively accessed in a smart manner. + /// The property descriptors for each field are created once and then cached. + /// In addition, this interface holds knowledge of repeated fields, builders etc. + /// + internal interface IFieldAccessor + where TMessage : IMessage + where TBuilder : IBuilder + { + /// + /// Indicates whether the specified message contains the field. + /// + bool Has(TMessage message); + + /// + /// Gets the count of the repeated field in the specified message. + /// + int GetRepeatedCount(TMessage message); + + /// + /// Clears the field in the specified builder. + /// + /// + void Clear(TBuilder builder); + + /// + /// Creates a builder for the type of this field (which must be a message field). + /// + IBuilder CreateBuilder(); + + /// + /// Accessor for single fields + /// + object GetValue(TMessage message); + + /// + /// Mutator for single fields + /// + void SetValue(TBuilder builder, object value); + + /// + /// Accessor for repeated fields + /// + object GetRepeatedValue(TMessage message, int index); + + /// + /// Mutator for repeated fields + /// + void SetRepeated(TBuilder builder, int index, object value); + + /// + /// Adds the specified value to the field in the given builder. + /// + void AddRepeated(TBuilder builder, object value); + + /// + /// Returns a read-only wrapper around the value of a repeated field. + /// + object GetRepeatedWrapper(TBuilder builder); + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs b/csharp/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs new file mode 100644 index 00000000..798f0dd7 --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldAccess/ReflectionUtil.cs @@ -0,0 +1,189 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Reflection; + +namespace Google.ProtocolBuffers.FieldAccess +{ + /// + /// 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. + /// + internal static class ReflectionUtil + { + /// + /// Empty Type[] used when calling GetProperty to force property instead of indexer fetching. + /// + internal static readonly Type[] EmptyTypes = new Type[0]; + + /// + /// Creates a delegate which will execute the given method and then return + /// the result as an object. + /// + public static Func CreateUpcastDelegate(MethodInfo method) + { + // The tricky bit is invoking CreateCreateUpcastDelegateImpl with the right type parameters + MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateUpcastDelegateImpl"); + MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof(T), method.ReturnType); + return (Func) closedImpl.Invoke(null, new object[] {method}); + } + + /// + /// Method used solely for implementing CreateUpcastDelegate. Public to avoid trust issues + /// in low-trust scenarios. + /// + public static Func CreateUpcastDelegateImpl(MethodInfo method) + { + // Convert the reflection call into an open delegate, i.e. instead of calling x.Method() + // we'll call getter(x). + Func getter = ReflectionUtil.CreateDelegateFunc(method); + + // Implicit upcast to object (within the delegate) + return delegate(TSource source) { return getter(source); }; + } + + /// + /// Creates a delegate which will execute the given method after casting the parameter + /// down from object to the required parameter type. + /// + public static Action CreateDowncastDelegate(MethodInfo method) + { + MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateDowncastDelegateImpl"); + MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof(T), method.GetParameters()[0].ParameterType); + return (Action) closedImpl.Invoke(null, new object[] {method}); + } + + public static Action CreateDowncastDelegateImpl(MethodInfo method) + { + // Convert the reflection call into an open delegate, i.e. instead of calling x.Method(y) we'll + // call Method(x, y) + Action call = ReflectionUtil.CreateDelegateAction(method); + + return delegate(TSource source, object parameter) { call(source, (TParam) parameter); }; + } + + /// + /// Creates a delegate which will execute the given method after casting the parameter + /// down from object to the required parameter type. + /// + public static Action CreateDowncastDelegateIgnoringReturn(MethodInfo method) + { + MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateDowncastDelegateIgnoringReturnImpl"); + MethodInfo closedImpl = openImpl.MakeGenericMethod(typeof(T), method.GetParameters()[0].ParameterType, + method.ReturnType); + return (Action) closedImpl.Invoke(null, new object[] {method}); + } + + public static Action CreateDowncastDelegateIgnoringReturnImpl( + MethodInfo method) + { + // Convert the reflection call into an open delegate, i.e. instead of calling x.Method(y) we'll + // call Method(x, y) + Func call = ReflectionUtil.CreateDelegateFunc(method); + + return delegate(TSource source, object parameter) { call(source, (TParam) parameter); }; + } + + /// + /// Creates a delegate which will execute the given static method and cast the result up to IBuilder. + /// + public static Func CreateStaticUpcastDelegate(MethodInfo method) + { + MethodInfo openImpl = typeof(ReflectionUtil).GetMethod("CreateStaticUpcastDelegateImpl"); + MethodInfo closedImpl = openImpl.MakeGenericMethod(method.ReturnType); + return (Func) closedImpl.Invoke(null, new object[] {method}); + } + + public static Func CreateStaticUpcastDelegateImpl(MethodInfo method) + { + Func call = ReflectionUtil.CreateDelegateFunc(method); + return delegate { return (IBuilder) call(); }; + } + + + internal static Func CreateDelegateFunc(MethodInfo method) + { +#if !CF20 + object tdelegate = Delegate.CreateDelegate(typeof(Func), null, method); + return (Func)tdelegate; +#else + return delegate() { return (TResult)method.Invoke(null, null); }; +#endif + } + + internal static Func CreateDelegateFunc(MethodInfo method) + { +#if !CF20 + object tdelegate = Delegate.CreateDelegate(typeof(Func), null, method); + return (Func)tdelegate; +#else + if (method.IsStatic) + { + return delegate(T arg1) { return (TResult) method.Invoke(null, new object[] {arg1}); }; + } + return delegate(T arg1) { return (TResult)method.Invoke(arg1, null); }; +#endif + } + + internal static Func CreateDelegateFunc(MethodInfo method) + { +#if !CF20 + object tdelegate = Delegate.CreateDelegate(typeof(Func), null, method); + return (Func)tdelegate; +#else + if (method.IsStatic) + { + return delegate(T1 arg1, T2 arg2) { return (TResult) method.Invoke(null, new object[] {arg1, arg2}); }; + } + return delegate(T1 arg1, T2 arg2) { return (TResult)method.Invoke(arg1, new object[] { arg2 }); }; +#endif + } + + internal static Action CreateDelegateAction(MethodInfo method) + { +#if !CF20 + object tdelegate = Delegate.CreateDelegate(typeof(Action), null, method); + return (Action)tdelegate; +#else + if (method.IsStatic) + { + return delegate(T1 arg1, T2 arg2) { method.Invoke(null, new object[] {arg1, arg2}); }; + } + return delegate(T1 arg1, T2 arg2) { method.Invoke(arg1, new object[] { arg2 }); }; +#endif + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/RepeatedEnumAccessor.cs b/csharp/src/ProtocolBuffers/FieldAccess/RepeatedEnumAccessor.cs new file mode 100644 index 00000000..152c2e0a --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldAccess/RepeatedEnumAccessor.cs @@ -0,0 +1,83 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System.Collections; +using System.Collections.Generic; +using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.FieldAccess +{ + /// + /// Accessor for a repeated enum field. + /// + internal sealed class RepeatedEnumAccessor : RepeatedPrimitiveAccessor + where TMessage : IMessage + where TBuilder : IBuilder + { + private readonly EnumDescriptor enumDescriptor; + + internal RepeatedEnumAccessor(FieldDescriptor field, string name) : base(name) + { + enumDescriptor = field.EnumType; + } + + public override object GetValue(TMessage message) + { + List ret = new List(); + foreach (int rawValue in (IEnumerable) base.GetValue(message)) + { + ret.Add(enumDescriptor.FindValueByNumber(rawValue)); + } + return Lists.AsReadOnly(ret); + } + + public override object GetRepeatedValue(TMessage message, int index) + { + // Note: This relies on the fact that the CLR allows unboxing from an enum to + // its underlying value + int rawValue = (int) base.GetRepeatedValue(message, index); + return enumDescriptor.FindValueByNumber(rawValue); + } + + public override void AddRepeated(TBuilder builder, object value) + { + ThrowHelper.ThrowIfNull(value, "value"); + base.AddRepeated(builder, ((EnumValueDescriptor) value).Number); + } + + public override void SetRepeated(TBuilder builder, int index, object value) + { + ThrowHelper.ThrowIfNull(value, "value"); + base.SetRepeated(builder, index, ((EnumValueDescriptor) value).Number); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs b/csharp/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs new file mode 100644 index 00000000..fd18b904 --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldAccess/RepeatedMessageAccessor.cs @@ -0,0 +1,97 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Reflection; + +namespace Google.ProtocolBuffers.FieldAccess +{ + /// + /// Accessor for a repeated message field. + /// + /// TODO(jonskeet): Try to extract the commonality between this and SingleMessageAccessor. + /// We almost want multiple inheritance... + /// + internal sealed class RepeatedMessageAccessor : RepeatedPrimitiveAccessor + where TMessage : IMessage + where TBuilder : IBuilder + { + /// + /// The static method to create a builder for the property type. For example, + /// in a message type "Foo", a field called "bar" might be of type "Baz". This + /// method is Baz.CreateBuilder. + /// + private readonly Func createBuilderDelegate; + + internal RepeatedMessageAccessor(string name) : base(name) + { + MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", EmptyTypes); + if (createBuilderMethod == null) + { + throw new ArgumentException("No public static CreateBuilder method declared in " + ClrType.Name); + } + createBuilderDelegate = ReflectionUtil.CreateStaticUpcastDelegate(createBuilderMethod); + } + + /// + /// Creates a message of the appropriate CLR type from the given value, + /// which may already be of the right type or may be a dynamic message. + /// + private object CoerceType(object value) + { + ThrowHelper.ThrowIfNull(value, "value"); + // If it's already of the right type, we're done + if (ClrType.IsInstanceOfType(value)) + { + return value; + } + + // No... so let's create a builder of the right type, and merge the value in. + IMessageLite message = (IMessageLite) value; + return CreateBuilder().WeakMergeFrom(message).WeakBuild(); + } + + public override void SetRepeated(TBuilder builder, int index, object value) + { + base.SetRepeated(builder, index, CoerceType(value)); + } + + public override IBuilder CreateBuilder() + { + return createBuilderDelegate(); + } + + public override void AddRepeated(TBuilder builder, object value) + { + base.AddRepeated(builder, CoerceType(value)); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs b/csharp/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs new file mode 100644 index 00000000..d3b926bc --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldAccess/RepeatedPrimitiveAccessor.cs @@ -0,0 +1,158 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Collections; +using System.Reflection; + +namespace Google.ProtocolBuffers.FieldAccess +{ + /// + /// Accessor for a repeated field of type int, ByteString etc. + /// + internal class RepeatedPrimitiveAccessor : IFieldAccessor + where TMessage : IMessage + where TBuilder : IBuilder + { + private readonly Type clrType; + private readonly Func getValueDelegate; + private readonly Func clearDelegate; + private readonly Action addValueDelegate; + private readonly Func getRepeatedWrapperDelegate; + private readonly Func countDelegate; + private readonly MethodInfo getElementMethod; + private readonly MethodInfo setElementMethod; + + // Replacement for Type.EmptyTypes which apparently isn't available on the compact framework + internal static readonly Type[] EmptyTypes = new Type[0]; + + /// + /// The CLR type of the field (int, the enum type, ByteString, the message etc). + /// This is taken from the return type of the method used to retrieve a single + /// value. + /// + protected Type ClrType + { + get { return clrType; } + } + + internal RepeatedPrimitiveAccessor(string name) + { + PropertyInfo messageProperty = typeof(TMessage).GetProperty(name + "List"); + PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name + "List"); + PropertyInfo countProperty = typeof(TMessage).GetProperty(name + "Count"); + MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name, EmptyTypes); + getElementMethod = typeof(TMessage).GetMethod("Get" + name, new Type[] {typeof(int)}); + clrType = getElementMethod.ReturnType; + MethodInfo addMethod = typeof(TBuilder).GetMethod("Add" + name, new Type[] {ClrType}); + setElementMethod = typeof(TBuilder).GetMethod("Set" + name, new Type[] {typeof(int), ClrType}); + if (messageProperty == null + || builderProperty == null + || countProperty == null + || clearMethod == null + || addMethod == null + || getElementMethod == null + || setElementMethod == null) + { + throw new ArgumentException("Not all required properties/methods available"); + } + clearDelegate = ReflectionUtil.CreateDelegateFunc(clearMethod); + countDelegate = ReflectionUtil.CreateDelegateFunc(countProperty.GetGetMethod()); + getValueDelegate = ReflectionUtil.CreateUpcastDelegate(messageProperty.GetGetMethod()); + addValueDelegate = ReflectionUtil.CreateDowncastDelegateIgnoringReturn(addMethod); + getRepeatedWrapperDelegate = ReflectionUtil.CreateUpcastDelegate(builderProperty.GetGetMethod()); + } + + public bool Has(TMessage message) + { + throw new InvalidOperationException(); + } + + public virtual IBuilder CreateBuilder() + { + throw new InvalidOperationException(); + } + + public virtual object GetValue(TMessage message) + { + return getValueDelegate(message); + } + + public void SetValue(TBuilder builder, object value) + { + // Add all the elements individually. This serves two purposes: + // 1) Verifies that each element has the correct type. + // 2) Insures that the caller cannot modify the list later on and + // have the modifications be reflected in the message. + Clear(builder); + foreach (object element in (IEnumerable) value) + { + AddRepeated(builder, element); + } + } + + public void Clear(TBuilder builder) + { + clearDelegate(builder); + } + + public int GetRepeatedCount(TMessage message) + { + return countDelegate(message); + } + + public virtual object GetRepeatedValue(TMessage message, int index) + { + return getElementMethod.Invoke(message, new object[] {index}); + } + + public virtual void SetRepeated(TBuilder builder, int index, object value) + { + ThrowHelper.ThrowIfNull(value, "value"); + setElementMethod.Invoke(builder, new object[] {index, value}); + } + + public virtual void AddRepeated(TBuilder builder, object value) + { + ThrowHelper.ThrowIfNull(value, "value"); + addValueDelegate(builder, value); + } + + /// + /// The builder class's accessor already builds a read-only wrapper for + /// us, which is exactly what we want. + /// + public object GetRepeatedWrapper(TBuilder builder) + { + return getRepeatedWrapperDelegate(builder); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs b/csharp/src/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs new file mode 100644 index 00000000..6327cc55 --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldAccess/SingleEnumAccessor.cs @@ -0,0 +1,74 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers.FieldAccess +{ + /// + /// Accessor for fields representing a non-repeated enum value. + /// + internal sealed class SingleEnumAccessor : SinglePrimitiveAccessor + where TMessage : IMessage + where TBuilder : IBuilder + { + private readonly EnumDescriptor enumDescriptor; + + internal SingleEnumAccessor(FieldDescriptor field, string name) : base(name) + { + enumDescriptor = field.EnumType; + } + + /// + /// Returns an EnumValueDescriptor representing the value in the builder. + /// Note that if an enum has multiple values for the same number, the descriptor + /// for the first value with that number will be returned. + /// + public override object GetValue(TMessage message) + { + // Note: This relies on the fact that the CLR allows unboxing from an enum to + // its underlying value + int rawValue = (int) base.GetValue(message); + return enumDescriptor.FindValueByNumber(rawValue); + } + + /// + /// Sets the value as an enum (via an int) in the builder, + /// from an EnumValueDescriptor parameter. + /// + public override void SetValue(TBuilder builder, object value) + { + ThrowHelper.ThrowIfNull(value, "value"); + EnumValueDescriptor valueDescriptor = (EnumValueDescriptor) value; + base.SetValue(builder, valueDescriptor.Number); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs b/csharp/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs new file mode 100644 index 00000000..6bf48a0c --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldAccess/SingleMessageAccessor.cs @@ -0,0 +1,89 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Reflection; + +namespace Google.ProtocolBuffers.FieldAccess +{ + /// + /// Accessor for fields representing a non-repeated message value. + /// + internal sealed class SingleMessageAccessor : SinglePrimitiveAccessor + where TMessage : IMessage + where TBuilder : IBuilder + { + /// + /// The static method to create a builder for the property type. For example, + /// in a message type "Foo", a field called "bar" might be of type "Baz". This + /// method is Baz.CreateBuilder. + /// + private readonly Func createBuilderDelegate; + + internal SingleMessageAccessor(string name) : base(name) + { + MethodInfo createBuilderMethod = ClrType.GetMethod("CreateBuilder", ReflectionUtil.EmptyTypes); + if (createBuilderMethod == null) + { + throw new ArgumentException("No public static CreateBuilder method declared in " + ClrType.Name); + } + createBuilderDelegate = ReflectionUtil.CreateStaticUpcastDelegate(createBuilderMethod); + } + + /// + /// Creates a message of the appropriate CLR type from the given value, + /// which may already be of the right type or may be a dynamic message. + /// + private object CoerceType(object value) + { + ThrowHelper.ThrowIfNull(value, "value"); + // If it's already of the right type, we're done + if (ClrType.IsInstanceOfType(value)) + { + return value; + } + + // No... so let's create a builder of the right type, and merge the value in. + IMessageLite message = (IMessageLite) value; + return CreateBuilder().WeakMergeFrom(message).WeakBuild(); + } + + public override void SetValue(TBuilder builder, object value) + { + base.SetValue(builder, CoerceType(value)); + } + + public override IBuilder CreateBuilder() + { + return createBuilderDelegate(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs b/csharp/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs new file mode 100644 index 00000000..e5a07540 --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldAccess/SinglePrimitiveAccessor.cs @@ -0,0 +1,133 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Reflection; + +namespace Google.ProtocolBuffers.FieldAccess +{ + /// + /// Access for a non-repeated field of a "primitive" type (i.e. not another message or an enum). + /// + internal class SinglePrimitiveAccessor : IFieldAccessor + where TMessage : IMessage + where TBuilder : IBuilder + { + private readonly Type clrType; + private readonly Func getValueDelegate; + private readonly Action setValueDelegate; + private readonly Func hasDelegate; + private readonly Func clearDelegate; + + /// + /// The CLR type of the field (int, the enum type, ByteString, the message etc). + /// As declared by the property. + /// + protected Type ClrType + { + get { return clrType; } + } + + internal SinglePrimitiveAccessor(string name) + { + PropertyInfo messageProperty = typeof(TMessage).GetProperty(name, null, ReflectionUtil.EmptyTypes); + PropertyInfo builderProperty = typeof(TBuilder).GetProperty(name, null, ReflectionUtil.EmptyTypes); + PropertyInfo hasProperty = typeof(TMessage).GetProperty("Has" + name); + MethodInfo clearMethod = typeof(TBuilder).GetMethod("Clear" + name); + if (messageProperty == null || builderProperty == null || hasProperty == null || clearMethod == null) + { + throw new ArgumentException("Not all required properties/methods available"); + } + clrType = messageProperty.PropertyType; + hasDelegate = ReflectionUtil.CreateDelegateFunc(hasProperty.GetGetMethod()); + clearDelegate = ReflectionUtil.CreateDelegateFunc(clearMethod); + getValueDelegate = ReflectionUtil.CreateUpcastDelegate(messageProperty.GetGetMethod()); + setValueDelegate = ReflectionUtil.CreateDowncastDelegate(builderProperty.GetSetMethod()); + } + + public bool Has(TMessage message) + { + return hasDelegate(message); + } + + public void Clear(TBuilder builder) + { + clearDelegate(builder); + } + + /// + /// Only valid for message types - this implementation throws InvalidOperationException. + /// + public virtual IBuilder CreateBuilder() + { + throw new InvalidOperationException(); + } + + public virtual object GetValue(TMessage message) + { + return getValueDelegate(message); + } + + public virtual void SetValue(TBuilder builder, object value) + { + setValueDelegate(builder, value); + } + + #region Methods only related to repeated values + + public int GetRepeatedCount(TMessage message) + { + throw new InvalidOperationException(); + } + + public object GetRepeatedValue(TMessage message, int index) + { + throw new InvalidOperationException(); + } + + public void SetRepeated(TBuilder builder, int index, object value) + { + throw new InvalidOperationException(); + } + + public void AddRepeated(TBuilder builder, object value) + { + throw new InvalidOperationException(); + } + + public object GetRepeatedWrapper(TBuilder builder) + { + throw new InvalidOperationException(); + } + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FieldSet.cs b/csharp/src/ProtocolBuffers/FieldSet.cs new file mode 100644 index 00000000..f3c08cf5 --- /dev/null +++ b/csharp/src/ProtocolBuffers/FieldSet.cs @@ -0,0 +1,632 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + public interface IFieldDescriptorLite : IComparable + { + bool IsRepeated { get; } + bool IsRequired { get; } + bool IsPacked { get; } + bool IsExtension { get; } + bool MessageSetWireFormat { get; } //field.ContainingType.Options.MessageSetWireFormat + int FieldNumber { get; } + string Name { get; } + string FullName { get; } + IEnumLiteMap EnumType { get; } + FieldType FieldType { get; } + MappedType MappedType { get; } + object DefaultValue { get; } + } + + /// + /// A class which represents an arbitrary set of fields of some message type. + /// This is used to implement DynamicMessage, and also to represent extensions + /// in GeneratedMessage. This class is internal, since outside users should probably + /// be using DynamicMessage. + /// + /// As in the Java implementation, this class goes against the rest of the framework + /// in terms of mutability. Instead of having a mutable Builder class and an immutable + /// FieldSet class, FieldSet just has a MakeImmutable() method. This is safe so long as + /// all callers are careful not to let a mutable FieldSet escape into the open. This would + /// be impossible to guarantee if this were a public class, of course. + /// + /// All repeated fields are stored as IList[object] even + /// TODO(jonskeet): Finish this comment! + /// + internal sealed class FieldSet + { + private static readonly FieldSet defaultInstance = + new FieldSet(new Dictionary()).MakeImmutable(); + + private IDictionary fields; + + private FieldSet(IDictionary fields) + { + this.fields = fields; + } + + public static FieldSet CreateInstance() + { + // Use SortedList to keep fields in the canonical order + return new FieldSet(new SortedList()); + } + + /// + /// Makes this FieldSet immutable, and returns it for convenience. Any + /// mutable repeated fields are made immutable, as well as the map itself. + /// + internal FieldSet MakeImmutable() + { + // First check if we have any repeated values + bool hasRepeats = false; + foreach (object value in fields.Values) + { + IList list = value as IList; + if (list != null && !list.IsReadOnly) + { + hasRepeats = true; + break; + } + } + + if (hasRepeats) + { + var tmp = new SortedList(); + foreach (KeyValuePair entry in fields) + { + IList list = entry.Value as IList; + tmp[entry.Key] = list == null ? entry.Value : Lists.AsReadOnly(list); + } + fields = tmp; + } + + fields = Dictionaries.AsReadOnly(fields); + + return this; + } + + /// + /// Returns the default, immutable instance with no fields defined. + /// + internal static FieldSet DefaultInstance + { + get { return defaultInstance; } + } + + /// + /// Returns an immutable mapping of fields. Note that although the mapping itself + /// is immutable, the entries may not be (i.e. any repeated values are represented by + /// mutable lists). The behaviour is not specified if the contents are mutated. + /// + internal IDictionary AllFields + { + get { return Dictionaries.AsReadOnly(fields); } + } + +#if !LITE + /// + /// Force coercion to full descriptor dictionary. + /// + internal IDictionary AllFieldDescriptors + { + get + { + SortedList copy = + new SortedList(); + foreach (KeyValuePair fd in fields) + { + copy.Add((FieldDescriptor) fd.Key, fd.Value); + } + return Dictionaries.AsReadOnly(copy); + } + } +#endif + + /// + /// See . + /// + public bool HasField(IFieldDescriptorLite field) + { + if (field.IsRepeated) + { + throw new ArgumentException("HasField() can only be called on non-repeated fields."); + } + + return fields.ContainsKey(field); + } + + /// + /// Clears all fields. + /// + internal void Clear() + { + fields.Clear(); + } + + /// + /// See + /// + /// + /// If the field is not set, the behaviour when fetching this property varies by field type: + /// + /// For singular message values, null is returned. + /// For singular non-message values, the default value of the field is returned. + /// For repeated values, an empty immutable list is returned. This will be compatible + /// with IList[object], regardless of the type of the repeated item. + /// + /// This method returns null if the field is a singular message type + /// and is not set; in this case it is up to the caller to fetch the + /// message's default instance. For repeated fields of message types, + /// an empty collection is returned. For repeated fields of non-message + /// types, null is returned. + /// + /// When setting this property, any list values are copied, and each element is checked + /// to ensure it is of an appropriate type. + /// + /// + internal object this[IFieldDescriptorLite field] + { + get + { + object result; + if (fields.TryGetValue(field, out result)) + { + return result; + } + if (field.MappedType == MappedType.Message) + { + if (field.IsRepeated) + { + return new List(); + } + else + { + return null; + } + } + return field.DefaultValue; + } + set + { + if (field.IsRepeated) + { + List list = value as List; + if (list == null) + { + throw new ArgumentException("Wrong object type used with protocol message reflection."); + } + + // Wrap the contents in a new list so that the caller cannot change + // the list's contents after setting it. + List newList = new List(list); + foreach (object element in newList) + { + VerifyType(field, element); + } + value = newList; + } + else + { + VerifyType(field, value); + } + fields[field] = value; + } + } + + /// + /// See + /// + internal object this[IFieldDescriptorLite field, int index] + { + get + { + if (!field.IsRepeated) + { + throw new ArgumentException( + "Indexer specifying field and index can only be called on repeated fields."); + } + + return ((IList) this[field])[index]; + } + set + { + if (!field.IsRepeated) + { + throw new ArgumentException( + "Indexer specifying field and index can only be called on repeated fields."); + } + VerifyType(field, value); + object list; + if (!fields.TryGetValue(field, out list)) + { + throw new ArgumentOutOfRangeException(); + } + ((IList) list)[index] = value; + } + } + + /// + /// See + /// + internal void AddRepeatedField(IFieldDescriptorLite field, object value) + { + if (!field.IsRepeated) + { + throw new ArgumentException("AddRepeatedField can only be called on repeated fields."); + } + VerifyType(field, value); + object list; + if (!fields.TryGetValue(field, out list)) + { + list = new List(); + fields[field] = list; + } + ((IList) list).Add(value); + } + + /// + /// Returns an enumerator for the field map. Used to write the fields out. + /// + internal IEnumerator> GetEnumerator() + { + return fields.GetEnumerator(); + } + + /// + /// See + /// + /// + /// Since FieldSet itself does not have any way of knowing about + /// required fields that aren't actually present in the set, it is up + /// to the caller to check for genuinely required fields. This property + /// merely checks that any messages present are themselves initialized. + /// + internal bool IsInitialized + { + get + { + foreach (KeyValuePair entry in fields) + { + IFieldDescriptorLite field = entry.Key; + if (field.MappedType == MappedType.Message) + { + if (field.IsRepeated) + { + foreach (IMessageLite message in (IEnumerable) entry.Value) + { + if (!message.IsInitialized) + { + return false; + } + } + } + else + { + if (!((IMessageLite) entry.Value).IsInitialized) + { + return false; + } + } + } + } + return true; + } + } + + /// + /// Verifies whether all the required fields in the specified message + /// descriptor are present in this field set, as well as whether + /// all the embedded messages are themselves initialized. + /// + internal bool IsInitializedWithRespectTo(IEnumerable typeFields) + { + foreach (IFieldDescriptorLite field in typeFields) + { + if (field.IsRequired && !HasField(field)) + { + return false; + } + } + return IsInitialized; + } + + /// + /// See + /// + public void ClearField(IFieldDescriptorLite field) + { + fields.Remove(field); + } + + /// + /// See + /// + public int GetRepeatedFieldCount(IFieldDescriptorLite field) + { + if (!field.IsRepeated) + { + throw new ArgumentException("GetRepeatedFieldCount() can only be called on repeated fields."); + } + + return ((IList) this[field]).Count; + } + +#if !LITE + /// + /// See + /// + public void MergeFrom(IMessage other) + { + foreach (KeyValuePair fd in other.AllFields) + { + MergeField(fd.Key, fd.Value); + } + } +#endif + + /// + /// Implementation of both MergeFrom methods. + /// + /// + public void MergeFrom(FieldSet other) + { + // Note: We don't attempt to verify that other's fields have valid + // types. Doing so would be a losing battle. We'd have to verify + // all sub-messages as well, and we'd have to make copies of all of + // them to insure that they don't change after verification (since + // the IMessageLite interface itself cannot enforce immutability of + // implementations). + // TODO(jonskeet): Provide a function somewhere called MakeDeepCopy() + // which allows people to make secure deep copies of messages. + + foreach (KeyValuePair entry in other.fields) + { + MergeField(entry.Key, entry.Value); + } + } + + private void MergeField(IFieldDescriptorLite field, object mergeValue) + { + object existingValue; + fields.TryGetValue(field, out existingValue); + if (field.IsRepeated) + { + if (existingValue == null) + { + existingValue = new List(); + fields[field] = existingValue; + } + IList list = (IList) existingValue; + foreach (object otherValue in (IEnumerable) mergeValue) + { + list.Add(otherValue); + } + } + else if (field.MappedType == MappedType.Message && existingValue != null) + { + IMessageLite existingMessage = (IMessageLite) existingValue; + IMessageLite merged = existingMessage.WeakToBuilder() + .WeakMergeFrom((IMessageLite) mergeValue) + .WeakBuild(); + this[field] = merged; + } + else + { + this[field] = mergeValue; + } + } + + /// + /// See . + /// + public void WriteTo(ICodedOutputStream output) + { + foreach (KeyValuePair entry in fields) + { + WriteField(entry.Key, entry.Value, output); + } + } + + /// + /// Writes a single field to a CodedOutputStream. + /// + public void WriteField(IFieldDescriptorLite field, Object value, ICodedOutputStream output) + { + if (field.IsExtension && field.MessageSetWireFormat) + { + output.WriteMessageSetExtension(field.FieldNumber, field.Name, (IMessageLite) value); + } + else + { + if (field.IsRepeated) + { + IEnumerable valueList = (IEnumerable) value; + if (field.IsPacked) + { + output.WritePackedArray(field.FieldType, field.FieldNumber, field.Name, valueList); + } + else + { + output.WriteArray(field.FieldType, field.FieldNumber, field.Name, valueList); + } + } + else + { + output.WriteField(field.FieldType, field.FieldNumber, field.Name, value); + } + } + } + + /// + /// See . It's up to the caller to + /// cache the resulting size if desired. + /// + public int SerializedSize + { + get + { + int size = 0; + foreach (KeyValuePair entry in fields) + { + IFieldDescriptorLite field = entry.Key; + object value = entry.Value; + + if (field.IsExtension && field.MessageSetWireFormat) + { + size += CodedOutputStream.ComputeMessageSetExtensionSize(field.FieldNumber, (IMessageLite) value); + } + else + { + if (field.IsRepeated) + { + IEnumerable valueList = (IEnumerable) value; + if (field.IsPacked) + { + int dataSize = 0; + foreach (object element in valueList) + { + dataSize += CodedOutputStream.ComputeFieldSizeNoTag(field.FieldType, element); + } + size += dataSize + CodedOutputStream.ComputeTagSize(field.FieldNumber) + + CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + else + { + foreach (object element in valueList) + { + size += CodedOutputStream.ComputeFieldSize(field.FieldType, field.FieldNumber, + element); + } + } + } + else + { + size += CodedOutputStream.ComputeFieldSize(field.FieldType, field.FieldNumber, value); + } + } + } + return size; + } + } + + /// + /// Verifies that the given object is of the correct type to be a valid + /// value for the given field. + /// + /// + /// For repeated fields, this checks if the object is of the right + /// element type, not whether it's a list. + /// + /// The value is not of the right type. + /// The value is null. + private static void VerifyType(IFieldDescriptorLite field, object value) + { + ThrowHelper.ThrowIfNull(value, "value"); + bool isValid = false; + switch (field.MappedType) + { + case MappedType.Int32: + isValid = value is int; + break; + case MappedType.Int64: + isValid = value is long; + break; + case MappedType.UInt32: + isValid = value is uint; + break; + case MappedType.UInt64: + isValid = value is ulong; + break; + case MappedType.Single: + isValid = value is float; + break; + case MappedType.Double: + isValid = value is double; + break; + case MappedType.Boolean: + isValid = value is bool; + break; + case MappedType.String: + isValid = value is string; + break; + case MappedType.ByteString: + isValid = value is ByteString; + break; + case MappedType.Enum: + IEnumLite enumValue = value as IEnumLite; + isValid = enumValue != null && field.EnumType.IsValidValue(enumValue); + break; + case MappedType.Message: + IMessageLite messageValue = value as IMessageLite; + isValid = messageValue != null; +#if !LITE + if (isValid && messageValue is IMessage && field is FieldDescriptor) + { + isValid = ((IMessage) messageValue).DescriptorForType == ((FieldDescriptor) field).MessageType; + } +#endif + break; + } + + if (!isValid) + { + // When chaining calls to SetField(), it can be hard to tell from + // the stack trace which exact call failed, since the whole chain is + // considered one line of code. So, let's make sure to include the + // field name and other useful info in the exception. + string message = "Wrong object type used with protocol message reflection."; +#if !LITE + FieldDescriptor fieldinfo = + field as FieldDescriptor; + if (fieldinfo != null) + { + message += "Message type \"" + fieldinfo.ContainingType.FullName; + message += "\", field \"" + (fieldinfo.IsExtension ? fieldinfo.FullName : fieldinfo.Name); + message += "\", value was type \"" + value.GetType().Name + "\"."; + } +#endif + throw new ArgumentException(message); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/FrameworkPortability.cs b/csharp/src/ProtocolBuffers/FrameworkPortability.cs new file mode 100644 index 00000000..8ce81987 --- /dev/null +++ b/csharp/src/ProtocolBuffers/FrameworkPortability.cs @@ -0,0 +1,111 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Globalization; +using System.Reflection; +using System.Text.RegularExpressions; + +namespace Google.ProtocolBuffers +{ + /// + /// Class containing helpful workarounds for various platform compatibility + /// + internal static class FrameworkPortability + { +#if COMPACT_FRAMEWORK + internal const string NewLine = "\n"; +#else + internal static readonly string NewLine = System.Environment.NewLine; +#endif + +#if CLIENTPROFILE + internal const RegexOptions CompiledRegexWhereAvailable = RegexOptions.Compiled; +#else + internal const RegexOptions CompiledRegexWhereAvailable = RegexOptions.None; +#endif + + internal static CultureInfo InvariantCulture + { + get { return CultureInfo.InvariantCulture; } + } + + internal static double Int64ToDouble(long value) + { +#if CLIENTPROFILE + return BitConverter.Int64BitsToDouble(value); +#else + double[] arresult = new double[1]; + Buffer.BlockCopy(new[] { value }, 0, arresult, 0, 8); + return arresult[0]; +#endif + } + + internal static long DoubleToInt64(double value) + { +#if CLIENTPROFILE + return BitConverter.DoubleToInt64Bits(value); +#else + long[] arresult = new long[1]; + Buffer.BlockCopy(new[] { value }, 0, arresult, 0, 8); + return arresult[0]; +#endif + } + + internal static bool TryParseInt32(string text, out int number) + { + return TryParseInt32(text, NumberStyles.Any, InvariantCulture, out number); + } + + internal static bool TryParseInt32(string text, NumberStyles style, IFormatProvider format, out int number) + { +#if COMPACT_FRAMEWORK + try + { + number = int.Parse(text, style, format); + return true; + } + catch + { + number = 0; + return false; + } +#else + return int.TryParse(text, style, format, out number); +#endif + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/GeneratedBuilder.cs b/csharp/src/ProtocolBuffers/GeneratedBuilder.cs new file mode 100644 index 00000000..fd6fe4d7 --- /dev/null +++ b/csharp/src/ProtocolBuffers/GeneratedBuilder.cs @@ -0,0 +1,215 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.FieldAccess; + +namespace Google.ProtocolBuffers +{ + /// + /// All generated protocol message builder classes extend this class. It implements + /// most of the IBuilder interface using reflection. Users can ignore this class + /// as an implementation detail. + /// + public abstract partial class GeneratedBuilder : AbstractBuilder + where TMessage : GeneratedMessage + where TBuilder : GeneratedBuilder, new() + { + /// + /// Returns the message being built at the moment. + /// + protected abstract TMessage MessageBeingBuilt { get; } + + protected internal FieldAccessorTable InternalFieldAccessors + { + get { return DefaultInstanceForType.FieldAccessorsFromBuilder; } + } + + public override IDictionary AllFields + { + get { return MessageBeingBuilt.AllFields; } + } + + public override object this[FieldDescriptor field] + { + get + { + // For repeated fields, the underlying list object is still modifiable at this point. + // Make sure not to expose the modifiable list to the caller. + return field.IsRepeated + ? InternalFieldAccessors[field].GetRepeatedWrapper(ThisBuilder) + : MessageBeingBuilt[field]; + } + set { InternalFieldAccessors[field].SetValue(ThisBuilder, value); } + } + + /// + /// Called by derived classes to parse an unknown field. + /// + /// true unless the tag is an end-group tag + [CLSCompliant(false)] + protected virtual bool ParseUnknownField(ICodedInputStream input, UnknownFieldSet.Builder unknownFields, + ExtensionRegistry extensionRegistry, uint tag, string fieldName) + { + return unknownFields.MergeFieldFrom(tag, input); + } + + public override MessageDescriptor DescriptorForType + { + get { return DefaultInstanceForType.DescriptorForType; } + } + + public override int GetRepeatedFieldCount(FieldDescriptor field) + { + return MessageBeingBuilt.GetRepeatedFieldCount(field); + } + + public override object this[FieldDescriptor field, int index] + { + get { return MessageBeingBuilt[field, index]; } + set { InternalFieldAccessors[field].SetRepeated(ThisBuilder, index, value); } + } + + public override bool HasField(FieldDescriptor field) + { + return MessageBeingBuilt.HasField(field); + } + + public override IBuilder CreateBuilderForField(FieldDescriptor field) + { + return InternalFieldAccessors[field].CreateBuilder(); + } + + public override TBuilder ClearField(FieldDescriptor field) + { + InternalFieldAccessors[field].Clear(ThisBuilder); + return ThisBuilder; + } + + public override TBuilder MergeFrom(TMessage other) + { + if (other.DescriptorForType != InternalFieldAccessors.Descriptor) + { + throw new ArgumentException("Message type mismatch"); + } + + foreach (KeyValuePair entry in other.AllFields) + { + FieldDescriptor field = entry.Key; + if (field.IsRepeated) + { + // Concatenate repeated fields + foreach (object element in (IEnumerable) entry.Value) + { + AddRepeatedField(field, element); + } + } + else if (field.MappedType == MappedType.Message && HasField(field)) + { + // Merge singular embedded messages + IMessageLite oldValue = (IMessageLite) this[field]; + this[field] = oldValue.WeakCreateBuilderForType() + .WeakMergeFrom(oldValue) + .WeakMergeFrom((IMessageLite) entry.Value) + .WeakBuildPartial(); + } + else + { + // Just overwrite + this[field] = entry.Value; + } + } + + //Fix for unknown fields not merging, see java's AbstractMessage.Builder line 236 + MergeUnknownFields(other.UnknownFields); + + return ThisBuilder; + } + + public override TBuilder MergeUnknownFields(UnknownFieldSet unknownFields) + { + if (unknownFields != UnknownFieldSet.DefaultInstance) + { + TMessage result = MessageBeingBuilt; + result.SetUnknownFields(UnknownFieldSet.CreateBuilder(result.UnknownFields) + .MergeFrom(unknownFields) + .Build()); + } + return ThisBuilder; + } + + public override TBuilder AddRepeatedField(FieldDescriptor field, object value) + { + InternalFieldAccessors[field].AddRepeated(ThisBuilder, value); + return ThisBuilder; + } + + /// + /// Like Build(), but will wrap UninitializedMessageException in + /// InvalidProtocolBufferException. + /// + public TMessage BuildParsed() + { + if (!IsInitialized) + { + throw new UninitializedMessageException(MessageBeingBuilt).AsInvalidProtocolBufferException(); + } + return BuildPartial(); + } + + /// + /// Implementation of . + /// + public override TMessage Build() + { + // If the message is null, we'll throw a more appropriate exception in BuildPartial. + if (!IsInitialized) + { + throw new UninitializedMessageException(MessageBeingBuilt); + } + return BuildPartial(); + } + + public override UnknownFieldSet UnknownFields + { + get { return MessageBeingBuilt.UnknownFields; } + set { MessageBeingBuilt.SetUnknownFields(value); } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/GeneratedBuilderLite.cs b/csharp/src/ProtocolBuffers/GeneratedBuilderLite.cs new file mode 100644 index 00000000..4030e801 --- /dev/null +++ b/csharp/src/ProtocolBuffers/GeneratedBuilderLite.cs @@ -0,0 +1,101 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers +{ + /// + /// All generated protocol message builder classes extend this class. It implements + /// most of the IBuilder interface using reflection. Users can ignore this class + /// as an implementation detail. + /// + public abstract partial class GeneratedBuilderLite : AbstractBuilderLite + where TMessage : GeneratedMessageLite + where TBuilder : GeneratedBuilderLite + { + /// + /// Returns the message being built at the moment. + /// + protected abstract TMessage MessageBeingBuilt { get; } + + public override TBuilder MergeFrom(IMessageLite other) + { + //do nothing, Lite runtime does not support cross-message merges + return ThisBuilder; + } + + public abstract TBuilder MergeFrom(TMessage other); + + /// + /// Called by derived classes to parse an unknown field. + /// + /// true unless the tag is an end-group tag + [CLSCompliant(false)] + protected virtual bool ParseUnknownField(ICodedInputStream input, + ExtensionRegistry extensionRegistry, uint tag, string fieldName) + { + return input.SkipField(); + } + + /// + /// Like Build(), but will wrap UninitializedMessageException in + /// InvalidProtocolBufferException. + /// + public TMessage BuildParsed() + { + if (!IsInitialized) + { + throw new UninitializedMessageException(MessageBeingBuilt).AsInvalidProtocolBufferException(); + } + return BuildPartial(); + } + + /// + /// Implementation of . + /// + public override TMessage Build() + { + // If the message is null, we'll throw a more appropriate exception in BuildPartial. + if (!IsInitialized) + { + throw new UninitializedMessageException(MessageBeingBuilt); + } + return BuildPartial(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/GeneratedExtensionBase.cs b/csharp/src/ProtocolBuffers/GeneratedExtensionBase.cs new file mode 100644 index 00000000..424b981a --- /dev/null +++ b/csharp/src/ProtocolBuffers/GeneratedExtensionBase.cs @@ -0,0 +1,185 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Base type for all generated extensions. + /// + /// + /// The protocol compiler generates a static singleton instance of this + /// class for each extension. For exmaple, imagine a .proto file with: + /// + /// message Foo { + /// extensions 1000 to max + /// } + /// + /// extend Foo { + /// optional int32 bar; + /// } + /// + /// Then MyProto.Foo.Bar has type GeneratedExtensionBase<MyProto.Foo,int>. + /// + /// In general, users should ignore the details of this type, and + /// simply use the static singletons as parameters to the extension accessors + /// in ExtendableMessage and ExtendableBuilder. + /// The interface implemented by both GeneratedException and GeneratedRepeatException, + /// to make it easier to cope with repeats separately. + /// + public abstract class GeneratedExtensionBase + { + private readonly FieldDescriptor descriptor; + private readonly IMessageLite messageDefaultInstance; + + protected GeneratedExtensionBase(FieldDescriptor descriptor, Type singularExtensionType) + { + if (!descriptor.IsExtension) + { + throw new ArgumentException("GeneratedExtension given a regular (non-extension) field."); + } + + this.descriptor = descriptor; + if (descriptor.MappedType == MappedType.Message) + { + PropertyInfo defaultInstanceProperty = singularExtensionType + .GetProperty("DefaultInstance", BindingFlags.Static | BindingFlags.Public); + if (defaultInstanceProperty == null) + { + throw new ArgumentException("No public static DefaultInstance property for type " + + typeof(TExtension).Name); + } + + messageDefaultInstance = (IMessageLite) defaultInstanceProperty.GetValue(null, null); + } + } + + public FieldDescriptor Descriptor + { + get { return descriptor; } + } + + public int Number + { + get { return Descriptor.FieldNumber; } + } + + /// + /// Returns the default message instance for extensions which are message types. + /// + public IMessageLite MessageDefaultInstance + { + get { return messageDefaultInstance; } + } + + public object SingularFromReflectionType(object value) + { + switch (Descriptor.MappedType) + { + case MappedType.Message: + if (value is TExtension) + { + return value; + } + else + { + // It seems the copy of the embedded message stored inside the + // extended message is not of the exact type the user was + // expecting. This can happen if a user defines a + // GeneratedExtension manually and gives it a different type. + // This should not happen in normal use. But, to be nice, we'll + // copy the message to whatever type the caller was expecting. + return MessageDefaultInstance.WeakCreateBuilderForType() + .WeakMergeFrom((IMessageLite) value).WeakBuild(); + } + case MappedType.Enum: + // Just return a boxed int - that can be unboxed to the enum + EnumValueDescriptor enumValue = (EnumValueDescriptor) value; + return enumValue.Number; + default: + return value; + } + } + + /// + /// Converts from the type used by the native accessors to the type + /// used by reflection accessors. For example, the reflection accessors + /// for enums use EnumValueDescriptors but the native accessors use + /// the generated enum type. + /// + public object ToReflectionType(object value) + { + if (descriptor.IsRepeated) + { + if (descriptor.MappedType == MappedType.Enum) + { + // Must convert the whole list. + IList result = new List(); + foreach (object element in (IEnumerable) value) + { + result.Add(SingularToReflectionType(element)); + } + return result; + } + else + { + return value; + } + } + else + { + return SingularToReflectionType(value); + } + } + + /// + /// Like ToReflectionType(object) but for a single element. + /// + internal Object SingularToReflectionType(object value) + { + return descriptor.MappedType == MappedType.Enum + ? descriptor.EnumType.FindValueByNumber((int) value) + : value; + } + + public abstract object FromReflectionType(object value); + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/GeneratedExtensionLite.cs b/csharp/src/ProtocolBuffers/GeneratedExtensionLite.cs new file mode 100644 index 00000000..a1623348 --- /dev/null +++ b/csharp/src/ProtocolBuffers/GeneratedExtensionLite.cs @@ -0,0 +1,354 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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; +using System.Collections.Generic; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + public interface IGeneratedExtensionLite + { + int Number { get; } + object ContainingType { get; } + IMessageLite MessageDefaultInstance { get; } + IFieldDescriptorLite Descriptor { get; } + } + + public class ExtensionDescriptorLite : IFieldDescriptorLite + { + private readonly string fullName; + private readonly IEnumLiteMap enumTypeMap; + private readonly int number; + private readonly FieldType type; + private readonly bool isRepeated; + private readonly bool isPacked; + private readonly MappedType mapType; + private readonly object defaultValue; + + public ExtensionDescriptorLite(string fullName, IEnumLiteMap enumTypeMap, int number, FieldType type, + object defaultValue, bool isRepeated, bool isPacked) + { + this.fullName = fullName; + this.enumTypeMap = enumTypeMap; + this.number = number; + this.type = type; + this.mapType = FieldMappingAttribute.MappedTypeFromFieldType(type); + this.isRepeated = isRepeated; + this.isPacked = isPacked; + this.defaultValue = defaultValue; + } + + public string Name + { + get + { + string name = fullName; + int offset = name.LastIndexOf('.'); + if (offset >= 0) + { + name = name.Substring(offset); + } + return name; + } + } + + public string FullName + { + get { return fullName; } + } + + public bool IsRepeated + { + get { return isRepeated; } + } + + public bool IsRequired + { + get { return false; } + } + + public bool IsPacked + { + get { return isPacked; } + } + + public bool IsExtension + { + get { return true; } + } + + /// + /// This is not supported and assertions are made to ensure this does not exist on extensions of Lite types + /// + public bool MessageSetWireFormat + { + get { return false; } + } + + public int FieldNumber + { + get { return number; } + } + + public IEnumLiteMap EnumType + { + get { return enumTypeMap; } + } + + public FieldType FieldType + { + get { return type; } + } + + public MappedType MappedType + { + get { return mapType; } + } + + public object DefaultValue + { + get { return defaultValue; } + } + + public int CompareTo(IFieldDescriptorLite other) + { + return FieldNumber.CompareTo(other.FieldNumber); + } + } + + public class GeneratedRepeatExtensionLite : + GeneratedExtensionLite> + where TContainingType : IMessageLite + { + public GeneratedRepeatExtensionLite(string fullName, TContainingType containingTypeDefaultInstance, + IMessageLite messageDefaultInstance, IEnumLiteMap enumTypeMap, int number, + FieldType type, bool isPacked) : + base( + fullName, containingTypeDefaultInstance, new List(), + messageDefaultInstance, enumTypeMap, number, type, isPacked) + { + } + + public override object ToReflectionType(object value) + { + IList result = new List(); + foreach (object element in (IEnumerable) value) + { + result.Add(SingularToReflectionType(element)); + } + return result; + } + + public override object FromReflectionType(object value) + { + // Must convert the whole list. + List result = new List(); + foreach (object element in (IEnumerable) value) + { + result.Add((TExtensionType) SingularFromReflectionType(element)); + } + return result; + } + } + + public class GeneratedExtensionLite : IGeneratedExtensionLite + where TContainingType : IMessageLite + { + private readonly TContainingType containingTypeDefaultInstance; + private readonly TExtensionType defaultValue; + private readonly IMessageLite messageDefaultInstance; + private readonly ExtensionDescriptorLite descriptor; + + // We can't always initialize a GeneratedExtension when we first construct + // it due to initialization order difficulties (namely, the default + // instances may not have been constructed yet). So, we construct an + // uninitialized GeneratedExtension once, then call internalInit() on it + // later. Generated code will always call internalInit() on all extensions + // as part of the static initialization code, and internalInit() throws an + // exception if called more than once, so this method is useless to users. + protected GeneratedExtensionLite( + TContainingType containingTypeDefaultInstance, + TExtensionType defaultValue, + IMessageLite messageDefaultInstance, + ExtensionDescriptorLite descriptor) + { + this.containingTypeDefaultInstance = containingTypeDefaultInstance; + this.messageDefaultInstance = messageDefaultInstance; + this.defaultValue = defaultValue; + this.descriptor = descriptor; + } + + /** For use by generated code only. */ + + public GeneratedExtensionLite( + string fullName, + TContainingType containingTypeDefaultInstance, + TExtensionType defaultValue, + IMessageLite messageDefaultInstance, + IEnumLiteMap enumTypeMap, + int number, + FieldType type) + : this(containingTypeDefaultInstance, defaultValue, messageDefaultInstance, + new ExtensionDescriptorLite(fullName, enumTypeMap, number, type, defaultValue, + false /* isRepeated */, false /* isPacked */)) + { + } + + private static readonly IList Empty = new object[0]; + /** Repeating fields: For use by generated code only. */ + + protected GeneratedExtensionLite( + string fullName, + TContainingType containingTypeDefaultInstance, + TExtensionType defaultValue, + IMessageLite messageDefaultInstance, + IEnumLiteMap enumTypeMap, + int number, + FieldType type, + bool isPacked) + : this(containingTypeDefaultInstance, defaultValue, messageDefaultInstance, + new ExtensionDescriptorLite(fullName, enumTypeMap, number, type, Empty, + true /* isRepeated */, isPacked)) + { + } + + /// + /// Returns information about this extension + /// + public IFieldDescriptorLite Descriptor + { + get { return descriptor; } + } + + /// + /// Returns the default value for this extension + /// + public TExtensionType DefaultValue + { + get { return defaultValue; } + } + + /// + /// used for the extension registry + /// + object IGeneratedExtensionLite.ContainingType + { + get { return ContainingTypeDefaultInstance; } + } + + /** + * Default instance of the type being extended, used to identify that type. + */ + + public TContainingType ContainingTypeDefaultInstance + { + get { return containingTypeDefaultInstance; } + } + + /** Get the field number. */ + + public int Number + { + get { return descriptor.FieldNumber; } + } + + /** + * If the extension is an embedded message, this is the default instance of + * that type. + */ + + public IMessageLite MessageDefaultInstance + { + get { return messageDefaultInstance; } + } + + /// + /// Converts from the type used by the native accessors to the type + /// used by reflection accessors. For example, the reflection accessors + /// for enums use EnumValueDescriptors but the native accessors use + /// the generated enum type. + /// + public virtual object ToReflectionType(object value) + { + return SingularToReflectionType(value); + } + + /// + /// Like ToReflectionType(object) but for a single element. + /// + public object SingularToReflectionType(object value) + { + return descriptor.MappedType == MappedType.Enum + ? descriptor.EnumType.FindValueByNumber((int) value) + : value; + } + + public virtual object FromReflectionType(object value) + { + return SingularFromReflectionType(value); + } + + public object SingularFromReflectionType(object value) + { + switch (Descriptor.MappedType) + { + case MappedType.Message: + if (value is TExtensionType) + { + return value; + } + else + { + // It seems the copy of the embedded message stored inside the + // extended message is not of the exact type the user was + // expecting. This can happen if a user defines a + // GeneratedExtension manually and gives it a different type. + // This should not happen in normal use. But, to be nice, we'll + // copy the message to whatever type the caller was expecting. + return MessageDefaultInstance.WeakCreateBuilderForType() + .WeakMergeFrom((IMessageLite) value).WeakBuild(); + } + case MappedType.Enum: + // Just return a boxed int - that can be unboxed to the enum + IEnumLite enumValue = (IEnumLite) value; + return enumValue.Number; + default: + return value; + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/GeneratedMessage.cs b/csharp/src/ProtocolBuffers/GeneratedMessage.cs new file mode 100644 index 00000000..6f4b6657 --- /dev/null +++ b/csharp/src/ProtocolBuffers/GeneratedMessage.cs @@ -0,0 +1,181 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Xml; +using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.FieldAccess; + +namespace Google.ProtocolBuffers +{ + /// + /// All generated protocol message classes extend this class. It implements + /// most of the IMessage interface using reflection. Users + /// can ignore this class as an implementation detail. + /// + public abstract partial class GeneratedMessage : AbstractMessage + where TMessage : GeneratedMessage + where TBuilder : GeneratedBuilder, new() + { + private UnknownFieldSet unknownFields = UnknownFieldSet.DefaultInstance; + + /// + /// Returns the message as a TMessage. + /// + protected abstract TMessage ThisMessage { get; } + + internal FieldAccessorTable FieldAccessorsFromBuilder + { + get { return InternalFieldAccessors; } + } + + protected abstract FieldAccessorTable InternalFieldAccessors { get; } + + public override MessageDescriptor DescriptorForType + { + get { return InternalFieldAccessors.Descriptor; } + } + + internal IDictionary GetMutableFieldMap() + { + // Use a SortedList so we'll end up serializing fields in order + var ret = new SortedList(); + MessageDescriptor descriptor = DescriptorForType; + foreach (FieldDescriptor field in descriptor.Fields) + { + IFieldAccessor accessor = InternalFieldAccessors[field]; + if (field.IsRepeated) + { + if (accessor.GetRepeatedCount(ThisMessage) != 0) + { + ret[field] = accessor.GetValue(ThisMessage); + } + } + else if (HasField(field)) + { + ret[field] = accessor.GetValue(ThisMessage); + } + } + return ret; + } + + public override bool IsInitialized + { + get + { + foreach (FieldDescriptor field in DescriptorForType.Fields) + { + // Check that all required fields are present. + if (field.IsRequired && !HasField(field)) + { + return false; + } + // Check that embedded messages are initialized. + // This code is similar to that in AbstractMessage, but we don't + // fetch all the field values - just the ones we need to. + if (field.MappedType == MappedType.Message) + { + if (field.IsRepeated) + { + // We know it's an IList, but not the exact type - so + // IEnumerable is the best we can do. (C# generics aren't covariant yet.) + foreach (IMessageLite element in (IEnumerable) this[field]) + { + if (!element.IsInitialized) + { + return false; + } + } + } + else + { + if (HasField(field) && !((IMessageLite) this[field]).IsInitialized) + { + return false; + } + } + } + } + return true; + } + } + + public override IDictionary AllFields + { + get { return Dictionaries.AsReadOnly(GetMutableFieldMap()); } + } + + public override bool HasField(FieldDescriptor field) + { + return InternalFieldAccessors[field].Has(ThisMessage); + } + + public override int GetRepeatedFieldCount(FieldDescriptor field) + { + return InternalFieldAccessors[field].GetRepeatedCount(ThisMessage); + } + + public override object this[FieldDescriptor field, int index] + { + get { return InternalFieldAccessors[field].GetRepeatedValue(ThisMessage, index); } + } + + public override object this[FieldDescriptor field] + { + get { return InternalFieldAccessors[field].GetValue(ThisMessage); } + } + + public override UnknownFieldSet UnknownFields + { + get { return unknownFields; } + } + + /// + /// Replaces the set of unknown fields for this message. This should + /// only be used before a message is built, by the builder. (In the + /// Java code it is private, but the builder is nested so has access + /// to it.) + /// + internal void SetUnknownFields(UnknownFieldSet fieldSet) + { + unknownFields = fieldSet; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/GeneratedMessageLite.cs b/csharp/src/ProtocolBuffers/GeneratedMessageLite.cs new file mode 100644 index 00000000..0dfc976b --- /dev/null +++ b/csharp/src/ProtocolBuffers/GeneratedMessageLite.cs @@ -0,0 +1,182 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Globalization; +using System.IO; +using System.Text; + +namespace Google.ProtocolBuffers +{ + /// + /// All generated protocol message classes extend this class. It implements + /// most of the IMessage interface using reflection. Users + /// can ignore this class as an implementation detail. + /// + public abstract partial class GeneratedMessageLite : AbstractMessageLite + where TMessage : GeneratedMessageLite + where TBuilder : GeneratedBuilderLite + { + protected abstract TMessage ThisMessage { get; } + + public override sealed string ToString() + { + using (StringWriter wtr = new StringWriter()) + { + PrintTo(wtr); + return wtr.ToString(); + } + } + + /// + /// PrintTo() helper methods for Lite Runtime + /// + protected static void PrintField(string name, IList value, TextWriter writer) + { + foreach (T item in value) + { + PrintField(name, true, (object) item, writer); + } + } + + /// + /// PrintTo() helper methods for Lite Runtime + /// + protected static void PrintField(string name, bool hasValue, object value, TextWriter writer) + { + if (!hasValue) + { + return; + } + if (value is IMessageLite) + { + writer.WriteLine("{0} {{", name); + ((IMessageLite) value).PrintTo(writer); + writer.WriteLine("}"); + } + else if (value is ByteString || value is String) + { + writer.Write("{0}: \"", name); + if (value is String) + { + EscapeBytes(Encoding.UTF8.GetBytes((string) value), writer); + } + else + { + EscapeBytes(((ByteString) value), writer); + } + writer.WriteLine("\""); + } + else if (value is bool) + { + writer.WriteLine("{0}: {1}", name, (bool) value ? "true" : "false"); + } + else if (value is IEnumLite) + { + writer.WriteLine("{0}: {1}", name, ((IEnumLite) value).Name); + } + else + { + writer.WriteLine("{0}: {1}", name, ((IConvertible)value).ToString(FrameworkPortability.InvariantCulture)); + } + } + + /// + /// COPIED from TextFormat + /// Escapes bytes in the format used in protocol buffer text format, which + /// is the same as the format used for C string literals. All bytes + /// that are not printable 7-bit ASCII characters are escaped, as well as + /// backslash, single-quote, and double-quote characters. Characters for + /// which no defined short-hand escape sequence is defined will be escaped + /// using 3-digit octal sequences. + /// The returned value is guaranteed to be entirely ASCII. + /// + private static void EscapeBytes(IEnumerable input, TextWriter writer) + { + foreach (byte b in input) + { + switch (b) + { + // C# does not use \a or \v + case 0x07: + writer.Write("\\a"); + break; + case (byte) '\b': + writer.Write("\\b"); + break; + case (byte) '\f': + writer.Write("\\f"); + break; + case (byte) '\n': + writer.Write("\\n"); + break; + case (byte) '\r': + writer.Write("\\r"); + break; + case (byte) '\t': + writer.Write("\\t"); + break; + case 0x0b: + writer.Write("\\v"); + break; + case (byte) '\\': + writer.Write("\\\\"); + break; + case (byte) '\'': + writer.Write("\\\'"); + break; + case (byte) '"': + writer.Write("\\\""); + break; + default: + if (b >= 0x20 && b < 128) + { + writer.Write((char) b); + } + else + { + writer.Write('\\'); + writer.Write((char) ('0' + ((b >> 6) & 3))); + writer.Write((char) ('0' + ((b >> 3) & 7))); + writer.Write((char) ('0' + (b & 7))); + } + break; + } + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/GeneratedRepeatExtension.cs b/csharp/src/ProtocolBuffers/GeneratedRepeatExtension.cs new file mode 100644 index 00000000..7e7b088c --- /dev/null +++ b/csharp/src/ProtocolBuffers/GeneratedRepeatExtension.cs @@ -0,0 +1,88 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Class used to represent repeat extensions in generated classes. + /// + public sealed class GeneratedRepeatExtension : GeneratedExtensionBase> + { + private GeneratedRepeatExtension(FieldDescriptor field) : base(field, typeof(TExtensionElement)) + { + } + + public static GeneratedExtensionBase> CreateInstance(FieldDescriptor descriptor) + { + if (!descriptor.IsRepeated) + { + throw new ArgumentException("Must call GeneratedRepeatExtension.CreateInstance() for repeated types."); + } + return new GeneratedRepeatExtension(descriptor); + } + + /// + /// Converts the list to the right type. + /// TODO(jonskeet): Check where this is used, and whether we need to convert + /// for primitive types. + /// + /// + /// + public override object FromReflectionType(object value) + { + if (Descriptor.MappedType == MappedType.Message || + Descriptor.MappedType == MappedType.Enum) + { + // Must convert the whole list. + List result = new List(); + foreach (object element in (IEnumerable) value) + { + result.Add((TExtensionElement) SingularFromReflectionType(element)); + } + return result; + } + else + { + return value; + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/GeneratedSingleExtension.cs b/csharp/src/ProtocolBuffers/GeneratedSingleExtension.cs new file mode 100644 index 00000000..f0f1979b --- /dev/null +++ b/csharp/src/ProtocolBuffers/GeneratedSingleExtension.cs @@ -0,0 +1,65 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Generated extension for a singular field. + /// + public sealed class GeneratedSingleExtension : GeneratedExtensionBase + { + internal GeneratedSingleExtension(FieldDescriptor descriptor) : base(descriptor, typeof(TExtension)) + { + } + + public static GeneratedSingleExtension CreateInstance(FieldDescriptor descriptor) + { + if (descriptor.IsRepeated) + { + throw new ArgumentException("Must call GeneratedRepeateExtension.CreateInstance() for repeated types."); + } + return new GeneratedSingleExtension(descriptor); + } + + public override object FromReflectionType(object value) + { + return base.SingularFromReflectionType(value); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/IBuilder.cs b/csharp/src/ProtocolBuffers/IBuilder.cs new file mode 100644 index 00000000..f9c0df61 --- /dev/null +++ b/csharp/src/ProtocolBuffers/IBuilder.cs @@ -0,0 +1,309 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Non-generic interface for all members whose signatures don't require knowledge of + /// the type being built. The generic interface extends this one. Some methods return + /// either an IBuilder or an IMessage; in these cases the generic interface redeclares + /// the same method with a type-specific signature. Implementations are encouraged to + /// use explicit interface implemenation for the non-generic form. This mirrors + /// how IEnumerable and IEnumerable<T> work. + /// + public interface IBuilder : IBuilderLite + { + /// + /// Returns true iff all required fields in the message and all + /// embedded messages are set. + /// + new bool IsInitialized { get; } + + /// + /// Only present in the nongeneric interface - useful for tests, but + /// not as much in real life. + /// + IBuilder SetField(FieldDescriptor field, object value); + + /// + /// Only present in the nongeneric interface - useful for tests, but + /// not as much in real life. + /// + IBuilder SetRepeatedField(FieldDescriptor field, int index, object value); + + /// + /// Behaves like the equivalent property in IMessage<T>. + /// The returned map may or may not reflect future changes to the builder. + /// Either way, the returned map is unmodifiable. + /// + IDictionary AllFields { get; } + + /// + /// Allows getting and setting of a field. + /// + /// + /// + /// + object this[FieldDescriptor field] { get; set; } + + /// + /// Get the message's type descriptor. + /// + /// + MessageDescriptor DescriptorForType { get; } + + /// + /// + /// + /// + /// + int GetRepeatedFieldCount(FieldDescriptor field); + + /// + /// Allows getting and setting of a repeated field value. + /// + /// + object this[FieldDescriptor field, int index] { get; set; } + + /// + /// + /// + bool HasField(FieldDescriptor field); + + /// + /// + /// + UnknownFieldSet UnknownFields { get; set; } + + /// + /// Create a builder for messages of the appropriate type for the given field. + /// Messages built with this can then be passed to the various mutation properties + /// and methods. + /// + IBuilder CreateBuilderForField(FieldDescriptor field); + + #region Methods which are like those of the generic form, but without any knowledge of the type parameters + + IBuilder WeakAddRepeatedField(FieldDescriptor field, object value); + new IBuilder WeakClear(); + IBuilder WeakClearField(FieldDescriptor field); + IBuilder WeakMergeFrom(IMessage message); + new IBuilder WeakMergeFrom(ByteString data); + new IBuilder WeakMergeFrom(ByteString data, ExtensionRegistry registry); + new IBuilder WeakMergeFrom(ICodedInputStream input); + new IBuilder WeakMergeFrom(ICodedInputStream input, ExtensionRegistry registry); + new IMessage WeakBuild(); + new IMessage WeakBuildPartial(); + new IBuilder WeakClone(); + new IMessage WeakDefaultInstanceForType { get; } + + #endregion + } + + /// + /// Interface implemented by Protocol Message builders. + /// TODO(jonskeet): Consider "SetXXX" methods returning the builder, as well as the properties. + /// + /// Type of message + /// Type of builder + public interface IBuilder : IBuilder, IBuilderLite + where TMessage : IMessage + where TBuilder : IBuilder + { + TBuilder SetUnknownFields(UnknownFieldSet unknownFields); + + /// + /// Resets all fields to their default values. + /// + new TBuilder Clear(); + + /// + /// Merge the specified other message which may be a different implementation of + /// the same message descriptor. + /// + TBuilder MergeFrom(IMessage other); + + /// + /// Constructs the final message. Once this is called, this Builder instance + /// is no longer valid, and calling any other method may throw a + /// NullReferenceException. If you need to continue working with the builder + /// after calling Build, call Clone first. + /// + /// the message + /// is missing one or more required fields; use BuildPartial to bypass + /// this check + new TMessage Build(); + + /// + /// Like Build(), but does not throw an exception if the message is missing + /// required fields. Instead, a partial message is returned. + /// + new TMessage BuildPartial(); + + /// + /// Clones this builder. + /// TODO(jonskeet): Explain depth of clone. + /// + new TBuilder Clone(); + + /// + /// Parses a message of this type from the input and merges it with this + /// message, as if using MergeFrom(IMessage<T>). + /// + /// + /// Warning: This does not verify that all required fields are present + /// in the input message. If you call Build() without setting all + /// required fields, it will throw an UninitializedMessageException. + /// There are a few good ways to deal with this: + /// + /// Call IsInitialized to verify to verify that all required fields are + /// set before building. + /// Parse the message separately using one of the static ParseFrom + /// methods, then use MergeFrom(IMessage<T>) to merge it with + /// this one. ParseFrom will throw an InvalidProtocolBufferException + /// (an IOException) if some required fields are missing. + /// Use BuildPartial to build, which ignores missing required fields. + /// + /// + new TBuilder MergeFrom(ICodedInputStream input); + + /// + /// Like MergeFrom(ICodedInputStream), but also parses extensions. + /// The extensions that you want to be able to parse must be registered + /// in . Extensions not in the registry + /// will be treated as unknown fields. + /// + new TBuilder MergeFrom(ICodedInputStream input, ExtensionRegistry extensionRegistry); + + /// + /// Get's the message's type's default instance. + /// + /// + new TMessage DefaultInstanceForType { get; } + + /// + /// Clears the field. This is exactly equivalent to calling the generated + /// Clear method corresponding to the field. + /// + /// + /// + TBuilder ClearField(FieldDescriptor field); + + /// + /// Appends the given value as a new element for the specified repeated field. + /// + /// the field is not a repeated field, + /// the field does not belong to this builder's type, or the value is + /// of the incorrect type + /// + TBuilder AddRepeatedField(FieldDescriptor field, object value); + + /// + /// Merge some unknown fields into the set for this message. + /// + TBuilder MergeUnknownFields(UnknownFieldSet unknownFields); + + /// + /// Like MergeFrom(Stream), but does not read until the end of the file. + /// Instead, the size of the message (encoded as a varint) is read first, + /// then the message data. Use Message.WriteDelimitedTo(Stream) to + /// write messages in this format. + /// + /// + new TBuilder MergeDelimitedFrom(Stream input); + + /// + /// Like MergeDelimitedFrom(Stream) but supporting extensions. + /// + new TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistry extensionRegistry); + + #region Convenience methods + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream). + /// + new TBuilder MergeFrom(ByteString data); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream, extensionRegistry). + /// + new TBuilder MergeFrom(ByteString data, ExtensionRegistry extensionRegistry); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream). + /// + new TBuilder MergeFrom(byte[] data); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream, extensionRegistry). + /// + new TBuilder MergeFrom(byte[] data, ExtensionRegistry extensionRegistry); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream). Note that this method always reads + /// the entire input (unless it throws an exception). If you want it to + /// stop earlier, you will need to wrap the input in a wrapper + /// stream which limits reading. Or, use IMessage.WriteDelimitedTo(Stream) + /// to write your message and MmergeDelimitedFrom(Stream) to read it. + /// Despite usually reading the entire stream, this method never closes the stream. + /// + new TBuilder MergeFrom(Stream input); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream, extensionRegistry). + /// + new TBuilder MergeFrom(Stream input, ExtensionRegistry extensionRegistry); + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/IBuilderLite.cs b/csharp/src/ProtocolBuffers/IBuilderLite.cs new file mode 100644 index 00000000..330fe495 --- /dev/null +++ b/csharp/src/ProtocolBuffers/IBuilderLite.cs @@ -0,0 +1,213 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers +{ + /// + /// Non-generic interface for all members whose signatures don't require knowledge of + /// the type being built. The generic interface extends this one. Some methods return + /// either an IBuilder or an IMessage; in these cases the generic interface redeclares + /// the same method with a type-specific signature. Implementations are encouraged to + /// use explicit interface implemenation for the non-generic form. This mirrors + /// how IEnumerable and IEnumerable<T> work. + /// + public partial interface IBuilderLite + { + /// + /// Returns true iff all required fields in the message and all + /// embedded messages are set. + /// + bool IsInitialized { get; } + + IBuilderLite WeakClear(); + IBuilderLite WeakMergeFrom(IMessageLite message); + IBuilderLite WeakMergeFrom(ByteString data); + IBuilderLite WeakMergeFrom(ByteString data, ExtensionRegistry registry); + IBuilderLite WeakMergeFrom(ICodedInputStream input); + IBuilderLite WeakMergeFrom(ICodedInputStream input, ExtensionRegistry registry); + IMessageLite WeakBuild(); + IMessageLite WeakBuildPartial(); + IBuilderLite WeakClone(); + IMessageLite WeakDefaultInstanceForType { get; } + } + + /// + /// Interface implemented by Protocol Message builders. + /// TODO(jonskeet): Consider "SetXXX" methods returning the builder, as well as the properties. + /// + /// Type of message + /// Type of builder + public interface IBuilderLite : IBuilderLite + where TMessage : IMessageLite + where TBuilder : IBuilderLite + { + /// + /// Resets all fields to their default values. + /// + TBuilder Clear(); + + /// + /// Merge the specified other message which may be a different implementation of + /// the same message descriptor. + /// + TBuilder MergeFrom(IMessageLite other); + + /// + /// Constructs the final message. Once this is called, this Builder instance + /// is no longer valid, and calling any other method may throw a + /// NullReferenceException. If you need to continue working with the builder + /// after calling Build, call Clone first. + /// + /// the message + /// is missing one or more required fields; use BuildPartial to bypass + /// this check + TMessage Build(); + + /// + /// Like Build(), but does not throw an exception if the message is missing + /// required fields. Instead, a partial message is returned. + /// + TMessage BuildPartial(); + + /// + /// Clones this builder. + /// TODO(jonskeet): Explain depth of clone. + /// + TBuilder Clone(); + + /// + /// Parses a message of this type from the input and merges it with this + /// message, as if using MergeFrom(IMessage<T>). + /// + /// + /// Warning: This does not verify that all required fields are present + /// in the input message. If you call Build() without setting all + /// required fields, it will throw an UninitializedMessageException. + /// There are a few good ways to deal with this: + /// + /// Call IsInitialized to verify to verify that all required fields are + /// set before building. + /// Parse the message separately using one of the static ParseFrom + /// methods, then use MergeFrom(IMessage<T>) to merge it with + /// this one. ParseFrom will throw an InvalidProtocolBufferException + /// (an IOException) if some required fields are missing. + /// Use BuildPartial to build, which ignores missing required fields. + /// + /// + TBuilder MergeFrom(ICodedInputStream input); + + /// + /// Like MergeFrom(ICodedInputStream), but also parses extensions. + /// The extensions that you want to be able to parse must be registered + /// in . Extensions not in the registry + /// will be treated as unknown fields. + /// + TBuilder MergeFrom(ICodedInputStream input, ExtensionRegistry extensionRegistry); + + /// + /// Get's the message's type's default instance. + /// + /// + TMessage DefaultInstanceForType { get; } + + /// + /// Like MergeFrom(Stream), but does not read until the end of the file. + /// Instead, the size of the message (encoded as a varint) is read first, + /// then the message data. Use Message.WriteDelimitedTo(Stream) to + /// write messages in this format. + /// + /// + TBuilder MergeDelimitedFrom(Stream input); + + /// + /// Like MergeDelimitedFrom(Stream) but supporting extensions. + /// + TBuilder MergeDelimitedFrom(Stream input, ExtensionRegistry extensionRegistry); + + #region Convenience methods + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream). + /// + TBuilder MergeFrom(ByteString data); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream, ExtensionRegistry). + /// + TBuilder MergeFrom(ByteString data, ExtensionRegistry extensionRegistry); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream). + /// + TBuilder MergeFrom(byte[] data); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream, ExtensionRegistry). + /// + TBuilder MergeFrom(byte[] data, ExtensionRegistry extensionRegistry); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream). Note that this method always reads + /// the entire input (unless it throws an exception). If you want it to + /// stop earlier, you will need to wrap the input in a wrapper + /// stream which limits reading. Or, use IMessage.WriteDelimitedTo(Stream) + /// to write your message and MmergeDelimitedFrom(Stream) to read it. + /// Despite usually reading the entire stream, this method never closes the stream. + /// + TBuilder MergeFrom(Stream input); + + /// + /// Parse as a message of this type and merge + /// it with the message being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream, ExtensionRegistry). + /// + TBuilder MergeFrom(Stream input, ExtensionRegistry extensionRegistry); + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ICodedInputStream.cs b/csharp/src/ProtocolBuffers/ICodedInputStream.cs new file mode 100644 index 00000000..b39b602d --- /dev/null +++ b/csharp/src/ProtocolBuffers/ICodedInputStream.cs @@ -0,0 +1,345 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +//Disable warning CS3010: CLS-compliant interfaces must have only CLS-compliant members +#pragma warning disable 3010 + +namespace Google.ProtocolBuffers +{ + public interface ICodedInputStream + { + /// + /// Reads any message initialization data expected from the input stream + /// + /// + /// This is primarily used by text formats and unnecessary for protobuffers' own + /// binary format. The API for MessageStart/End was added for consistent handling + /// of output streams regardless of the actual writer implementation. + /// + void ReadMessageStart(); + /// + /// Reads any message finalization data expected from the input stream + /// + /// + /// This is primarily used by text formats and unnecessary for protobuffers' own + /// binary format. The API for MessageStart/End was added for consistent handling + /// of output streams regardless of the actual writer implementation. + /// + void ReadMessageEnd(); + /// + /// Attempt to read a field tag, returning false if we have reached the end + /// of the input data. + /// + /// + /// + /// If fieldTag is non-zero and ReadTag returns true then the value in fieldName + /// may or may not be populated. However, if fieldTag is zero and ReadTag returns + /// true, then fieldName should be populated with a non-null field name. + /// + /// In other words if ReadTag returns true then either fieldTag will be non-zero OR + /// fieldName will be non-zero. In some cases both may be populated, however the + /// builders will always prefer the fieldTag over fieldName. + /// + /// + [CLSCompliant(false)] + bool ReadTag(out uint fieldTag, out string fieldName); + + /// + /// Read a double field from the stream. + /// + bool ReadDouble(ref double value); + + /// + /// Read a float field from the stream. + /// + bool ReadFloat(ref float value); + + /// + /// Read a uint64 field from the stream. + /// + [CLSCompliant(false)] + bool ReadUInt64(ref ulong value); + + /// + /// Read an int64 field from the stream. + /// + bool ReadInt64(ref long value); + + /// + /// Read an int32 field from the stream. + /// + bool ReadInt32(ref int value); + + /// + /// Read a fixed64 field from the stream. + /// + [CLSCompliant(false)] + bool ReadFixed64(ref ulong value); + + /// + /// Read a fixed32 field from the stream. + /// + [CLSCompliant(false)] + bool ReadFixed32(ref uint value); + + /// + /// Read a bool field from the stream. + /// + bool ReadBool(ref bool value); + + /// + /// Reads a string field from the stream. + /// + bool ReadString(ref string value); + + /// + /// Reads a group field value from the stream. + /// + void ReadGroup(int fieldNumber, IBuilderLite builder, + ExtensionRegistry extensionRegistry); + + /// + /// Reads a group field value from the stream and merges it into the given + /// UnknownFieldSet. + /// + [Obsolete] + void ReadUnknownGroup(int fieldNumber, IBuilderLite builder); + + /// + /// Reads an embedded message field value from the stream. + /// + void ReadMessage(IBuilderLite builder, ExtensionRegistry extensionRegistry); + + /// + /// Reads a bytes field value from the stream. + /// + bool ReadBytes(ref ByteString value); + + /// + /// Reads a uint32 field value from the stream. + /// + [CLSCompliant(false)] + bool ReadUInt32(ref uint value); + + /// + /// Reads an enum field value from the stream. The caller is responsible + /// for converting the numeric value to an actual enum. + /// + bool ReadEnum(ref IEnumLite value, out object unknown, IEnumLiteMap mapping); + + /// + /// Reads an enum field value from the stream. If the enum is valid for type T, + /// then the ref value is set and it returns true. Otherwise the unkown output + /// value is set and this method returns false. + /// + [CLSCompliant(false)] + bool ReadEnum(ref T value, out object unknown) + where T : struct, IComparable, IFormattable; + + /// + /// Reads an sfixed32 field value from the stream. + /// + bool ReadSFixed32(ref int value); + + /// + /// Reads an sfixed64 field value from the stream. + /// + bool ReadSFixed64(ref long value); + + /// + /// Reads an sint32 field value from the stream. + /// + bool ReadSInt32(ref int value); + + /// + /// Reads an sint64 field value from the stream. + /// + bool ReadSInt64(ref long value); + + /// + /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed and the + /// type is numeric, it will read a packed array. + /// + [CLSCompliant(false)] + void ReadPrimitiveArray(FieldType fieldType, uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed, it will + /// read a packed array. + /// + [CLSCompliant(false)] + void ReadEnumArray(uint fieldTag, string fieldName, ICollection list, out ICollection unknown, + IEnumLiteMap mapping); + + /// + /// Reads an array of primitive values into the list, if the wire-type of fieldTag is length-prefixed, it will + /// read a packed array. + /// + [CLSCompliant(false)] + void ReadEnumArray(uint fieldTag, string fieldName, ICollection list, out ICollection unknown) + where T : struct, IComparable, IFormattable; + + /// + /// Reads a set of messages using the as a template. T is not guaranteed to be + /// the most derived type, it is only the type specifier for the collection. + /// + [CLSCompliant(false)] + void ReadMessageArray(uint fieldTag, string fieldName, ICollection list, T messageType, + ExtensionRegistry registry) where T : IMessageLite; + + /// + /// Reads a set of messages using the as a template. + /// + [CLSCompliant(false)] + void ReadGroupArray(uint fieldTag, string fieldName, ICollection list, T messageType, + ExtensionRegistry registry) where T : IMessageLite; + + /// + /// Reads a field of any primitive type. Enums, groups and embedded + /// messages are not handled by this method. + /// + bool ReadPrimitiveField(FieldType fieldType, ref object value); + + /// + /// Returns true if the stream has reached the end of the input. This is the + /// case if either the end of the underlying input source has been reached or + /// the stream has reached a limit created using PushLimit. + /// + bool IsAtEnd { get; } + + /// + /// Reads and discards a single field, given its tag value. + /// + /// false if the tag is an end-group tag, in which case + /// nothing is skipped. Otherwise, returns true. + [CLSCompliant(false)] + bool SkipField(); + + /// + /// Reads one or more repeated string field values from the stream. + /// + [CLSCompliant(false)] + void ReadStringArray(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated ByteString field values from the stream. + /// + [CLSCompliant(false)] + void ReadBytesArray(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated boolean field values from the stream. + /// + [CLSCompliant(false)] + void ReadBoolArray(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated Int32 field values from the stream. + /// + [CLSCompliant(false)] + void ReadInt32Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated SInt32 field values from the stream. + /// + [CLSCompliant(false)] + void ReadSInt32Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated UInt32 field values from the stream. + /// + [CLSCompliant(false)] + void ReadUInt32Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated Fixed32 field values from the stream. + /// + [CLSCompliant(false)] + void ReadFixed32Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated SFixed32 field values from the stream. + /// + [CLSCompliant(false)] + void ReadSFixed32Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated Int64 field values from the stream. + /// + [CLSCompliant(false)] + void ReadInt64Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated SInt64 field values from the stream. + /// + [CLSCompliant(false)] + void ReadSInt64Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated UInt64 field values from the stream. + /// + [CLSCompliant(false)] + void ReadUInt64Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated Fixed64 field values from the stream. + /// + [CLSCompliant(false)] + void ReadFixed64Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated SFixed64 field values from the stream. + /// + [CLSCompliant(false)] + void ReadSFixed64Array(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated Double field values from the stream. + /// + [CLSCompliant(false)] + void ReadDoubleArray(uint fieldTag, string fieldName, ICollection list); + + /// + /// Reads one or more repeated Float field values from the stream. + /// + [CLSCompliant(false)] + void ReadFloatArray(uint fieldTag, string fieldName, ICollection list); + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ICodedOutputStream.cs b/csharp/src/ProtocolBuffers/ICodedOutputStream.cs new file mode 100644 index 00000000..64c80653 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ICodedOutputStream.cs @@ -0,0 +1,374 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using Google.ProtocolBuffers.Descriptors; + +//Disable warning CS3010: CLS-compliant interfaces must have only CLS-compliant members +#pragma warning disable 3010 + +namespace Google.ProtocolBuffers +{ + /// + /// Provides an interface that is used write a message. Most often proto buffers are written + /// in their binary form by creating a instance via the CodedOutputStream.CreateInstance + /// static factory. + /// + public interface ICodedOutputStream + { + /// + /// Writes any message initialization data needed to the output stream + /// + /// + /// This is primarily used by text formats and unnecessary for protobuffers' own + /// binary format. The API for MessageStart/End was added for consistent handling + /// of output streams regardless of the actual writer implementation. + /// + void WriteMessageStart(); + /// + /// Writes any message finalization data needed to the output stream + /// + /// + /// This is primarily used by text formats and unnecessary for protobuffers' own + /// binary format. The API for MessageStart/End was added for consistent handling + /// of output streams regardless of the actual writer implementation. + /// + void WriteMessageEnd(); + /// + /// Indicates that all temporary buffers be written to the final output. + /// + void Flush(); + /// + /// Writes an unknown message as a group + /// + [Obsolete] + void WriteUnknownGroup(int fieldNumber, IMessageLite value); + /// + /// Writes an unknown field value of bytes + /// + void WriteUnknownBytes(int fieldNumber, ByteString value); + /// + /// Writes an unknown field of a primitive type + /// + [CLSCompliant(false)] + void WriteUnknownField(int fieldNumber, WireFormat.WireType wireType, ulong value); + /// + /// Writes an extension as a message-set group + /// + void WriteMessageSetExtension(int fieldNumber, string fieldName, IMessageLite value); + /// + /// Writes an unknown extension as a message-set group + /// + void WriteMessageSetExtension(int fieldNumber, string fieldName, ByteString value); + + /// + /// Writes a field value, including tag, to the stream. + /// + void WriteField(FieldType fieldType, int fieldNumber, string fieldName, object value); + + /// + /// Writes a double field value, including tag, to the stream. + /// + void WriteDouble(int fieldNumber, string fieldName, double value); + + /// + /// Writes a float field value, including tag, to the stream. + /// + void WriteFloat(int fieldNumber, string fieldName, float value); + + /// + /// Writes a uint64 field value, including tag, to the stream. + /// + [CLSCompliant(false)] + void WriteUInt64(int fieldNumber, string fieldName, ulong value); + + /// + /// Writes an int64 field value, including tag, to the stream. + /// + void WriteInt64(int fieldNumber, string fieldName, long value); + + /// + /// Writes an int32 field value, including tag, to the stream. + /// + void WriteInt32(int fieldNumber, string fieldName, int value); + + /// + /// Writes a fixed64 field value, including tag, to the stream. + /// + [CLSCompliant(false)] + void WriteFixed64(int fieldNumber, string fieldName, ulong value); + + /// + /// Writes a fixed32 field value, including tag, to the stream. + /// + [CLSCompliant(false)] + void WriteFixed32(int fieldNumber, string fieldName, uint value); + + /// + /// Writes a bool field value, including tag, to the stream. + /// + void WriteBool(int fieldNumber, string fieldName, bool value); + + /// + /// Writes a string field value, including tag, to the stream. + /// + void WriteString(int fieldNumber, string fieldName, string value); + + /// + /// Writes a group field value, including tag, to the stream. + /// + void WriteGroup(int fieldNumber, string fieldName, IMessageLite value); + + /// + /// Writes a message field value, including tag, to the stream. + /// + void WriteMessage(int fieldNumber, string fieldName, IMessageLite value); + + /// + /// Writes a byte array field value, including tag, to the stream. + /// + void WriteBytes(int fieldNumber, string fieldName, ByteString value); + + /// + /// Writes a UInt32 field value, including tag, to the stream. + /// + [CLSCompliant(false)] + void WriteUInt32(int fieldNumber, string fieldName, uint value); + + /// + /// Writes an enum field value, including tag, to the stream. + /// + void WriteEnum(int fieldNumber, string fieldName, int value, object rawValue); + + /// + /// Writes a fixed 32-bit field value, including tag, to the stream. + /// + void WriteSFixed32(int fieldNumber, string fieldName, int value); + + /// + /// Writes a signed fixed 64-bit field value, including tag, to the stream. + /// + void WriteSFixed64(int fieldNumber, string fieldName, long value); + + /// + /// Writes a signed 32-bit field value, including tag, to the stream. + /// + void WriteSInt32(int fieldNumber, string fieldName, int value); + + /// + /// Writes a signed 64-bit field value, including tag, to the stream. + /// + void WriteSInt64(int fieldNumber, string fieldName, long value); + + /// + /// Writes a repeated field value, including tag(s), to the stream. + /// + void WriteArray(FieldType fieldType, int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated group value, including tag(s), to the stream. + /// + void WriteGroupArray(int fieldNumber, string fieldName, IEnumerable list) + where T : IMessageLite; + + /// + /// Writes a repeated message value, including tag(s), to the stream. + /// + void WriteMessageArray(int fieldNumber, string fieldName, IEnumerable list) + where T : IMessageLite; + + /// + /// Writes a repeated string value, including tag(s), to the stream. + /// + void WriteStringArray(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated ByteString value, including tag(s), to the stream. + /// + void WriteBytesArray(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated boolean value, including tag(s), to the stream. + /// + void WriteBoolArray(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated Int32 value, including tag(s), to the stream. + /// + void WriteInt32Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated SInt32 value, including tag(s), to the stream. + /// + void WriteSInt32Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated UInt32 value, including tag(s), to the stream. + /// + void WriteUInt32Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated Fixed32 value, including tag(s), to the stream. + /// + void WriteFixed32Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated SFixed32 value, including tag(s), to the stream. + /// + void WriteSFixed32Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated Int64 value, including tag(s), to the stream. + /// + void WriteInt64Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated SInt64 value, including tag(s), to the stream. + /// + void WriteSInt64Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated UInt64 value, including tag(s), to the stream. + /// + void WriteUInt64Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated Fixed64 value, including tag(s), to the stream. + /// + void WriteFixed64Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated SFixed64 value, including tag(s), to the stream. + /// + void WriteSFixed64Array(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated Double value, including tag(s), to the stream. + /// + void WriteDoubleArray(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated Float value, including tag(s), to the stream. + /// + void WriteFloatArray(int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a repeated enumeration value of type T, including tag(s), to the stream. + /// + [CLSCompliant(false)] + void WriteEnumArray(int fieldNumber, string fieldName, IEnumerable list) + where T : struct, IComparable, IFormattable; + + /// + /// Writes a packed repeated primitive, including tag and length, to the stream. + /// + void WritePackedArray(FieldType fieldType, int fieldNumber, string fieldName, IEnumerable list); + + /// + /// Writes a packed repeated boolean, including tag and length, to the stream. + /// + void WritePackedBoolArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated Int32, including tag and length, to the stream. + /// + void WritePackedInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated SInt32, including tag and length, to the stream. + /// + void WritePackedSInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated UInt32, including tag and length, to the stream. + /// + void WritePackedUInt32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated Fixed32, including tag and length, to the stream. + /// + void WritePackedFixed32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated SFixed32, including tag and length, to the stream. + /// + void WritePackedSFixed32Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated Int64, including tag and length, to the stream. + /// + void WritePackedInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated SInt64, including tag and length, to the stream. + /// + void WritePackedSInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated UInt64, including tag and length, to the stream. + /// + void WritePackedUInt64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated Fixed64, including tag and length, to the stream. + /// + void WritePackedFixed64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated SFixed64, including tag and length, to the stream. + /// + void WritePackedSFixed64Array(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated Double, including tag and length, to the stream. + /// + void WritePackedDoubleArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated Float, including tag and length, to the stream. + /// + void WritePackedFloatArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list); + + /// + /// Writes a packed repeated enumeration of type T, including tag and length, to the stream. + /// + [CLSCompliant(false)] + void WritePackedEnumArray(int fieldNumber, string fieldName, int calculatedSize, IEnumerable list) + where T : struct, IComparable, IFormattable; + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/IMessage.cs b/csharp/src/ProtocolBuffers/IMessage.cs new file mode 100644 index 00000000..c23bc3f7 --- /dev/null +++ b/csharp/src/ProtocolBuffers/IMessage.cs @@ -0,0 +1,249 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Non-generic interface used for all parts of the API which don't require + /// any type knowledge. + /// + public interface IMessage : IMessageLite + { + /// + /// Returns the message's type's descriptor. This differs from the + /// Descriptor property of each generated message class in that this + /// method is an abstract method of IMessage whereas Descriptor is + /// a static property of a specific class. They return the same thing. + /// + MessageDescriptor DescriptorForType { get; } + + /// + /// Returns a collection of all the fields in this message which are set + /// and their corresponding values. A singular ("required" or "optional") + /// field is set iff HasField() returns true for that field. A "repeated" + /// field is set iff GetRepeatedFieldSize() is greater than zero. The + /// values are exactly what would be returned by calling + /// GetField(FieldDescriptor) for each field. The map + /// is guaranteed to be a sorted map, so iterating over it will return fields + /// in order by field number. + /// + IDictionary AllFields { get; } + + /// + /// Returns true if the given field is set. This is exactly equivalent + /// to calling the generated "Has" property corresponding to the field. + /// + /// the field is a repeated field, + /// or it's not a field of this type + bool HasField(FieldDescriptor field); + + /// + /// Obtains the value of the given field, or the default value if + /// it isn't set. For value type fields, the boxed value is returned. + /// For enum fields, the EnumValueDescriptor for the enum is returned. + /// For embedded message fields, the sub-message + /// is returned. For repeated fields, an IList<T> is returned. + /// + object this[FieldDescriptor field] { get; } + + /// + /// Returns the number of elements of a repeated field. This is + /// exactly equivalent to calling the generated "Count" property + /// corresponding to the field. + /// + /// the field is not a repeated field, + /// or it's not a field of this type + int GetRepeatedFieldCount(FieldDescriptor field); + + /// + /// Gets an element of a repeated field. For value type fields + /// excluding enums, the boxed value is returned. For embedded + /// message fields, the sub-message is returned. For enums, the + /// relevant EnumValueDescriptor is returned. + /// + /// the field is not a repeated field, + /// or it's not a field of this type + /// the index is out of + /// range for the repeated field's value + object this[FieldDescriptor field, int index] { get; } + + /// + /// Returns the unknown fields for this message. + /// + UnknownFieldSet UnknownFields { get; } + + /// + /// Returns true iff all required fields in the message and all embedded + /// messages are set. + /// + new bool IsInitialized { get; } + + /// + /// Serializes the message and writes it to the given output stream. + /// This does not flush or close the stream. + /// + /// + /// Protocol Buffers are not self-delimiting. Therefore, if you write + /// any more data to the stream after the message, you must somehow ensure + /// that the parser on the receiving end does not interpret this as being + /// part of the protocol message. One way of doing this is by writing the size + /// of the message before the data, then making sure you limit the input to + /// that size when receiving the data. Alternatively, use WriteDelimitedTo(Stream). + /// + new void WriteTo(ICodedOutputStream output); + + /// + /// Like WriteTo(Stream) but writes the size of the message as a varint before + /// writing the data. This allows more data to be written to the stream after the + /// message without the need to delimit the message data yourself. Use + /// IBuilder.MergeDelimitedFrom(Stream) or the static method + /// YourMessageType.ParseDelimitedFrom(Stream) to parse messages written by this method. + /// + /// + new void WriteDelimitedTo(Stream output); + + /// + /// Returns the number of bytes required to encode this message. + /// The result is only computed on the first call and memoized after that. + /// + new int SerializedSize { get; } + + #region Comparison and hashing + + /// + /// Compares the specified object with this message for equality. + /// Returns true iff the given object is a message of the same type + /// (as defined by DescriptorForType) and has identical values + /// for all its fields. + /// + new bool Equals(object other); + + /// + /// Returns the hash code value for this message. + /// TODO(jonskeet): Specify the hash algorithm, but better than the Java one! + /// + new int GetHashCode(); + + #endregion + + #region Convenience methods + + /// + /// Converts the message to a string in protocol buffer text format. + /// This is just a trivial wrapper around TextFormat.PrintToString. + /// + new string ToString(); + + /// + /// Serializes the message to a ByteString. This is a trivial wrapper + /// around WriteTo(ICodedOutputStream). + /// + new ByteString ToByteString(); + + /// + /// Serializes the message to a byte array. This is a trivial wrapper + /// around WriteTo(ICodedOutputStream). + /// + new byte[] ToByteArray(); + + /// + /// Serializes the message and writes it to the given stream. + /// This is just a wrapper around WriteTo(ICodedOutputStream). This + /// does not flush or close the stream. + /// + /// + new void WriteTo(Stream output); + + #endregion + + /// + /// Creates a builder for the type, but in a weakly typed manner. This + /// is typically implemented by strongly typed messages by just returning + /// the result of CreateBuilderForType. + /// + new IBuilder WeakCreateBuilderForType(); + + /// + /// Creates a builder with the same contents as this message. This + /// is typically implemented by strongly typed messages by just returning + /// the result of ToBuilder. + /// + new IBuilder WeakToBuilder(); + + new IMessage WeakDefaultInstanceForType { get; } + } + + public interface IMessage : IMessage, IMessageLite + { + /// + /// Returns an instance of this message type with all fields set to + /// their default values. This may or may not be a singleton. This differs + /// from the DefaultInstance property of each generated message class in that this + /// method is an abstract method of IMessage whereas DefaultInstance is + /// a static property of a specific class. They return the same thing. + /// + new TMessage DefaultInstanceForType { get; } + } + + /// + /// Type-safe interface for all generated messages to implement. + /// + public interface IMessage : IMessage, IMessageLite + where TMessage : IMessage + where TBuilder : IBuilder + { + #region Builders + + /// + /// Constructs a new builder for a message of the same type as this message. + /// + new TBuilder CreateBuilderForType(); + + /// + /// Creates a builder with the same contents as this current instance. + /// This is typically implemented by strongly typed messages by just + /// returning the result of ToBuilder(). + /// + new TBuilder ToBuilder(); + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/IMessageLite.cs b/csharp/src/ProtocolBuffers/IMessageLite.cs new file mode 100644 index 00000000..ea5d9940 --- /dev/null +++ b/csharp/src/ProtocolBuffers/IMessageLite.cs @@ -0,0 +1,188 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers +{ + /// + /// Non-generic interface used for all parts of the API which don't require + /// any type knowledge. + /// + public partial interface IMessageLite + { + /// + /// Returns true iff all required fields in the message and all embedded + /// messages are set. + /// + bool IsInitialized { get; } + + /// + /// Serializes the message and writes it to the given output stream. + /// This does not flush or close the stream. + /// + /// + /// Protocol Buffers are not self-delimiting. Therefore, if you write + /// any more data to the stream after the message, you must somehow ensure + /// that the parser on the receiving end does not interpret this as being + /// part of the protocol message. One way of doing this is by writing the size + /// of the message before the data, then making sure you limit the input to + /// that size when receiving the data. Alternatively, use WriteDelimitedTo(Stream). + /// + void WriteTo(ICodedOutputStream output); + + /// + /// Like WriteTo(Stream) but writes the size of the message as a varint before + /// writing the data. This allows more data to be written to the stream after the + /// message without the need to delimit the message data yourself. Use + /// IBuilder.MergeDelimitedFrom(Stream) or the static method + /// YourMessageType.ParseDelimitedFrom(Stream) to parse messages written by this method. + /// + /// + void WriteDelimitedTo(Stream output); + + /// + /// Returns the number of bytes required to encode this message. + /// The result is only computed on the first call and memoized after that. + /// + int SerializedSize { get; } + + #region Comparison and hashing + + /// + /// Compares the specified object with this message for equality. + /// Returns true iff the given object is a message of the same type + /// (as defined by DescriptorForType) and has identical values + /// for all its fields. + /// + bool Equals(object other); + + /// + /// Returns the hash code value for this message. + /// TODO(jonskeet): Specify the hash algorithm, but better than the Java one! + /// + int GetHashCode(); + + #endregion + + #region Convenience methods + + /// + /// Converts the message to a string in protocol buffer text format. + /// This is just a trivial wrapper around TextFormat.PrintToString. + /// + string ToString(); + + /// + /// Converts the message to a string. + /// + void PrintTo(TextWriter writer); + + /// + /// Serializes the message to a ByteString. This is a trivial wrapper + /// around WriteTo(ICodedOutputStream). + /// + ByteString ToByteString(); + + /// + /// Serializes the message to a byte array. This is a trivial wrapper + /// around WriteTo(ICodedOutputStream). + /// + byte[] ToByteArray(); + + /// + /// Serializes the message and writes it to the given stream. + /// This is just a wrapper around WriteTo(ICodedOutputStream). This + /// does not flush or close the stream. + /// + /// + void WriteTo(Stream output); + + #endregion + + /// + /// Creates a builder for the type, but in a weakly typed manner. This + /// is typically implemented by strongly typed messages by just returning + /// the result of CreateBuilderForType. + /// + IBuilderLite WeakCreateBuilderForType(); + + /// + /// Creates a builder with the same contents as this message. This + /// is typically implemented by strongly typed messages by just returning + /// the result of ToBuilder. + /// + IBuilderLite WeakToBuilder(); + + IMessageLite WeakDefaultInstanceForType { get; } + } + + public interface IMessageLite : IMessageLite + { + /// + /// Returns an instance of this message type with all fields set to + /// their default values. This may or may not be a singleton. This differs + /// from the DefaultInstance property of each generated message class in that this + /// method is an abstract method of IMessage whereas DefaultInstance is + /// a static property of a specific class. They return the same thing. + /// + TMessage DefaultInstanceForType { get; } + } + + /// + /// Type-safe interface for all generated messages to implement. + /// + public interface IMessageLite : IMessageLite + where TMessage : IMessageLite + where TBuilder : IBuilderLite + { + #region Builders + + /// + /// Constructs a new builder for a message of the same type as this message. + /// + TBuilder CreateBuilderForType(); + + /// + /// Creates a builder with the same contents as this current instance. + /// This is typically implemented by strongly typed messages by just + /// returning the result of ToBuilder(). + /// + TBuilder ToBuilder(); + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/IRpcChannel.cs b/csharp/src/ProtocolBuffers/IRpcChannel.cs new file mode 100644 index 00000000..4ca24ea7 --- /dev/null +++ b/csharp/src/ProtocolBuffers/IRpcChannel.cs @@ -0,0 +1,63 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Interface for an RPC channel. A channel represents a communication line to + /// a service (IService implementation) which can be used to call that service's + /// methods. The service may be running on another machine. Normally, you should + /// not call an IRpcChannel directly, but instead construct a stub wrapping it. + /// Generated service classes contain a CreateStub method for precisely this purpose. + /// + public interface IRpcChannel + { + /// + /// Calls the given method of the remote service. This method is similar + /// to with one important difference: the + /// caller decides the types of the IMessage objects, not the implementation. + /// The request may be of any type as long as request.Descriptor == method.InputType. + /// The response passed to the callback will be of the same type as + /// (which must be such that + /// responsePrototype.Descriptor == method.OutputType). + /// + void CallMethod(MethodDescriptor method, IRpcController controller, + IMessage request, IMessage responsePrototype, Action done); + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/IRpcController.cs b/csharp/src/ProtocolBuffers/IRpcController.cs new file mode 100644 index 00000000..b155bec5 --- /dev/null +++ b/csharp/src/ProtocolBuffers/IRpcController.cs @@ -0,0 +1,125 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers +{ + /// + /// Mediates a single method call. The primary purpose of the controller + /// is to provide a way to manipulate settings specific to the + /// RPC implementation and to find out about RPC-level errors. + /// + /// The methods provided by this interface are intended to be a "least + /// common denominator" set of features which we expect all implementations to + /// support. Specific implementations may provide more advanced features, + /// (e.g. deadline propagation). + /// + public interface IRpcController + { + #region Client side calls + + // These calls may be made from the client side only. Their results + // are undefined on the server side (may throw exceptions). + + /// + /// Resets the controller to its initial state so that it may be reused in + /// a new call. This can be called from the client side only. It must not + /// be called while an RPC is in progress. + /// + void Reset(); + + /// + /// After a call has finished, returns true if the call failed. The possible + /// reasons for failure depend on the RPC implementation. Failed must + /// only be called on the client side, and must not be called before a call has + /// finished. + /// + bool Failed { get; } + + /// + /// If Failed is true, ErrorText returns a human-readable description of the error. + /// + string ErrorText { get; } + + /// + /// Advises the RPC system that the caller desires that the RPC call be + /// canceled. The RPC system may cancel it immediately, may wait awhile and + /// then cancel it, or may not even cancel the call at all. If the call is + /// canceled, the "done" callback will still be called and the RpcController + /// will indicate that the call failed at that time. + /// + void StartCancel(); + + #endregion + + #region Server side calls + + // These calls may be made from the server side only. Their results + // are undefined on the client side (may throw exceptions). + + /// + /// Causes Failed to return true on the client side. + /// will be incorporated into the message returned by ErrorText. + /// If you find you need to return machine-readable information about + /// failures, you should incorporate it into your response protocol buffer + /// and should *not* call SetFailed. + /// + void SetFailed(string reason); + + /// + /// If true, indicates that the client canceled the RPC, so the server may as + /// well give up on replying to it. This method must be called on the server + /// side only. The server should still call the final "done" callback. + /// + bool IsCanceled(); + + /// + /// Requests that the given callback be called when the RPC is canceled. + /// The parameter passed to the callback will always be null. The callback will + /// be called exactly once. If the RPC completes without being canceled, the + /// callback will be called after completion. If the RPC has already been canceled + /// when NotifyOnCancel is called, the callback will be called immediately. + /// + /// NotifyOnCancel must be called no more than once per request. It must be + /// called on the server side only. + /// + /// + void NotifyOnCancel(Action callback); + + #endregion + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/IRpcDispatch.cs b/csharp/src/ProtocolBuffers/IRpcDispatch.cs new file mode 100644 index 00000000..524838e4 --- /dev/null +++ b/csharp/src/ProtocolBuffers/IRpcDispatch.cs @@ -0,0 +1,78 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers +{ + /// + /// Provides an entry-point for transport listeners to call a specified method on a service + /// + public interface IRpcServerStub : IDisposable + { + /// + /// Calls the method identified by methodName and returns the message + /// + /// The method name on the service descriptor (case-sensitive) + /// The ICodedInputStream to deserialize the call parameter from + /// The extension registry to use when deserializing the call parameter + /// The message that was returned from the service's method + IMessageLite CallMethod(string methodName, ICodedInputStream input, ExtensionRegistry registry); + } + + /// + /// Used to forward an invocation of a service method to a transport sender implementation + /// + public interface IRpcDispatch + { + /// + /// Calls the service member on the endpoint connected. This is generally done by serializing + /// the message, sending the bytes over a transport, and then deserializing the call parameter + /// to invoke the service's actual implementation via IRpcServerStub. Once the call has + /// completed the result message is serialized and returned to the originating endpoint. + /// + /// The type of the response message + /// The type of of the response builder + /// The name of the method on the service + /// The message instance provided to the service call + /// The builder used to deserialize the response + /// The resulting message of the service call + TMessage CallMethod(string method, IMessageLite request, + IBuilderLite response) + where TMessage : IMessageLite + where TBuilder : IBuilderLite; + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/IService.cs b/csharp/src/ProtocolBuffers/IService.cs new file mode 100644 index 00000000..61af35c1 --- /dev/null +++ b/csharp/src/ProtocolBuffers/IService.cs @@ -0,0 +1,102 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Base interface for protocol-buffer-based RPC services. Services themselves + /// are abstract classes (implemented either by servers or as stubs) but they + /// implement this itnerface. The methods of this interface can be used to call + /// the methods of the service without knowing its exact type at compile time + /// (analagous to the IMessage interface). + /// + public interface IService + { + /// + /// The ServiceDescriptor describing this service and its methods. + /// + ServiceDescriptor DescriptorForType { get; } + + /// + /// Call a method of the service specified by MethodDescriptor. This is + /// normally implemented as a simple switch that calls the standard + /// definitions of the service's methods. + /// + /// Preconditions + /// + /// method.Service == DescriptorForType + /// request is of the exact same class as the object returned by GetRequestPrototype(method) + /// controller is of the correct type for the RPC implementation being used by this service. + /// For stubs, the "correct type" depends on the IRpcChannel which the stub is using. Server-side + /// implementations are expected to accept whatever type of IRpcController the server-side RPC implementation + /// uses. + /// + /// + /// + /// Postconditions + /// + /// will be called when the method is complete. + /// This may before CallMethod returns or it may be at some point in the future. + /// The parameter to is the response. It will be of the + /// exact same type as would be returned by . + /// If the RPC failed, the parameter to will be null. + /// Further details about the failure can be found by querying . + /// + /// + /// + void CallMethod(MethodDescriptor method, IRpcController controller, + IMessage request, Action done); + + /// + /// CallMethod requires that the request passed in is of a particular implementation + /// of IMessage. This method gets the default instance of this type of a given method. + /// You can then call WeakCreateBuilderForType to create a builder to build an object which + /// you can then pass to CallMethod. + /// + IMessage GetRequestPrototype(MethodDescriptor method); + + /// + /// Like GetRequestPrototype, but returns a prototype of the response message. + /// This is generally not needed because the IService implementation contructs + /// the response message itself, but it may be useful in some cases to know ahead + /// of time what type of object will be returned. + /// + IMessage GetResponsePrototype(MethodDescriptor method); + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/InvalidProtocolBufferException.cs b/csharp/src/ProtocolBuffers/InvalidProtocolBufferException.cs new file mode 100644 index 00000000..67d7b374 --- /dev/null +++ b/csharp/src/ProtocolBuffers/InvalidProtocolBufferException.cs @@ -0,0 +1,112 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers +{ + /// + /// Thrown when a protocol message being parsed is invalid in some way, + /// e.g. it contains a malformed varint or a negative byte length. + /// + public sealed class InvalidProtocolBufferException : IOException + { + internal InvalidProtocolBufferException(string message) + : base(message) + { + } + + public static InvalidProtocolBufferException TruncatedMessage() + { + return new InvalidProtocolBufferException( + "While parsing a protocol message, the input ended unexpectedly " + + "in the middle of a field. This could mean either than the " + + "input has been truncated or that an embedded message " + + "misreported its own length."); + } + + internal static InvalidProtocolBufferException NegativeSize() + { + return new InvalidProtocolBufferException( + "CodedInputStream encountered an embedded string or message " + + "which claimed to have negative size."); + } + + public static InvalidProtocolBufferException MalformedVarint() + { + return new InvalidProtocolBufferException( + "CodedInputStream encountered a malformed varint."); + } + + public static InvalidProtocolBufferException InvalidTag() + { + return new InvalidProtocolBufferException( + "Protocol message contained an invalid tag (zero)."); + } + + internal static InvalidProtocolBufferException InvalidEndTag() + { + return new InvalidProtocolBufferException( + "Protocol message end-group tag did not match expected tag."); + } + + internal static InvalidProtocolBufferException InvalidWireType() + { + return new InvalidProtocolBufferException( + "Protocol message tag had invalid wire type."); + } + + internal static InvalidProtocolBufferException RecursionLimitExceeded() + { + return new InvalidProtocolBufferException( + "Protocol message had too many levels of nesting. May be malicious. " + + "Use CodedInputStream.SetRecursionLimit() to increase the depth limit."); + } + + internal static InvalidProtocolBufferException SizeLimitExceeded() + { + return new InvalidProtocolBufferException( + "Protocol message was too large. May be malicious. " + + "Use CodedInputStream.SetSizeLimit() to increase the size limit."); + } + + internal static InvalidProtocolBufferException InvalidMessageStreamTag() + { + return new InvalidProtocolBufferException( + "Stream of protocol messages had invalid tag. Expected tag is length-delimited field 1."); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/MessageStreamIterator.cs b/csharp/src/ProtocolBuffers/MessageStreamIterator.cs new file mode 100644 index 00000000..32d697ca --- /dev/null +++ b/csharp/src/ProtocolBuffers/MessageStreamIterator.cs @@ -0,0 +1,170 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace Google.ProtocolBuffers +{ + /// + /// Iterates over data created using a . + /// Unlike MessageStreamWriter, this class is not usually constructed directly with + /// a stream; instead it is provided with a way of opening a stream when iteration + /// is started. The stream is closed when the iteration is completed or the enumerator + /// is disposed. (This occurs naturally when using foreach.) + /// + public class MessageStreamIterator : IEnumerable + where TMessage : IMessage + { + private readonly StreamProvider streamProvider; + private readonly ExtensionRegistry extensionRegistry; + private readonly int sizeLimit; + + /// + /// The default instance of TMessage type used to construct builders while reading + /// + private static readonly TMessage defaultMessageInstance = CreateDefaultInstance(); + /// + /// Any exception (within reason) thrown in type ctor is caught and rethrown in the constructor. + /// This makes life a lot simpler for the caller. + /// + private static Exception typeInitializationException; + + + /// + /// Vastly simplified the reflection to simply obtain the default instance and use it to construct + /// the weak builder while simply casting the result. Ideally this class should have required a + /// TBuilder type argument with a new() constraint to construct the initial instance thereby the + /// reflection could be eliminated. + /// + private static TMessage CreateDefaultInstance() + { + try + { + return (TMessage)typeof(TMessage) + .GetProperty("DefaultInstance", typeof(TMessage), new Type[0]) + .GetValue(null, null); + } + catch (Exception e) + { + typeInitializationException = e; + return default(TMessage); + } + } + + private static readonly uint ExpectedTag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited); + + private MessageStreamIterator(StreamProvider streamProvider, ExtensionRegistry extensionRegistry, int sizeLimit) + { + if (ReferenceEquals(defaultMessageInstance, null)) + { + throw new System.Reflection.TargetInvocationException(typeInitializationException); + } + this.streamProvider = streamProvider; + this.extensionRegistry = extensionRegistry; + this.sizeLimit = sizeLimit; + } + + private MessageStreamIterator(StreamProvider streamProvider, ExtensionRegistry extensionRegistry) + : this(streamProvider, extensionRegistry, CodedInputStream.DefaultSizeLimit) + { + } + + /// + /// Creates a new instance which uses the same stream provider as this one, + /// but the specified extension registry. + /// + public MessageStreamIterator WithExtensionRegistry(ExtensionRegistry newRegistry) + { + return new MessageStreamIterator(streamProvider, newRegistry, sizeLimit); + } + + /// + /// Creates a new instance which uses the same stream provider and extension registry as this one, + /// but with the specified size limit. Note that this must be big enough for the largest message + /// and the tag and size preceding it. + /// + public MessageStreamIterator WithSizeLimit(int newSizeLimit) + { + return new MessageStreamIterator(streamProvider, extensionRegistry, newSizeLimit); + } + +#if CLIENTPROFILE + public static MessageStreamIterator FromFile(string file) + { + return new MessageStreamIterator(() => File.OpenRead(file), ExtensionRegistry.Empty); + } +#endif + + public static MessageStreamIterator FromStreamProvider(StreamProvider streamProvider) + { + return new MessageStreamIterator(streamProvider, ExtensionRegistry.Empty); + } + + public IEnumerator GetEnumerator() + { + using (Stream stream = streamProvider()) + { + CodedInputStream input = CodedInputStream.CreateInstance(stream); + input.SetSizeLimit(sizeLimit); + uint tag; + string name; + while (input.ReadTag(out tag, out name)) + { + if ((tag == 0 && name == "item") || (tag == ExpectedTag)) + { + IBuilder builder = defaultMessageInstance.WeakCreateBuilderForType(); + input.ReadMessage(builder, extensionRegistry); + yield return (TMessage)builder.WeakBuild(); + } + else + { + throw InvalidProtocolBufferException.InvalidMessageStreamTag(); + } + + input.ResetSizeCounter(); + } + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/MessageStreamWriter.cs b/csharp/src/ProtocolBuffers/MessageStreamWriter.cs new file mode 100644 index 00000000..3430e13c --- /dev/null +++ b/csharp/src/ProtocolBuffers/MessageStreamWriter.cs @@ -0,0 +1,70 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; + +namespace Google.ProtocolBuffers +{ + /// + /// Writes multiple messages to the same stream. Each message is written + /// as if it were an element of a repeated field 1 in a larger protocol buffer. + /// This class takes no ownership of the stream it is given; it never closes the + /// stream. + /// + public sealed class MessageStreamWriter where T : IMessage + { + private readonly CodedOutputStream codedOutput; + + /// + /// Creates an instance which writes to the given stream. + /// + /// Stream to write messages to. + public MessageStreamWriter(Stream output) + { + codedOutput = CodedOutputStream.CreateInstance(output); + } + + public void Write(T message) + { + codedOutput.WriteMessage(1, "item", message); + } + + public void Flush() + { + codedOutput.Flush(); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/MessageUtil.cs b/csharp/src/ProtocolBuffers/MessageUtil.cs new file mode 100644 index 00000000..d120d209 --- /dev/null +++ b/csharp/src/ProtocolBuffers/MessageUtil.cs @@ -0,0 +1,109 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers +{ + /// + /// Utilities for arbitrary messages of an unknown type. This class does not use + /// generics precisely because it is designed for dynamically discovered types. + /// + public static class MessageUtil + { + /// + /// Returns the default message for the given type. If an exception is thrown + /// (directly from this code), the message will be suitable to be displayed to a user. + /// + /// + /// The type parameter is null. + /// The type doesn't implement IMessage, or doesn't + /// have a static DefaultMessage property of the same type, or is generic or abstract. + /// + public static IMessage GetDefaultMessage(Type type) + { + if (type == null) + { + throw new ArgumentNullException("type", "No type specified."); + } + if (type.IsAbstract || type.IsGenericTypeDefinition) + { + throw new ArgumentException("Unable to get a default message for an abstract or generic type (" + + type.FullName + ")"); + } + if (!typeof(IMessage).IsAssignableFrom(type)) + { + throw new ArgumentException("Unable to get a default message for non-message type (" + type.FullName + + ")"); + } + PropertyInfo property = type.GetProperty("DefaultInstance", + BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); + if (property == null) + { + throw new ArgumentException(type.FullName + " doesn't have a static DefaultInstance property"); + } + if (property.PropertyType != type) + { + throw new ArgumentException(type.FullName + ".DefaultInstance property is of the wrong type"); + } + return (IMessage) property.GetValue(null, null); + } + + /// + /// Returns the default message for the type with the given name. This is just + /// a convenience wrapper around calling Type.GetType and then GetDefaultMessage. + /// If an exception is thrown, the message will be suitable to be displayed to a user. + /// + /// + /// The typeName parameter is null. + /// The type doesn't implement IMessage, or doesn't + /// have a static DefaultMessage property of the same type, or can't be found. + public static IMessage GetDefaultMessage(string typeName) + { + if (typeName == null) + { + throw new ArgumentNullException("typeName", "No type name specified."); + } + Type type = Type.GetType(typeName); + if (type == null) + { + throw new ArgumentException("Unable to load type " + typeName); + } + return GetDefaultMessage(type); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/NameHelpers.cs b/csharp/src/ProtocolBuffers/NameHelpers.cs new file mode 100644 index 00000000..80a1f9aa --- /dev/null +++ b/csharp/src/ProtocolBuffers/NameHelpers.cs @@ -0,0 +1,140 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Text.RegularExpressions; + +namespace Google.ProtocolBuffers +{ + /// + /// Helpers for converting names to pascal case etc. + /// + public class NameHelpers + { + /// + /// All characters that are not alpha-numeric + /// + private static readonly Regex NonAlphaNumericCharacters = new Regex(@"[^a-zA-Z0-9]+"); + + /// + /// Matches lower-case character that follow either an underscore, or a number + /// + private static readonly Regex UnderscoreOrNumberWithLowerCase = new Regex(@"[0-9_][a-z]"); + + /// + /// Removes non alpha numeric characters while capitalizing letters that follow + /// a number or underscore. The first letter is always upper case. + /// + public static string UnderscoresToPascalCase(string input) + { + string name = UnderscoresToUpperCase(input); + + // Pascal case always begins with upper-case letter + if (Char.IsLower(name[0])) + { + char[] chars = name.ToCharArray(); + chars[0] = char.ToUpper(chars[0]); + return new string(chars); + } + return name; + } + + /// + /// Removes non alpha numeric characters while capitalizing letters that follow + /// a number or underscore. The first letter is always lower case. + /// + public static string UnderscoresToCamelCase(string input) + { + string name = UnderscoresToUpperCase(input); + + // Camel case always begins with lower-case letter + if (Char.IsUpper(name[0])) + { + char[] chars = name.ToCharArray(); + chars[0] = char.ToLower(chars[0]); + return new string(chars); + } + return name; + } + + /// + /// Capitalizes any characters following an '_' or a number '0' - '9' and removes + /// all non alpha-numeric characters. If the resulting string begins with a number + /// an '_' will be prefixed. + /// + private static string UnderscoresToUpperCase(string input) + { + string name = UnderscoreOrNumberWithLowerCase.Replace(input, x => x.Value.ToUpper()); + name = NonAlphaNumericCharacters.Replace(name, String.Empty); + + if (name.Length == 0) + { + throw new ArgumentException(String.Format("The field name '{0}' is invalid.", input)); + } + + // Fields can not start with a number + if (Char.IsNumber(name[0])) + { + name = '_' + name; + } + + return name; + } + + internal static string StripProto(string text) + { + if (!StripSuffix(ref text, ".protodevel")) + { + StripSuffix(ref text, ".proto"); + } + return text; + } + + /// + /// Attempts to strip a suffix from a string, returning whether + /// or not the suffix was actually present. + /// + public static bool StripSuffix(ref string text, string suffix) + { + if (text.EndsWith(suffix)) + { + text = text.Substring(0, text.Length - suffix.Length); + return true; + } + return false; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/Properties/AssemblyInfo.cs b/csharp/src/ProtocolBuffers/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..cbab444d --- /dev/null +++ b/csharp/src/ProtocolBuffers/Properties/AssemblyInfo.cs @@ -0,0 +1,72 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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. +using System; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +using System.Security; + +[assembly: AssemblyTitle("ProtocolBuffers")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ProtocolBuffers")] +[assembly: AssemblyCopyright("Copyright © 2008")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("2.4.1.555")] + +[assembly: AssemblyVersion("2.4.1.555")] + +#if !NOFILEVERSION +[assembly: AssemblyFileVersion("2.4.1.555")] +#endif + +[assembly: CLSCompliant(true)] + +#if CLIENTPROFILE // ROK - not defined in SL, CF, or PL +[assembly: AllowPartiallyTrustedCallers] +#endif diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.CF20.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.CF20.csproj new file mode 100644 index 00000000..bfadf166 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.CF20.csproj @@ -0,0 +1,166 @@ + + + COMPACT_FRAMEWORK + CF20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF20\Debug + obj\CF20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + Off + true + + + pdbonly + true + bin\CF20\Release + obj\CF20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.CF35.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.CF35.csproj new file mode 100644 index 00000000..72e35c17 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.CF35.csproj @@ -0,0 +1,167 @@ + + + COMPACT_FRAMEWORK + CF35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF35\Debug + obj\CF35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + Off + true + + + pdbonly + true + bin\CF35\Release + obj\CF35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.NET20.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.NET20.csproj new file mode 100644 index 00000000..9bba7285 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.NET20.csproj @@ -0,0 +1,154 @@ + + + CLIENTPROFILE + NET20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET20\Debug + obj\NET20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + Off + + + pdbonly + true + bin\NET20\Release + obj\NET20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.NET35.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.NET35.csproj new file mode 100644 index 00000000..6a79d921 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.NET35.csproj @@ -0,0 +1,155 @@ + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.NET40.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.NET40.csproj new file mode 100644 index 00000000..7495778e --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.NET40.csproj @@ -0,0 +1,155 @@ + + + CLIENTPROFILE + NET40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET40\Debug + obj\NET40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET40\Release + obj\NET40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.PL40.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.PL40.csproj new file mode 100644 index 00000000..00ffddb8 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.PL40.csproj @@ -0,0 +1,158 @@ + + + PORTABLE_LIBRARY + PL40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + 10.0 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Profile1 + + + true + full + false + bin\PL40\Debug + obj\PL40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + + + pdbonly + true + bin\PL40\Release + obj\PL40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.SL20.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.SL20.csproj new file mode 100644 index 00000000..10fc8283 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.SL20.csproj @@ -0,0 +1,169 @@ + + + SILVERLIGHT + SL20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + + + true + full + false + bin\SL20\Debug + obj\SL20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL20\Release + obj\SL20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.SL30.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.SL30.csproj new file mode 100644 index 00000000..4fe571ca --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.SL30.csproj @@ -0,0 +1,170 @@ + + + SILVERLIGHT + SL30 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + + + true + full + false + bin\SL30\Debug + obj\SL30\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL30\Release + obj\SL30\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.SL40.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.SL40.csproj new file mode 100644 index 00000000..3664e473 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.SL40.csproj @@ -0,0 +1,171 @@ + + + SILVERLIGHT + SL40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + v4.0 + + + true + full + false + bin\SL40\Debug + obj\SL40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL40\Release + obj\SL40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffers.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffers.csproj new file mode 100644 index 00000000..fe1f04ac --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffers.csproj @@ -0,0 +1,155 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffers + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.CF20.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.CF20.csproj new file mode 100644 index 00000000..6cf373f2 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.CF20.csproj @@ -0,0 +1,111 @@ + + + COMPACT_FRAMEWORK + CF20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF20\Debug + obj\CF20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + Off + true + + + pdbonly + true + bin\CF20\Release + obj\CF20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.CF35.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.CF35.csproj new file mode 100644 index 00000000..dad00719 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.CF35.csproj @@ -0,0 +1,112 @@ + + + COMPACT_FRAMEWORK + CF35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF35\Debug + obj\CF35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + Off + true + + + pdbonly + true + bin\CF35\Release + obj\CF35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.NET20.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.NET20.csproj new file mode 100644 index 00000000..d5167768 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.NET20.csproj @@ -0,0 +1,99 @@ + + + CLIENTPROFILE + NET20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET20\Debug + obj\NET20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + Off + + + pdbonly + true + bin\NET20\Release + obj\NET20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.NET35.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.NET35.csproj new file mode 100644 index 00000000..d811fb58 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.NET35.csproj @@ -0,0 +1,100 @@ + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.NET40.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.NET40.csproj new file mode 100644 index 00000000..ad3abc6c --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.NET40.csproj @@ -0,0 +1,100 @@ + + + CLIENTPROFILE + NET40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET40\Debug + obj\NET40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET40\Release + obj\NET40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.PL40.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.PL40.csproj new file mode 100644 index 00000000..67f9093e --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.PL40.csproj @@ -0,0 +1,103 @@ + + + PORTABLE_LIBRARY + PL40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + 10.0 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Profile1 + + + true + full + false + bin\PL40\Debug + obj\PL40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + + + pdbonly + true + bin\PL40\Release + obj\PL40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.SL20.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.SL20.csproj new file mode 100644 index 00000000..1bbad180 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.SL20.csproj @@ -0,0 +1,114 @@ + + + SILVERLIGHT + SL20 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + + + true + full + false + bin\SL20\Debug + obj\SL20\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL20\Release + obj\SL20\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.SL30.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.SL30.csproj new file mode 100644 index 00000000..ab0e809b --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.SL30.csproj @@ -0,0 +1,115 @@ + + + SILVERLIGHT + SL30 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + + + true + full + false + bin\SL30\Debug + obj\SL30\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL30\Release + obj\SL30\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.SL40.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.SL40.csproj new file mode 100644 index 00000000..42e5be18 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.SL40.csproj @@ -0,0 +1,116 @@ + + + SILVERLIGHT + SL40 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + false + false + false + v4.0 + + + true + full + false + bin\SL40\Debug + obj\SL40\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + pdbonly + true + bin\SL40\Release + obj\SL40\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + Off + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OfflineApplication + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ProtocolBuffersLite.csproj b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.csproj new file mode 100644 index 00000000..4037c2bf --- /dev/null +++ b/csharp/src/ProtocolBuffers/ProtocolBuffersLite.csproj @@ -0,0 +1,100 @@ + + + + CLIENTPROFILE + NET35 + Debug + AnyCPU + 9.0.30729 + 2.0 + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + DEBUG;TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + $(OutputPath)\$(AssemblyName).xml + 1591, 1570, 1571, 1572, 1573, 1574 + TRACE;LITE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + Off + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/RpcUtil.cs b/csharp/src/ProtocolBuffers/RpcUtil.cs new file mode 100644 index 00000000..4659d86a --- /dev/null +++ b/csharp/src/ProtocolBuffers/RpcUtil.cs @@ -0,0 +1,79 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers +{ + /// + /// Grab-bag of utility functions useful when dealing with RPCs. + /// + public static class RpcUtil + { + /// + /// Converts an Action[IMessage] to an Action[T]. + /// + public static Action SpecializeCallback(Action action) + where T : IMessage + { + return message => action(message); + } + + /// + /// Converts an Action[T] to an Action[IMessage]. + /// The generalized action will accept any message object which has + /// the same descriptor, and will convert it to the correct class + /// before calling the original action. However, if the generalized + /// callback is given a message with a different descriptor, an + /// exception will be thrown. + /// + public static Action GeneralizeCallback(Action action, + TMessage defaultInstance) + where TMessage : class, IMessage + where TBuilder : IBuilder + { + return message => + { + TMessage castMessage = message as TMessage; + if (castMessage == null) + { + castMessage = defaultInstance.CreateBuilderForType().MergeFrom(message).Build(); + } + action(castMessage); + }; + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/SortedList.cs b/csharp/src/ProtocolBuffers/SortedList.cs new file mode 100644 index 00000000..2dd7da92 --- /dev/null +++ b/csharp/src/ProtocolBuffers/SortedList.cs @@ -0,0 +1,167 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 + +#if NOSORTEDLIST +using System.Collections; +using System.Collections.Generic; + +namespace Google.ProtocolBuffers +{ + /// + /// Dictionary implementation which always yields keys in sorted order. + /// This is not particularly efficient: it wraps a normal dictionary + /// for most operations, but sorts by key when either iterating or + /// fetching the Keys/Values properties. + /// + internal sealed class SortedList : IDictionary + { + private readonly IDictionary wrapped = new Dictionary(); + + public SortedList() + { + } + + public SortedList(IDictionary dictionary) + { + foreach (KeyValuePair entry in dictionary) + { + Add(entry.Key, entry.Value); + } + } + + public void Add(TKey key, TValue value) + { + wrapped.Add(key, value); + } + + public bool ContainsKey(TKey key) + { + return wrapped.ContainsKey(key); + } + + public ICollection Keys + { + get + { + List keys = new List(wrapped.Count); + foreach (var pair in this) + { + keys.Add(pair.Key); + } + return keys; + } + } + + public bool Remove(TKey key) + { + return wrapped.Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + return wrapped.TryGetValue(key, out value); + } + + public ICollection Values + { + get + { + List values = new List(wrapped.Count); + foreach (var pair in this) + { + values.Add(pair.Value); + } + return values; + } + } + + public TValue this[TKey key] + { + get { return wrapped[key]; } + set { wrapped[key] = value; } + } + + public void Add(KeyValuePair item) + { + wrapped.Add(item); + } + + public void Clear() + { + wrapped.Clear(); + } + + public bool Contains(KeyValuePair item) + { + return wrapped.Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + wrapped.CopyTo(array, arrayIndex); + } + + public int Count + { + get { return wrapped.Count; } + } + + public bool IsReadOnly + { + get { return wrapped.IsReadOnly; } + } + + public bool Remove(KeyValuePair item) + { + return wrapped.Remove(item); + } + + public IEnumerator> GetEnumerator() + { + IComparer comparer = Comparer.Default; + var list = new List>(wrapped); + list.Sort((x, y) => comparer.Compare(x.Key, y.Key)); + return list.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} + +#endif \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/TextFormat.cs b/csharp/src/ProtocolBuffers/TextFormat.cs new file mode 100644 index 00000000..747dce4e --- /dev/null +++ b/csharp/src/ProtocolBuffers/TextFormat.cs @@ -0,0 +1,899 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Provides ASCII text formatting support for messages. + /// TODO(jonskeet): Support for alternative line endings. + /// (Easy to print, via TextGenerator. Not sure about parsing.) + /// + public static class TextFormat + { + /// + /// Outputs a textual representation of the Protocol Message supplied into + /// the parameter output. + /// + public static void Print(IMessage message, TextWriter output) + { + TextGenerator generator = new TextGenerator(output, "\n"); + Print(message, generator); + } + + /// + /// Outputs a textual representation of the Protocol Message builder supplied into + /// the parameter output. + /// + public static void Print(IBuilder builder, TextWriter output) + { + TextGenerator generator = new TextGenerator(output, "\n"); + Print(builder, generator); + } + + /// + /// Outputs a textual representation of to . + /// + public static void Print(UnknownFieldSet fields, TextWriter output) + { + TextGenerator generator = new TextGenerator(output, "\n"); + PrintUnknownFields(fields, generator); + } + + public static string PrintToString(IMessage message) + { + StringWriter text = new StringWriter(); + Print(message, text); + return text.ToString(); + } + + public static string PrintToString(IBuilder builder) + { + StringWriter text = new StringWriter(); + Print(builder, text); + return text.ToString(); + } + + public static string PrintToString(UnknownFieldSet fields) + { + StringWriter text = new StringWriter(); + Print(fields, text); + return text.ToString(); + } + + private static void Print(IMessage message, TextGenerator generator) + { + foreach (KeyValuePair entry in message.AllFields) + { + PrintField(entry.Key, entry.Value, generator); + } + PrintUnknownFields(message.UnknownFields, generator); + } + + private static void Print(IBuilder message, TextGenerator generator) + { + foreach (KeyValuePair entry in message.AllFields) + { + PrintField(entry.Key, entry.Value, generator); + } + PrintUnknownFields(message.UnknownFields, generator); + } + + internal static void PrintField(FieldDescriptor field, object value, TextGenerator generator) + { + if (field.IsRepeated) + { + // Repeated field. Print each element. + foreach (object element in (IEnumerable) value) + { + PrintSingleField(field, element, generator); + } + } + else + { + PrintSingleField(field, value, generator); + } + } + + private static void PrintSingleField(FieldDescriptor field, Object value, TextGenerator generator) + { + if (field.IsExtension) + { + generator.Print("["); + // We special-case MessageSet elements for compatibility with proto1. + if (field.ContainingType.Options.MessageSetWireFormat + && field.FieldType == FieldType.Message + && field.IsOptional + // object equality (TODO(jonskeet): Work out what this comment means!) + && field.ExtensionScope == field.MessageType) + { + generator.Print(field.MessageType.FullName); + } + else + { + generator.Print(field.FullName); + } + generator.Print("]"); + } + else + { + if (field.FieldType == FieldType.Group) + { + // Groups must be serialized with their original capitalization. + generator.Print(field.MessageType.Name); + } + else + { + generator.Print(field.Name); + } + } + + if (field.MappedType == MappedType.Message) + { + generator.Print(" {\n"); + generator.Indent(); + } + else + { + generator.Print(": "); + } + + PrintFieldValue(field, value, generator); + + if (field.MappedType == MappedType.Message) + { + generator.Outdent(); + generator.Print("}"); + } + generator.Print("\n"); + } + + private static void PrintFieldValue(FieldDescriptor field, object value, TextGenerator generator) + { + switch (field.FieldType) + { + // The Float and Double types must specify the "r" format to preserve their precision, otherwise, + // the double to/from string will trim the precision to 6 places. As with other numeric formats + // below, always use the invariant culture so it's predictable. + case FieldType.Float: + generator.Print(((float)value).ToString("r", FrameworkPortability.InvariantCulture)); + break; + case FieldType.Double: + generator.Print(((double)value).ToString("r", FrameworkPortability.InvariantCulture)); + break; + + case FieldType.Int32: + case FieldType.Int64: + case FieldType.SInt32: + case FieldType.SInt64: + case FieldType.SFixed32: + case FieldType.SFixed64: + case FieldType.UInt32: + case FieldType.UInt64: + case FieldType.Fixed32: + case FieldType.Fixed64: + // The simple Object.ToString converts using the current culture. + // We want to always use the invariant culture so it's predictable. + generator.Print(((IConvertible)value).ToString(FrameworkPortability.InvariantCulture)); + break; + case FieldType.Bool: + // Explicitly use the Java true/false + generator.Print((bool) value ? "true" : "false"); + break; + + case FieldType.String: + generator.Print("\""); + generator.Print(EscapeText((string) value)); + generator.Print("\""); + break; + + case FieldType.Bytes: + { + generator.Print("\""); + generator.Print(EscapeBytes((ByteString) value)); + generator.Print("\""); + break; + } + + case FieldType.Enum: + { + if (value is IEnumLite && !(value is EnumValueDescriptor)) + { + throw new NotSupportedException("Lite enumerations are not supported."); + } + generator.Print(((EnumValueDescriptor) value).Name); + break; + } + + case FieldType.Message: + case FieldType.Group: + if (value is IMessageLite && !(value is IMessage)) + { + throw new NotSupportedException("Lite messages are not supported."); + } + Print((IMessage) value, generator); + break; + } + } + + private static void PrintUnknownFields(UnknownFieldSet unknownFields, TextGenerator generator) + { + foreach (KeyValuePair entry in unknownFields.FieldDictionary) + { + String prefix = entry.Key.ToString() + ": "; + UnknownField field = entry.Value; + + foreach (ulong value in field.VarintList) + { + generator.Print(prefix); + generator.Print(value.ToString()); + generator.Print("\n"); + } + foreach (uint value in field.Fixed32List) + { + generator.Print(prefix); + generator.Print(string.Format("0x{0:x8}", value)); + generator.Print("\n"); + } + foreach (ulong value in field.Fixed64List) + { + generator.Print(prefix); + generator.Print(string.Format("0x{0:x16}", value)); + generator.Print("\n"); + } + foreach (ByteString value in field.LengthDelimitedList) + { + generator.Print(entry.Key.ToString()); + generator.Print(": \""); + generator.Print(EscapeBytes(value)); + generator.Print("\"\n"); + } + foreach (UnknownFieldSet value in field.GroupList) + { + generator.Print(entry.Key.ToString()); + generator.Print(" {\n"); + generator.Indent(); + PrintUnknownFields(value, generator); + generator.Outdent(); + generator.Print("}\n"); + } + } + } + + [CLSCompliant(false)] + public static ulong ParseUInt64(string text) + { + return (ulong) ParseInteger(text, false, true); + } + + public static long ParseInt64(string text) + { + return ParseInteger(text, true, true); + } + + [CLSCompliant(false)] + public static uint ParseUInt32(string text) + { + return (uint) ParseInteger(text, false, false); + } + + public static int ParseInt32(string text) + { + return (int) ParseInteger(text, true, false); + } + + public static float ParseFloat(string text) + { + switch (text) + { + case "-inf": + case "-infinity": + case "-inff": + case "-infinityf": + return float.NegativeInfinity; + case "inf": + case "infinity": + case "inff": + case "infinityf": + return float.PositiveInfinity; + case "nan": + case "nanf": + return float.NaN; + default: + return float.Parse(text, FrameworkPortability.InvariantCulture); + } + } + + public static double ParseDouble(string text) + { + switch (text) + { + case "-inf": + case "-infinity": + return double.NegativeInfinity; + case "inf": + case "infinity": + return double.PositiveInfinity; + case "nan": + return double.NaN; + default: + return double.Parse(text, FrameworkPortability.InvariantCulture); + } + } + + /// + /// Parses an integer in hex (leading 0x), decimal (no prefix) or octal (leading 0). + /// Only a negative sign is permitted, and it must come before the radix indicator. + /// + private static long ParseInteger(string text, bool isSigned, bool isLong) + { + string original = text; + bool negative = false; + if (text.StartsWith("-")) + { + if (!isSigned) + { + throw new FormatException("Number must be positive: " + original); + } + negative = true; + text = text.Substring(1); + } + + int radix = 10; + if (text.StartsWith("0x")) + { + radix = 16; + text = text.Substring(2); + } + else if (text.StartsWith("0")) + { + radix = 8; + } + + ulong result; + try + { + // Workaround for https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=278448 + // We should be able to use Convert.ToUInt64 for all cases. + result = radix == 10 ? ulong.Parse(text) : Convert.ToUInt64(text, radix); + } + catch (OverflowException) + { + // Convert OverflowException to FormatException so there's a single exception type this method can throw. + string numberDescription = string.Format("{0}-bit {1}signed integer", isLong ? 64 : 32, + isSigned ? "" : "un"); + throw new FormatException("Number out of range for " + numberDescription + ": " + original); + } + + if (negative) + { + ulong max = isLong ? 0x8000000000000000UL : 0x80000000L; + if (result > max) + { + string numberDescription = string.Format("{0}-bit signed integer", isLong ? 64 : 32); + throw new FormatException("Number out of range for " + numberDescription + ": " + original); + } + return -((long) result); + } + else + { + ulong max = isSigned + ? (isLong ? (ulong) long.MaxValue : int.MaxValue) + : (isLong ? ulong.MaxValue : uint.MaxValue); + if (result > max) + { + string numberDescription = string.Format("{0}-bit {1}signed integer", isLong ? 64 : 32, + isSigned ? "" : "un"); + throw new FormatException("Number out of range for " + numberDescription + ": " + original); + } + return (long) result; + } + } + + /// + /// Tests a character to see if it's an octal digit. + /// + private static bool IsOctal(char c) + { + return '0' <= c && c <= '7'; + } + + /// + /// Tests a character to see if it's a hex digit. + /// + private static bool IsHex(char c) + { + return ('0' <= c && c <= '9') || + ('a' <= c && c <= 'f') || + ('A' <= c && c <= 'F'); + } + + /// + /// Interprets a character as a digit (in any base up to 36) and returns the + /// numeric value. + /// + private static int ParseDigit(char c) + { + if ('0' <= c && c <= '9') + { + return c - '0'; + } + else if ('a' <= c && c <= 'z') + { + return c - 'a' + 10; + } + else + { + return c - 'A' + 10; + } + } + + /// + /// Unescapes a text string as escaped using . + /// Two-digit hex escapes (starting with "\x" are also recognised. + /// + public static string UnescapeText(string input) + { + return UnescapeBytes(input).ToStringUtf8(); + } + + /// + /// Like but escapes a text string. + /// The string is first encoded as UTF-8, then each byte escaped individually. + /// The returned value is guaranteed to be entirely ASCII. + /// + public static string EscapeText(string input) + { + return EscapeBytes(ByteString.CopyFromUtf8(input)); + } + + /// + /// Escapes bytes in the format used in protocol buffer text format, which + /// is the same as the format used for C string literals. All bytes + /// that are not printable 7-bit ASCII characters are escaped, as well as + /// backslash, single-quote, and double-quote characters. Characters for + /// which no defined short-hand escape sequence is defined will be escaped + /// using 3-digit octal sequences. + /// The returned value is guaranteed to be entirely ASCII. + /// + public static String EscapeBytes(ByteString input) + { + StringBuilder builder = new StringBuilder(input.Length); + foreach (byte b in input) + { + switch (b) + { + // C# does not use \a or \v + case 0x07: + builder.Append("\\a"); + break; + case (byte) '\b': + builder.Append("\\b"); + break; + case (byte) '\f': + builder.Append("\\f"); + break; + case (byte) '\n': + builder.Append("\\n"); + break; + case (byte) '\r': + builder.Append("\\r"); + break; + case (byte) '\t': + builder.Append("\\t"); + break; + case 0x0b: + builder.Append("\\v"); + break; + case (byte) '\\': + builder.Append("\\\\"); + break; + case (byte) '\'': + builder.Append("\\\'"); + break; + case (byte) '"': + builder.Append("\\\""); + break; + default: + if (b >= 0x20 && b < 128) + { + builder.Append((char) b); + } + else + { + builder.Append('\\'); + builder.Append((char) ('0' + ((b >> 6) & 3))); + builder.Append((char) ('0' + ((b >> 3) & 7))); + builder.Append((char) ('0' + (b & 7))); + } + break; + } + } + return builder.ToString(); + } + + /// + /// Performs string unescaping from C style (octal, hex, form feeds, tab etc) into a byte string. + /// + public static ByteString UnescapeBytes(string input) + { + byte[] result = new byte[input.Length]; + int pos = 0; + for (int i = 0; i < input.Length; i++) + { + char c = input[i]; + if (c > 127 || c < 32) + { + throw new FormatException("Escaped string must only contain ASCII"); + } + if (c != '\\') + { + result[pos++] = (byte) c; + continue; + } + if (i + 1 >= input.Length) + { + throw new FormatException("Invalid escape sequence: '\\' at end of string."); + } + + i++; + c = input[i]; + if (c >= '0' && c <= '7') + { + // Octal escape. + int code = ParseDigit(c); + if (i + 1 < input.Length && IsOctal(input[i + 1])) + { + i++; + code = code*8 + ParseDigit(input[i]); + } + if (i + 1 < input.Length && IsOctal(input[i + 1])) + { + i++; + code = code*8 + ParseDigit(input[i]); + } + result[pos++] = (byte) code; + } + else + { + switch (c) + { + case 'a': + result[pos++] = 0x07; + break; + case 'b': + result[pos++] = (byte) '\b'; + break; + case 'f': + result[pos++] = (byte) '\f'; + break; + case 'n': + result[pos++] = (byte) '\n'; + break; + case 'r': + result[pos++] = (byte) '\r'; + break; + case 't': + result[pos++] = (byte) '\t'; + break; + case 'v': + result[pos++] = 0x0b; + break; + case '\\': + result[pos++] = (byte) '\\'; + break; + case '\'': + result[pos++] = (byte) '\''; + break; + case '"': + result[pos++] = (byte) '\"'; + break; + + case 'x': + // hex escape + int code; + if (i + 1 < input.Length && IsHex(input[i + 1])) + { + i++; + code = ParseDigit(input[i]); + } + else + { + throw new FormatException("Invalid escape sequence: '\\x' with no digits"); + } + if (i + 1 < input.Length && IsHex(input[i + 1])) + { + ++i; + code = code*16 + ParseDigit(input[i]); + } + result[pos++] = (byte) code; + break; + + default: + throw new FormatException("Invalid escape sequence: '\\" + c + "'"); + } + } + } + + return ByteString.CopyFrom(result, 0, pos); + } + + public static void Merge(string text, IBuilder builder) + { + Merge(text, ExtensionRegistry.Empty, builder); + } + + public static void Merge(TextReader reader, IBuilder builder) + { + Merge(reader, ExtensionRegistry.Empty, builder); + } + + public static void Merge(TextReader reader, ExtensionRegistry registry, IBuilder builder) + { + Merge(reader.ReadToEnd(), registry, builder); + } + + public static void Merge(string text, ExtensionRegistry registry, IBuilder builder) + { + TextTokenizer tokenizer = new TextTokenizer(text); + + while (!tokenizer.AtEnd) + { + MergeField(tokenizer, registry, builder); + } + } + + /// + /// Parses a single field from the specified tokenizer and merges it into + /// the builder. + /// + private static void MergeField(TextTokenizer tokenizer, ExtensionRegistry extensionRegistry, + IBuilder builder) + { + FieldDescriptor field; + MessageDescriptor type = builder.DescriptorForType; + ExtensionInfo extension = null; + + if (tokenizer.TryConsume("[")) + { + // An extension. + StringBuilder name = new StringBuilder(tokenizer.ConsumeIdentifier()); + while (tokenizer.TryConsume(".")) + { + name.Append("."); + name.Append(tokenizer.ConsumeIdentifier()); + } + + extension = extensionRegistry.FindByName(type, name.ToString()); + + if (extension == null) + { + throw tokenizer.CreateFormatExceptionPreviousToken("Extension \"" + name + + "\" not found in the ExtensionRegistry."); + } + else if (extension.Descriptor.ContainingType != type) + { + throw tokenizer.CreateFormatExceptionPreviousToken("Extension \"" + name + + "\" does not extend message type \"" + + type.FullName + "\"."); + } + + tokenizer.Consume("]"); + + field = extension.Descriptor; + } + else + { + String name = tokenizer.ConsumeIdentifier(); + field = type.FindDescriptor(name); + + // Group names are expected to be capitalized as they appear in the + // .proto file, which actually matches their type names, not their field + // names. + if (field == null) + { + // Explicitly specify the invariant culture so that this code does not break when + // executing in Turkey. +#if PORTABLE_LIBRARY + String lowerName = name.ToLowerInvariant(); +#else + String lowerName = name.ToLower(FrameworkPortability.InvariantCulture); +#endif + field = type.FindDescriptor(lowerName); + // If the case-insensitive match worked but the field is NOT a group, + // TODO(jonskeet): What? Java comment ends here! + if (field != null && field.FieldType != FieldType.Group) + { + field = null; + } + } + // Again, special-case group names as described above. + if (field != null && field.FieldType == FieldType.Group && field.MessageType.Name != name) + { + field = null; + } + + if (field == null) + { + throw tokenizer.CreateFormatExceptionPreviousToken( + "Message type \"" + type.FullName + "\" has no field named \"" + name + "\"."); + } + } + + object value = null; + + if (field.MappedType == MappedType.Message) + { + tokenizer.TryConsume(":"); // optional + + String endToken; + if (tokenizer.TryConsume("<")) + { + endToken = ">"; + } + else + { + tokenizer.Consume("{"); + endToken = "}"; + } + + IBuilder subBuilder; + if (extension == null) + { + subBuilder = builder.CreateBuilderForField(field); + } + else + { + subBuilder = extension.DefaultInstance.WeakCreateBuilderForType() as IBuilder; + if (subBuilder == null) + { + throw new NotSupportedException("Lite messages are not supported."); + } + } + + while (!tokenizer.TryConsume(endToken)) + { + if (tokenizer.AtEnd) + { + throw tokenizer.CreateFormatException("Expected \"" + endToken + "\"."); + } + MergeField(tokenizer, extensionRegistry, subBuilder); + } + + value = subBuilder.WeakBuild(); + } + else + { + tokenizer.Consume(":"); + + switch (field.FieldType) + { + case FieldType.Int32: + case FieldType.SInt32: + case FieldType.SFixed32: + value = tokenizer.ConsumeInt32(); + break; + + case FieldType.Int64: + case FieldType.SInt64: + case FieldType.SFixed64: + value = tokenizer.ConsumeInt64(); + break; + + case FieldType.UInt32: + case FieldType.Fixed32: + value = tokenizer.ConsumeUInt32(); + break; + + case FieldType.UInt64: + case FieldType.Fixed64: + value = tokenizer.ConsumeUInt64(); + break; + + case FieldType.Float: + value = tokenizer.ConsumeFloat(); + break; + + case FieldType.Double: + value = tokenizer.ConsumeDouble(); + break; + + case FieldType.Bool: + value = tokenizer.ConsumeBoolean(); + break; + + case FieldType.String: + value = tokenizer.ConsumeString(); + break; + + case FieldType.Bytes: + value = tokenizer.ConsumeByteString(); + break; + + case FieldType.Enum: + { + EnumDescriptor enumType = field.EnumType; + + if (tokenizer.LookingAtInteger()) + { + int number = tokenizer.ConsumeInt32(); + value = enumType.FindValueByNumber(number); + if (value == null) + { + throw tokenizer.CreateFormatExceptionPreviousToken( + "Enum type \"" + enumType.FullName + + "\" has no value with number " + number + "."); + } + } + else + { + String id = tokenizer.ConsumeIdentifier(); + value = enumType.FindValueByName(id); + if (value == null) + { + throw tokenizer.CreateFormatExceptionPreviousToken( + "Enum type \"" + enumType.FullName + + "\" has no value named \"" + id + "\"."); + } + } + + break; + } + + case FieldType.Message: + case FieldType.Group: + throw new InvalidOperationException("Can't get here."); + } + } + + if (field.IsRepeated) + { + builder.WeakAddRepeatedField(field, value); + } + else + { + builder.SetField(field, value); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/TextGenerator.cs b/csharp/src/ProtocolBuffers/TextGenerator.cs new file mode 100644 index 00000000..30cbf0fd --- /dev/null +++ b/csharp/src/ProtocolBuffers/TextGenerator.cs @@ -0,0 +1,159 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using System.Text; + +namespace Google.ProtocolBuffers +{ + /// + /// Helper class to control indentation. Used for TextFormat and by ProtoGen. + /// + public sealed class TextGenerator + { + /// + /// The string to use at the end of each line. We assume that "Print" is only called using \n + /// to indicate a line break; that's what we use to detect when we need to indent etc, and + /// *just* the \n is replaced with the contents of lineBreak. + /// + private readonly string lineBreak; + + /// + /// Writer to write formatted text to. + /// + private readonly TextWriter writer; + + /// + /// Keeps track of whether the next piece of text should be indented + /// + private bool atStartOfLine = true; + + /// + /// Keeps track of the current level of indentation + /// + private readonly StringBuilder indent = new StringBuilder(); + + /// + /// Creates a generator writing to the given writer. The writer + /// is not closed by this class. + /// + public TextGenerator(TextWriter writer, string lineBreak) + { + this.writer = writer; + this.lineBreak = lineBreak; + } + + /// + /// Indents text by two spaces. After calling Indent(), two spaces + /// will be inserted at the beginning of each line of text. Indent() may + /// be called multiple times to produce deeper indents. + /// + public void Indent() + { + indent.Append(" "); + } + + /// + /// Reduces the current indent level by two spaces. + /// + public void Outdent() + { + if (indent.Length == 0) + { + throw new InvalidOperationException("Too many calls to Outdent()"); + } + indent.Length -= 2; + } + + public void WriteLine(string text) + { + Print(text); + Print("\n"); + } + + public void WriteLine(string format, params object[] args) + { + WriteLine(string.Format(format, args)); + } + + public void WriteLine() + { + WriteLine(""); + } + + /// + /// Prints the given text to the output stream, indenting at line boundaries. + /// + /// + public void Print(string text) + { + int pos = 0; + + for (int i = 0; i < text.Length; i++) + { + if (text[i] == '\n') + { + // Strip off the \n from what we write + Write(text.Substring(pos, i - pos)); + Write(lineBreak); + pos = i + 1; + atStartOfLine = true; + } + } + Write(text.Substring(pos)); + } + + public void Write(string format, params object[] args) + { + Write(string.Format(format, args)); + } + + private void Write(string data) + { + if (data.Length == 0) + { + return; + } + if (atStartOfLine) + { + atStartOfLine = false; + writer.Write(indent); + } + writer.Write(data); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/TextTokenizer.cs b/csharp/src/ProtocolBuffers/TextTokenizer.cs new file mode 100644 index 00000000..5bb27fd0 --- /dev/null +++ b/csharp/src/ProtocolBuffers/TextTokenizer.cs @@ -0,0 +1,501 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.Globalization; +using System.Text.RegularExpressions; + +namespace Google.ProtocolBuffers +{ + /// + /// Represents a stream of tokens parsed from a string. + /// + internal sealed class TextTokenizer + { + private readonly string text; + private string currentToken; + + /// + /// The character index within the text to perform the next regex match at. + /// + private int matchPos = 0; + + /// + /// The character index within the text at which the current token begins. + /// + private int pos = 0; + + /// + /// The line number of the current token. + /// + private int line = 0; + + /// + /// The column number of the current token. + /// + private int column = 0; + + /// + /// The line number of the previous token. + /// + private int previousLine = 0; + + /// + /// The column number of the previous token. + /// + private int previousColumn = 0; + + // Note: atomic groups used to mimic possessive quantifiers in Java in both of these regexes + internal static readonly Regex WhitespaceAndCommentPattern = new Regex("\\G(?>(\\s|(#.*$))+)", + FrameworkPortability. + CompiledRegexWhereAvailable | + RegexOptions.Multiline); + + private static readonly Regex TokenPattern = new Regex( + "\\G[a-zA-Z_](?>[0-9a-zA-Z_+-]*)|" + // an identifier + "\\G[0-9+-](?>[0-9a-zA-Z_.+-]*)|" + // a number + "\\G\"(?>([^\"\\\n\\\\]|\\\\.)*)(\"|\\\\?$)|" + // a double-quoted string + "\\G\'(?>([^\"\\\n\\\\]|\\\\.)*)(\'|\\\\?$)", // a single-quoted string + FrameworkPortability.CompiledRegexWhereAvailable | RegexOptions.Multiline); + + private static readonly Regex DoubleInfinity = new Regex("^-?inf(inity)?$", + FrameworkPortability.CompiledRegexWhereAvailable | + RegexOptions.IgnoreCase); + + private static readonly Regex FloatInfinity = new Regex("^-?inf(inity)?f?$", + FrameworkPortability.CompiledRegexWhereAvailable | + RegexOptions.IgnoreCase); + + private static readonly Regex FloatNan = new Regex("^nanf?$", + FrameworkPortability.CompiledRegexWhereAvailable | + RegexOptions.IgnoreCase); + + /** Construct a tokenizer that parses tokens from the given text. */ + + public TextTokenizer(string text) + { + this.text = text; + SkipWhitespace(); + NextToken(); + } + + /// + /// Are we at the end of the input? + /// + public bool AtEnd + { + get { return currentToken.Length == 0; } + } + + /// + /// Advances to the next token. + /// + public void NextToken() + { + previousLine = line; + previousColumn = column; + + // Advance the line counter to the current position. + while (pos < matchPos) + { + if (text[pos] == '\n') + { + ++line; + column = 0; + } + else + { + ++column; + } + ++pos; + } + + // Match the next token. + if (matchPos == text.Length) + { + // EOF + currentToken = ""; + } + else + { + Match match = TokenPattern.Match(text, matchPos); + if (match.Success) + { + currentToken = match.Value; + matchPos += match.Length; + } + else + { + // Take one character. + currentToken = text[matchPos].ToString(); + matchPos++; + } + + SkipWhitespace(); + } + } + + /// + /// Skip over any whitespace so that matchPos starts at the next token. + /// + private void SkipWhitespace() + { + Match match = WhitespaceAndCommentPattern.Match(text, matchPos); + if (match.Success) + { + matchPos += match.Length; + } + } + + /// + /// If the next token exactly matches the given token, consume it and return + /// true. Otherwise, return false without doing anything. + /// + public bool TryConsume(string token) + { + if (currentToken == token) + { + NextToken(); + return true; + } + return false; + } + + /* + * If the next token exactly matches {@code token}, consume it. Otherwise, + * throw a {@link ParseException}. + */ + + /// + /// If the next token exactly matches the specified one, consume it. + /// Otherwise, throw a FormatException. + /// + /// + public void Consume(string token) + { + if (!TryConsume(token)) + { + throw CreateFormatException("Expected \"" + token + "\"."); + } + } + + /// + /// Returns true if the next token is an integer, but does not consume it. + /// + public bool LookingAtInteger() + { + if (currentToken.Length == 0) + { + return false; + } + + char c = currentToken[0]; + return ('0' <= c && c <= '9') || c == '-' || c == '+'; + } + + /// + /// If the next token is an identifier, consume it and return its value. + /// Otherwise, throw a FormatException. + /// + public string ConsumeIdentifier() + { + foreach (char c in currentToken) + { + if (('a' <= c && c <= 'z') || + ('A' <= c && c <= 'Z') || + ('0' <= c && c <= '9') || + (c == '_') || (c == '.')) + { + // OK + } + else + { + throw CreateFormatException("Expected identifier."); + } + } + + string result = currentToken; + NextToken(); + return result; + } + + /// + /// If the next token is a 32-bit signed integer, consume it and return its + /// value. Otherwise, throw a FormatException. + /// + public int ConsumeInt32() + { + try + { + int result = TextFormat.ParseInt32(currentToken); + NextToken(); + return result; + } + catch (FormatException e) + { + throw CreateIntegerParseException(e); + } + } + + /// + /// If the next token is a 32-bit unsigned integer, consume it and return its + /// value. Otherwise, throw a FormatException. + /// + public uint ConsumeUInt32() + { + try + { + uint result = TextFormat.ParseUInt32(currentToken); + NextToken(); + return result; + } + catch (FormatException e) + { + throw CreateIntegerParseException(e); + } + } + + /// + /// If the next token is a 64-bit signed integer, consume it and return its + /// value. Otherwise, throw a FormatException. + /// + public long ConsumeInt64() + { + try + { + long result = TextFormat.ParseInt64(currentToken); + NextToken(); + return result; + } + catch (FormatException e) + { + throw CreateIntegerParseException(e); + } + } + + /// + /// If the next token is a 64-bit unsigned integer, consume it and return its + /// value. Otherwise, throw a FormatException. + /// + public ulong ConsumeUInt64() + { + try + { + ulong result = TextFormat.ParseUInt64(currentToken); + NextToken(); + return result; + } + catch (FormatException e) + { + throw CreateIntegerParseException(e); + } + } + + /// + /// If the next token is a double, consume it and return its value. + /// Otherwise, throw a FormatException. + /// + public double ConsumeDouble() + { + // We need to parse infinity and nan separately because + // double.Parse() does not accept "inf", "infinity", or "nan". + if (DoubleInfinity.IsMatch(currentToken)) + { + bool negative = currentToken.StartsWith("-"); + NextToken(); + return negative ? double.NegativeInfinity : double.PositiveInfinity; + } + if (currentToken.Equals("nan", StringComparison.OrdinalIgnoreCase)) + { + NextToken(); + return Double.NaN; + } + + try + { + double result = double.Parse(currentToken, FrameworkPortability.InvariantCulture); + NextToken(); + return result; + } + catch (FormatException e) + { + throw CreateFloatParseException(e); + } + catch (OverflowException e) + { + throw CreateFloatParseException(e); + } + } + + /// + /// If the next token is a float, consume it and return its value. + /// Otherwise, throw a FormatException. + /// + public float ConsumeFloat() + { + // We need to parse infinity and nan separately because + // Float.parseFloat() does not accept "inf", "infinity", or "nan". + if (FloatInfinity.IsMatch(currentToken)) + { + bool negative = currentToken.StartsWith("-"); + NextToken(); + return negative ? float.NegativeInfinity : float.PositiveInfinity; + } + if (FloatNan.IsMatch(currentToken)) + { + NextToken(); + return float.NaN; + } + + if (currentToken.EndsWith("f")) + { + currentToken = currentToken.TrimEnd('f'); + } + + try + { + float result = float.Parse(currentToken, FrameworkPortability.InvariantCulture); + NextToken(); + return result; + } + catch (FormatException e) + { + throw CreateFloatParseException(e); + } + catch (OverflowException e) + { + throw CreateFloatParseException(e); + } + } + + /// + /// If the next token is a Boolean, consume it and return its value. + /// Otherwise, throw a FormatException. + /// + public bool ConsumeBoolean() + { + if (currentToken == "true") + { + NextToken(); + return true; + } + if (currentToken == "false") + { + NextToken(); + return false; + } + throw CreateFormatException("Expected \"true\" or \"false\"."); + } + + /// + /// If the next token is a string, consume it and return its (unescaped) value. + /// Otherwise, throw a FormatException. + /// + public string ConsumeString() + { + return ConsumeByteString().ToStringUtf8(); + } + + /// + /// If the next token is a string, consume it, unescape it as a + /// ByteString and return it. Otherwise, throw a FormatException. + /// + public ByteString ConsumeByteString() + { + char quote = currentToken.Length > 0 ? currentToken[0] : '\0'; + if (quote != '\"' && quote != '\'') + { + throw CreateFormatException("Expected string."); + } + + if (currentToken.Length < 2 || + currentToken[currentToken.Length - 1] != quote) + { + throw CreateFormatException("String missing ending quote."); + } + + try + { + string escaped = currentToken.Substring(1, currentToken.Length - 2); + ByteString result = TextFormat.UnescapeBytes(escaped); + NextToken(); + return result; + } + catch (FormatException e) + { + throw CreateFormatException(e.Message); + } + } + + /// + /// Returns a format exception with the current line and column numbers + /// in the description, suitable for throwing. + /// + public FormatException CreateFormatException(string description) + { + // Note: People generally prefer one-based line and column numbers. + return new FormatException((line + 1) + ":" + (column + 1) + ": " + description); + } + + /// + /// Returns a format exception with the line and column numbers of the + /// previous token in the description, suitable for throwing. + /// + public FormatException CreateFormatExceptionPreviousToken(string description) + { + // Note: People generally prefer one-based line and column numbers. + return new FormatException((previousLine + 1) + ":" + (previousColumn + 1) + ": " + description); + } + + /// + /// Constructs an appropriate FormatException for the given existing exception + /// when trying to parse an integer. + /// + private FormatException CreateIntegerParseException(FormatException e) + { + return CreateFormatException("Couldn't parse integer: " + e.Message); + } + + /// + /// Constructs an appropriate FormatException for the given existing exception + /// when trying to parse a float or double. + /// + private FormatException CreateFloatParseException(Exception e) + { + return CreateFormatException("Couldn't parse number: " + e.Message); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/ThrowHelper.cs b/csharp/src/ProtocolBuffers/ThrowHelper.cs new file mode 100644 index 00000000..69e5f569 --- /dev/null +++ b/csharp/src/ProtocolBuffers/ThrowHelper.cs @@ -0,0 +1,92 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.ProtocolBuffers +{ + /// + /// Helper methods for throwing exceptions + /// + public static class ThrowHelper + { + /// + /// Throws an ArgumentNullException if the given value is null. + /// + public static void ThrowIfNull(object value, string name) + { + if (value == null) + { + throw new ArgumentNullException(name); + } + } + + /// + /// Throws an ArgumentNullException if the given value is null. + /// + public static void ThrowIfNull(object value) + { + if (value == null) + { + throw new ArgumentNullException(); + } + } + + /// + /// Throws an ArgumentNullException if the given value or any element within it is null. + /// + public static void ThrowIfAnyNull(IEnumerable sequence) + { + foreach (T t in sequence) + { + if (t == null) + { + throw new ArgumentNullException(); + } + } + } + + public static Exception CreateMissingMethod(Type type, string methodName) + { +#if CLIENTPROFILE + return new System.MissingMethodException(type.FullName, methodName); +#else + return new System.ArgumentException(String.Format("The method '{0}' was not found on type {1}.", methodName, type)); +#endif + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/UninitializedMessageException.cs b/csharp/src/ProtocolBuffers/UninitializedMessageException.cs new file mode 100644 index 00000000..9e4f856e --- /dev/null +++ b/csharp/src/ProtocolBuffers/UninitializedMessageException.cs @@ -0,0 +1,208 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +#if !LITE +using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; + +#endif + +namespace Google.ProtocolBuffers +{ + /// + /// TODO(jonskeet): Write summary text. + /// + public sealed class UninitializedMessageException : Exception + { + private readonly IList missingFields; + + private UninitializedMessageException(IList missingFields) + : base(BuildDescription(missingFields)) + { + this.missingFields = new List(missingFields); + } + + /// + /// Returns a read-only list of human-readable names of + /// required fields missing from this message. Each name + /// is a full path to a field, e.g. "foo.bar[5].baz" + /// + public IList MissingFields + { + get { return missingFields; } + } + + /// + /// Converts this exception into an InvalidProtocolBufferException. + /// When a parsed message is missing required fields, this should be thrown + /// instead of UninitializedMessageException. + /// + public InvalidProtocolBufferException AsInvalidProtocolBufferException() + { + return new InvalidProtocolBufferException(Message); + } + + /// + /// Constructs the description string for a given list of missing fields. + /// + private static string BuildDescription(IEnumerable missingFields) + { + StringBuilder description = new StringBuilder("Message missing required fields: "); + bool first = true; + foreach (string field in missingFields) + { + if (first) + { + first = false; + } + else + { + description.Append(", "); + } + description.Append(field); + } + return description.ToString(); + } + + /// + /// For Lite exceptions that do not known how to enumerate missing fields + /// + public UninitializedMessageException(IMessageLite message) + : base(String.Format("Message {0} is missing required fields", message.GetType())) + { + missingFields = new List(); + } + +#if !LITE + public UninitializedMessageException(IMessage message) + : this(FindMissingFields(message)) + { + } + + /// + /// Returns a list of the full "paths" of missing required + /// fields in the specified message. + /// + private static IList FindMissingFields(IMessage message) + { + List results = new List(); + FindMissingFields(message, "", results); + return results; + } + + /// + /// Recursive helper implementing FindMissingFields. + /// + private static void FindMissingFields(IMessage message, String prefix, List results) + { + foreach (FieldDescriptor field in message.DescriptorForType.Fields) + { + if (field.IsRequired && !message.HasField(field)) + { + results.Add(prefix + field.Name); + } + } + + foreach (KeyValuePair entry in message.AllFields) + { + FieldDescriptor field = entry.Key; + object value = entry.Value; + + if (field.MappedType == MappedType.Message) + { + if (field.IsRepeated) + { + int i = 0; + foreach (object element in (IEnumerable) value) + { + if (element is IMessage) + { + FindMissingFields((IMessage) element, SubMessagePrefix(prefix, field, i++), results); + } + else + { + results.Add(prefix + field.Name); + } + } + } + else + { + if (message.HasField(field)) + { + if (value is IMessage) + { + FindMissingFields((IMessage) value, SubMessagePrefix(prefix, field, -1), results); + } + else + { + results.Add(prefix + field.Name); + } + } + } + } + } + } + + private static String SubMessagePrefix(String prefix, FieldDescriptor field, int index) + { + StringBuilder result = new StringBuilder(prefix); + if (field.IsExtension) + { + result.Append('(') + .Append(field.FullName) + .Append(')'); + } + else + { + result.Append(field.Name); + } + if (index != -1) + { + result.Append('[') + .Append(index) + .Append(']'); + } + result.Append('.'); + return result.ToString(); + } +#endif + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/UnknownField.cs b/csharp/src/ProtocolBuffers/UnknownField.cs new file mode 100644 index 00000000..e03477fe --- /dev/null +++ b/csharp/src/ProtocolBuffers/UnknownField.cs @@ -0,0 +1,418 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using Google.ProtocolBuffers.Collections; + +namespace Google.ProtocolBuffers +{ + /// + /// Represents a single field in an UnknownFieldSet. + /// + /// An UnknownField consists of five lists of values. The lists correspond + /// to the five "wire types" used in the protocol buffer binary format. + /// The wire type of each field can be determined from the encoded form alone, + /// without knowing the field's declared type. So, we are able to parse + /// unknown values at least this far and separate them. Normally, only one + /// of the five lists will contain any values, since it is impossible to + /// define a valid message type that declares two different types for the + /// same field number. However, the code is designed to allow for the case + /// where the same unknown field number is encountered using multiple different + /// wire types. + /// + /// UnknownField is an immutable class. To construct one, you must use an + /// UnknownField.Builder. + /// + public sealed class UnknownField + { + public const string UnknownFieldName = "unknown_field"; + private static readonly UnknownField defaultInstance = CreateBuilder().Build(); + private readonly ReadOnlyCollection varintList; + private readonly ReadOnlyCollection fixed32List; + private readonly ReadOnlyCollection fixed64List; + private readonly ReadOnlyCollection lengthDelimitedList; + private readonly ReadOnlyCollection groupList; + + private UnknownField(ReadOnlyCollection varintList, + ReadOnlyCollection fixed32List, + ReadOnlyCollection fixed64List, + ReadOnlyCollection lengthDelimitedList, + ReadOnlyCollection groupList) + { + this.varintList = varintList; + this.fixed32List = fixed32List; + this.fixed64List = fixed64List; + this.lengthDelimitedList = lengthDelimitedList; + this.groupList = groupList; + } + + public static UnknownField DefaultInstance + { + get { return defaultInstance; } + } + + /// + /// The list of varint values for this field. + /// + public IList VarintList + { + get { return varintList; } + } + + /// + /// The list of fixed32 values for this field. + /// + public IList Fixed32List + { + get { return fixed32List; } + } + + /// + /// The list of fixed64 values for this field. + /// + public IList Fixed64List + { + get { return fixed64List; } + } + + /// + /// The list of length-delimited values for this field. + /// + public IList LengthDelimitedList + { + get { return lengthDelimitedList; } + } + + /// + /// The list of embedded group values for this field. These + /// are represented using UnknownFieldSets rather than Messages + /// since the group's type is presumably unknown. + /// + public IList GroupList + { + get { return groupList; } + } + + public override bool Equals(object other) + { + if (ReferenceEquals(this, other)) + { + return true; + } + UnknownField otherField = other as UnknownField; + return otherField != null + && Lists.Equals(varintList, otherField.varintList) + && Lists.Equals(fixed32List, otherField.fixed32List) + && Lists.Equals(fixed64List, otherField.fixed64List) + && Lists.Equals(lengthDelimitedList, otherField.lengthDelimitedList) + && Lists.Equals(groupList, otherField.groupList); + } + + public override int GetHashCode() + { + int hash = 43; + hash = hash*47 + Lists.GetHashCode(varintList); + hash = hash*47 + Lists.GetHashCode(fixed32List); + hash = hash*47 + Lists.GetHashCode(fixed64List); + hash = hash*47 + Lists.GetHashCode(lengthDelimitedList); + hash = hash*47 + Lists.GetHashCode(groupList); + return hash; + } + + /// + /// Constructs a new Builder. + /// + public static Builder CreateBuilder() + { + return new Builder(); + } + + /// + /// Constructs a new Builder and initializes it to a copy of . + /// + public static Builder CreateBuilder(UnknownField copyFrom) + { + return new Builder().MergeFrom(copyFrom); + } + + /// + /// Serializes the field, including the field number, and writes it to + /// . + /// + public void WriteTo(int fieldNumber, ICodedOutputStream output) + { + foreach (ulong value in varintList) + { + output.WriteUnknownField(fieldNumber, WireFormat.WireType.Varint, value); + } + foreach (uint value in fixed32List) + { + output.WriteUnknownField(fieldNumber, WireFormat.WireType.Fixed32, value); + } + foreach (ulong value in fixed64List) + { + output.WriteUnknownField(fieldNumber, WireFormat.WireType.Fixed64, value); + } + foreach (ByteString value in lengthDelimitedList) + { + output.WriteUnknownBytes(fieldNumber, value); + } + foreach (UnknownFieldSet value in groupList) + { +#pragma warning disable 0612 + output.WriteUnknownGroup(fieldNumber, value); +#pragma warning restore 0612 + } + } + + /// + /// Computes the number of bytes required to encode this field, including field + /// number. + /// + public int GetSerializedSize(int fieldNumber) + { + int result = 0; + foreach (ulong value in varintList) + { + result += CodedOutputStream.ComputeUInt64Size(fieldNumber, value); + } + foreach (uint value in fixed32List) + { + result += CodedOutputStream.ComputeFixed32Size(fieldNumber, value); + } + foreach (ulong value in fixed64List) + { + result += CodedOutputStream.ComputeFixed64Size(fieldNumber, value); + } + foreach (ByteString value in lengthDelimitedList) + { + result += CodedOutputStream.ComputeBytesSize(fieldNumber, value); + } + foreach (UnknownFieldSet value in groupList) + { +#pragma warning disable 0612 + result += CodedOutputStream.ComputeUnknownGroupSize(fieldNumber, value); +#pragma warning restore 0612 + } + return result; + } + + /// + /// Serializes the length-delimited values of the field, including field + /// number, and writes them to using the MessageSet wire format. + /// + /// + /// + public void WriteAsMessageSetExtensionTo(int fieldNumber, ICodedOutputStream output) + { + foreach (ByteString value in lengthDelimitedList) + { + output.WriteMessageSetExtension(fieldNumber, UnknownFieldName, value); + } + } + + /// + /// Get the number of bytes required to encode this field, incuding field number, + /// using the MessageSet wire format. + /// + public int GetSerializedSizeAsMessageSetExtension(int fieldNumber) + { + int result = 0; + foreach (ByteString value in lengthDelimitedList) + { + result += CodedOutputStream.ComputeRawMessageSetExtensionSize(fieldNumber, value); + } + return result; + } + + /// + /// Used to build instances of UnknownField. + /// + public sealed class Builder + { + private List varintList; + private List fixed32List; + private List fixed64List; + private List lengthDelimitedList; + private List groupList; + + /// + /// Builds the field. After building, the builder is reset to an empty + /// state. (This is actually easier than making it unusable.) + /// + public UnknownField Build() + { + return new UnknownField(MakeReadOnly(ref varintList), + MakeReadOnly(ref fixed32List), + MakeReadOnly(ref fixed64List), + MakeReadOnly(ref lengthDelimitedList), + MakeReadOnly(ref groupList)); + } + + /// + /// Merge the values in into this field. For each list + /// of values, 's values are append to the ones in this + /// field. + /// + public Builder MergeFrom(UnknownField other) + { + varintList = AddAll(varintList, other.VarintList); + fixed32List = AddAll(fixed32List, other.Fixed32List); + fixed64List = AddAll(fixed64List, other.Fixed64List); + lengthDelimitedList = AddAll(lengthDelimitedList, other.LengthDelimitedList); + groupList = AddAll(groupList, other.GroupList); + return this; + } + + /// + /// Returns a new list containing all of the given specified values from + /// both the and lists. + /// If is null and is empty, + /// null is returned. Otherwise, either a new list is created (if + /// is null) or the elements of are added to . + /// + private static List AddAll(List current, IList extras) + { + if (extras.Count == 0) + { + return current; + } + if (current == null) + { + current = new List(extras); + } + else + { + current.AddRange(extras); + } + return current; + } + + /// + /// Clears the contents of this builder. + /// + public Builder Clear() + { + varintList = null; + fixed32List = null; + fixed64List = null; + lengthDelimitedList = null; + groupList = null; + return this; + } + + /// + /// Adds a varint value. + /// + [CLSCompliant(false)] + public Builder AddVarint(ulong value) + { + varintList = Add(varintList, value); + return this; + } + + /// + /// Adds a fixed32 value. + /// + [CLSCompliant(false)] + public Builder AddFixed32(uint value) + { + fixed32List = Add(fixed32List, value); + return this; + } + + /// + /// Adds a fixed64 value. + /// + [CLSCompliant(false)] + public Builder AddFixed64(ulong value) + { + fixed64List = Add(fixed64List, value); + return this; + } + + /// + /// Adds a length-delimited value. + /// + public Builder AddLengthDelimited(ByteString value) + { + lengthDelimitedList = Add(lengthDelimitedList, value); + return this; + } + + /// + /// Adds an embedded group. + /// + /// + /// + public Builder AddGroup(UnknownFieldSet value) + { + groupList = Add(groupList, value); + return this; + } + + /// + /// Adds to the , creating + /// a new list if is null. The list is returned - either + /// the original reference or the new list. + /// + private static List Add(List list, T value) + { + if (list == null) + { + list = new List(); + } + list.Add(value); + return list; + } + + /// + /// Returns a read-only version of the given IList, and clears + /// the field used for . If the value + /// is null, an empty list is produced using Lists.Empty. + /// + /// + private static ReadOnlyCollection MakeReadOnly(ref List list) + { + ReadOnlyCollection ret = list == null ? Lists.Empty : new ReadOnlyCollection(list); + list = null; + return ret; + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/UnknownFieldSet.cs b/csharp/src/ProtocolBuffers/UnknownFieldSet.cs new file mode 100644 index 00000000..09ed680f --- /dev/null +++ b/csharp/src/ProtocolBuffers/UnknownFieldSet.cs @@ -0,0 +1,1043 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.Collections; +using Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// Used to keep track of fields which were seen when parsing a protocol message + /// but whose field numbers or types are unrecognized. This most frequently + /// occurs when new fields are added to a message type and then messages containing + /// those fields are read by old software that was built before the new types were + /// added. + /// + /// Every message contains an UnknownFieldSet. + /// + /// Most users will never need to use this class directly. + /// + public sealed partial class UnknownFieldSet : IMessageLite + { + private static readonly UnknownFieldSet defaultInstance = + new UnknownFieldSet(new Dictionary()); + + private readonly IDictionary fields; + + private UnknownFieldSet(IDictionary fields) + { + this.fields = fields; + } + + /// + /// Creates a new unknown field set builder. + /// + public static Builder CreateBuilder() + { + return new Builder(); + } + + /// + /// Creates a new unknown field set builder + /// and initialize it from . + /// + public static Builder CreateBuilder(UnknownFieldSet original) + { + return new Builder().MergeFrom(original); + } + + public static UnknownFieldSet DefaultInstance + { + get { return defaultInstance; } + } + + /// + /// Returns a read-only view of the mapping from field numbers to values. + /// + public IDictionary FieldDictionary + { + get { return Dictionaries.AsReadOnly(fields); } + } + + /// + /// Checks whether or not the given field number is present in the set. + /// + public bool HasField(int field) + { + return fields.ContainsKey(field); + } + + /// + /// Fetches a field by number, returning an empty field if not present. + /// Never returns null. + /// + public UnknownField this[int number] + { + get + { + UnknownField ret; + if (!fields.TryGetValue(number, out ret)) + { + ret = UnknownField.DefaultInstance; + } + return ret; + } + } + + /// + /// Serializes the set and writes it to . + /// + public void WriteTo(ICodedOutputStream output) + { + foreach (KeyValuePair entry in fields) + { + entry.Value.WriteTo(entry.Key, output); + } + } + + /// + /// Gets the number of bytes required to encode this set. + /// + public int SerializedSize + { + get + { + int result = 0; + foreach (KeyValuePair entry in fields) + { + result += entry.Value.GetSerializedSize(entry.Key); + } + return result; + } + } + + /// + /// Converts the set to a string in protocol buffer text format. This + /// is just a trivial wrapper around TextFormat.PrintToString. + /// + public override String ToString() + { + return TextFormat.PrintToString(this); + } + + /// + /// Converts the set to a string in protocol buffer text format. This + /// is just a trivial wrapper around TextFormat.PrintToString. + /// + public void PrintTo(TextWriter writer) + { + TextFormat.Print(this, writer); + } + + /// + /// Serializes the message to a ByteString and returns it. This is + /// just a trivial wrapper around WriteTo(ICodedOutputStream). + /// + /// + public ByteString ToByteString() + { + ByteString.CodedBuilder codedBuilder = new ByteString.CodedBuilder(SerializedSize); + WriteTo(codedBuilder.CodedOutput); + return codedBuilder.Build(); + } + + /// + /// Serializes the message to a byte array and returns it. This is + /// just a trivial wrapper around WriteTo(ICodedOutputStream). + /// + /// + public byte[] ToByteArray() + { + byte[] data = new byte[SerializedSize]; + CodedOutputStream output = CodedOutputStream.CreateInstance(data); + WriteTo(output); + output.CheckNoSpaceLeft(); + return data; + } + + /// + /// Serializes the message and writes it to . This is + /// just a trivial wrapper around WriteTo(ICodedOutputStream). + /// + /// + public void WriteTo(Stream output) + { + CodedOutputStream codedOutput = CodedOutputStream.CreateInstance(output); + WriteTo(codedOutput); + codedOutput.Flush(); + } + + /// + /// Serializes the set and writes it to using + /// the MessageSet wire format. + /// + public void WriteAsMessageSetTo(ICodedOutputStream output) + { + foreach (KeyValuePair entry in fields) + { + entry.Value.WriteAsMessageSetExtensionTo(entry.Key, output); + } + } + + /// + /// Gets the number of bytes required to encode this set using the MessageSet + /// wire format. + /// + public int SerializedSizeAsMessageSet + { + get + { + int result = 0; + foreach (KeyValuePair entry in fields) + { + result += entry.Value.GetSerializedSizeAsMessageSetExtension(entry.Key); + } + return result; + } + } + + public override bool Equals(object other) + { + if (ReferenceEquals(this, other)) + { + return true; + } + UnknownFieldSet otherSet = other as UnknownFieldSet; + return otherSet != null && Dictionaries.Equals(fields, otherSet.fields); + } + + public override int GetHashCode() + { + return Dictionaries.GetHashCode(fields); + } + + /// + /// Parses an UnknownFieldSet from the given input. + /// + public static UnknownFieldSet ParseFrom(ICodedInputStream input) + { + return CreateBuilder().MergeFrom(input).Build(); + } + + /// + /// Parses an UnknownFieldSet from the given data. + /// + public static UnknownFieldSet ParseFrom(ByteString data) + { + return CreateBuilder().MergeFrom(data).Build(); + } + + /// + /// Parses an UnknownFieldSet from the given data. + /// + public static UnknownFieldSet ParseFrom(byte[] data) + { + return CreateBuilder().MergeFrom(data).Build(); + } + + /// + /// Parses an UnknownFieldSet from the given input. + /// + public static UnknownFieldSet ParseFrom(Stream input) + { + return CreateBuilder().MergeFrom(input).Build(); + } + + #region IMessageLite Members + + public bool IsInitialized + { + get { return fields != null; } + } + + public void WriteDelimitedTo(Stream output) + { + CodedOutputStream codedOutput = CodedOutputStream.CreateInstance(output); + codedOutput.WriteRawVarint32((uint) SerializedSize); + WriteTo(codedOutput); + codedOutput.Flush(); + } + + public IBuilderLite WeakCreateBuilderForType() + { + return new Builder(); + } + + public IBuilderLite WeakToBuilder() + { + return new Builder(fields); + } + + public IMessageLite WeakDefaultInstanceForType + { + get { return defaultInstance; } + } + + #endregion + + /// + /// Builder for UnknownFieldSets. + /// + public sealed partial class Builder : IBuilderLite + { + /// + /// Mapping from number to field. Note that by using a SortedList we ensure + /// that the fields will be serialized in ascending order. + /// + private IDictionary fields; + + // Optimization: We keep around a builder for the last field that was + // modified so that we can efficiently add to it multiple times in a + // row (important when parsing an unknown repeated field). + private int lastFieldNumber; + private UnknownField.Builder lastField; + + internal Builder() + { + fields = new SortedList(); + } + + internal Builder(IDictionary dictionary) + { + fields = new SortedList(dictionary); + } + + /// + /// Returns a field builder for the specified field number, including any values + /// which already exist. + /// + private UnknownField.Builder GetFieldBuilder(int number) + { + if (lastField != null) + { + if (number == lastFieldNumber) + { + return lastField; + } + // Note: AddField() will reset lastField and lastFieldNumber. + AddField(lastFieldNumber, lastField.Build()); + } + if (number == 0) + { + return null; + } + + lastField = UnknownField.CreateBuilder(); + UnknownField existing; + if (fields.TryGetValue(number, out existing)) + { + lastField.MergeFrom(existing); + } + lastFieldNumber = number; + return lastField; + } + + /// + /// Build the UnknownFieldSet and return it. Once this method has been called, + /// this instance will no longer be usable. Calling any method after this + /// will throw a NullReferenceException. + /// + public UnknownFieldSet Build() + { + GetFieldBuilder(0); // Force lastField to be built. + UnknownFieldSet result = fields.Count == 0 ? DefaultInstance : new UnknownFieldSet(fields); + fields = null; + return result; + } + + /// + /// Adds a field to the set. If a field with the same number already exists, it + /// is replaced. + /// + public Builder AddField(int number, UnknownField field) + { + if (number == 0) + { + throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number."); + } + if (lastField != null && lastFieldNumber == number) + { + // Discard this. + lastField = null; + lastFieldNumber = 0; + } + fields[number] = field; + return this; + } + + /// + /// Resets the builder to an empty set. + /// + public Builder Clear() + { + fields.Clear(); + lastFieldNumber = 0; + lastField = null; + return this; + } + + /// + /// Parse an entire message from and merge + /// its fields into this set. + /// + public Builder MergeFrom(ICodedInputStream input) + { + uint tag; + string name; + while (input.ReadTag(out tag, out name)) + { + if (tag == 0) + { + if (input.SkipField()) + { + continue; //can't merge unknown without field tag + } + break; + } + + if (!MergeFieldFrom(tag, input)) + { + break; + } + } + return this; + } + + /// + /// Parse a single field from and merge it + /// into this set. + /// + /// The field's tag number, which was already parsed. + /// The coded input stream containing the field + /// false if the tag is an "end group" tag, true otherwise + [CLSCompliant(false)] + public bool MergeFieldFrom(uint tag, ICodedInputStream input) + { + if (tag == 0) + { + input.SkipField(); + return true; + } + + int number = WireFormat.GetTagFieldNumber(tag); + switch (WireFormat.GetTagWireType(tag)) + { + case WireFormat.WireType.Varint: + { + ulong uint64 = 0; + if (input.ReadUInt64(ref uint64)) + { + GetFieldBuilder(number).AddVarint(uint64); + } + return true; + } + case WireFormat.WireType.Fixed32: + { + uint uint32 = 0; + if (input.ReadFixed32(ref uint32)) + { + GetFieldBuilder(number).AddFixed32(uint32); + } + return true; + } + case WireFormat.WireType.Fixed64: + { + ulong uint64 = 0; + if (input.ReadFixed64(ref uint64)) + { + GetFieldBuilder(number).AddFixed64(uint64); + } + return true; + } + case WireFormat.WireType.LengthDelimited: + { + ByteString bytes = null; + if (input.ReadBytes(ref bytes)) + { + GetFieldBuilder(number).AddLengthDelimited(bytes); + } + return true; + } + case WireFormat.WireType.StartGroup: + { + Builder subBuilder = CreateBuilder(); +#pragma warning disable 0612 + input.ReadUnknownGroup(number, subBuilder); +#pragma warning restore 0612 + GetFieldBuilder(number).AddGroup(subBuilder.Build()); + return true; + } + case WireFormat.WireType.EndGroup: + return false; + default: + throw InvalidProtocolBufferException.InvalidWireType(); + } + } + + /// + /// Parses as an UnknownFieldSet and merge it + /// with the set being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream). + /// + public Builder MergeFrom(Stream input) + { + CodedInputStream codedInput = CodedInputStream.CreateInstance(input); + MergeFrom(codedInput); + codedInput.CheckLastTagWas(0); + return this; + } + + /// + /// Parses as an UnknownFieldSet and merge it + /// with the set being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream). + /// + public Builder MergeFrom(ByteString data) + { + CodedInputStream input = data.CreateCodedInput(); + MergeFrom(input); + input.CheckLastTagWas(0); + return this; + } + + /// + /// Parses as an UnknownFieldSet and merge it + /// with the set being built. This is just a small wrapper around + /// MergeFrom(ICodedInputStream). + /// + public Builder MergeFrom(byte[] data) + { + CodedInputStream input = CodedInputStream.CreateInstance(data); + MergeFrom(input); + input.CheckLastTagWas(0); + return this; + } + + /// + /// Convenience method for merging a new field containing a single varint + /// value. This is used in particular when an unknown enum value is + /// encountered. + /// + [CLSCompliant(false)] + public Builder MergeVarintField(int number, ulong value) + { + if (number == 0) + { + throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number."); + } + GetFieldBuilder(number).AddVarint(value); + return this; + } + + /// + /// Merges the fields from into this set. + /// If a field number exists in both sets, the values in + /// will be appended to the values in this set. + /// + public Builder MergeFrom(UnknownFieldSet other) + { + if (other != DefaultInstance) + { + foreach (KeyValuePair entry in other.fields) + { + MergeField(entry.Key, entry.Value); + } + } + return this; + } + + /// + /// Checks if the given field number is present in the set. + /// + public bool HasField(int number) + { + if (number == 0) + { + throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number."); + } + return number == lastFieldNumber || fields.ContainsKey(number); + } + + /// + /// Adds a field to the unknown field set. If a field with the same + /// number already exists, the two are merged. + /// + public Builder MergeField(int number, UnknownField field) + { + if (number == 0) + { + throw new ArgumentOutOfRangeException("number", "Zero is not a valid field number."); + } + if (HasField(number)) + { + GetFieldBuilder(number).MergeFrom(field); + } + else + { + // Optimization: We could call getFieldBuilder(number).mergeFrom(field) + // in this case, but that would create a copy of the Field object. + // We'd rather reuse the one passed to us, so call AddField() instead. + AddField(number, field); + } + return this; + } + + internal void MergeFrom(ICodedInputStream input, ExtensionRegistry extensionRegistry, IBuilder builder) + { + uint tag; + string name; + while (input.ReadTag(out tag, out name)) + { + if (tag == 0 && name != null) + { + FieldDescriptor fieldByName = builder.DescriptorForType.FindFieldByName(name); + if (fieldByName != null) + { + tag = WireFormat.MakeTag(fieldByName); + } + else + { + ExtensionInfo extension = extensionRegistry.FindByName(builder.DescriptorForType, name); + if (extension != null) + { + tag = WireFormat.MakeTag(extension.Descriptor); + } + } + } + if (tag == 0) + { + if (input.SkipField()) + { + continue; //can't merge unknown without field tag + } + break; + } + + if (!MergeFieldFrom(input, extensionRegistry, builder, tag, name)) + { + // end group tag + break; + } + } + } + + /// + /// Like + /// but parses a single field. + /// + /// The input to read the field from + /// Registry to use when an extension field is encountered + /// Builder to merge field into, if it's a known field + /// The tag, which should already have been read from the input + /// true unless the tag is an end-group tag + internal bool MergeFieldFrom(ICodedInputStream input, + ExtensionRegistry extensionRegistry, IBuilder builder, uint tag, + string fieldName) + { + if (tag == 0 && fieldName != null) + { + FieldDescriptor fieldByName = builder.DescriptorForType.FindFieldByName(fieldName); + if (fieldByName != null) + { + tag = WireFormat.MakeTag(fieldByName); + } + else + { + ExtensionInfo extension = extensionRegistry.FindByName(builder.DescriptorForType, fieldName); + if (extension != null) + { + tag = WireFormat.MakeTag(extension.Descriptor); + } + } + } + + MessageDescriptor type = builder.DescriptorForType; + if (type.Options.MessageSetWireFormat && tag == WireFormat.MessageSetTag.ItemStart) + { + MergeMessageSetExtensionFromCodedStream(input, extensionRegistry, builder); + return true; + } + + WireFormat.WireType wireType = WireFormat.GetTagWireType(tag); + int fieldNumber = WireFormat.GetTagFieldNumber(tag); + + FieldDescriptor field; + IMessageLite defaultFieldInstance = null; + + if (type.IsExtensionNumber(fieldNumber)) + { + ExtensionInfo extension = extensionRegistry[type, fieldNumber]; + if (extension == null) + { + field = null; + } + else + { + field = extension.Descriptor; + defaultFieldInstance = extension.DefaultInstance; + } + } + else + { + field = type.FindFieldByNumber(fieldNumber); + } + + // Unknown field or wrong wire type. Skip. + if (field == null) + { + return MergeFieldFrom(tag, input); + } + if (wireType != WireFormat.GetWireType(field)) + { + WireFormat.WireType expectedType = WireFormat.GetWireType(field.FieldType); + if (wireType == expectedType) + { + //Allowed as of 2.3, this is unpacked data for a packed array + } + else if (field.IsRepeated && wireType == WireFormat.WireType.LengthDelimited && + (expectedType == WireFormat.WireType.Varint || expectedType == WireFormat.WireType.Fixed32 || + expectedType == WireFormat.WireType.Fixed64)) + { + //Allowed as of 2.3, this is packed data for an unpacked array + } + else + { + return MergeFieldFrom(tag, input); + } + } + + switch (field.FieldType) + { + case FieldType.Group: + case FieldType.Message: + { + IBuilderLite subBuilder = (defaultFieldInstance != null) + ? defaultFieldInstance.WeakCreateBuilderForType() + : builder.CreateBuilderForField(field); + if (!field.IsRepeated) + { + subBuilder.WeakMergeFrom((IMessageLite) builder[field]); + if (field.FieldType == FieldType.Group) + { + input.ReadGroup(field.FieldNumber, subBuilder, extensionRegistry); + } + else + { + input.ReadMessage(subBuilder, extensionRegistry); + } + builder[field] = subBuilder.WeakBuild(); + } + else + { + List list = new List(); + if (field.FieldType == FieldType.Group) + { + input.ReadGroupArray(tag, fieldName, list, subBuilder.WeakDefaultInstanceForType, + extensionRegistry); + } + else + { + input.ReadMessageArray(tag, fieldName, list, subBuilder.WeakDefaultInstanceForType, + extensionRegistry); + } + + foreach (IMessageLite m in list) + { + builder.WeakAddRepeatedField(field, m); + } + return true; + } + break; + } + case FieldType.Enum: + { + if (!field.IsRepeated) + { + object unknown; + IEnumLite value = null; + if (input.ReadEnum(ref value, out unknown, field.EnumType)) + { + builder[field] = value; + } + else if (unknown is int) + { + MergeVarintField(fieldNumber, (ulong) (int) unknown); + } + } + else + { + ICollection unknown; + List list = new List(); + input.ReadEnumArray(tag, fieldName, list, out unknown, field.EnumType); + + foreach (IEnumLite en in list) + { + builder.WeakAddRepeatedField(field, en); + } + + if (unknown != null) + { + foreach (object oval in unknown) + { + if (oval is int) + { + MergeVarintField(fieldNumber, (ulong) (int) oval); + } + } + } + } + break; + } + default: + { + if (!field.IsRepeated) + { + object value = null; + if (input.ReadPrimitiveField(field.FieldType, ref value)) + { + builder[field] = value; + } + } + else + { + List list = new List(); + input.ReadPrimitiveArray(field.FieldType, tag, fieldName, list); + foreach (object oval in list) + { + builder.WeakAddRepeatedField(field, oval); + } + } + break; + } + } + return true; + } + + /// + /// Called by MergeFieldFrom to parse a MessageSet extension. + /// + private void MergeMessageSetExtensionFromCodedStream(ICodedInputStream input, + ExtensionRegistry extensionRegistry, IBuilder builder) + { + MessageDescriptor type = builder.DescriptorForType; + + // The wire format for MessageSet is: + // message MessageSet { + // repeated group Item = 1 { + // required int32 typeId = 2; + // required bytes message = 3; + // } + // } + // "typeId" is the extension's field number. The extension can only be + // a message type, where "message" contains the encoded bytes of that + // message. + // + // In practice, we will probably never see a MessageSet item in which + // the message appears before the type ID, or where either field does not + // appear exactly once. However, in theory such cases are valid, so we + // should be prepared to accept them. + + int typeId = 0; + ByteString rawBytes = null; // If we encounter "message" before "typeId" + IBuilderLite subBuilder = null; + FieldDescriptor field = null; + + uint lastTag = WireFormat.MessageSetTag.ItemStart; + uint tag; + string name; + while (input.ReadTag(out tag, out name)) + { + if (tag == 0 && name != null) + { + if (name == "type_id") + { + tag = WireFormat.MessageSetTag.TypeID; + } + else if (name == "message") + { + tag = WireFormat.MessageSetTag.Message; + } + } + if (tag == 0) + { + if (input.SkipField()) + { + continue; //can't merge unknown without field tag + } + break; + } + + lastTag = tag; + if (tag == WireFormat.MessageSetTag.TypeID) + { + typeId = 0; + // Zero is not a valid type ID. + if (input.ReadInt32(ref typeId) && typeId != 0) + { + ExtensionInfo extension = extensionRegistry[type, typeId]; + if (extension != null) + { + field = extension.Descriptor; + subBuilder = extension.DefaultInstance.WeakCreateBuilderForType(); + IMessageLite originalMessage = (IMessageLite) builder[field]; + if (originalMessage != null) + { + subBuilder.WeakMergeFrom(originalMessage); + } + if (rawBytes != null) + { + // We already encountered the message. Parse it now. + // TODO(jonskeet): Check this is okay. It's subtly different from the Java, as it doesn't create an input stream from rawBytes. + // In fact, why don't we just call MergeFrom(rawBytes)? And what about the extension registry? + subBuilder.WeakMergeFrom(rawBytes.CreateCodedInput()); + rawBytes = null; + } + } + else + { + // Unknown extension number. If we already saw data, put it + // in rawBytes. + if (rawBytes != null) + { + MergeField(typeId, UnknownField.CreateBuilder().AddLengthDelimited(rawBytes).Build()); + rawBytes = null; + } + } + } + } + else if (tag == WireFormat.MessageSetTag.Message) + { + if (subBuilder != null) + { + // We already know the type, so we can parse directly from the input + // with no copying. Hooray! + input.ReadMessage(subBuilder, extensionRegistry); + } + else if (input.ReadBytes(ref rawBytes)) + { + if (typeId != 0) + { + // We don't know how to parse this. Ignore it. + MergeField(typeId, + UnknownField.CreateBuilder().AddLengthDelimited(rawBytes).Build()); + } + } + } + else + { + // Unknown tag. Skip it. + if (!input.SkipField()) + { + break; // end of group + } + } + } + + if (lastTag != WireFormat.MessageSetTag.ItemEnd) + { + throw InvalidProtocolBufferException.InvalidEndTag(); + } + + if (subBuilder != null) + { + builder[field] = subBuilder.WeakBuild(); + } + } + + #region IBuilderLite Members + + bool IBuilderLite.IsInitialized + { + get { return fields != null; } + } + + IBuilderLite IBuilderLite.WeakClear() + { + return Clear(); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(IMessageLite message) + { + return MergeFrom((UnknownFieldSet) message); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(ByteString data) + { + return MergeFrom(data); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(ByteString data, ExtensionRegistry registry) + { + return MergeFrom(data); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(ICodedInputStream input) + { + return MergeFrom(input); + } + + IBuilderLite IBuilderLite.WeakMergeFrom(ICodedInputStream input, ExtensionRegistry registry) + { + return MergeFrom(input); + } + + IMessageLite IBuilderLite.WeakBuild() + { + return Build(); + } + + IMessageLite IBuilderLite.WeakBuildPartial() + { + return Build(); + } + + IBuilderLite IBuilderLite.WeakClone() + { + return Build().WeakToBuilder(); + } + + IMessageLite IBuilderLite.WeakDefaultInstanceForType + { + get { return DefaultInstance; } + } + + #endregion + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffers/WireFormat.cs b/csharp/src/ProtocolBuffers/WireFormat.cs new file mode 100644 index 00000000..a03f1652 --- /dev/null +++ b/csharp/src/ProtocolBuffers/WireFormat.cs @@ -0,0 +1,192 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers.Descriptors; + +namespace Google.ProtocolBuffers +{ + /// + /// This class is used internally by the Protocol Buffer Library and generated + /// message implementations. It is public only for the sake of those generated + /// messages. Others should not use this class directly. + /// + /// This class contains constants and helper functions useful for dealing with + /// the Protocol Buffer wire format. + /// + /// + public static class WireFormat + { + #region Fixed sizes. + + // TODO(jonskeet): Move these somewhere else. They're messy. Consider making FieldType a smarter kind of enum + public const int Fixed32Size = 4; + public const int Fixed64Size = 8; + public const int SFixed32Size = 4; + public const int SFixed64Size = 8; + public const int FloatSize = 4; + public const int DoubleSize = 8; + public const int BoolSize = 1; + + #endregion + + [CLSCompliant(false)] + public enum WireType : uint + { + Varint = 0, + Fixed64 = 1, + LengthDelimited = 2, + StartGroup = 3, + EndGroup = 4, + Fixed32 = 5 + } + + internal static class MessageSetField + { + internal const int Item = 1; + internal const int TypeID = 2; + internal const int Message = 3; + } + + internal static class MessageSetTag + { + internal static readonly uint ItemStart = MakeTag(MessageSetField.Item, WireType.StartGroup); + internal static readonly uint ItemEnd = MakeTag(MessageSetField.Item, WireType.EndGroup); + internal static readonly uint TypeID = MakeTag(MessageSetField.TypeID, WireType.Varint); + internal static readonly uint Message = MakeTag(MessageSetField.Message, WireType.LengthDelimited); + } + + private const int TagTypeBits = 3; + private const uint TagTypeMask = (1 << TagTypeBits) - 1; + + /// + /// Given a tag value, determines the wire type (lower 3 bits). + /// + [CLSCompliant(false)] + public static WireType GetTagWireType(uint tag) + { + return (WireType) (tag & TagTypeMask); + } + + [CLSCompliant(false)] + public static bool IsEndGroupTag(uint tag) + { + return (WireType) (tag & TagTypeMask) == WireType.EndGroup; + } + + /// + /// Given a tag value, determines the field number (the upper 29 bits). + /// + [CLSCompliant(false)] + public static int GetTagFieldNumber(uint tag) + { + return (int) tag >> TagTypeBits; + } + + /// + /// Makes a tag value given a field number and wire type. + /// TODO(jonskeet): Should we just have a Tag structure? + /// + [CLSCompliant(false)] + public static uint MakeTag(int fieldNumber, WireType wireType) + { + return (uint) (fieldNumber << TagTypeBits) | (uint) wireType; + } + +#if !LITE + [CLSCompliant(false)] + public static uint MakeTag(FieldDescriptor field) + { + return MakeTag(field.FieldNumber, GetWireType(field)); + } + + /// + /// Returns the wire type for the given field descriptor. This differs + /// from GetWireType(FieldType) for packed repeated fields. + /// + internal static WireType GetWireType(FieldDescriptor descriptor) + { + return descriptor.IsPacked ? WireType.LengthDelimited : GetWireType(descriptor.FieldType); + } + +#endif + + /// + /// Converts a field type to its wire type. Done with a switch for the sake + /// of speed - this is significantly faster than a dictionary lookup. + /// + [CLSCompliant(false)] + public static WireType GetWireType(FieldType fieldType) + { + switch (fieldType) + { + case FieldType.Double: + return WireType.Fixed64; + case FieldType.Float: + return WireType.Fixed32; + case FieldType.Int64: + case FieldType.UInt64: + case FieldType.Int32: + return WireType.Varint; + case FieldType.Fixed64: + return WireType.Fixed64; + case FieldType.Fixed32: + return WireType.Fixed32; + case FieldType.Bool: + return WireType.Varint; + case FieldType.String: + return WireType.LengthDelimited; + case FieldType.Group: + return WireType.StartGroup; + case FieldType.Message: + case FieldType.Bytes: + return WireType.LengthDelimited; + case FieldType.UInt32: + return WireType.Varint; + case FieldType.SFixed32: + return WireType.Fixed32; + case FieldType.SFixed64: + return WireType.Fixed64; + case FieldType.SInt32: + case FieldType.SInt64: + case FieldType.Enum: + return WireType.Varint; + default: + throw new ArgumentOutOfRangeException("No such field type"); + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLibrary.CF20.sln b/csharp/src/ProtocolBuffersLibrary.CF20.sln new file mode 100644 index 00000000..7f1836fe --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.CF20.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.CF20.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.CF20.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.CF20.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.CF20.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.CF20.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.CF20.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.CF20.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLibrary.CF35.sln b/csharp/src/ProtocolBuffersLibrary.CF35.sln new file mode 100644 index 00000000..d83e22c1 --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.CF35.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.CF35.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.CF35.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.CF35.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.CF35.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.CF35.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.CF35.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.CF35.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLibrary.NET20.sln b/csharp/src/ProtocolBuffersLibrary.NET20.sln new file mode 100644 index 00000000..2de8ed21 --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.NET20.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.NET20.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.NET20.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.NET20.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.NET20.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.NET20.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.NET20.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.NET20.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLibrary.NET35.sln b/csharp/src/ProtocolBuffersLibrary.NET35.sln new file mode 100644 index 00000000..639ab170 --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.NET35.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.NET35.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.NET35.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.NET35.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.NET35.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.NET35.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.NET35.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.NET35.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLibrary.NET40.sln b/csharp/src/ProtocolBuffersLibrary.NET40.sln new file mode 100644 index 00000000..84926456 --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.NET40.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.NET40.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.NET40.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.NET40.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.NET40.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.NET40.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.NET40.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.NET40.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLibrary.PL40.sln b/csharp/src/ProtocolBuffersLibrary.PL40.sln new file mode 100644 index 00000000..aca83c2e --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.PL40.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.PL40.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.PL40.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.PL40.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.PL40.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.PL40.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.PL40.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.PL40.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLibrary.SL20.sln b/csharp/src/ProtocolBuffersLibrary.SL20.sln new file mode 100644 index 00000000..bba4adad --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.SL20.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.SL20.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.SL20.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.SL20.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.SL20.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.SL20.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.SL20.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.SL20.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLibrary.SL30.sln b/csharp/src/ProtocolBuffersLibrary.SL30.sln new file mode 100644 index 00000000..080c22ea --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.SL30.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.SL30.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.SL30.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.SL30.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.SL30.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.SL30.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.SL30.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.SL30.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLibrary.SL40.sln b/csharp/src/ProtocolBuffersLibrary.SL40.sln new file mode 100644 index 00000000..01ea5748 --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.SL40.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.SL40.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.SL40.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.SL40.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.SL40.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.SL40.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.SL40.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.SL40.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLibrary.sln b/csharp/src/ProtocolBuffersLibrary.sln new file mode 100644 index 00000000..c91314a0 --- /dev/null +++ b/csharp/src/ProtocolBuffersLibrary.sln @@ -0,0 +1,55 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers", "ProtocolBuffers\ProtocolBuffers.csproj", "{6908BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite", "ProtocolBuffers\ProtocolBuffersLite.csproj", "{6969BDCE-D925-43F3-94AC-A531E6DF2591}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffers.Serialization.csproj", "{231391AF-449C-4A39-986C-AD7F270F4750}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Serialization", "ProtocolBuffers.Serialization\ProtocolBuffersLite.Serialization.csproj", "{E067A59D-9D0A-4A1F-92B1-38E4457241D1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffers.Test", "ProtocolBuffers.Test\ProtocolBuffers.Test.csproj", "{DD01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLite.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLite.Test.csproj", "{EE01ED24-3750-4567-9A23-1DB676A15610}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtocolBuffersLiteMixed.Test", "ProtocolBuffersLite.Test\ProtocolBuffersLiteMixed.Test.csproj", "{EEFFED24-3750-4567-9A23-1DB676A15610}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6908BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6969BDCE-D925-43F3-94AC-A531E6DF2591}.Release|Any CPU.Build.0 = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Debug|Any CPU.Build.0 = Debug|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.ActiveCfg = Release|Any CPU + {231391AF-449C-4A39-986C-AD7F270F4750}.Release|Any CPU.Build.0 = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E067A59D-9D0A-4A1F-92B1-38E4457241D1}.Release|Any CPU.Build.0 = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE01ED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EEFFED24-3750-4567-9A23-1DB676A15610}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/csharp/src/ProtocolBuffersLite.Test/AbstractBuilderLiteTest.cs b/csharp/src/ProtocolBuffersLite.Test/AbstractBuilderLiteTest.cs new file mode 100644 index 00000000..66791afb --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/AbstractBuilderLiteTest.cs @@ -0,0 +1,340 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class AbstractBuilderLiteTest + { + [TestMethod] + public void TestMergeFromCodedInputStream() + { + TestAllTypesLite copy, + msg = TestAllTypesLite.CreateBuilder() + .SetOptionalUint32(uint.MaxValue).Build(); + + copy = TestAllTypesLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + using (MemoryStream ms = new MemoryStream(msg.ToByteArray())) + { + CodedInputStream ci = CodedInputStream.CreateInstance(ms); + copy = copy.ToBuilder().MergeFrom(ci).Build(); + } + + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestIBuilderLiteWeakClear() + { + TestAllTypesLite copy, msg = TestAllTypesLite.DefaultInstance; + + copy = msg.ToBuilder().SetOptionalString("Should be removed.").Build(); + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + copy = (TestAllTypesLite) ((IBuilderLite) copy.ToBuilder()).WeakClear().WeakBuild(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestBuilderLiteMergeFromCodedInputStream() + { + TestAllTypesLite copy, + msg = TestAllTypesLite.CreateBuilder() + .SetOptionalString("Should be merged.").Build(); + + copy = TestAllTypesLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + copy = + copy.ToBuilder().MergeFrom(CodedInputStream.CreateInstance(new MemoryStream(msg.ToByteArray()))).Build(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestBuilderLiteMergeDelimitedFrom() + { + TestAllTypesLite copy, + msg = TestAllTypesLite.CreateBuilder() + .SetOptionalString("Should be merged.").Build(); + + copy = TestAllTypesLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + Stream s = new MemoryStream(); + msg.WriteDelimitedTo(s); + s.Position = 0; + copy = copy.ToBuilder().MergeDelimitedFrom(s).Build(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestBuilderLiteMergeDelimitedFromExtensions() + { + TestAllExtensionsLite copy, + msg = TestAllExtensionsLite.CreateBuilder() + .SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, + "Should be merged.").Build(); + + copy = TestAllExtensionsLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + Stream s = new MemoryStream(); + msg.WriteDelimitedTo(s); + s.Position = 0; + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestLiteProtoFile.RegisterAllExtensions(registry); + + copy = copy.ToBuilder().MergeDelimitedFrom(s, registry).Build(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + Assert.AreEqual("Should be merged.", copy.GetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite)); + } + + [TestMethod] + public void TestBuilderLiteMergeFromStream() + { + TestAllTypesLite copy, + msg = TestAllTypesLite.CreateBuilder() + .SetOptionalString("Should be merged.").Build(); + + copy = TestAllTypesLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + Stream s = new MemoryStream(); + msg.WriteTo(s); + s.Position = 0; + copy = copy.ToBuilder().MergeFrom(s).Build(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestBuilderLiteMergeFromStreamExtensions() + { + TestAllExtensionsLite copy, + msg = TestAllExtensionsLite.CreateBuilder() + .SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, + "Should be merged.").Build(); + + copy = TestAllExtensionsLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + Stream s = new MemoryStream(); + msg.WriteTo(s); + s.Position = 0; + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestLiteProtoFile.RegisterAllExtensions(registry); + + copy = copy.ToBuilder().MergeFrom(s, registry).Build(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + Assert.AreEqual("Should be merged.", copy.GetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite)); + } + + [TestMethod] + public void TestIBuilderLiteWeakMergeFromIMessageLite() + { + TestAllTypesLite copy, + msg = TestAllTypesLite.CreateBuilder() + .SetOptionalString("Should be merged.").Build(); + + copy = TestAllTypesLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + copy = (TestAllTypesLite) ((IBuilderLite) copy.ToBuilder()).WeakMergeFrom((IMessageLite) msg).WeakBuild(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestIBuilderLiteWeakMergeFromByteString() + { + TestAllTypesLite copy, + msg = TestAllTypesLite.CreateBuilder() + .SetOptionalString("Should be merged.").Build(); + + copy = TestAllTypesLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + copy = (TestAllTypesLite) ((IBuilderLite) copy.ToBuilder()).WeakMergeFrom(msg.ToByteString()).WeakBuild(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestIBuilderLiteWeakMergeFromByteStringExtensions() + { + TestAllExtensionsLite copy, + msg = TestAllExtensionsLite.CreateBuilder() + .SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, + "Should be merged.").Build(); + + copy = TestAllExtensionsLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + copy = + (TestAllExtensionsLite) + ((IBuilderLite) copy.ToBuilder()).WeakMergeFrom(msg.ToByteString(), ExtensionRegistry.Empty).WeakBuild(); + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestLiteProtoFile.RegisterAllExtensions(registry); + + copy = + (TestAllExtensionsLite) + ((IBuilderLite) copy.ToBuilder()).WeakMergeFrom(msg.ToByteString(), registry).WeakBuild(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + Assert.AreEqual("Should be merged.", copy.GetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite)); + } + + [TestMethod] + public void TestIBuilderLiteWeakMergeFromCodedInputStream() + { + TestAllTypesLite copy, + msg = TestAllTypesLite.CreateBuilder() + .SetOptionalUint32(uint.MaxValue).Build(); + + copy = TestAllTypesLite.DefaultInstance; + Assert.AreNotEqual(msg.ToByteArray(), copy.ToByteArray()); + + using (MemoryStream ms = new MemoryStream(msg.ToByteArray())) + { + CodedInputStream ci = CodedInputStream.CreateInstance(ms); + copy = (TestAllTypesLite) ((IBuilderLite) copy.ToBuilder()).WeakMergeFrom(ci).WeakBuild(); + } + + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestIBuilderLiteWeakBuildPartial() + { + IBuilderLite builder = TestRequiredLite.CreateBuilder(); + Assert.IsFalse(builder.IsInitialized); + + IMessageLite msg = builder.WeakBuildPartial(); + Assert.IsFalse(msg.IsInitialized); + + TestUtil.AssertBytesEqual(msg.ToByteArray(), TestRequiredLite.DefaultInstance.ToByteArray()); + } + + [TestMethod, ExpectedException(typeof(UninitializedMessageException))] + public void TestIBuilderLiteWeakBuildUninitialized() + { + IBuilderLite builder = TestRequiredLite.CreateBuilder(); + Assert.IsFalse(builder.IsInitialized); + builder.WeakBuild(); + } + + [TestMethod] + public void TestIBuilderLiteWeakBuild() + { + IBuilderLite builder = TestRequiredLite.CreateBuilder() + .SetD(0) + .SetEn(ExtraEnum.EXLITE_BAZ); + Assert.IsTrue(builder.IsInitialized); + builder.WeakBuild(); + } + + [TestMethod] + public void TestIBuilderLiteWeakClone() + { + TestRequiredLite msg = TestRequiredLite.CreateBuilder() + .SetD(1).SetEn(ExtraEnum.EXLITE_BAR).Build(); + Assert.IsTrue(msg.IsInitialized); + + IMessageLite copy = ((IBuilderLite) msg.ToBuilder()).WeakClone().WeakBuild(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestIBuilderLiteWeakDefaultInstance() + { + Assert.IsTrue(ReferenceEquals(TestRequiredLite.DefaultInstance, + ((IBuilderLite) TestRequiredLite.CreateBuilder()).WeakDefaultInstanceForType)); + } + + [TestMethod] + public void TestGeneratedBuilderLiteAddRange() + { + TestAllTypesLite copy, + msg = TestAllTypesLite.CreateBuilder() + .SetOptionalUint32(123) + .AddRepeatedInt32(1) + .AddRepeatedInt32(2) + .AddRepeatedInt32(3) + .Build(); + + copy = msg.DefaultInstanceForType.ToBuilder().MergeFrom(msg).Build(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + // ROK 5/7/2013 Issue #54: should retire all bytes in buffer (bufferSize) + [TestMethod] + public void TestBufferRefillIssue() + { + var ms = new MemoryStream(); + BucketOfBytes.CreateBuilder() + .SetValue(ByteString.CopyFrom(new byte[3000])) + .Build().WriteDelimitedTo(ms); + BucketOfBytesEx.CreateBuilder() + .SetValue(ByteString.CopyFrom(new byte[1000])) + .SetValue2(ByteString.CopyFrom(new byte[1100])) + .Build().WriteDelimitedTo(ms); + BucketOfBytes.CreateBuilder() + .SetValue(ByteString.CopyFrom(new byte[100])) + .Build().WriteDelimitedTo(ms); + + ms.Position = 0; + var input = CodedInputStream.CreateInstance(ms); + var builder = BucketOfBytes.CreateBuilder(); + input.ReadMessage(builder, ExtensionRegistry.Empty); + Assert.AreEqual(3005L, input.Position); + Assert.AreEqual(3000, builder.Value.Length); + input.ReadMessage(builder, ExtensionRegistry.Empty); + Assert.AreEqual(5114, input.Position); + Assert.AreEqual(1000, builder.Value.Length); + input.ReadMessage(builder, ExtensionRegistry.Empty); + Assert.AreEqual(5217L, input.Position); + Assert.AreEqual(input.Position, ms.Length); + Assert.AreEqual(100, builder.Value.Length); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/AbstractMessageLiteTest.cs b/csharp/src/ProtocolBuffersLite.Test/AbstractMessageLiteTest.cs new file mode 100644 index 00000000..bead60fb --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/AbstractMessageLiteTest.cs @@ -0,0 +1,136 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class AbstractMessageLiteTest + { + [TestMethod] + public void TestMessageLiteToByteString() + { + TestRequiredLite msg = TestRequiredLite.CreateBuilder() + .SetD(42) + .SetEn(ExtraEnum.EXLITE_BAZ) + .Build(); + + ByteString b = msg.ToByteString(); + Assert.AreEqual(4, b.Length); + Assert.AreEqual(TestRequiredLite.DFieldNumber << 3, b[0]); + Assert.AreEqual(42, b[1]); + Assert.AreEqual(TestRequiredLite.EnFieldNumber << 3, b[2]); + Assert.AreEqual((int) ExtraEnum.EXLITE_BAZ, b[3]); + } + + [TestMethod] + public void TestMessageLiteToByteArray() + { + TestRequiredLite msg = TestRequiredLite.CreateBuilder() + .SetD(42) + .SetEn(ExtraEnum.EXLITE_BAZ) + .Build(); + + ByteString b = msg.ToByteString(); + ByteString copy = ByteString.CopyFrom(msg.ToByteArray()); + Assert.AreEqual(b, copy); + } + + [TestMethod] + public void TestMessageLiteWriteTo() + { + TestRequiredLite msg = TestRequiredLite.CreateBuilder() + .SetD(42) + .SetEn(ExtraEnum.EXLITE_BAZ) + .Build(); + + MemoryStream ms = new MemoryStream(); + msg.WriteTo(ms); + TestUtil.AssertBytesEqual(msg.ToByteArray(), ms.ToArray()); + } + + [TestMethod] + public void TestMessageLiteWriteDelimitedTo() + { + TestRequiredLite msg = TestRequiredLite.CreateBuilder() + .SetD(42) + .SetEn(ExtraEnum.EXLITE_BAZ) + .Build(); + + MemoryStream ms = new MemoryStream(); + msg.WriteDelimitedTo(ms); + byte[] buffer = ms.ToArray(); + + Assert.AreEqual(5, buffer.Length); + Assert.AreEqual(4, buffer[0]); + byte[] msgBytes = new byte[4]; + Array.Copy(buffer, 1, msgBytes, 0, 4); + TestUtil.AssertBytesEqual(msg.ToByteArray(), msgBytes); + } + + [TestMethod] + public void TestIMessageLiteWeakCreateBuilderForType() + { + IMessageLite msg = TestRequiredLite.DefaultInstance; + Assert.AreEqual(typeof(TestRequiredLite.Builder), msg.WeakCreateBuilderForType().GetType()); + } + + [TestMethod] + public void TestMessageLiteWeakToBuilder() + { + IMessageLite msg = TestRequiredLite.CreateBuilder() + .SetD(42) + .SetEn(ExtraEnum.EXLITE_BAZ) + .Build(); + + IMessageLite copy = msg.WeakToBuilder().WeakBuild(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestMessageLiteWeakDefaultInstanceForType() + { + IMessageLite msg = TestRequiredLite.DefaultInstance; + Assert.IsTrue(Object.ReferenceEquals(TestRequiredLite.DefaultInstance, msg.WeakDefaultInstanceForType)); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/App.xaml b/csharp/src/ProtocolBuffersLite.Test/App.xaml new file mode 100644 index 00000000..d4f1f2e3 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/csharp/src/ProtocolBuffersLite.Test/App.xaml.cs b/csharp/src/ProtocolBuffersLite.Test/App.xaml.cs new file mode 100644 index 00000000..0c9fd9e6 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/App.xaml.cs @@ -0,0 +1,60 @@ +using System; +using System.Windows; +using Microsoft.Silverlight.Testing; + +namespace Google.ProtocolBuffers +{ + public partial class App : Application + { + + public App() + { + this.Startup += this.Application_Startup; + this.Exit += this.Application_Exit; + this.UnhandledException += this.Application_UnhandledException; + + //InitializeComponent(); + } + + private void Application_Startup(object sender, StartupEventArgs e) + { + this.RootVisual = UnitTestSystem.CreateTestPage(); + } + + private void Application_Exit(object sender, EventArgs e) + { + + } + private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) + { + // If the app is running outside of the debugger then report the exception using + // the browser's exception mechanism. On IE this will display it a yellow alert + // icon in the status bar and Firefox will display a script error. + if (!System.Diagnostics.Debugger.IsAttached) + { + + // NOTE: This will allow the application to continue running after an exception has been thrown + // but not handled. + // For production applications this error handling should be replaced with something that will + // report the error to the website and stop the application. + e.Handled = true; + Deployment.Current.Dispatcher.BeginInvoke( + new EventHandler(ReportErrorToDOM), + new object[] { sender, e } ); + } + } + private void ReportErrorToDOM(object sender, ApplicationUnhandledExceptionEventArgs e) + { + try + { + string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; + errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); + + System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight 2 Application " + errorMsg + "\");"); + } + catch (Exception) + { + } + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ExtendableBuilderLiteTest.cs b/csharp/src/ProtocolBuffersLite.Test/ExtendableBuilderLiteTest.cs new file mode 100644 index 00000000..910ebaf5 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ExtendableBuilderLiteTest.cs @@ -0,0 +1,289 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using Google.ProtocolBuffers; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class ExtendableBuilderLiteTest + { + [TestMethod] + public void TestHasExtensionT() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 123); + + Assert.IsTrue(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + } + + [TestMethod] + public void TestHasExtensionTMissing() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder(); + Assert.IsFalse(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + } + + [TestMethod] + public void TestGetExtensionCountT() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 3); + + Assert.AreEqual(3, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + } + + [TestMethod] + public void TestGetExtensionCountTEmpty() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder(); + Assert.AreEqual(0, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + } + + [TestMethod] + public void TestGetExtensionTNull() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder(); + string value = builder.GetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite); + Assert.IsNull(value); + } + + [TestMethod] + public void TestGetExtensionTValue() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 3); + + Assert.AreEqual(3, builder.GetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + } + + [TestMethod] + public void TestGetExtensionTEmpty() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder(); + Assert.AreEqual(0, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite).Count); + } + + [TestMethod] + public void TestGetExtensionTList() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 3); + + IList values = builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite); + Assert.AreEqual(3, values.Count); + } + + [TestMethod] + public void TestGetExtensionTIndex() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2); + + for (int i = 0; i < 3; i++) + Assert.AreEqual(i, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, i)); + } + + [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))] + public void TestGetExtensionTIndexOutOfRange() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder(); + builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0); + } + + [TestMethod] + public void TestSetExtensionTIndex() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2); + + for (int i = 0; i < 3; i++) + Assert.AreEqual(i, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, i)); + + builder.SetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0, 5); + builder.SetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1, 6); + builder.SetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 2, 7); + + for (int i = 0; i < 3; i++) + Assert.AreEqual(5 + i, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, i)); + } + + [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))] + public void TestSetExtensionTIndexOutOfRange() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder(); + builder.SetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0, -1); + } + + [TestMethod] + public void TestClearExtensionTList() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0); + Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + + builder.ClearExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite); + Assert.AreEqual(0, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + } + + [TestMethod] + public void TestClearExtensionTValue() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 0); + Assert.IsTrue(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + + builder.ClearExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite); + Assert.IsFalse(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + } + + [TestMethod] + public void TestIndexedByDescriptor() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder(); + Assert.IsFalse(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + + builder[UnitTestLiteProtoFile.OptionalInt32ExtensionLite.Descriptor] = 123; + + Assert.IsTrue(builder.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + Assert.AreEqual(123, builder.GetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + } + + [TestMethod] + public void TestIndexedByDescriptorAndOrdinal() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0); + Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + + IFieldDescriptorLite f = UnitTestLiteProtoFile.RepeatedInt32ExtensionLite.Descriptor; + builder[f, 0] = 123; + + Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + Assert.AreEqual(123, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0)); + } + + [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))] + public void TestIndexedByDescriptorAndOrdinalOutOfRange() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder(); + Assert.AreEqual(0, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + + IFieldDescriptorLite f = UnitTestLiteProtoFile.RepeatedInt32ExtensionLite.Descriptor; + builder[f, 0] = 123; + } + + [TestMethod] + public void TestClearFieldByDescriptor() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0); + Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + + IFieldDescriptorLite f = UnitTestLiteProtoFile.RepeatedInt32ExtensionLite.Descriptor; + builder.ClearField(f); + Assert.AreEqual(0, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + } + + [TestMethod] + public void TestAddRepeatedFieldByDescriptor() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0); + Assert.AreEqual(1, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + + IFieldDescriptorLite f = UnitTestLiteProtoFile.RepeatedInt32ExtensionLite.Descriptor; + builder.AddRepeatedField(f, 123); + Assert.AreEqual(2, builder.GetExtensionCount(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite)); + Assert.AreEqual(123, builder.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 1)); + } + + [TestMethod] + public void TestMissingExtensionsLite() + { + const int optionalInt32 = 12345678; + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder(); + builder.SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, optionalInt32); + builder.AddExtension(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite, 1.1); + builder.AddExtension(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite, 1.2); + builder.AddExtension(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite, 1.3); + TestAllExtensionsLite msg = builder.Build(); + + Assert.IsTrue(msg.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + Assert.AreEqual(3, msg.GetExtensionCount(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite)); + + byte[] bits = msg.ToByteArray(); + TestAllExtensionsLite copy = TestAllExtensionsLite.ParseFrom(bits); + Assert.IsFalse(copy.HasExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + Assert.AreEqual(0, copy.GetExtensionCount(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite)); + Assert.AreNotEqual(msg, copy); + + //The lite runtime removes all unknown fields and extensions + byte[] copybits = copy.ToByteArray(); + Assert.AreEqual(0, copybits.Length); + } + + [TestMethod] + public void TestMissingFieldsLite() + { + TestAllTypesLite msg = TestAllTypesLite.CreateBuilder() + .SetOptionalInt32(123) + .SetOptionalString("123") + .Build(); + + byte[] bits = msg.ToByteArray(); + TestAllExtensionsLite copy = TestAllExtensionsLite.ParseFrom(bits); + Assert.AreNotEqual(msg, copy); + + //The lite runtime removes all unknown fields and extensions + byte[] copybits = copy.ToByteArray(); + Assert.AreEqual(0, copybits.Length); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ExtendableMessageLiteTest.cs b/csharp/src/ProtocolBuffersLite.Test/ExtendableMessageLiteTest.cs new file mode 100644 index 00000000..5c236aa3 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ExtendableMessageLiteTest.cs @@ -0,0 +1,379 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class ExtendableMessageLiteTest + { + //The lite framework does not make this assertion + //[TestMethod, Ignore, ExpectedException(typeof(ArgumentException))] + //public void ExtensionWriterInvalidExtension() + //{ + // TestPackedExtensionsLite.CreateBuilder()[ + // UnitTestLiteProtoFile.OptionalForeignMessageExtensionLite.Descriptor] = + // ForeignMessageLite.DefaultInstance; + //} + + [TestMethod] + public void ExtensionWriterTestMessages() + { + TestAllExtensionsLite.Builder b = TestAllExtensionsLite.CreateBuilder().SetExtension( + UnitTestLiteProtoFile.OptionalForeignMessageExtensionLite, + ForeignMessageLite.CreateBuilder().SetC(123).Build()); + TestAllExtensionsLite copy, msg = b.Build(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestLiteProtoFile.RegisterAllExtensions(registry); + + copy = TestAllExtensionsLite.ParseFrom(msg.ToByteArray(), registry); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void ExtensionWriterIsInitialized() + { + Assert.IsTrue(ForeignMessageLite.DefaultInstance.IsInitialized); + Assert.IsTrue(TestPackedExtensionsLite.CreateBuilder().IsInitialized); + Assert.IsTrue(TestAllExtensionsLite.CreateBuilder().SetExtension( + UnitTestLiteProtoFile.OptionalForeignMessageExtensionLite, ForeignMessageLite.DefaultInstance) + .IsInitialized); + } + + [TestMethod] + public void ExtensionWriterTestSetExtensionLists() + { + TestAllExtensionsLite msg, copy; + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .SetExtension(UnitTestLiteProtoFile.RepeatedBoolExtensionLite, new[] {true, false}) + .SetExtension(UnitTestLiteProtoFile.RepeatedCordExtensionLite, new[] {"123", "456"}) + .SetExtension(UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite, + new[] {ForeignEnumLite.FOREIGN_LITE_BAZ, ForeignEnumLite.FOREIGN_LITE_FOO}) + ; + + msg = builder.Build(); + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestLiteProtoFile.RegisterAllExtensions(registry); + + copy = TestAllExtensionsLite.ParseFrom(msg.ToByteArray(), registry); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + + Assert.AreEqual(ForeignEnumLite.FOREIGN_LITE_FOO, + copy.GetExtension(UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite, 1)); + } + + [TestMethod] + public void ExtensionWriterTest() + { + TestAllExtensionsLite.Builder builder = TestAllExtensionsLite.CreateBuilder() + .SetExtension(UnitTestLiteProtoFile.DefaultBoolExtensionLite, true) + .SetExtension(UnitTestLiteProtoFile.DefaultBytesExtensionLite, ByteString.CopyFromUtf8("123")) + .SetExtension(UnitTestLiteProtoFile.DefaultCordExtensionLite, "123") + .SetExtension(UnitTestLiteProtoFile.DefaultDoubleExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.DefaultFixed32ExtensionLite, 123u) + .SetExtension(UnitTestLiteProtoFile.DefaultFixed64ExtensionLite, 123u) + .SetExtension(UnitTestLiteProtoFile.DefaultFloatExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.DefaultForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ) + .SetExtension(UnitTestLiteProtoFile.DefaultImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ) + .SetExtension(UnitTestLiteProtoFile.DefaultInt32ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.DefaultInt64ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.DefaultNestedEnumExtensionLite, + TestAllTypesLite.Types.NestedEnum.FOO) + .SetExtension(UnitTestLiteProtoFile.DefaultSfixed32ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.DefaultSfixed64ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.DefaultSint32ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.DefaultSint64ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.DefaultStringExtensionLite, "123") + .SetExtension(UnitTestLiteProtoFile.DefaultStringPieceExtensionLite, "123") + .SetExtension(UnitTestLiteProtoFile.DefaultUint32ExtensionLite, 123u) + .SetExtension(UnitTestLiteProtoFile.DefaultUint64ExtensionLite, 123u) + //Optional + .SetExtension(UnitTestLiteProtoFile.OptionalBoolExtensionLite, true) + .SetExtension(UnitTestLiteProtoFile.OptionalBytesExtensionLite, ByteString.CopyFromUtf8("123")) + .SetExtension(UnitTestLiteProtoFile.OptionalCordExtensionLite, "123") + .SetExtension(UnitTestLiteProtoFile.OptionalDoubleExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.OptionalFixed32ExtensionLite, 123u) + .SetExtension(UnitTestLiteProtoFile.OptionalFixed64ExtensionLite, 123u) + .SetExtension(UnitTestLiteProtoFile.OptionalFloatExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.OptionalForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ) + .SetExtension(UnitTestLiteProtoFile.OptionalImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ) + .SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.OptionalInt64ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite, + TestAllTypesLite.Types.NestedEnum.FOO) + .SetExtension(UnitTestLiteProtoFile.OptionalSfixed32ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.OptionalSfixed64ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.OptionalSint32ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.OptionalSint64ExtensionLite, 123) + .SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, "123") + .SetExtension(UnitTestLiteProtoFile.OptionalStringPieceExtensionLite, "123") + .SetExtension(UnitTestLiteProtoFile.OptionalUint32ExtensionLite, 123u) + .SetExtension(UnitTestLiteProtoFile.OptionalUint64ExtensionLite, 123u) + //Repeated + .AddExtension(UnitTestLiteProtoFile.RepeatedBoolExtensionLite, true) + .AddExtension(UnitTestLiteProtoFile.RepeatedBytesExtensionLite, ByteString.CopyFromUtf8("123")) + .AddExtension(UnitTestLiteProtoFile.RepeatedCordExtensionLite, "123") + .AddExtension(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.RepeatedFixed32ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.RepeatedFixed64ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.RepeatedFloatExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite, ForeignEnumLite.FOREIGN_LITE_BAZ) + .AddExtension(UnitTestLiteProtoFile.RepeatedImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.RepeatedInt64ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLite, + TestAllTypesLite.Types.NestedEnum.FOO) + .AddExtension(UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.RepeatedSint32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.RepeatedSint64ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.RepeatedStringExtensionLite, "123") + .AddExtension(UnitTestLiteProtoFile.RepeatedStringPieceExtensionLite, "123") + .AddExtension(UnitTestLiteProtoFile.RepeatedUint32ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.RepeatedUint64ExtensionLite, 123u) + ; + TestAllExtensionsLite msg = builder.Build(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestLiteProtoFile.RegisterAllExtensions(registry); + + TestAllExtensionsLite.Builder copyBuilder = + TestAllExtensionsLite.CreateBuilder().MergeFrom(msg.ToByteArray(), registry); + TestAllExtensionsLite copy = copyBuilder.Build(); + + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + + Assert.AreEqual(true, copy.GetExtension(UnitTestLiteProtoFile.DefaultBoolExtensionLite)); + Assert.AreEqual(ByteString.CopyFromUtf8("123"), + copy.GetExtension(UnitTestLiteProtoFile.DefaultBytesExtensionLite)); + Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.DefaultCordExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultDoubleExtensionLite)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.DefaultFixed32ExtensionLite)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.DefaultFixed64ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultFloatExtensionLite)); + Assert.AreEqual(ForeignEnumLite.FOREIGN_LITE_BAZ, + copy.GetExtension(UnitTestLiteProtoFile.DefaultForeignEnumExtensionLite)); + Assert.AreEqual(ImportEnumLite.IMPORT_LITE_BAZ, + copy.GetExtension(UnitTestLiteProtoFile.DefaultImportEnumExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultInt32ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultInt64ExtensionLite)); + Assert.AreEqual(TestAllTypesLite.Types.NestedEnum.FOO, + copy.GetExtension(UnitTestLiteProtoFile.DefaultNestedEnumExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultSfixed32ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultSfixed64ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultSint32ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.DefaultSint64ExtensionLite)); + Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.DefaultStringExtensionLite)); + Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.DefaultStringPieceExtensionLite)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.DefaultUint32ExtensionLite)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.DefaultUint64ExtensionLite)); + + Assert.AreEqual(true, copy.GetExtension(UnitTestLiteProtoFile.OptionalBoolExtensionLite)); + Assert.AreEqual(ByteString.CopyFromUtf8("123"), + copy.GetExtension(UnitTestLiteProtoFile.OptionalBytesExtensionLite)); + Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.OptionalCordExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalDoubleExtensionLite)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.OptionalFixed32ExtensionLite)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.OptionalFixed64ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalFloatExtensionLite)); + Assert.AreEqual(ForeignEnumLite.FOREIGN_LITE_BAZ, + copy.GetExtension(UnitTestLiteProtoFile.OptionalForeignEnumExtensionLite)); + Assert.AreEqual(ImportEnumLite.IMPORT_LITE_BAZ, + copy.GetExtension(UnitTestLiteProtoFile.OptionalImportEnumExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalInt64ExtensionLite)); + Assert.AreEqual(TestAllTypesLite.Types.NestedEnum.FOO, + copy.GetExtension(UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalSfixed32ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalSfixed64ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalSint32ExtensionLite)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.OptionalSint64ExtensionLite)); + Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite)); + Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.OptionalStringPieceExtensionLite)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.OptionalUint32ExtensionLite)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.OptionalUint64ExtensionLite)); + + Assert.AreEqual(true, copy.GetExtension(UnitTestLiteProtoFile.RepeatedBoolExtensionLite, 0)); + Assert.AreEqual(ByteString.CopyFromUtf8("123"), + copy.GetExtension(UnitTestLiteProtoFile.RepeatedBytesExtensionLite, 0)); + Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.RepeatedCordExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedDoubleExtensionLite, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.RepeatedFixed32ExtensionLite, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.RepeatedFixed64ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedFloatExtensionLite, 0)); + Assert.AreEqual(ForeignEnumLite.FOREIGN_LITE_BAZ, + copy.GetExtension(UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite, 0)); + Assert.AreEqual(ImportEnumLite.IMPORT_LITE_BAZ, + copy.GetExtension(UnitTestLiteProtoFile.RepeatedImportEnumExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedInt32ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedInt64ExtensionLite, 0)); + Assert.AreEqual(TestAllTypesLite.Types.NestedEnum.FOO, + copy.GetExtension(UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedSint32ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.RepeatedSint64ExtensionLite, 0)); + Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.RepeatedStringExtensionLite, 0)); + Assert.AreEqual("123", copy.GetExtension(UnitTestLiteProtoFile.RepeatedStringPieceExtensionLite, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.RepeatedUint32ExtensionLite, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.RepeatedUint64ExtensionLite, 0)); + } + + private TestPackedExtensionsLite BuildPackedExtensions() + { + TestPackedExtensionsLite.Builder builder = TestPackedExtensionsLite.CreateBuilder() + .AddExtension(UnitTestLiteProtoFile.PackedBoolExtensionLite, true) + .AddExtension(UnitTestLiteProtoFile.PackedDoubleExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedFixed32ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.PackedFixed64ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.PackedFloatExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedInt32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedInt64ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedSfixed32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedSfixed64ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedSint32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedSint64ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedUint32ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.PackedUint64ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.PackedBoolExtensionLite, true) + .AddExtension(UnitTestLiteProtoFile.PackedDoubleExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedFixed32ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.PackedFixed64ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.PackedFloatExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedInt32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedInt64ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedSfixed32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedSfixed64ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedSint32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedSint64ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.PackedUint32ExtensionLite, 123u) + .AddExtension(UnitTestLiteProtoFile.PackedUint64ExtensionLite, 123u); + + TestPackedExtensionsLite msg = builder.Build(); + return msg; + } + + private void AssertPackedExtensions(TestPackedExtensionsLite copy) + { + Assert.AreEqual(true, copy.GetExtension(UnitTestLiteProtoFile.PackedBoolExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedDoubleExtensionLite, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.PackedFixed32ExtensionLite, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.PackedFixed64ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedFloatExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedInt32ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedInt64ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedSfixed32ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedSfixed64ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedSint32ExtensionLite, 0)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedSint64ExtensionLite, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.PackedUint32ExtensionLite, 0)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.PackedUint64ExtensionLite, 0)); + + Assert.AreEqual(true, copy.GetExtension(UnitTestLiteProtoFile.PackedBoolExtensionLite, 1)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedDoubleExtensionLite, 1)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.PackedFixed32ExtensionLite, 1)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.PackedFixed64ExtensionLite, 1)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedFloatExtensionLite, 1)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedInt32ExtensionLite, 1)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedInt64ExtensionLite, 1)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedSfixed32ExtensionLite, 1)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedSfixed64ExtensionLite, 1)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedSint32ExtensionLite, 1)); + Assert.AreEqual(123, copy.GetExtension(UnitTestLiteProtoFile.PackedSint64ExtensionLite, 1)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.PackedUint32ExtensionLite, 1)); + Assert.AreEqual(123u, copy.GetExtension(UnitTestLiteProtoFile.PackedUint64ExtensionLite, 1)); + } + + [TestMethod] + public void ExtensionWriterTestPacked() + { + TestPackedExtensionsLite msg = BuildPackedExtensions(); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestLiteProtoFile.RegisterAllExtensions(registry); + + TestPackedExtensionsLite.Builder copyBuilder = + TestPackedExtensionsLite.CreateBuilder().MergeFrom(msg.ToByteArray(), registry); + TestPackedExtensionsLite copy = copyBuilder.Build(); + + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + + AssertPackedExtensions(copy); + } + + [TestMethod] + public void TestUnpackedAndPackedExtensions() + { + TestPackedExtensionsLite original = BuildPackedExtensions(); + AssertPackedExtensions(original); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestLiteProtoFile.RegisterAllExtensions(registry); + UnitTestExtrasLiteProtoFile.RegisterAllExtensions(registry); + + TestUnpackedExtensionsLite unpacked = TestUnpackedExtensionsLite.ParseFrom(original.ToByteArray(), registry); + + TestPackedExtensionsLite packed = TestPackedExtensionsLite.ParseFrom(unpacked.ToByteArray(), registry); + + Assert.AreEqual(original, packed); + TestUtil.AssertBytesEqual(original.ToByteArray(), packed.ToByteArray()); + AssertPackedExtensions(packed); + } + + [TestMethod] + public void TestUnpackedFromPackedInput() + { + byte[] packedData = BuildPackedExtensions().ToByteArray(); + + TestUnpackedTypesLite unpacked = TestUnpackedTypesLite.ParseFrom(packedData); + TestPackedTypesLite packed = TestPackedTypesLite.ParseFrom(unpacked.ToByteArray()); + TestUtil.AssertBytesEqual(packedData, packed.ToByteArray()); + + unpacked = TestUnpackedTypesLite.ParseFrom(packed.ToByteArray()); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestLiteProtoFile.RegisterAllExtensions(registry); + AssertPackedExtensions(TestPackedExtensionsLite.ParseFrom(unpacked.ToByteArray(), registry)); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs b/csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs new file mode 100644 index 00000000..37739d2f --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/InteropLiteTest.cs @@ -0,0 +1,186 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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 Google.ProtocolBuffers; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class InteropLiteTest + { + [TestMethod] + public void TestConvertFromFullMinimal() + { + TestInteropPerson person = TestInteropPerson.CreateBuilder() + .SetId(123) + .SetName("abc") + .Build(); + Assert.IsTrue(person.IsInitialized); + + TestInteropPersonLite copy = TestInteropPersonLite.ParseFrom(person.ToByteArray()); + + TestUtil.AssertBytesEqual(person.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestConvertFromFullComplete() + { + TestInteropPerson person = TestInteropPerson.CreateBuilder() + .SetId(123) + .SetName("abc") + .SetEmail("abc@123.com") + .AddRangeCodes(new[] {1, 2, 3}) + .AddPhone(TestInteropPerson.Types.PhoneNumber.CreateBuilder().SetNumber("555-1234").Build()) + .AddPhone(TestInteropPerson.Types.PhoneNumber.CreateBuilder().SetNumber("555-5678").Build()) + .AddAddresses( + TestInteropPerson.Types.Addresses.CreateBuilder().SetAddress("123 Seseme").SetCity("Wonderland"). + SetState("NA").SetZip(12345).Build()) + .SetExtension(UnitTestExtrasFullProtoFile.EmployeeId, + TestInteropEmployeeId.CreateBuilder().SetNumber("123").Build()) + .Build(); + Assert.IsTrue(person.IsInitialized); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestExtrasLiteProtoFile.RegisterAllExtensions(registry); + + TestInteropPersonLite copy = TestInteropPersonLite.ParseFrom(person.ToByteArray(), registry); + + TestUtil.AssertBytesEqual(person.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestConvertFromLiteMinimal() + { + TestInteropPersonLite person = TestInteropPersonLite.CreateBuilder() + .SetId(123) + .SetName("abc") + .Build(); + Assert.IsTrue(person.IsInitialized); + + TestInteropPerson copy = TestInteropPerson.ParseFrom(person.ToByteArray()); + + TestUtil.AssertBytesEqual(person.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestConvertFromLiteComplete() + { + TestInteropPersonLite person = TestInteropPersonLite.CreateBuilder() + .SetId(123) + .SetName("abc") + .SetEmail("abc@123.com") + .AddRangeCodes(new[] {1, 2, 3}) + .AddPhone(TestInteropPersonLite.Types.PhoneNumber.CreateBuilder().SetNumber("555-1234").Build()) + .AddPhone(TestInteropPersonLite.Types.PhoneNumber.CreateBuilder().SetNumber("555-5678").Build()) + .AddAddresses( + TestInteropPersonLite.Types.Addresses.CreateBuilder().SetAddress("123 Seseme").SetCity("Wonderland") + .SetState("NA").SetZip(12345).Build()) + .SetExtension(UnitTestExtrasLiteProtoFile.EmployeeIdLite, + TestInteropEmployeeIdLite.CreateBuilder().SetNumber("123").Build()) + .Build(); + Assert.IsTrue(person.IsInitialized); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestExtrasFullProtoFile.RegisterAllExtensions(registry); + + TestInteropPerson copy = TestInteropPerson.ParseFrom(person.ToByteArray(), registry); + + TestUtil.AssertBytesEqual(person.ToByteArray(), copy.ToByteArray()); + } + + public ByteString AllBytes + { + get + { + byte[] bytes = new byte[256]; + for (int i = 0; i < bytes.Length; i++) + bytes[i] = (byte) i; + return ByteString.CopyFrom(bytes); + } + } + + [TestMethod] + public void TestCompareStringValues() + { + TestInteropPersonLite person = TestInteropPersonLite.CreateBuilder() + .SetId(123) + .SetName("abc") + .SetEmail("abc@123.com") + .AddRangeCodes(new[] {1, 2, 3}) + .AddPhone(TestInteropPersonLite.Types.PhoneNumber.CreateBuilder().SetNumber("555-1234").Build()) + .AddPhone( + TestInteropPersonLite.Types.PhoneNumber.CreateBuilder().SetNumber( + System.Text.Encoding.UTF8.GetString(AllBytes.ToByteArray(), 0, AllBytes.Length)).Build()) + .AddAddresses( + TestInteropPersonLite.Types.Addresses.CreateBuilder().SetAddress("123 Seseme").SetCity("Wonderland") + .SetState("NA").SetZip(12345).Build()) + .SetExtension(UnitTestExtrasLiteProtoFile.EmployeeIdLite, + TestInteropEmployeeIdLite.CreateBuilder().SetNumber("123").Build()) + .Build(); + Assert.IsTrue(person.IsInitialized); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestExtrasFullProtoFile.RegisterAllExtensions(registry); + + TestInteropPerson copy = TestInteropPerson.ParseFrom(person.ToByteArray(), registry); + + TestUtil.AssertBytesEqual(person.ToByteArray(), copy.ToByteArray()); + + TestInteropPerson.Builder copyBuilder = TestInteropPerson.CreateBuilder(); + TextFormat.Merge( + person.ToString().Replace("[protobuf_unittest_extra.employee_id_lite]", + "[protobuf_unittest_extra.employee_id]"), registry, copyBuilder); + + copy = copyBuilder.Build(); + TestUtil.AssertBytesEqual(person.ToByteArray(), copy.ToByteArray()); + + string liteText = person.ToString().TrimEnd().Replace("\r", ""); + string fullText = copy.ToString().TrimEnd().Replace("\r", ""); + //map the extension type + liteText = liteText.Replace("[protobuf_unittest_extra.employee_id_lite]", + "[protobuf_unittest_extra.employee_id]"); + //lite version does not indent + while (fullText.IndexOf("\n ") >= 0) + fullText = fullText.Replace("\n ", "\n"); + + Assert.AreEqual(fullText, liteText); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/LiteTest.cs b/csharp/src/ProtocolBuffersLite.Test/LiteTest.cs new file mode 100644 index 00000000..3561876b --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/LiteTest.cs @@ -0,0 +1,118 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Google.ProtocolBuffers.Descriptors; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + /// + /// Miscellaneous tests for message operations that apply to both + /// generated and dynamic messages. + /// + [TestClass] + public class LiteTest + { + [TestMethod] + public void TestLite() + { + // Since lite messages are a subset of regular messages, we can mostly + // assume that the functionality of lite messages is already thoroughly + // tested by the regular tests. All this test really verifies is that + // a proto with optimize_for = LITE_RUNTIME compiles correctly when + // linked only against the lite library. That is all tested at compile + // time, leaving not much to do in this method. Let's just do some random + // stuff to make sure the lite message is actually here and usable. + + TestAllTypesLite message = + TestAllTypesLite.CreateBuilder() + .SetOptionalInt32(123) + .AddRepeatedString("hello") + .SetOptionalNestedMessage( + TestAllTypesLite.Types.NestedMessage.CreateBuilder().SetBb(7)) + .Build(); + + ByteString data = message.ToByteString(); + + TestAllTypesLite message2 = TestAllTypesLite.ParseFrom(data); + + Assert.AreEqual(123, message2.OptionalInt32); + Assert.AreEqual(1, message2.RepeatedStringCount); + Assert.AreEqual("hello", message2.RepeatedStringList[0]); + Assert.AreEqual(7, message2.OptionalNestedMessage.Bb); + } + + [TestMethod] + public void TestLiteExtensions() + { + // TODO(kenton): Unlike other features of the lite library, extensions are + // implemented completely differently from the regular library. We + // should probably test them more thoroughly. + + TestAllExtensionsLite message = + TestAllExtensionsLite.CreateBuilder() + .SetExtension(UnitTestLiteProtoFile.OptionalInt32ExtensionLite, 123) + .AddExtension(UnitTestLiteProtoFile.RepeatedStringExtensionLite, "hello") + .SetExtension(UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite, + TestAllTypesLite.Types.NestedEnum.BAZ) + .SetExtension(UnitTestLiteProtoFile.OptionalNestedMessageExtensionLite, + TestAllTypesLite.Types.NestedMessage.CreateBuilder().SetBb(7).Build()) + .Build(); + + // Test copying a message, since coping extensions actually does use a + // different code path between lite and regular libraries, and as of this + // writing, parsing hasn't been implemented yet. + TestAllExtensionsLite message2 = message.ToBuilder().Build(); + + Assert.AreEqual(123, (int) message2.GetExtension( + UnitTestLiteProtoFile.OptionalInt32ExtensionLite)); + Assert.AreEqual(1, message2.GetExtensionCount( + UnitTestLiteProtoFile.RepeatedStringExtensionLite)); + Assert.AreEqual(1, message2.GetExtension( + UnitTestLiteProtoFile.RepeatedStringExtensionLite).Count); + Assert.AreEqual("hello", message2.GetExtension( + UnitTestLiteProtoFile.RepeatedStringExtensionLite, 0)); + Assert.AreEqual(TestAllTypesLite.Types.NestedEnum.BAZ, message2.GetExtension( + UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite)); + Assert.AreEqual(7, message2.GetExtension( + UnitTestLiteProtoFile.OptionalNestedMessageExtensionLite).Bb); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/MissingFieldAndExtensionTest.cs b/csharp/src/ProtocolBuffersLite.Test/MissingFieldAndExtensionTest.cs new file mode 100644 index 00000000..c65cb7f1 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/MissingFieldAndExtensionTest.cs @@ -0,0 +1,240 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// 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.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using Google.ProtocolBuffers.TestProtos; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class MissingFieldAndExtensionTest + { + [TestMethod] + public void TestRecoverMissingExtensions() + { + const int optionalInt32 = 12345678; + TestAllExtensions.Builder builder = TestAllExtensions.CreateBuilder(); + builder.SetExtension(UnitTestProtoFile.OptionalInt32Extension, optionalInt32); + builder.AddExtension(UnitTestProtoFile.RepeatedDoubleExtension, 1.1); + builder.AddExtension(UnitTestProtoFile.RepeatedDoubleExtension, 1.2); + builder.AddExtension(UnitTestProtoFile.RepeatedDoubleExtension, 1.3); + TestAllExtensions msg = builder.Build(); + + Assert.IsTrue(msg.HasExtension(UnitTestProtoFile.OptionalInt32Extension)); + Assert.AreEqual(3, msg.GetExtensionCount(UnitTestProtoFile.RepeatedDoubleExtension)); + + byte[] bits = msg.ToByteArray(); + TestAllExtensions copy = TestAllExtensions.ParseFrom(bits); + Assert.IsFalse(copy.HasExtension(UnitTestProtoFile.OptionalInt32Extension)); + Assert.AreEqual(0, copy.GetExtensionCount(UnitTestProtoFile.RepeatedDoubleExtension)); + Assert.AreNotEqual(msg, copy); + + //Even though copy does not understand the typees they serialize correctly + byte[] copybits = copy.ToByteArray(); + TestUtil.AssertBytesEqual(bits, copybits); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestProtoFile.RegisterAllExtensions(registry); + + //Now we can take those copy bits and restore the full message with extensions + copy = TestAllExtensions.ParseFrom(copybits, registry); + Assert.IsTrue(copy.HasExtension(UnitTestProtoFile.OptionalInt32Extension)); + Assert.AreEqual(3, copy.GetExtensionCount(UnitTestProtoFile.RepeatedDoubleExtension)); + + Assert.AreEqual(msg, copy); + TestUtil.AssertBytesEqual(bits, copy.ToByteArray()); + + //If we modify the object this should all continue to work as before + copybits = copy.ToBuilder().Build().ToByteArray(); + TestUtil.AssertBytesEqual(bits, copybits); + + //If we replace extension the object this should all continue to work as before + copybits = copy.ToBuilder() + .SetExtension(UnitTestProtoFile.OptionalInt32Extension, optionalInt32) + .Build().ToByteArray(); + TestUtil.AssertBytesEqual(bits, copybits); + } + + [TestMethod] + public void TestRecoverMissingFields() + { + TestMissingFieldsA msga = TestMissingFieldsA.CreateBuilder() + .SetId(1001) + .SetName("Name") + .SetEmail("missing@field.value") + .Build(); + + //serialize to type B and verify all fields exist + TestMissingFieldsB msgb = TestMissingFieldsB.ParseFrom(msga.ToByteArray()); + Assert.AreEqual(1001, msgb.Id); + Assert.AreEqual("Name", msgb.Name); + Assert.IsFalse(msgb.HasWebsite); + Assert.AreEqual(1, msgb.UnknownFields.FieldDictionary.Count); + Assert.AreEqual("missing@field.value", + msgb.UnknownFields[TestMissingFieldsA.EmailFieldNumber].LengthDelimitedList[0].ToStringUtf8()); + + //serializes exactly the same (at least for this simple example) + TestUtil.AssertBytesEqual(msga.ToByteArray(), msgb.ToByteArray()); + Assert.AreEqual(msga, TestMissingFieldsA.ParseFrom(msgb.ToByteArray())); + + //now re-create an exact copy of A from serialized B + TestMissingFieldsA copya = TestMissingFieldsA.ParseFrom(msgb.ToByteArray()); + Assert.AreEqual(msga, copya); + Assert.AreEqual(1001, copya.Id); + Assert.AreEqual("Name", copya.Name); + Assert.AreEqual("missing@field.value", copya.Email); + + //Now we modify B... and try again + msgb = msgb.ToBuilder().SetWebsite("http://new.missing.field").Build(); + //Does B still have the missing field? + Assert.AreEqual(1, msgb.UnknownFields.FieldDictionary.Count); + + //Convert back to A and see if all fields are there? + copya = TestMissingFieldsA.ParseFrom(msgb.ToByteArray()); + Assert.AreNotEqual(msga, copya); + Assert.AreEqual(1001, copya.Id); + Assert.AreEqual("Name", copya.Name); + Assert.AreEqual("missing@field.value", copya.Email); + Assert.AreEqual(1, copya.UnknownFields.FieldDictionary.Count); + Assert.AreEqual("http://new.missing.field", + copya.UnknownFields[TestMissingFieldsB.WebsiteFieldNumber].LengthDelimitedList[0]. + ToStringUtf8()); + + //Lastly we can even still trip back to type B and see all fields: + TestMissingFieldsB copyb = TestMissingFieldsB.ParseFrom(copya.ToByteArray()); + Assert.AreEqual(copya.ToByteArray().Length, copyb.ToByteArray().Length); //not exact order. + Assert.AreEqual(1001, copyb.Id); + Assert.AreEqual("Name", copyb.Name); + Assert.AreEqual("http://new.missing.field", copyb.Website); + Assert.AreEqual(1, copyb.UnknownFields.FieldDictionary.Count); + Assert.AreEqual("missing@field.value", + copyb.UnknownFields[TestMissingFieldsA.EmailFieldNumber].LengthDelimitedList[0].ToStringUtf8 + ()); + } + + [TestMethod] + public void TestRecoverMissingMessage() + { + TestMissingFieldsA.Types.SubA suba = + TestMissingFieldsA.Types.SubA.CreateBuilder().SetCount(3).AddValues("a").AddValues("b").AddValues("c"). + Build(); + TestMissingFieldsA msga = TestMissingFieldsA.CreateBuilder() + .SetId(1001) + .SetName("Name") + .SetTestA(suba) + .Build(); + + //serialize to type B and verify all fields exist + TestMissingFieldsB msgb = TestMissingFieldsB.ParseFrom(msga.ToByteArray()); + Assert.AreEqual(1001, msgb.Id); + Assert.AreEqual("Name", msgb.Name); + Assert.AreEqual(1, msgb.UnknownFields.FieldDictionary.Count); + Assert.AreEqual(suba.ToString(), + TestMissingFieldsA.Types.SubA.ParseFrom( + msgb.UnknownFields[TestMissingFieldsA.TestAFieldNumber].LengthDelimitedList[0]).ToString + ()); + + //serializes exactly the same (at least for this simple example) + TestUtil.AssertBytesEqual(msga.ToByteArray(), msgb.ToByteArray()); + Assert.AreEqual(msga, TestMissingFieldsA.ParseFrom(msgb.ToByteArray())); + + //now re-create an exact copy of A from serialized B + TestMissingFieldsA copya = TestMissingFieldsA.ParseFrom(msgb.ToByteArray()); + Assert.AreEqual(msga, copya); + Assert.AreEqual(1001, copya.Id); + Assert.AreEqual("Name", copya.Name); + Assert.AreEqual(suba, copya.TestA); + + //Now we modify B... and try again + TestMissingFieldsB.Types.SubB subb = + TestMissingFieldsB.Types.SubB.CreateBuilder().AddValues("test-b").Build(); + msgb = msgb.ToBuilder().SetTestB(subb).Build(); + //Does B still have the missing field? + Assert.AreEqual(1, msgb.UnknownFields.FieldDictionary.Count); + + //Convert back to A and see if all fields are there? + copya = TestMissingFieldsA.ParseFrom(msgb.ToByteArray()); + Assert.AreNotEqual(msga, copya); + Assert.AreEqual(1001, copya.Id); + Assert.AreEqual("Name", copya.Name); + Assert.AreEqual(suba, copya.TestA); + Assert.AreEqual(1, copya.UnknownFields.FieldDictionary.Count); + TestUtil.AssertBytesEqual(subb.ToByteArray(), + copya.UnknownFields[TestMissingFieldsB.TestBFieldNumber].LengthDelimitedList[0].ToByteArray()); + + //Lastly we can even still trip back to type B and see all fields: + TestMissingFieldsB copyb = TestMissingFieldsB.ParseFrom(copya.ToByteArray()); + Assert.AreEqual(copya.ToByteArray().Length, copyb.ToByteArray().Length); //not exact order. + Assert.AreEqual(1001, copyb.Id); + Assert.AreEqual("Name", copyb.Name); + Assert.AreEqual(subb, copyb.TestB); + Assert.AreEqual(1, copyb.UnknownFields.FieldDictionary.Count); + } + + [TestMethod] + public void TestRestoreFromOtherType() + { + TestInteropPerson person = TestInteropPerson.CreateBuilder() + .SetId(123) + .SetName("abc") + .SetEmail("abc@123.com") + .AddRangeCodes(new[] {1, 2, 3}) + .AddPhone(TestInteropPerson.Types.PhoneNumber.CreateBuilder().SetNumber("555-1234").Build()) + .AddPhone(TestInteropPerson.Types.PhoneNumber.CreateBuilder().SetNumber("555-5678").Build()) + .AddAddresses( + TestInteropPerson.Types.Addresses.CreateBuilder().SetAddress("123 Seseme").SetCity("Wonderland"). + SetState("NA").SetZip(12345).Build()) + .SetExtension(UnitTestExtrasFullProtoFile.EmployeeId, + TestInteropEmployeeId.CreateBuilder().SetNumber("123").Build()) + .Build(); + Assert.IsTrue(person.IsInitialized); + + TestEmptyMessage temp = TestEmptyMessage.ParseFrom(person.ToByteArray()); + Assert.AreEqual(7, temp.UnknownFields.FieldDictionary.Count); + temp = temp.ToBuilder().Build(); + Assert.AreEqual(7, temp.UnknownFields.FieldDictionary.Count); + + ExtensionRegistry registry = ExtensionRegistry.CreateInstance(); + UnitTestExtrasFullProtoFile.RegisterAllExtensions(registry); + + TestInteropPerson copy = TestInteropPerson.ParseFrom(temp.ToByteArray(), registry); + Assert.AreEqual(person, copy); + TestUtil.AssertBytesEqual(person.ToByteArray(), copy.ToByteArray()); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/Properties/AppManifest.xml b/csharp/src/ProtocolBuffersLite.Test/Properties/AppManifest.xml new file mode 100644 index 00000000..a9552327 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/Properties/AppManifest.xml @@ -0,0 +1,6 @@ + + + + diff --git a/csharp/src/ProtocolBuffersLite.Test/Properties/OutOfBrowserSettings.xml b/csharp/src/ProtocolBuffersLite.Test/Properties/OutOfBrowserSettings.xml new file mode 100644 index 00000000..634f44bf --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/Properties/OutOfBrowserSettings.xml @@ -0,0 +1,7 @@ + + ProtocolBuffers.Test + + + + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.CF20.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.CF20.csproj new file mode 100644 index 00000000..abb9f616 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.CF20.csproj @@ -0,0 +1,133 @@ + + + COMPACT_FRAMEWORK + CF20 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF20\Debug + obj\CF20\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\CF20\Release + obj\CF20\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.CF35.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.CF35.csproj new file mode 100644 index 00000000..74edad11 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.CF35.csproj @@ -0,0 +1,134 @@ + + + COMPACT_FRAMEWORK + CF35 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF35\Debug + obj\CF35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\CF35\Release + obj\CF35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + true + Off + true + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.NET20.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.NET20.csproj new file mode 100644 index 00000000..59f9375f --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.NET20.csproj @@ -0,0 +1,121 @@ + + + CLIENTPROFILE + NET20 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET20\Debug + obj\NET20\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET20\Release + obj\NET20\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + true + Off + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.NET35.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.NET35.csproj new file mode 100644 index 00000000..e4ebfe1b --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.NET35.csproj @@ -0,0 +1,122 @@ + + + CLIENTPROFILE + NET35 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.NET40.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.NET40.csproj new file mode 100644 index 00000000..d02ac774 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.NET40.csproj @@ -0,0 +1,122 @@ + + + CLIENTPROFILE + NET40 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET40\Debug + obj\NET40\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET40\Release + obj\NET40\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.PL40.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.PL40.csproj new file mode 100644 index 00000000..b645a01e --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.PL40.csproj @@ -0,0 +1,156 @@ + + + PORTABLE_LIBRARY + PL40 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + 10.0 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + + false + false + true + true + true + Google.ProtocolBuffersLite.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + v4.0 + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\PL40\Debug + obj\PL40\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + + + pdbonly + true + bin\PL40\Release + obj\PL40\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.SL20.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.SL20.csproj new file mode 100644 index 00000000..b4ad946f --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.SL20.csproj @@ -0,0 +1,157 @@ + + + SILVERLIGHT + SL20 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + true + false + false + true + true + Google.ProtocolBuffersLite.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + v2.0 + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\SL20\Debug + obj\SL20\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\SL20\Release + obj\SL20\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + + + OfflineApplication + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.SL30.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.SL30.csproj new file mode 100644 index 00000000..b5870ede --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.SL30.csproj @@ -0,0 +1,158 @@ + + + SILVERLIGHT + SL30 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + true + false + false + true + true + Google.ProtocolBuffersLite.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + v3.5 + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\SL30\Debug + obj\SL30\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\SL30\Release + obj\SL30\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + + + OfflineApplication + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.SL40.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.SL40.csproj new file mode 100644 index 00000000..ef1543ec --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.SL40.csproj @@ -0,0 +1,158 @@ + + + SILVERLIGHT + SL40 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + true + false + false + v4.0 + true + true + Google.ProtocolBuffersLite.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\SL40\Debug + obj\SL40\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\SL40\Release + obj\SL40\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + + + OfflineApplication + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.csproj new file mode 100644 index 00000000..451aaf8b --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLite.Test.csproj @@ -0,0 +1,122 @@ + + + + CLIENTPROFILE + NET35 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EE01ED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersLite.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + TestRpcForMimeTypes.cs + + + TestRpcGenerator.cs + + + + + + + + + + + + + + + + + {E067A59D-9D0A-4A1F-92B1-38E4457241D1} + ProtocolBuffersLite.Serialization + + + {6969BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffersLite + True + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.CF20.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.CF20.csproj new file mode 100644 index 00000000..0ed3b36d --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.CF20.csproj @@ -0,0 +1,126 @@ + + + COMPACT_FRAMEWORK + CF20 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF20\Debug + obj\CF20\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\CF20\Release + obj\CF20\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.CF35.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.CF35.csproj new file mode 100644 index 00000000..50d4e643 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.CF35.csproj @@ -0,0 +1,127 @@ + + + COMPACT_FRAMEWORK + CF35 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Smartphone + f27da329-3269-4191-98e0-c87d3d7f1db9 + + + true + full + false + bin\CF35\Debug + obj\CF35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\CF35\Release + obj\CF35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOFILEVERSION + prompt + 4 + true + true + Off + true + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.NET20.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.NET20.csproj new file mode 100644 index 00000000..80593a4d --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.NET20.csproj @@ -0,0 +1,114 @@ + + + CLIENTPROFILE + NET20 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET20\Debug + obj\NET20\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET20\Release + obj\NET20\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOEXTENSIONS + prompt + 4 + true + true + Off + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.NET35.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.NET35.csproj new file mode 100644 index 00000000..e8b6d095 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.NET35.csproj @@ -0,0 +1,115 @@ + + + CLIENTPROFILE + NET35 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.NET40.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.NET40.csproj new file mode 100644 index 00000000..16ffefd6 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.NET40.csproj @@ -0,0 +1,115 @@ + + + CLIENTPROFILE + NET40 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET40\Debug + obj\NET40\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET40\Release + obj\NET40\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.PL40.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.PL40.csproj new file mode 100644 index 00000000..3d1a77b5 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.PL40.csproj @@ -0,0 +1,149 @@ + + + PORTABLE_LIBRARY + PL40 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + 10.0 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + + false + false + true + true + true + Google.ProtocolBuffersMixedLite.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + v4.0 + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\PL40\Debug + obj\PL40\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + + + pdbonly + true + bin\PL40\Release + obj\PL40\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.SL20.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.SL20.csproj new file mode 100644 index 00000000..22b2c272 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.SL20.csproj @@ -0,0 +1,150 @@ + + + SILVERLIGHT + SL20 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v2.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + true + false + false + true + true + Google.ProtocolBuffersMixedLite.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + v2.0 + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\SL20\Debug + obj\SL20\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\SL20\Release + obj\SL20\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST;NOEXTENSIONS + prompt + 4 + true + true + Off + true + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + OfflineApplication + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.SL30.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.SL30.csproj new file mode 100644 index 00000000..3627b765 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.SL30.csproj @@ -0,0 +1,151 @@ + + + SILVERLIGHT + SL30 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + true + false + false + true + true + Google.ProtocolBuffersMixedLite.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + v3.5 + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\SL30\Debug + obj\SL30\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\SL30\Release + obj\SL30\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + OfflineApplication + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.SL40.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.SL40.csproj new file mode 100644 index 00000000..a98c4d38 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.SL40.csproj @@ -0,0 +1,151 @@ + + + SILVERLIGHT + SL40 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v4.0 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + {A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + true + false + false + v4.0 + true + true + Google.ProtocolBuffersMixedLite.Test.xap + Properties\AppManifest.xml + Google.ProtocolBuffers.App + TestPage.html + true + Properties\OutOfBrowserSettings.xml + true + + + true + full + false + bin\SL40\Debug + obj\SL40\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + pdbonly + true + bin\SL40\Release + obj\SL40\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate);NOSERIALIZABLE;NOSORTEDLIST + prompt + 4 + true + true + Off + true + + + + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + App.xaml + + + + + MSBuild:Compile + Designer + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + + + OfflineApplication + + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.csproj b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.csproj new file mode 100644 index 00000000..7abd0abc --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/ProtocolBuffersLiteMixed.Test.csproj @@ -0,0 +1,115 @@ + + + + CLIENTPROFILE + NET35 + TEST + Debug + AnyCPU + 9.0.30729 + 2.0 + {EEFFED24-3750-4567-9A23-1DB676A15610} + Library + Properties + Google.ProtocolBuffers + Google.ProtocolBuffersMixedLite.Test + v3.5 + 512 + true + ..\..\keys\Google.ProtocolBuffers.snk + 3.5 + + + true + full + false + bin\NET35\Debug + obj\NET35\Debug\ + DEBUG;TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + pdbonly + true + bin\NET35\Release + obj\NET35\Release\ + TRACE;$(EnvironmentFlavor);$(EnvironmentTemplate) + prompt + 4 + true + true + Off + + + + + + + + + False + ..\..\lib\NUnit\lib\nunit.framework.dll + + + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.Silverlight.Testing.dll + + + False + ..\..\lib\Microsoft.Silverlight.Testing\April2010\Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll + + + + + Microsoft.VisualStudio.TestTools.cs + + + Properties\AssemblyInfo.cs + + + SerializableAttribute.cs + + + + + + + + + + + + + + + + + + + + + {6908BDCE-D925-43F3-94AC-A531E6DF2591} + ProtocolBuffers + + + + + + Program + $(ProjectDir)..\..\lib\NUnit\tools\nunit-console.exe + /nologo /noshadow /labels /wait $(AssemblyName).dll + $(ProjectDir)$(OutputPath) + + \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/SerializableLiteTest.cs b/csharp/src/ProtocolBuffersLite.Test/SerializableLiteTest.cs new file mode 100644 index 00000000..3efb9179 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/SerializableLiteTest.cs @@ -0,0 +1,55 @@ +using System; +#if !NOSERIALIZABLE +using System.Collections.Generic; +using System.IO; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters.Binary; +using System.Text; +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class SerializableLiteTest + { + /// + /// Just keep it from even compiling if we these objects don't implement the expected interface. + /// + public static readonly ISerializable CompileTimeCheckSerializableMessage = TestRequiredLite.DefaultInstance; + public static readonly ISerializable CompileTimeCheckSerializableBuilder = new TestRequiredLite.Builder(); + + [TestMethod] + public void TestPlainMessage() + { + TestRequiredLite message = TestRequiredLite.CreateBuilder() + .SetD(42) + .BuildPartial(); + + MemoryStream ms = new MemoryStream(); + new BinaryFormatter().Serialize(ms, message); + + ms.Position = 0; + TestRequiredLite copy = (TestRequiredLite)new BinaryFormatter().Deserialize(ms); + + Assert.AreEqual(message, copy); + } + + [TestMethod] + public void TestPlainBuilder() + { + TestRequiredLite.Builder builder = TestRequiredLite.CreateBuilder() + .SetD(42) + ; + + MemoryStream ms = new MemoryStream(); + new BinaryFormatter().Serialize(ms, builder); + + ms.Position = 0; + TestRequiredLite.Builder copy = (TestRequiredLite.Builder)new BinaryFormatter().Deserialize(ms); + + Assert.AreEqual(builder.BuildPartial(), copy.BuildPartial()); + } + } +} +#endif \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs b/csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs new file mode 100644 index 00000000..ce373028 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestLiteByApi.cs @@ -0,0 +1,121 @@ +#region Copyright notice and license + +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// http://github.com/jskeet/dotnet-protobufs/ +// Original C++/Java/Python code: +// http://code.google.com/p/protobuf/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#endregion + +using Google.ProtocolBuffers.TestProtos; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + [TestClass] + public class TestLiteByApi + { + [TestMethod] + public void TestAllTypesEquality() + { + TestAllTypesLite msg = TestAllTypesLite.DefaultInstance; + TestAllTypesLite copy = msg.ToBuilder().Build(); + Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode()); + Assert.IsTrue(msg.Equals(copy)); + msg = msg.ToBuilder().SetOptionalString("Hi").Build(); + Assert.AreNotEqual(msg.GetHashCode(), copy.GetHashCode()); + Assert.IsFalse(msg.Equals(copy)); + copy = copy.ToBuilder().SetOptionalString("Hi").Build(); + Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode()); + Assert.IsTrue(msg.Equals(copy)); + } + + [TestMethod] + public void TestEqualityOnExtensions() + { + TestAllExtensionsLite msg = TestAllExtensionsLite.DefaultInstance; + TestAllExtensionsLite copy = msg.ToBuilder().Build(); + Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode()); + Assert.IsTrue(msg.Equals(copy)); + msg = msg.ToBuilder().SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, "Hi").Build(); + Assert.AreNotEqual(msg.GetHashCode(), copy.GetHashCode()); + Assert.IsFalse(msg.Equals(copy)); + copy = copy.ToBuilder().SetExtension(UnitTestLiteProtoFile.OptionalStringExtensionLite, "Hi").Build(); + Assert.AreEqual(msg.GetHashCode(), copy.GetHashCode()); + Assert.IsTrue(msg.Equals(copy)); + } + + [TestMethod] + public void TestAllTypesToString() + { + TestAllTypesLite msg = TestAllTypesLite.DefaultInstance; + TestAllTypesLite copy = msg.ToBuilder().Build(); + Assert.AreEqual(msg.ToString(), copy.ToString()); + Assert.AreEqual(0, msg.ToString().Length); + msg = msg.ToBuilder().SetOptionalInt32(-1).Build(); + Assert.AreEqual("optional_int32: -1", msg.ToString().TrimEnd()); + msg = msg.ToBuilder().SetOptionalString("abc123").Build(); + Assert.AreEqual("optional_int32: -1\noptional_string: \"abc123\"", + msg.ToString().Replace("\r", "").TrimEnd()); + } + + [TestMethod] + public void TestAllTypesDefaultedRoundTrip() + { + TestAllTypesLite msg = TestAllTypesLite.DefaultInstance; + Assert.IsTrue(msg.IsInitialized); + TestAllTypesLite copy = TestAllTypesLite.CreateBuilder().MergeFrom(msg.ToByteArray()).Build(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + + [TestMethod] + public void TestAllTypesModifiedRoundTrip() + { + TestAllTypesLite msg = TestAllTypesLite.DefaultInstance; + msg.ToBuilder() + .SetOptionalBool(true) + .SetOptionalCord("Hi") + .SetOptionalDouble(1.123) + .SetOptionalForeignEnum(ForeignEnumLite.FOREIGN_LITE_FOO) + .SetOptionalForeignMessage(ForeignMessageLite.CreateBuilder().SetC('c').Build()) + .SetOptionalGroup(TestAllTypesLite.Types.OptionalGroup.CreateBuilder().SetA('a').Build()) + .SetOptionalImportEnum(ImportEnumLite.IMPORT_LITE_BAR) + .SetOptionalInt32(32) + .SetOptionalInt64(64) + .SetOptionalNestedEnum(TestAllTypesLite.Types.NestedEnum.FOO) + .SetOptionalString("SetOptionalString") + .AddRepeatedGroup(TestAllTypesLite.Types.RepeatedGroup.CreateBuilder().SetA('a').Build()) + .AddRepeatedGroup(TestAllTypesLite.Types.RepeatedGroup.CreateBuilder().SetA('A').Build()) + ; + TestAllTypesLite copy = TestAllTypesLite.CreateBuilder().MergeFrom(msg.ToByteArray()).Build(); + TestUtil.AssertBytesEqual(msg.ToByteArray(), copy.ToByteArray()); + } + } +} \ No newline at end of file diff --git a/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs new file mode 100644 index 00000000..42ef030d --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasFullProtoFile.cs @@ -0,0 +1,2144 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestExtrasFullProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.EmployeeId); + } + #endregion + #region Extensions + public const int EmployeeIdFieldNumber = 126; + public static pb::GeneratedExtensionBase EmployeeId; + #endregion + + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestInteropPerson__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestInteropPerson__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestInteropPerson_PhoneNumber__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestInteropPerson_PhoneNumber__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestInteropPerson_Addresses__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestInteropPerson_Addresses__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestInteropEmployeeId__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestInteropEmployeeId__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestMissingFieldsA__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestMissingFieldsA__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestMissingFieldsA_SubA__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestMissingFieldsA_SubA__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestMissingFieldsB__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestMissingFieldsB__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_extra_TestMissingFieldsB_SubB__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_extra_TestMissingFieldsB_SubB__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestExtrasFullProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiFleHRlc3QvdW5pdHRlc3RfZXh0cmFzX2Z1bGwucHJvdG8SF3Byb3RvYnVm", + "X3VuaXR0ZXN0X2V4dHJhGiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlv", + "bnMucHJvdG8i1gMKEVRlc3RJbnRlcm9wUGVyc29uEgwKBG5hbWUYASACKAkS", + "CgoCaWQYAiACKAUSDQoFZW1haWwYAyABKAkSEQoFY29kZXMYCiADKAVCAhAB", + "EkUKBXBob25lGAQgAygLMjYucHJvdG9idWZfdW5pdHRlc3RfZXh0cmEuVGVz", + "dEludGVyb3BQZXJzb24uUGhvbmVOdW1iZXISRwoJYWRkcmVzc2VzGAUgAygK", + "MjQucHJvdG9idWZfdW5pdHRlc3RfZXh0cmEuVGVzdEludGVyb3BQZXJzb24u", + "QWRkcmVzc2VzGmcKC1Bob25lTnVtYmVyEg4KBm51bWJlchgBIAIoCRJICgR0", + "eXBlGAIgASgOMjQucHJvdG9idWZfdW5pdHRlc3RfZXh0cmEuVGVzdEludGVy", + "b3BQZXJzb24uUGhvbmVUeXBlOgRIT01FGlgKCUFkZHJlc3NlcxIPCgdhZGRy", + "ZXNzGAEgAigJEhAKCGFkZHJlc3MyGAIgASgJEgwKBGNpdHkYAyACKAkSDQoF", + "c3RhdGUYBCACKAkSCwoDemlwGAUgAigHIisKCVBob25lVHlwZRIKCgZNT0JJ", + "TEUQABIICgRIT01FEAESCAoEV09SSxACKgUIZBDIASInChVUZXN0SW50ZXJv", + "cEVtcGxveWVlSWQSDgoGbnVtYmVyGAEgAigJIqUBChJUZXN0TWlzc2luZ0Zp", + "ZWxkc0ESDAoEbmFtZRgBIAIoCRIKCgJpZBgCIAIoBRINCgVlbWFpbBgDIAEo", + "CRI/CgV0ZXN0QRgLIAEoCzIwLnByb3RvYnVmX3VuaXR0ZXN0X2V4dHJhLlRl", + "c3RNaXNzaW5nRmllbGRzQS5TdWJBGiUKBFN1YkESDQoFY291bnQYBSACKAUS", + "DgoGdmFsdWVzGAYgAygJIpgBChJUZXN0TWlzc2luZ0ZpZWxkc0ISDAoEbmFt", + "ZRgBIAIoCRIKCgJpZBgCIAIoBRIPCgd3ZWJzaXRlGAQgASgJEj8KBXRlc3RC", + "GAwgASgLMjAucHJvdG9idWZfdW5pdHRlc3RfZXh0cmEuVGVzdE1pc3NpbmdG", + "aWVsZHNCLlN1YkIaFgoEU3ViQhIOCgZ2YWx1ZXMYByADKAk6bwoLZW1wbG95", + "ZWVfaWQSKi5wcm90b2J1Zl91bml0dGVzdF9leHRyYS5UZXN0SW50ZXJvcFBl", + "cnNvbhh+IAIoCzIuLnByb3RvYnVmX3VuaXR0ZXN0X2V4dHJhLlRlc3RJbnRl", + "cm9wRW1wbG95ZWVJZEJaChNjb20uZ29vZ2xlLnByb3RvYnVmSALCPkAKIUdv", + "b2dsZS5Qcm90b2NvbEJ1ZmZlcnMuVGVzdFByb3RvcxIbVW5pdFRlc3RFeHRy", + "YXNGdWxsUHJvdG9GaWxl")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_extra_TestInteropPerson__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_extra_TestInteropPerson__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestInteropPerson__Descriptor, + new string[] { "Name", "Id", "Email", "Codes", "Phone", "Addresses", }); + internal__static_protobuf_unittest_extra_TestInteropPerson_PhoneNumber__Descriptor = internal__static_protobuf_unittest_extra_TestInteropPerson__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_extra_TestInteropPerson_PhoneNumber__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestInteropPerson_PhoneNumber__Descriptor, + new string[] { "Number", "Type", }); + internal__static_protobuf_unittest_extra_TestInteropPerson_Addresses__Descriptor = internal__static_protobuf_unittest_extra_TestInteropPerson__Descriptor.NestedTypes[1]; + internal__static_protobuf_unittest_extra_TestInteropPerson_Addresses__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestInteropPerson_Addresses__Descriptor, + new string[] { "Address", "Address2", "City", "State", "Zip", }); + internal__static_protobuf_unittest_extra_TestInteropEmployeeId__Descriptor = Descriptor.MessageTypes[1]; + internal__static_protobuf_unittest_extra_TestInteropEmployeeId__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestInteropEmployeeId__Descriptor, + new string[] { "Number", }); + internal__static_protobuf_unittest_extra_TestMissingFieldsA__Descriptor = Descriptor.MessageTypes[2]; + internal__static_protobuf_unittest_extra_TestMissingFieldsA__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestMissingFieldsA__Descriptor, + new string[] { "Name", "Id", "Email", "TestA", }); + internal__static_protobuf_unittest_extra_TestMissingFieldsA_SubA__Descriptor = internal__static_protobuf_unittest_extra_TestMissingFieldsA__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_extra_TestMissingFieldsA_SubA__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestMissingFieldsA_SubA__Descriptor, + new string[] { "Count", "Values", }); + internal__static_protobuf_unittest_extra_TestMissingFieldsB__Descriptor = Descriptor.MessageTypes[3]; + internal__static_protobuf_unittest_extra_TestMissingFieldsB__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestMissingFieldsB__Descriptor, + new string[] { "Name", "Id", "Website", "TestB", }); + internal__static_protobuf_unittest_extra_TestMissingFieldsB_SubB__Descriptor = internal__static_protobuf_unittest_extra_TestMissingFieldsB__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_extra_TestMissingFieldsB_SubB__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_extra_TestMissingFieldsB_SubB__Descriptor, + new string[] { "Values", }); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.EmployeeId = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.Descriptor.Extensions[0]); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestInteropPerson : pb::ExtendableMessage { + private TestInteropPerson() { } + private static readonly TestInteropPerson defaultInstance = new TestInteropPerson().MakeReadOnly(); + public static TestInteropPerson DefaultInstance { + get { return defaultInstance; } + } + + public override TestInteropPerson DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestInteropPerson ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestInteropPerson__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestInteropPerson__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum PhoneType { + MOBILE = 0, + HOME = 1, + WORK = 2, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class PhoneNumber : pb::GeneratedMessage { + private PhoneNumber() { } + private static readonly PhoneNumber defaultInstance = new PhoneNumber().MakeReadOnly(); + public static PhoneNumber DefaultInstance { + get { return defaultInstance; } + } + + public override PhoneNumber DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override PhoneNumber ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestInteropPerson_PhoneNumber__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestInteropPerson_PhoneNumber__FieldAccessorTable; } + } + + public const int NumberFieldNumber = 1; + private bool hasNumber; + private string number_ = ""; + public bool HasNumber { + get { return hasNumber; } + } + public string Number { + get { return number_; } + } + + public const int TypeFieldNumber = 2; + private bool hasType; + private global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType type_ = global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType.HOME; + public bool HasType { + get { return hasType; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType Type { + get { return type_; } + } + + public static PhoneNumber ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static PhoneNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static PhoneNumber ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static PhoneNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static PhoneNumber ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static PhoneNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static PhoneNumber ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static PhoneNumber ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static PhoneNumber ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static PhoneNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private PhoneNumber MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(PhoneNumber prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(PhoneNumber cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private PhoneNumber result; + + private PhoneNumber PrepareBuilder() { + if (resultIsReadOnly) { + PhoneNumber original = result; + result = new PhoneNumber(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override PhoneNumber MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber.Descriptor; } + } + + public override PhoneNumber DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber.DefaultInstance; } + } + + public override PhoneNumber BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasNumber { + get { return result.hasNumber; } + } + public string Number { + get { return result.Number; } + set { SetNumber(value); } + } + public Builder SetNumber(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasNumber = true; + result.number_ = value; + return this; + } + public Builder ClearNumber() { + PrepareBuilder(); + result.hasNumber = false; + result.number_ = ""; + return this; + } + + public bool HasType { + get { return result.hasType; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType Type { + get { return result.Type; } + set { SetType(value); } + } + public Builder SetType(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType value) { + PrepareBuilder(); + result.hasType = true; + result.type_ = value; + return this; + } + public Builder ClearType() { + PrepareBuilder(); + result.hasType = false; + result.type_ = global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneType.HOME; + return this; + } + } + static PhoneNumber() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Addresses : pb::GeneratedMessage { + private Addresses() { } + private static readonly Addresses defaultInstance = new Addresses().MakeReadOnly(); + public static Addresses DefaultInstance { + get { return defaultInstance; } + } + + public override Addresses DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Addresses ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestInteropPerson_Addresses__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestInteropPerson_Addresses__FieldAccessorTable; } + } + + public const int AddressFieldNumber = 1; + private bool hasAddress; + private string address_ = ""; + public bool HasAddress { + get { return hasAddress; } + } + public string Address { + get { return address_; } + } + + public const int Address2FieldNumber = 2; + private bool hasAddress2; + private string address2_ = ""; + public bool HasAddress2 { + get { return hasAddress2; } + } + public string Address2 { + get { return address2_; } + } + + public const int CityFieldNumber = 3; + private bool hasCity; + private string city_ = ""; + public bool HasCity { + get { return hasCity; } + } + public string City { + get { return city_; } + } + + public const int StateFieldNumber = 4; + private bool hasState; + private string state_ = ""; + public bool HasState { + get { return hasState; } + } + public string State { + get { return state_; } + } + + public const int ZipFieldNumber = 5; + private bool hasZip; + private uint zip_; + public bool HasZip { + get { return hasZip; } + } + [global::System.CLSCompliant(false)] + public uint Zip { + get { return zip_; } + } + + public static Addresses ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Addresses ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Addresses ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Addresses ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Addresses ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Addresses ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Addresses ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Addresses ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Addresses ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Addresses ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Addresses MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Addresses prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Addresses cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Addresses result; + + private Addresses PrepareBuilder() { + if (resultIsReadOnly) { + Addresses original = result; + result = new Addresses(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Addresses MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses.Descriptor; } + } + + public override Addresses DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses.DefaultInstance; } + } + + public override Addresses BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasAddress { + get { return result.hasAddress; } + } + public string Address { + get { return result.Address; } + set { SetAddress(value); } + } + public Builder SetAddress(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasAddress = true; + result.address_ = value; + return this; + } + public Builder ClearAddress() { + PrepareBuilder(); + result.hasAddress = false; + result.address_ = ""; + return this; + } + + public bool HasAddress2 { + get { return result.hasAddress2; } + } + public string Address2 { + get { return result.Address2; } + set { SetAddress2(value); } + } + public Builder SetAddress2(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasAddress2 = true; + result.address2_ = value; + return this; + } + public Builder ClearAddress2() { + PrepareBuilder(); + result.hasAddress2 = false; + result.address2_ = ""; + return this; + } + + public bool HasCity { + get { return result.hasCity; } + } + public string City { + get { return result.City; } + set { SetCity(value); } + } + public Builder SetCity(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasCity = true; + result.city_ = value; + return this; + } + public Builder ClearCity() { + PrepareBuilder(); + result.hasCity = false; + result.city_ = ""; + return this; + } + + public bool HasState { + get { return result.hasState; } + } + public string State { + get { return result.State; } + set { SetState(value); } + } + public Builder SetState(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasState = true; + result.state_ = value; + return this; + } + public Builder ClearState() { + PrepareBuilder(); + result.hasState = false; + result.state_ = ""; + return this; + } + + public bool HasZip { + get { return result.hasZip; } + } + [global::System.CLSCompliant(false)] + public uint Zip { + get { return result.Zip; } + set { SetZip(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetZip(uint value) { + PrepareBuilder(); + result.hasZip = true; + result.zip_ = value; + return this; + } + public Builder ClearZip() { + PrepareBuilder(); + result.hasZip = false; + result.zip_ = 0; + return this; + } + } + static Addresses() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int IdFieldNumber = 2; + private bool hasId; + private int id_; + public bool HasId { + get { return hasId; } + } + public int Id { + get { return id_; } + } + + public const int EmailFieldNumber = 3; + private bool hasEmail; + private string email_ = ""; + public bool HasEmail { + get { return hasEmail; } + } + public string Email { + get { return email_; } + } + + public const int CodesFieldNumber = 10; + private pbc::PopsicleList codes_ = new pbc::PopsicleList(); + public scg::IList CodesList { + get { return pbc::Lists.AsReadOnly(codes_); } + } + public int CodesCount { + get { return codes_.Count; } + } + public int GetCodes(int index) { + return codes_[index]; + } + + public const int PhoneFieldNumber = 4; + private pbc::PopsicleList phone_ = new pbc::PopsicleList(); + public scg::IList PhoneList { + get { return phone_; } + } + public int PhoneCount { + get { return phone_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber GetPhone(int index) { + return phone_[index]; + } + + public const int AddressesFieldNumber = 5; + private pbc::PopsicleList addresses_ = new pbc::PopsicleList(); + public scg::IList AddressesList { + get { return addresses_; } + } + public int AddressesCount { + get { return addresses_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses GetAddresses(int index) { + return addresses_[index]; + } + + public static TestInteropPerson ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestInteropPerson ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestInteropPerson ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestInteropPerson ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestInteropPerson ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestInteropPerson ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestInteropPerson ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestInteropPerson ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestInteropPerson ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestInteropPerson ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestInteropPerson MakeReadOnly() { + codes_.MakeReadOnly(); + phone_.MakeReadOnly(); + addresses_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestInteropPerson prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestInteropPerson cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestInteropPerson result; + + private TestInteropPerson PrepareBuilder() { + if (resultIsReadOnly) { + TestInteropPerson original = result; + result = new TestInteropPerson(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestInteropPerson MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Descriptor; } + } + + public override TestInteropPerson DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.DefaultInstance; } + } + + public override TestInteropPerson BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasId { + get { return result.hasId; } + } + public int Id { + get { return result.Id; } + set { SetId(value); } + } + public Builder SetId(int value) { + PrepareBuilder(); + result.hasId = true; + result.id_ = value; + return this; + } + public Builder ClearId() { + PrepareBuilder(); + result.hasId = false; + result.id_ = 0; + return this; + } + + public bool HasEmail { + get { return result.hasEmail; } + } + public string Email { + get { return result.Email; } + set { SetEmail(value); } + } + public Builder SetEmail(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasEmail = true; + result.email_ = value; + return this; + } + public Builder ClearEmail() { + PrepareBuilder(); + result.hasEmail = false; + result.email_ = ""; + return this; + } + + public pbc::IPopsicleList CodesList { + get { return PrepareBuilder().codes_; } + } + public int CodesCount { + get { return result.CodesCount; } + } + public int GetCodes(int index) { + return result.GetCodes(index); + } + public Builder SetCodes(int index, int value) { + PrepareBuilder(); + result.codes_[index] = value; + return this; + } + public Builder AddCodes(int value) { + PrepareBuilder(); + result.codes_.Add(value); + return this; + } + public Builder AddRangeCodes(scg::IEnumerable values) { + PrepareBuilder(); + result.codes_.Add(values); + return this; + } + public Builder ClearCodes() { + PrepareBuilder(); + result.codes_.Clear(); + return this; + } + + public pbc::IPopsicleList PhoneList { + get { return PrepareBuilder().phone_; } + } + public int PhoneCount { + get { return result.PhoneCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber GetPhone(int index) { + return result.GetPhone(index); + } + public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.phone_[index] = value; + return this; + } + public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.phone_[index] = builderForValue.Build(); + return this; + } + public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.phone_.Add(value); + return this; + } + public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.PhoneNumber.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.phone_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangePhone(scg::IEnumerable values) { + PrepareBuilder(); + result.phone_.Add(values); + return this; + } + public Builder ClearPhone() { + PrepareBuilder(); + result.phone_.Clear(); + return this; + } + + public pbc::IPopsicleList AddressesList { + get { return PrepareBuilder().addresses_; } + } + public int AddressesCount { + get { return result.AddressesCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses GetAddresses(int index) { + return result.GetAddresses(index); + } + public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.addresses_[index] = value; + return this; + } + public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.addresses_[index] = builderForValue.Build(); + return this; + } + public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.addresses_.Add(value); + return this; + } + public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPerson.Types.Addresses.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.addresses_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeAddresses(scg::IEnumerable values) { + PrepareBuilder(); + result.addresses_.Add(values); + return this; + } + public Builder ClearAddresses() { + PrepareBuilder(); + result.addresses_.Clear(); + return this; + } + } + static TestInteropPerson() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestInteropEmployeeId : pb::GeneratedMessage { + private TestInteropEmployeeId() { } + private static readonly TestInteropEmployeeId defaultInstance = new TestInteropEmployeeId().MakeReadOnly(); + public static TestInteropEmployeeId DefaultInstance { + get { return defaultInstance; } + } + + public override TestInteropEmployeeId DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestInteropEmployeeId ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestInteropEmployeeId__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestInteropEmployeeId__FieldAccessorTable; } + } + + public const int NumberFieldNumber = 1; + private bool hasNumber; + private string number_ = ""; + public bool HasNumber { + get { return hasNumber; } + } + public string Number { + get { return number_; } + } + + public static TestInteropEmployeeId ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestInteropEmployeeId ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestInteropEmployeeId ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestInteropEmployeeId ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestInteropEmployeeId ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestInteropEmployeeId ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestInteropEmployeeId ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestInteropEmployeeId ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestInteropEmployeeId ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestInteropEmployeeId ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestInteropEmployeeId MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestInteropEmployeeId prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestInteropEmployeeId cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestInteropEmployeeId result; + + private TestInteropEmployeeId PrepareBuilder() { + if (resultIsReadOnly) { + TestInteropEmployeeId original = result; + result = new TestInteropEmployeeId(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestInteropEmployeeId MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropEmployeeId.Descriptor; } + } + + public override TestInteropEmployeeId DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropEmployeeId.DefaultInstance; } + } + + public override TestInteropEmployeeId BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasNumber { + get { return result.hasNumber; } + } + public string Number { + get { return result.Number; } + set { SetNumber(value); } + } + public Builder SetNumber(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasNumber = true; + result.number_ = value; + return this; + } + public Builder ClearNumber() { + PrepareBuilder(); + result.hasNumber = false; + result.number_ = ""; + return this; + } + } + static TestInteropEmployeeId() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMissingFieldsA : pb::GeneratedMessage { + private TestMissingFieldsA() { } + private static readonly TestMissingFieldsA defaultInstance = new TestMissingFieldsA().MakeReadOnly(); + public static TestMissingFieldsA DefaultInstance { + get { return defaultInstance; } + } + + public override TestMissingFieldsA DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMissingFieldsA ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestMissingFieldsA__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestMissingFieldsA__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SubA : pb::GeneratedMessage { + private SubA() { } + private static readonly SubA defaultInstance = new SubA().MakeReadOnly(); + public static SubA DefaultInstance { + get { return defaultInstance; } + } + + public override SubA DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SubA ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestMissingFieldsA_SubA__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestMissingFieldsA_SubA__FieldAccessorTable; } + } + + public const int CountFieldNumber = 5; + private bool hasCount; + private int count_; + public bool HasCount { + get { return hasCount; } + } + public int Count { + get { return count_; } + } + + public const int ValuesFieldNumber = 6; + private pbc::PopsicleList values_ = new pbc::PopsicleList(); + public scg::IList ValuesList { + get { return pbc::Lists.AsReadOnly(values_); } + } + public int ValuesCount { + get { return values_.Count; } + } + public string GetValues(int index) { + return values_[index]; + } + + public static SubA ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SubA ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SubA ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SubA ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SubA ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SubA ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SubA ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SubA ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SubA ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SubA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SubA MakeReadOnly() { + values_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SubA prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SubA cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SubA result; + + private SubA PrepareBuilder() { + if (resultIsReadOnly) { + SubA original = result; + result = new SubA(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SubA MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.Descriptor; } + } + + public override SubA DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance; } + } + + public override SubA BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasCount { + get { return result.hasCount; } + } + public int Count { + get { return result.Count; } + set { SetCount(value); } + } + public Builder SetCount(int value) { + PrepareBuilder(); + result.hasCount = true; + result.count_ = value; + return this; + } + public Builder ClearCount() { + PrepareBuilder(); + result.hasCount = false; + result.count_ = 0; + return this; + } + + public pbc::IPopsicleList ValuesList { + get { return PrepareBuilder().values_; } + } + public int ValuesCount { + get { return result.ValuesCount; } + } + public string GetValues(int index) { + return result.GetValues(index); + } + public Builder SetValues(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.values_[index] = value; + return this; + } + public Builder AddValues(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.values_.Add(value); + return this; + } + public Builder AddRangeValues(scg::IEnumerable values) { + PrepareBuilder(); + result.values_.Add(values); + return this; + } + public Builder ClearValues() { + PrepareBuilder(); + result.values_.Clear(); + return this; + } + } + static SubA() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int IdFieldNumber = 2; + private bool hasId; + private int id_; + public bool HasId { + get { return hasId; } + } + public int Id { + get { return id_; } + } + + public const int EmailFieldNumber = 3; + private bool hasEmail; + private string email_ = ""; + public bool HasEmail { + get { return hasEmail; } + } + public string Email { + get { return email_; } + } + + public const int TestAFieldNumber = 11; + private bool hasTestA; + private global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA testA_; + public bool HasTestA { + get { return hasTestA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA TestA { + get { return testA_ ?? global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance; } + } + + public static TestMissingFieldsA ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMissingFieldsA ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMissingFieldsA ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMissingFieldsA ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMissingFieldsA ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMissingFieldsA ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMissingFieldsA ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMissingFieldsA ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMissingFieldsA ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMissingFieldsA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMissingFieldsA MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMissingFieldsA prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMissingFieldsA cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMissingFieldsA result; + + private TestMissingFieldsA PrepareBuilder() { + if (resultIsReadOnly) { + TestMissingFieldsA original = result; + result = new TestMissingFieldsA(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMissingFieldsA MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Descriptor; } + } + + public override TestMissingFieldsA DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.DefaultInstance; } + } + + public override TestMissingFieldsA BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasId { + get { return result.hasId; } + } + public int Id { + get { return result.Id; } + set { SetId(value); } + } + public Builder SetId(int value) { + PrepareBuilder(); + result.hasId = true; + result.id_ = value; + return this; + } + public Builder ClearId() { + PrepareBuilder(); + result.hasId = false; + result.id_ = 0; + return this; + } + + public bool HasEmail { + get { return result.hasEmail; } + } + public string Email { + get { return result.Email; } + set { SetEmail(value); } + } + public Builder SetEmail(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasEmail = true; + result.email_ = value; + return this; + } + public Builder ClearEmail() { + PrepareBuilder(); + result.hasEmail = false; + result.email_ = ""; + return this; + } + + public bool HasTestA { + get { return result.hasTestA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA TestA { + get { return result.TestA; } + set { SetTestA(value); } + } + public Builder SetTestA(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasTestA = true; + result.testA_ = value; + return this; + } + public Builder SetTestA(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasTestA = true; + result.testA_ = builderForValue.Build(); + return this; + } + public Builder MergeTestA(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasTestA && + result.testA_ != global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.DefaultInstance) { + result.testA_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsA.Types.SubA.CreateBuilder(result.testA_).MergeFrom(value).BuildPartial(); + } else { + result.testA_ = value; + } + result.hasTestA = true; + return this; + } + public Builder ClearTestA() { + PrepareBuilder(); + result.hasTestA = false; + result.testA_ = null; + return this; + } + } + static TestMissingFieldsA() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMissingFieldsB : pb::GeneratedMessage { + private TestMissingFieldsB() { } + private static readonly TestMissingFieldsB defaultInstance = new TestMissingFieldsB().MakeReadOnly(); + public static TestMissingFieldsB DefaultInstance { + get { return defaultInstance; } + } + + public override TestMissingFieldsB DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMissingFieldsB ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestMissingFieldsB__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestMissingFieldsB__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SubB : pb::GeneratedMessage { + private SubB() { } + private static readonly SubB defaultInstance = new SubB().MakeReadOnly(); + public static SubB DefaultInstance { + get { return defaultInstance; } + } + + public override SubB DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SubB ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestMissingFieldsB_SubB__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.internal__static_protobuf_unittest_extra_TestMissingFieldsB_SubB__FieldAccessorTable; } + } + + public const int ValuesFieldNumber = 7; + private pbc::PopsicleList values_ = new pbc::PopsicleList(); + public scg::IList ValuesList { + get { return pbc::Lists.AsReadOnly(values_); } + } + public int ValuesCount { + get { return values_.Count; } + } + public string GetValues(int index) { + return values_[index]; + } + + public static SubB ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SubB ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SubB ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SubB ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SubB ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SubB ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SubB ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SubB ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SubB ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SubB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SubB MakeReadOnly() { + values_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SubB prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SubB cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SubB result; + + private SubB PrepareBuilder() { + if (resultIsReadOnly) { + SubB original = result; + result = new SubB(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SubB MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.Descriptor; } + } + + public override SubB DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance; } + } + + public override SubB BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public pbc::IPopsicleList ValuesList { + get { return PrepareBuilder().values_; } + } + public int ValuesCount { + get { return result.ValuesCount; } + } + public string GetValues(int index) { + return result.GetValues(index); + } + public Builder SetValues(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.values_[index] = value; + return this; + } + public Builder AddValues(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.values_.Add(value); + return this; + } + public Builder AddRangeValues(scg::IEnumerable values) { + PrepareBuilder(); + result.values_.Add(values); + return this; + } + public Builder ClearValues() { + PrepareBuilder(); + result.values_.Clear(); + return this; + } + } + static SubB() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int IdFieldNumber = 2; + private bool hasId; + private int id_; + public bool HasId { + get { return hasId; } + } + public int Id { + get { return id_; } + } + + public const int WebsiteFieldNumber = 4; + private bool hasWebsite; + private string website_ = ""; + public bool HasWebsite { + get { return hasWebsite; } + } + public string Website { + get { return website_; } + } + + public const int TestBFieldNumber = 12; + private bool hasTestB; + private global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB testB_; + public bool HasTestB { + get { return hasTestB; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB TestB { + get { return testB_ ?? global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance; } + } + + public static TestMissingFieldsB ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMissingFieldsB ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMissingFieldsB ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMissingFieldsB ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMissingFieldsB ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMissingFieldsB ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMissingFieldsB ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMissingFieldsB ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMissingFieldsB ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMissingFieldsB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMissingFieldsB MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMissingFieldsB prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMissingFieldsB cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMissingFieldsB result; + + private TestMissingFieldsB PrepareBuilder() { + if (resultIsReadOnly) { + TestMissingFieldsB original = result; + result = new TestMissingFieldsB(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMissingFieldsB MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Descriptor; } + } + + public override TestMissingFieldsB DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.DefaultInstance; } + } + + public override TestMissingFieldsB BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasId { + get { return result.hasId; } + } + public int Id { + get { return result.Id; } + set { SetId(value); } + } + public Builder SetId(int value) { + PrepareBuilder(); + result.hasId = true; + result.id_ = value; + return this; + } + public Builder ClearId() { + PrepareBuilder(); + result.hasId = false; + result.id_ = 0; + return this; + } + + public bool HasWebsite { + get { return result.hasWebsite; } + } + public string Website { + get { return result.Website; } + set { SetWebsite(value); } + } + public Builder SetWebsite(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasWebsite = true; + result.website_ = value; + return this; + } + public Builder ClearWebsite() { + PrepareBuilder(); + result.hasWebsite = false; + result.website_ = ""; + return this; + } + + public bool HasTestB { + get { return result.hasTestB; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB TestB { + get { return result.TestB; } + set { SetTestB(value); } + } + public Builder SetTestB(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasTestB = true; + result.testB_ = value; + return this; + } + public Builder SetTestB(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasTestB = true; + result.testB_ = builderForValue.Build(); + return this; + } + public Builder MergeTestB(global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasTestB && + result.testB_ != global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.DefaultInstance) { + result.testB_ = global::Google.ProtocolBuffers.TestProtos.TestMissingFieldsB.Types.SubB.CreateBuilder(result.testB_).MergeFrom(value).BuildPartial(); + } else { + result.testB_ = value; + } + result.hasTestB = true; + return this; + } + public Builder ClearTestB() { + PrepareBuilder(); + result.hasTestB = false; + result.testB_ = null; + return this; + } + } + static TestMissingFieldsB() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasFullProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs new file mode 100644 index 00000000..caeb5ba9 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestExtrasLiteProtoFile.cs @@ -0,0 +1,4226 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestExtrasLiteProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.EmployeeIdLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedInt32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedInt64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedUint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedUint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedFixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedFixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSfixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSfixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedFloatExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedDoubleExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedBoolExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedEnumExtensionLite); + } + #endregion + #region Extensions + public const int EmployeeIdLiteFieldNumber = 126; + public static pb::GeneratedExtensionLite EmployeeIdLite; + public const int UnpackedInt32ExtensionLiteFieldNumber = 90; + public static pb::GeneratedRepeatExtensionLite UnpackedInt32ExtensionLite; + public const int UnpackedInt64ExtensionLiteFieldNumber = 91; + public static pb::GeneratedRepeatExtensionLite UnpackedInt64ExtensionLite; + public const int UnpackedUint32ExtensionLiteFieldNumber = 92; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite UnpackedUint32ExtensionLite; + public const int UnpackedUint64ExtensionLiteFieldNumber = 93; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite UnpackedUint64ExtensionLite; + public const int UnpackedSint32ExtensionLiteFieldNumber = 94; + public static pb::GeneratedRepeatExtensionLite UnpackedSint32ExtensionLite; + public const int UnpackedSint64ExtensionLiteFieldNumber = 95; + public static pb::GeneratedRepeatExtensionLite UnpackedSint64ExtensionLite; + public const int UnpackedFixed32ExtensionLiteFieldNumber = 96; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite UnpackedFixed32ExtensionLite; + public const int UnpackedFixed64ExtensionLiteFieldNumber = 97; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite UnpackedFixed64ExtensionLite; + public const int UnpackedSfixed32ExtensionLiteFieldNumber = 98; + public static pb::GeneratedRepeatExtensionLite UnpackedSfixed32ExtensionLite; + public const int UnpackedSfixed64ExtensionLiteFieldNumber = 99; + public static pb::GeneratedRepeatExtensionLite UnpackedSfixed64ExtensionLite; + public const int UnpackedFloatExtensionLiteFieldNumber = 100; + public static pb::GeneratedRepeatExtensionLite UnpackedFloatExtensionLite; + public const int UnpackedDoubleExtensionLiteFieldNumber = 101; + public static pb::GeneratedRepeatExtensionLite UnpackedDoubleExtensionLite; + public const int UnpackedBoolExtensionLiteFieldNumber = 102; + public static pb::GeneratedRepeatExtensionLite UnpackedBoolExtensionLite; + public const int UnpackedEnumExtensionLiteFieldNumber = 103; + public static pb::GeneratedRepeatExtensionLite UnpackedEnumExtensionLite; + #endregion + + #region Static variables + #endregion + #region Extensions + internal static readonly object Descriptor; + static UnitTestExtrasLiteProtoFile() { + Descriptor = null; + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.EmployeeIdLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest_extra.employee_id_lite", + global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.TestInteropEmployeeIdLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.EmployeeIdLiteFieldNumber, + pbd::FieldType.Message); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedInt32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_int32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedInt32ExtensionLiteFieldNumber, + pbd::FieldType.Int32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedInt64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_int64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedInt64ExtensionLiteFieldNumber, + pbd::FieldType.Int64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedUint32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_uint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedUint32ExtensionLiteFieldNumber, + pbd::FieldType.UInt32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedUint64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_uint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedUint64ExtensionLiteFieldNumber, + pbd::FieldType.UInt64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSint32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_sint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSint32ExtensionLiteFieldNumber, + pbd::FieldType.SInt32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSint64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_sint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSint64ExtensionLiteFieldNumber, + pbd::FieldType.SInt64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedFixed32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_fixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedFixed32ExtensionLiteFieldNumber, + pbd::FieldType.Fixed32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedFixed64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_fixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedFixed64ExtensionLiteFieldNumber, + pbd::FieldType.Fixed64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSfixed32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_sfixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSfixed32ExtensionLiteFieldNumber, + pbd::FieldType.SFixed32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSfixed64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_sfixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedSfixed64ExtensionLiteFieldNumber, + pbd::FieldType.SFixed64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedFloatExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_float_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedFloatExtensionLiteFieldNumber, + pbd::FieldType.Float, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedDoubleExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_double_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedDoubleExtensionLiteFieldNumber, + pbd::FieldType.Double, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedBoolExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_bool_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedBoolExtensionLiteFieldNumber, + pbd::FieldType.Bool, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedEnumExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest_extra.unpacked_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance, + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.UnpackedEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum, + false); + } + #endregion + + } + #region Enums + public enum ExtraEnum { + DEFAULT = 10, + EXLITE_FOO = 7, + EXLITE_BAR = 8, + EXLITE_BAZ = 9, + } + + public enum UnpackedTypesForeignEnumLite { + FOREIGN_LITE_FOO = 4, + FOREIGN_LITE_BAR = 5, + FOREIGN_LITE_BAZ = 6, + } + + #endregion + + #region Messages + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRequiredLite : pb::GeneratedMessageLite { + private TestRequiredLite() { } + private static readonly TestRequiredLite defaultInstance = new TestRequiredLite().MakeReadOnly(); + private static readonly string[] _testRequiredLiteFieldNames = new string[] { "d", "en" }; + private static readonly uint[] _testRequiredLiteFieldTags = new uint[] { 8, 16 }; + public static TestRequiredLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestRequiredLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRequiredLite ThisMessage { + get { return this; } + } + + public const int DFieldNumber = 1; + private bool hasD; + private int d_; + public bool HasD { + get { return hasD; } + } + public int D { + get { return d_; } + } + + public const int EnFieldNumber = 2; + private bool hasEn; + private global::Google.ProtocolBuffers.TestProtos.ExtraEnum en_ = global::Google.ProtocolBuffers.TestProtos.ExtraEnum.DEFAULT; + public bool HasEn { + get { return hasEn; } + } + public global::Google.ProtocolBuffers.TestProtos.ExtraEnum En { + get { return en_; } + } + + public override bool IsInitialized { + get { + if (!hasD) return false; + if (!hasEn) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRequiredLiteFieldNames; + if (hasD) { + output.WriteInt32(1, field_names[0], D); + } + if (hasEn) { + output.WriteEnum(2, field_names[1], (int) En, En); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasD) { + size += pb::CodedOutputStream.ComputeInt32Size(1, D); + } + if (hasEn) { + size += pb::CodedOutputStream.ComputeEnumSize(2, (int) En); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasD) hash ^= d_.GetHashCode(); + if (hasEn) hash ^= en_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestRequiredLite other = obj as TestRequiredLite; + if (other == null) return false; + if (hasD != other.hasD || (hasD && !d_.Equals(other.d_))) return false; + if (hasEn != other.hasEn || (hasEn && !en_.Equals(other.en_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("d", hasD, d_, writer); + PrintField("en", hasEn, en_, writer); + } + #endregion + + public static TestRequiredLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRequiredLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRequiredLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRequiredLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRequiredLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRequiredLite prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRequiredLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRequiredLite result; + + private TestRequiredLite PrepareBuilder() { + if (resultIsReadOnly) { + TestRequiredLite original = result; + result = new TestRequiredLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRequiredLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestRequiredLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredLite.DefaultInstance; } + } + + public override TestRequiredLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestRequiredLite) { + return MergeFrom((TestRequiredLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRequiredLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasD) { + D = other.D; + } + if (other.HasEn) { + En = other.En; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRequiredLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRequiredLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasD = input.ReadInt32(ref result.d_); + break; + } + case 16: { + object unknown; + if(input.ReadEnum(ref result.en_, out unknown)) { + result.hasEn = true; + } else if(unknown is int) { + } + break; + } + } + } + + return this; + } + + + public bool HasD { + get { return result.hasD; } + } + public int D { + get { return result.D; } + set { SetD(value); } + } + public Builder SetD(int value) { + PrepareBuilder(); + result.hasD = true; + result.d_ = value; + return this; + } + public Builder ClearD() { + PrepareBuilder(); + result.hasD = false; + result.d_ = 0; + return this; + } + + public bool HasEn { + get { return result.hasEn; } + } + public global::Google.ProtocolBuffers.TestProtos.ExtraEnum En { + get { return result.En; } + set { SetEn(value); } + } + public Builder SetEn(global::Google.ProtocolBuffers.TestProtos.ExtraEnum value) { + PrepareBuilder(); + result.hasEn = true; + result.en_ = value; + return this; + } + public Builder ClearEn() { + PrepareBuilder(); + result.hasEn = false; + result.en_ = global::Google.ProtocolBuffers.TestProtos.ExtraEnum.DEFAULT; + return this; + } + } + static TestRequiredLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestInteropPersonLite : pb::ExtendableMessageLite { + private TestInteropPersonLite() { } + private static readonly TestInteropPersonLite defaultInstance = new TestInteropPersonLite().MakeReadOnly(); + private static readonly string[] _testInteropPersonLiteFieldNames = new string[] { "addresses", "codes", "email", "id", "name", "phone" }; + private static readonly uint[] _testInteropPersonLiteFieldTags = new uint[] { 43, 82, 26, 16, 10, 34 }; + public static TestInteropPersonLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestInteropPersonLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestInteropPersonLite ThisMessage { + get { return this; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum PhoneType { + MOBILE = 0, + HOME = 1, + WORK = 2, + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class PhoneNumber : pb::GeneratedMessageLite { + private PhoneNumber() { } + private static readonly PhoneNumber defaultInstance = new PhoneNumber().MakeReadOnly(); + private static readonly string[] _phoneNumberFieldNames = new string[] { "number", "type" }; + private static readonly uint[] _phoneNumberFieldTags = new uint[] { 10, 16 }; + public static PhoneNumber DefaultInstance { + get { return defaultInstance; } + } + + public override PhoneNumber DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override PhoneNumber ThisMessage { + get { return this; } + } + + public const int NumberFieldNumber = 1; + private bool hasNumber; + private string number_ = ""; + public bool HasNumber { + get { return hasNumber; } + } + public string Number { + get { return number_; } + } + + public const int TypeFieldNumber = 2; + private bool hasType; + private global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType type_ = global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType.HOME; + public bool HasType { + get { return hasType; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType Type { + get { return type_; } + } + + public override bool IsInitialized { + get { + if (!hasNumber) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _phoneNumberFieldNames; + if (hasNumber) { + output.WriteString(1, field_names[0], Number); + } + if (hasType) { + output.WriteEnum(2, field_names[1], (int) Type, Type); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasNumber) { + size += pb::CodedOutputStream.ComputeStringSize(1, Number); + } + if (hasType) { + size += pb::CodedOutputStream.ComputeEnumSize(2, (int) Type); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasNumber) hash ^= number_.GetHashCode(); + if (hasType) hash ^= type_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + PhoneNumber other = obj as PhoneNumber; + if (other == null) return false; + if (hasNumber != other.hasNumber || (hasNumber && !number_.Equals(other.number_))) return false; + if (hasType != other.hasType || (hasType && !type_.Equals(other.type_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("number", hasNumber, number_, writer); + PrintField("type", hasType, type_, writer); + } + #endregion + + public static PhoneNumber ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static PhoneNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static PhoneNumber ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static PhoneNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static PhoneNumber ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static PhoneNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static PhoneNumber ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static PhoneNumber ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static PhoneNumber ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static PhoneNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private PhoneNumber MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(PhoneNumber prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(PhoneNumber cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private PhoneNumber result; + + private PhoneNumber PrepareBuilder() { + if (resultIsReadOnly) { + PhoneNumber original = result; + result = new PhoneNumber(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override PhoneNumber MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override PhoneNumber DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.DefaultInstance; } + } + + public override PhoneNumber BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is PhoneNumber) { + return MergeFrom((PhoneNumber) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(PhoneNumber other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasNumber) { + Number = other.Number; + } + if (other.HasType) { + Type = other.Type; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_phoneNumberFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _phoneNumberFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasNumber = input.ReadString(ref result.number_); + break; + } + case 16: { + object unknown; + if(input.ReadEnum(ref result.type_, out unknown)) { + result.hasType = true; + } else if(unknown is int) { + } + break; + } + } + } + + return this; + } + + + public bool HasNumber { + get { return result.hasNumber; } + } + public string Number { + get { return result.Number; } + set { SetNumber(value); } + } + public Builder SetNumber(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasNumber = true; + result.number_ = value; + return this; + } + public Builder ClearNumber() { + PrepareBuilder(); + result.hasNumber = false; + result.number_ = ""; + return this; + } + + public bool HasType { + get { return result.hasType; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType Type { + get { return result.Type; } + set { SetType(value); } + } + public Builder SetType(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType value) { + PrepareBuilder(); + result.hasType = true; + result.type_ = value; + return this; + } + public Builder ClearType() { + PrepareBuilder(); + result.hasType = false; + result.type_ = global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneType.HOME; + return this; + } + } + static PhoneNumber() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Addresses : pb::GeneratedMessageLite { + private Addresses() { } + private static readonly Addresses defaultInstance = new Addresses().MakeReadOnly(); + private static readonly string[] _addressesFieldNames = new string[] { "address", "address2", "city", "state", "zip" }; + private static readonly uint[] _addressesFieldTags = new uint[] { 10, 18, 26, 34, 45 }; + public static Addresses DefaultInstance { + get { return defaultInstance; } + } + + public override Addresses DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Addresses ThisMessage { + get { return this; } + } + + public const int AddressFieldNumber = 1; + private bool hasAddress; + private string address_ = ""; + public bool HasAddress { + get { return hasAddress; } + } + public string Address { + get { return address_; } + } + + public const int Address2FieldNumber = 2; + private bool hasAddress2; + private string address2_ = ""; + public bool HasAddress2 { + get { return hasAddress2; } + } + public string Address2 { + get { return address2_; } + } + + public const int CityFieldNumber = 3; + private bool hasCity; + private string city_ = ""; + public bool HasCity { + get { return hasCity; } + } + public string City { + get { return city_; } + } + + public const int StateFieldNumber = 4; + private bool hasState; + private string state_ = ""; + public bool HasState { + get { return hasState; } + } + public string State { + get { return state_; } + } + + public const int ZipFieldNumber = 5; + private bool hasZip; + private uint zip_; + public bool HasZip { + get { return hasZip; } + } + [global::System.CLSCompliant(false)] + public uint Zip { + get { return zip_; } + } + + public override bool IsInitialized { + get { + if (!hasAddress) return false; + if (!hasCity) return false; + if (!hasState) return false; + if (!hasZip) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _addressesFieldNames; + if (hasAddress) { + output.WriteString(1, field_names[0], Address); + } + if (hasAddress2) { + output.WriteString(2, field_names[1], Address2); + } + if (hasCity) { + output.WriteString(3, field_names[2], City); + } + if (hasState) { + output.WriteString(4, field_names[3], State); + } + if (hasZip) { + output.WriteFixed32(5, field_names[4], Zip); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasAddress) { + size += pb::CodedOutputStream.ComputeStringSize(1, Address); + } + if (hasAddress2) { + size += pb::CodedOutputStream.ComputeStringSize(2, Address2); + } + if (hasCity) { + size += pb::CodedOutputStream.ComputeStringSize(3, City); + } + if (hasState) { + size += pb::CodedOutputStream.ComputeStringSize(4, State); + } + if (hasZip) { + size += pb::CodedOutputStream.ComputeFixed32Size(5, Zip); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasAddress) hash ^= address_.GetHashCode(); + if (hasAddress2) hash ^= address2_.GetHashCode(); + if (hasCity) hash ^= city_.GetHashCode(); + if (hasState) hash ^= state_.GetHashCode(); + if (hasZip) hash ^= zip_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + Addresses other = obj as Addresses; + if (other == null) return false; + if (hasAddress != other.hasAddress || (hasAddress && !address_.Equals(other.address_))) return false; + if (hasAddress2 != other.hasAddress2 || (hasAddress2 && !address2_.Equals(other.address2_))) return false; + if (hasCity != other.hasCity || (hasCity && !city_.Equals(other.city_))) return false; + if (hasState != other.hasState || (hasState && !state_.Equals(other.state_))) return false; + if (hasZip != other.hasZip || (hasZip && !zip_.Equals(other.zip_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("address", hasAddress, address_, writer); + PrintField("address2", hasAddress2, address2_, writer); + PrintField("city", hasCity, city_, writer); + PrintField("state", hasState, state_, writer); + PrintField("zip", hasZip, zip_, writer); + } + #endregion + + public static Addresses ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Addresses ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Addresses ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Addresses ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Addresses ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Addresses ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Addresses ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Addresses ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Addresses ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Addresses ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Addresses MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Addresses prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Addresses cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Addresses result; + + private Addresses PrepareBuilder() { + if (resultIsReadOnly) { + Addresses original = result; + result = new Addresses(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Addresses MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override Addresses DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.DefaultInstance; } + } + + public override Addresses BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is Addresses) { + return MergeFrom((Addresses) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Addresses other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasAddress) { + Address = other.Address; + } + if (other.HasAddress2) { + Address2 = other.Address2; + } + if (other.HasCity) { + City = other.City; + } + if (other.HasState) { + State = other.State; + } + if (other.HasZip) { + Zip = other.Zip; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_addressesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _addressesFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasAddress = input.ReadString(ref result.address_); + break; + } + case 18: { + result.hasAddress2 = input.ReadString(ref result.address2_); + break; + } + case 26: { + result.hasCity = input.ReadString(ref result.city_); + break; + } + case 34: { + result.hasState = input.ReadString(ref result.state_); + break; + } + case 45: { + result.hasZip = input.ReadFixed32(ref result.zip_); + break; + } + } + } + + return this; + } + + + public bool HasAddress { + get { return result.hasAddress; } + } + public string Address { + get { return result.Address; } + set { SetAddress(value); } + } + public Builder SetAddress(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasAddress = true; + result.address_ = value; + return this; + } + public Builder ClearAddress() { + PrepareBuilder(); + result.hasAddress = false; + result.address_ = ""; + return this; + } + + public bool HasAddress2 { + get { return result.hasAddress2; } + } + public string Address2 { + get { return result.Address2; } + set { SetAddress2(value); } + } + public Builder SetAddress2(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasAddress2 = true; + result.address2_ = value; + return this; + } + public Builder ClearAddress2() { + PrepareBuilder(); + result.hasAddress2 = false; + result.address2_ = ""; + return this; + } + + public bool HasCity { + get { return result.hasCity; } + } + public string City { + get { return result.City; } + set { SetCity(value); } + } + public Builder SetCity(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasCity = true; + result.city_ = value; + return this; + } + public Builder ClearCity() { + PrepareBuilder(); + result.hasCity = false; + result.city_ = ""; + return this; + } + + public bool HasState { + get { return result.hasState; } + } + public string State { + get { return result.State; } + set { SetState(value); } + } + public Builder SetState(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasState = true; + result.state_ = value; + return this; + } + public Builder ClearState() { + PrepareBuilder(); + result.hasState = false; + result.state_ = ""; + return this; + } + + public bool HasZip { + get { return result.hasZip; } + } + [global::System.CLSCompliant(false)] + public uint Zip { + get { return result.Zip; } + set { SetZip(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetZip(uint value) { + PrepareBuilder(); + result.hasZip = true; + result.zip_ = value; + return this; + } + public Builder ClearZip() { + PrepareBuilder(); + result.hasZip = false; + result.zip_ = 0; + return this; + } + } + static Addresses() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int NameFieldNumber = 1; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public const int IdFieldNumber = 2; + private bool hasId; + private int id_; + public bool HasId { + get { return hasId; } + } + public int Id { + get { return id_; } + } + + public const int EmailFieldNumber = 3; + private bool hasEmail; + private string email_ = ""; + public bool HasEmail { + get { return hasEmail; } + } + public string Email { + get { return email_; } + } + + public const int CodesFieldNumber = 10; + private int codesMemoizedSerializedSize; + private pbc::PopsicleList codes_ = new pbc::PopsicleList(); + public scg::IList CodesList { + get { return pbc::Lists.AsReadOnly(codes_); } + } + public int CodesCount { + get { return codes_.Count; } + } + public int GetCodes(int index) { + return codes_[index]; + } + + public const int PhoneFieldNumber = 4; + private pbc::PopsicleList phone_ = new pbc::PopsicleList(); + public scg::IList PhoneList { + get { return phone_; } + } + public int PhoneCount { + get { return phone_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber GetPhone(int index) { + return phone_[index]; + } + + public const int AddressesFieldNumber = 5; + private pbc::PopsicleList addresses_ = new pbc::PopsicleList(); + public scg::IList AddressesList { + get { return addresses_; } + } + public int AddressesCount { + get { return addresses_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses GetAddresses(int index) { + return addresses_[index]; + } + + public override bool IsInitialized { + get { + if (!hasName) return false; + if (!hasId) return false; + foreach (global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber element in PhoneList) { + if (!element.IsInitialized) return false; + } + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testInteropPersonLiteFieldNames; + pb::ExtendableMessageLite.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasName) { + output.WriteString(1, field_names[4], Name); + } + if (hasId) { + output.WriteInt32(2, field_names[3], Id); + } + if (hasEmail) { + output.WriteString(3, field_names[2], Email); + } + if (phone_.Count > 0) { + output.WriteMessageArray(4, field_names[5], phone_); + } + if (addresses_.Count > 0) { + output.WriteGroupArray(5, field_names[0], addresses_); + } + if (codes_.Count > 0) { + output.WritePackedInt32Array(10, field_names[1], codesMemoizedSerializedSize, codes_); + } + extensionWriter.WriteUntil(200, output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(1, Name); + } + if (hasId) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Id); + } + if (hasEmail) { + size += pb::CodedOutputStream.ComputeStringSize(3, Email); + } + { + int dataSize = 0; + foreach (int element in CodesList) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + if (codes_.Count != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + codesMemoizedSerializedSize = dataSize; + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber element in PhoneList) { + size += pb::CodedOutputStream.ComputeMessageSize(4, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses element in AddressesList) { + size += pb::CodedOutputStream.ComputeGroupSize(5, element); + } + size += ExtensionsSerializedSize; + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasName) hash ^= name_.GetHashCode(); + if (hasId) hash ^= id_.GetHashCode(); + if (hasEmail) hash ^= email_.GetHashCode(); + foreach(int i in codes_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber i in phone_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses i in addresses_) + hash ^= i.GetHashCode(); + hash ^= base.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestInteropPersonLite other = obj as TestInteropPersonLite; + if (other == null) return false; + if (hasName != other.hasName || (hasName && !name_.Equals(other.name_))) return false; + if (hasId != other.hasId || (hasId && !id_.Equals(other.id_))) return false; + if (hasEmail != other.hasEmail || (hasEmail && !email_.Equals(other.email_))) return false; + if(codes_.Count != other.codes_.Count) return false; + for(int ix=0; ix < codes_.Count; ix++) + if(!codes_[ix].Equals(other.codes_[ix])) return false; + if(phone_.Count != other.phone_.Count) return false; + for(int ix=0; ix < phone_.Count; ix++) + if(!phone_[ix].Equals(other.phone_[ix])) return false; + if(addresses_.Count != other.addresses_.Count) return false; + for(int ix=0; ix < addresses_.Count; ix++) + if(!addresses_[ix].Equals(other.addresses_[ix])) return false; + if (!base.Equals(other)) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("name", hasName, name_, writer); + PrintField("id", hasId, id_, writer); + PrintField("email", hasEmail, email_, writer); + PrintField("phone", phone_, writer); + PrintField("Addresses", addresses_, writer); + PrintField("codes", codes_, writer); + base.PrintTo(writer); + } + #endregion + + public static TestInteropPersonLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestInteropPersonLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestInteropPersonLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestInteropPersonLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestInteropPersonLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestInteropPersonLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestInteropPersonLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestInteropPersonLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestInteropPersonLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestInteropPersonLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestInteropPersonLite MakeReadOnly() { + codes_.MakeReadOnly(); + phone_.MakeReadOnly(); + addresses_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestInteropPersonLite prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestInteropPersonLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestInteropPersonLite result; + + private TestInteropPersonLite PrepareBuilder() { + if (resultIsReadOnly) { + TestInteropPersonLite original = result; + result = new TestInteropPersonLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestInteropPersonLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestInteropPersonLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.DefaultInstance; } + } + + public override TestInteropPersonLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestInteropPersonLite) { + return MergeFrom((TestInteropPersonLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestInteropPersonLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasName) { + Name = other.Name; + } + if (other.HasId) { + Id = other.Id; + } + if (other.HasEmail) { + Email = other.Email; + } + if (other.codes_.Count != 0) { + result.codes_.Add(other.codes_); + } + if (other.phone_.Count != 0) { + result.phone_.Add(other.phone_); + } + if (other.addresses_.Count != 0) { + result.addresses_.Add(other.addresses_); + } + this.MergeExtensionFields(other); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testInteropPersonLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testInteropPersonLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasName = input.ReadString(ref result.name_); + break; + } + case 16: { + result.hasId = input.ReadInt32(ref result.id_); + break; + } + case 26: { + result.hasEmail = input.ReadString(ref result.email_); + break; + } + case 34: { + input.ReadMessageArray(tag, field_name, result.phone_, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.DefaultInstance, extensionRegistry); + break; + } + case 43: { + input.ReadGroupArray(tag, field_name, result.addresses_, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.DefaultInstance, extensionRegistry); + break; + } + case 82: + case 80: { + input.ReadInt32Array(tag, field_name, result.codes_); + break; + } + } + } + + return this; + } + + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + + public bool HasId { + get { return result.hasId; } + } + public int Id { + get { return result.Id; } + set { SetId(value); } + } + public Builder SetId(int value) { + PrepareBuilder(); + result.hasId = true; + result.id_ = value; + return this; + } + public Builder ClearId() { + PrepareBuilder(); + result.hasId = false; + result.id_ = 0; + return this; + } + + public bool HasEmail { + get { return result.hasEmail; } + } + public string Email { + get { return result.Email; } + set { SetEmail(value); } + } + public Builder SetEmail(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasEmail = true; + result.email_ = value; + return this; + } + public Builder ClearEmail() { + PrepareBuilder(); + result.hasEmail = false; + result.email_ = ""; + return this; + } + + public pbc::IPopsicleList CodesList { + get { return PrepareBuilder().codes_; } + } + public int CodesCount { + get { return result.CodesCount; } + } + public int GetCodes(int index) { + return result.GetCodes(index); + } + public Builder SetCodes(int index, int value) { + PrepareBuilder(); + result.codes_[index] = value; + return this; + } + public Builder AddCodes(int value) { + PrepareBuilder(); + result.codes_.Add(value); + return this; + } + public Builder AddRangeCodes(scg::IEnumerable values) { + PrepareBuilder(); + result.codes_.Add(values); + return this; + } + public Builder ClearCodes() { + PrepareBuilder(); + result.codes_.Clear(); + return this; + } + + public pbc::IPopsicleList PhoneList { + get { return PrepareBuilder().phone_; } + } + public int PhoneCount { + get { return result.PhoneCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber GetPhone(int index) { + return result.GetPhone(index); + } + public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.phone_[index] = value; + return this; + } + public Builder SetPhone(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.phone_[index] = builderForValue.Build(); + return this; + } + public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.phone_.Add(value); + return this; + } + public Builder AddPhone(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.phone_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangePhone(scg::IEnumerable values) { + PrepareBuilder(); + result.phone_.Add(values); + return this; + } + public Builder ClearPhone() { + PrepareBuilder(); + result.phone_.Clear(); + return this; + } + + public pbc::IPopsicleList AddressesList { + get { return PrepareBuilder().addresses_; } + } + public int AddressesCount { + get { return result.AddressesCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses GetAddresses(int index) { + return result.GetAddresses(index); + } + public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.addresses_[index] = value; + return this; + } + public Builder SetAddresses(int index, global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.addresses_[index] = builderForValue.Build(); + return this; + } + public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.addresses_.Add(value); + return this; + } + public Builder AddAddresses(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.Addresses.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.addresses_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeAddresses(scg::IEnumerable values) { + PrepareBuilder(); + result.addresses_.Add(values); + return this; + } + public Builder ClearAddresses() { + PrepareBuilder(); + result.addresses_.Clear(); + return this; + } + } + static TestInteropPersonLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestInteropEmployeeIdLite : pb::GeneratedMessageLite { + private TestInteropEmployeeIdLite() { } + private static readonly TestInteropEmployeeIdLite defaultInstance = new TestInteropEmployeeIdLite().MakeReadOnly(); + private static readonly string[] _testInteropEmployeeIdLiteFieldNames = new string[] { "number" }; + private static readonly uint[] _testInteropEmployeeIdLiteFieldTags = new uint[] { 10 }; + public static TestInteropEmployeeIdLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestInteropEmployeeIdLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestInteropEmployeeIdLite ThisMessage { + get { return this; } + } + + public const int NumberFieldNumber = 1; + private bool hasNumber; + private string number_ = ""; + public bool HasNumber { + get { return hasNumber; } + } + public string Number { + get { return number_; } + } + + public override bool IsInitialized { + get { + if (!hasNumber) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testInteropEmployeeIdLiteFieldNames; + if (hasNumber) { + output.WriteString(1, field_names[0], Number); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasNumber) { + size += pb::CodedOutputStream.ComputeStringSize(1, Number); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasNumber) hash ^= number_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestInteropEmployeeIdLite other = obj as TestInteropEmployeeIdLite; + if (other == null) return false; + if (hasNumber != other.hasNumber || (hasNumber && !number_.Equals(other.number_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("number", hasNumber, number_, writer); + } + #endregion + + public static TestInteropEmployeeIdLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestInteropEmployeeIdLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestInteropEmployeeIdLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestInteropEmployeeIdLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestInteropEmployeeIdLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestInteropEmployeeIdLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestInteropEmployeeIdLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestInteropEmployeeIdLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestInteropEmployeeIdLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestInteropEmployeeIdLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestInteropEmployeeIdLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestInteropEmployeeIdLite prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestInteropEmployeeIdLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestInteropEmployeeIdLite result; + + private TestInteropEmployeeIdLite PrepareBuilder() { + if (resultIsReadOnly) { + TestInteropEmployeeIdLite original = result; + result = new TestInteropEmployeeIdLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestInteropEmployeeIdLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestInteropEmployeeIdLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestInteropEmployeeIdLite.DefaultInstance; } + } + + public override TestInteropEmployeeIdLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestInteropEmployeeIdLite) { + return MergeFrom((TestInteropEmployeeIdLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestInteropEmployeeIdLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestInteropEmployeeIdLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasNumber) { + Number = other.Number; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testInteropEmployeeIdLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testInteropEmployeeIdLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasNumber = input.ReadString(ref result.number_); + break; + } + } + } + + return this; + } + + + public bool HasNumber { + get { return result.hasNumber; } + } + public string Number { + get { return result.Number; } + set { SetNumber(value); } + } + public Builder SetNumber(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasNumber = true; + result.number_ = value; + return this; + } + public Builder ClearNumber() { + PrepareBuilder(); + result.hasNumber = false; + result.number_ = ""; + return this; + } + } + static TestInteropEmployeeIdLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestUnpackedExtensionsLite : pb::ExtendableMessageLite { + private TestUnpackedExtensionsLite() { } + private static readonly TestUnpackedExtensionsLite defaultInstance = new TestUnpackedExtensionsLite().MakeReadOnly(); + private static readonly string[] _testUnpackedExtensionsLiteFieldNames = new string[] { }; + private static readonly uint[] _testUnpackedExtensionsLiteFieldTags = new uint[] { }; + public static TestUnpackedExtensionsLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestUnpackedExtensionsLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestUnpackedExtensionsLite ThisMessage { + get { return this; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testUnpackedExtensionsLiteFieldNames; + pb::ExtendableMessageLite.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + hash ^= base.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestUnpackedExtensionsLite other = obj as TestUnpackedExtensionsLite; + if (other == null) return false; + if (!base.Equals(other)) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + base.PrintTo(writer); + } + #endregion + + public static TestUnpackedExtensionsLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedExtensionsLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedExtensionsLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedExtensionsLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedExtensionsLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedExtensionsLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedExtensionsLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestUnpackedExtensionsLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestUnpackedExtensionsLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedExtensionsLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestUnpackedExtensionsLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestUnpackedExtensionsLite prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestUnpackedExtensionsLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestUnpackedExtensionsLite result; + + private TestUnpackedExtensionsLite PrepareBuilder() { + if (resultIsReadOnly) { + TestUnpackedExtensionsLite original = result; + result = new TestUnpackedExtensionsLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestUnpackedExtensionsLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestUnpackedExtensionsLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance; } + } + + public override TestUnpackedExtensionsLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestUnpackedExtensionsLite) { + return MergeFrom((TestUnpackedExtensionsLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestUnpackedExtensionsLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testUnpackedExtensionsLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testUnpackedExtensionsLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + } + } + + return this; + } + + } + static TestUnpackedExtensionsLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestUnpackedTypesLite : pb::GeneratedMessageLite { + private TestUnpackedTypesLite() { } + private static readonly TestUnpackedTypesLite defaultInstance = new TestUnpackedTypesLite().MakeReadOnly(); + private static readonly string[] _testUnpackedTypesLiteFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; + private static readonly uint[] _testUnpackedTypesLiteFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; + public static TestUnpackedTypesLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestUnpackedTypesLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestUnpackedTypesLite ThisMessage { + get { return this; } + } + + public const int UnpackedInt32FieldNumber = 90; + private pbc::PopsicleList unpackedInt32_ = new pbc::PopsicleList(); + public scg::IList UnpackedInt32List { + get { return pbc::Lists.AsReadOnly(unpackedInt32_); } + } + public int UnpackedInt32Count { + get { return unpackedInt32_.Count; } + } + public int GetUnpackedInt32(int index) { + return unpackedInt32_[index]; + } + + public const int UnpackedInt64FieldNumber = 91; + private pbc::PopsicleList unpackedInt64_ = new pbc::PopsicleList(); + public scg::IList UnpackedInt64List { + get { return pbc::Lists.AsReadOnly(unpackedInt64_); } + } + public int UnpackedInt64Count { + get { return unpackedInt64_.Count; } + } + public long GetUnpackedInt64(int index) { + return unpackedInt64_[index]; + } + + public const int UnpackedUint32FieldNumber = 92; + private pbc::PopsicleList unpackedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedUint32List { + get { return pbc::Lists.AsReadOnly(unpackedUint32_); } + } + public int UnpackedUint32Count { + get { return unpackedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedUint32(int index) { + return unpackedUint32_[index]; + } + + public const int UnpackedUint64FieldNumber = 93; + private pbc::PopsicleList unpackedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedUint64List { + get { return pbc::Lists.AsReadOnly(unpackedUint64_); } + } + public int UnpackedUint64Count { + get { return unpackedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedUint64(int index) { + return unpackedUint64_[index]; + } + + public const int UnpackedSint32FieldNumber = 94; + private pbc::PopsicleList unpackedSint32_ = new pbc::PopsicleList(); + public scg::IList UnpackedSint32List { + get { return pbc::Lists.AsReadOnly(unpackedSint32_); } + } + public int UnpackedSint32Count { + get { return unpackedSint32_.Count; } + } + public int GetUnpackedSint32(int index) { + return unpackedSint32_[index]; + } + + public const int UnpackedSint64FieldNumber = 95; + private pbc::PopsicleList unpackedSint64_ = new pbc::PopsicleList(); + public scg::IList UnpackedSint64List { + get { return pbc::Lists.AsReadOnly(unpackedSint64_); } + } + public int UnpackedSint64Count { + get { return unpackedSint64_.Count; } + } + public long GetUnpackedSint64(int index) { + return unpackedSint64_[index]; + } + + public const int UnpackedFixed32FieldNumber = 96; + private pbc::PopsicleList unpackedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedFixed32List { + get { return pbc::Lists.AsReadOnly(unpackedFixed32_); } + } + public int UnpackedFixed32Count { + get { return unpackedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedFixed32(int index) { + return unpackedFixed32_[index]; + } + + public const int UnpackedFixed64FieldNumber = 97; + private pbc::PopsicleList unpackedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedFixed64List { + get { return pbc::Lists.AsReadOnly(unpackedFixed64_); } + } + public int UnpackedFixed64Count { + get { return unpackedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedFixed64(int index) { + return unpackedFixed64_[index]; + } + + public const int UnpackedSfixed32FieldNumber = 98; + private pbc::PopsicleList unpackedSfixed32_ = new pbc::PopsicleList(); + public scg::IList UnpackedSfixed32List { + get { return pbc::Lists.AsReadOnly(unpackedSfixed32_); } + } + public int UnpackedSfixed32Count { + get { return unpackedSfixed32_.Count; } + } + public int GetUnpackedSfixed32(int index) { + return unpackedSfixed32_[index]; + } + + public const int UnpackedSfixed64FieldNumber = 99; + private pbc::PopsicleList unpackedSfixed64_ = new pbc::PopsicleList(); + public scg::IList UnpackedSfixed64List { + get { return pbc::Lists.AsReadOnly(unpackedSfixed64_); } + } + public int UnpackedSfixed64Count { + get { return unpackedSfixed64_.Count; } + } + public long GetUnpackedSfixed64(int index) { + return unpackedSfixed64_[index]; + } + + public const int UnpackedFloatFieldNumber = 100; + private pbc::PopsicleList unpackedFloat_ = new pbc::PopsicleList(); + public scg::IList UnpackedFloatList { + get { return pbc::Lists.AsReadOnly(unpackedFloat_); } + } + public int UnpackedFloatCount { + get { return unpackedFloat_.Count; } + } + public float GetUnpackedFloat(int index) { + return unpackedFloat_[index]; + } + + public const int UnpackedDoubleFieldNumber = 101; + private pbc::PopsicleList unpackedDouble_ = new pbc::PopsicleList(); + public scg::IList UnpackedDoubleList { + get { return pbc::Lists.AsReadOnly(unpackedDouble_); } + } + public int UnpackedDoubleCount { + get { return unpackedDouble_.Count; } + } + public double GetUnpackedDouble(int index) { + return unpackedDouble_[index]; + } + + public const int UnpackedBoolFieldNumber = 102; + private pbc::PopsicleList unpackedBool_ = new pbc::PopsicleList(); + public scg::IList UnpackedBoolList { + get { return pbc::Lists.AsReadOnly(unpackedBool_); } + } + public int UnpackedBoolCount { + get { return unpackedBool_.Count; } + } + public bool GetUnpackedBool(int index) { + return unpackedBool_[index]; + } + + public const int UnpackedEnumFieldNumber = 103; + private pbc::PopsicleList unpackedEnum_ = new pbc::PopsicleList(); + public scg::IList UnpackedEnumList { + get { return pbc::Lists.AsReadOnly(unpackedEnum_); } + } + public int UnpackedEnumCount { + get { return unpackedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.UnpackedTypesForeignEnumLite GetUnpackedEnum(int index) { + return unpackedEnum_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testUnpackedTypesLiteFieldNames; + if (unpackedInt32_.Count > 0) { + output.WriteInt32Array(90, field_names[6], unpackedInt32_); + } + if (unpackedInt64_.Count > 0) { + output.WriteInt64Array(91, field_names[7], unpackedInt64_); + } + if (unpackedUint32_.Count > 0) { + output.WriteUInt32Array(92, field_names[12], unpackedUint32_); + } + if (unpackedUint64_.Count > 0) { + output.WriteUInt64Array(93, field_names[13], unpackedUint64_); + } + if (unpackedSint32_.Count > 0) { + output.WriteSInt32Array(94, field_names[10], unpackedSint32_); + } + if (unpackedSint64_.Count > 0) { + output.WriteSInt64Array(95, field_names[11], unpackedSint64_); + } + if (unpackedFixed32_.Count > 0) { + output.WriteFixed32Array(96, field_names[3], unpackedFixed32_); + } + if (unpackedFixed64_.Count > 0) { + output.WriteFixed64Array(97, field_names[4], unpackedFixed64_); + } + if (unpackedSfixed32_.Count > 0) { + output.WriteSFixed32Array(98, field_names[8], unpackedSfixed32_); + } + if (unpackedSfixed64_.Count > 0) { + output.WriteSFixed64Array(99, field_names[9], unpackedSfixed64_); + } + if (unpackedFloat_.Count > 0) { + output.WriteFloatArray(100, field_names[5], unpackedFloat_); + } + if (unpackedDouble_.Count > 0) { + output.WriteDoubleArray(101, field_names[1], unpackedDouble_); + } + if (unpackedBool_.Count > 0) { + output.WriteBoolArray(102, field_names[0], unpackedBool_); + } + if (unpackedEnum_.Count > 0) { + output.WriteEnumArray(103, field_names[2], unpackedEnum_); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in UnpackedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedInt32_.Count; + } + { + int dataSize = 0; + foreach (long element in UnpackedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedInt64_.Count; + } + { + int dataSize = 0; + foreach (uint element in UnpackedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedUint32_.Count; + } + { + int dataSize = 0; + foreach (ulong element in UnpackedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedUint64_.Count; + } + { + int dataSize = 0; + foreach (int element in UnpackedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedSint32_.Count; + } + { + int dataSize = 0; + foreach (long element in UnpackedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedSint64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedFixed32_.Count; + size += dataSize; + size += 2 * unpackedFixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedFixed64_.Count; + size += dataSize; + size += 2 * unpackedFixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedSfixed32_.Count; + size += dataSize; + size += 2 * unpackedSfixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedSfixed64_.Count; + size += dataSize; + size += 2 * unpackedSfixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedFloat_.Count; + size += dataSize; + size += 2 * unpackedFloat_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedDouble_.Count; + size += dataSize; + size += 2 * unpackedDouble_.Count; + } + { + int dataSize = 0; + dataSize = 1 * unpackedBool_.Count; + size += dataSize; + size += 2 * unpackedBool_.Count; + } + { + int dataSize = 0; + if (unpackedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.UnpackedTypesForeignEnumLite element in unpackedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * unpackedEnum_.Count; + } + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + foreach(int i in unpackedInt32_) + hash ^= i.GetHashCode(); + foreach(long i in unpackedInt64_) + hash ^= i.GetHashCode(); + foreach(uint i in unpackedUint32_) + hash ^= i.GetHashCode(); + foreach(ulong i in unpackedUint64_) + hash ^= i.GetHashCode(); + foreach(int i in unpackedSint32_) + hash ^= i.GetHashCode(); + foreach(long i in unpackedSint64_) + hash ^= i.GetHashCode(); + foreach(uint i in unpackedFixed32_) + hash ^= i.GetHashCode(); + foreach(ulong i in unpackedFixed64_) + hash ^= i.GetHashCode(); + foreach(int i in unpackedSfixed32_) + hash ^= i.GetHashCode(); + foreach(long i in unpackedSfixed64_) + hash ^= i.GetHashCode(); + foreach(float i in unpackedFloat_) + hash ^= i.GetHashCode(); + foreach(double i in unpackedDouble_) + hash ^= i.GetHashCode(); + foreach(bool i in unpackedBool_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.UnpackedTypesForeignEnumLite i in unpackedEnum_) + hash ^= i.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestUnpackedTypesLite other = obj as TestUnpackedTypesLite; + if (other == null) return false; + if(unpackedInt32_.Count != other.unpackedInt32_.Count) return false; + for(int ix=0; ix < unpackedInt32_.Count; ix++) + if(!unpackedInt32_[ix].Equals(other.unpackedInt32_[ix])) return false; + if(unpackedInt64_.Count != other.unpackedInt64_.Count) return false; + for(int ix=0; ix < unpackedInt64_.Count; ix++) + if(!unpackedInt64_[ix].Equals(other.unpackedInt64_[ix])) return false; + if(unpackedUint32_.Count != other.unpackedUint32_.Count) return false; + for(int ix=0; ix < unpackedUint32_.Count; ix++) + if(!unpackedUint32_[ix].Equals(other.unpackedUint32_[ix])) return false; + if(unpackedUint64_.Count != other.unpackedUint64_.Count) return false; + for(int ix=0; ix < unpackedUint64_.Count; ix++) + if(!unpackedUint64_[ix].Equals(other.unpackedUint64_[ix])) return false; + if(unpackedSint32_.Count != other.unpackedSint32_.Count) return false; + for(int ix=0; ix < unpackedSint32_.Count; ix++) + if(!unpackedSint32_[ix].Equals(other.unpackedSint32_[ix])) return false; + if(unpackedSint64_.Count != other.unpackedSint64_.Count) return false; + for(int ix=0; ix < unpackedSint64_.Count; ix++) + if(!unpackedSint64_[ix].Equals(other.unpackedSint64_[ix])) return false; + if(unpackedFixed32_.Count != other.unpackedFixed32_.Count) return false; + for(int ix=0; ix < unpackedFixed32_.Count; ix++) + if(!unpackedFixed32_[ix].Equals(other.unpackedFixed32_[ix])) return false; + if(unpackedFixed64_.Count != other.unpackedFixed64_.Count) return false; + for(int ix=0; ix < unpackedFixed64_.Count; ix++) + if(!unpackedFixed64_[ix].Equals(other.unpackedFixed64_[ix])) return false; + if(unpackedSfixed32_.Count != other.unpackedSfixed32_.Count) return false; + for(int ix=0; ix < unpackedSfixed32_.Count; ix++) + if(!unpackedSfixed32_[ix].Equals(other.unpackedSfixed32_[ix])) return false; + if(unpackedSfixed64_.Count != other.unpackedSfixed64_.Count) return false; + for(int ix=0; ix < unpackedSfixed64_.Count; ix++) + if(!unpackedSfixed64_[ix].Equals(other.unpackedSfixed64_[ix])) return false; + if(unpackedFloat_.Count != other.unpackedFloat_.Count) return false; + for(int ix=0; ix < unpackedFloat_.Count; ix++) + if(!unpackedFloat_[ix].Equals(other.unpackedFloat_[ix])) return false; + if(unpackedDouble_.Count != other.unpackedDouble_.Count) return false; + for(int ix=0; ix < unpackedDouble_.Count; ix++) + if(!unpackedDouble_[ix].Equals(other.unpackedDouble_[ix])) return false; + if(unpackedBool_.Count != other.unpackedBool_.Count) return false; + for(int ix=0; ix < unpackedBool_.Count; ix++) + if(!unpackedBool_[ix].Equals(other.unpackedBool_[ix])) return false; + if(unpackedEnum_.Count != other.unpackedEnum_.Count) return false; + for(int ix=0; ix < unpackedEnum_.Count; ix++) + if(!unpackedEnum_[ix].Equals(other.unpackedEnum_[ix])) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("unpacked_int32", unpackedInt32_, writer); + PrintField("unpacked_int64", unpackedInt64_, writer); + PrintField("unpacked_uint32", unpackedUint32_, writer); + PrintField("unpacked_uint64", unpackedUint64_, writer); + PrintField("unpacked_sint32", unpackedSint32_, writer); + PrintField("unpacked_sint64", unpackedSint64_, writer); + PrintField("unpacked_fixed32", unpackedFixed32_, writer); + PrintField("unpacked_fixed64", unpackedFixed64_, writer); + PrintField("unpacked_sfixed32", unpackedSfixed32_, writer); + PrintField("unpacked_sfixed64", unpackedSfixed64_, writer); + PrintField("unpacked_float", unpackedFloat_, writer); + PrintField("unpacked_double", unpackedDouble_, writer); + PrintField("unpacked_bool", unpackedBool_, writer); + PrintField("unpacked_enum", unpackedEnum_, writer); + } + #endregion + + public static TestUnpackedTypesLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedTypesLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypesLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedTypesLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypesLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedTypesLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypesLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestUnpackedTypesLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestUnpackedTypesLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedTypesLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestUnpackedTypesLite MakeReadOnly() { + unpackedInt32_.MakeReadOnly(); + unpackedInt64_.MakeReadOnly(); + unpackedUint32_.MakeReadOnly(); + unpackedUint64_.MakeReadOnly(); + unpackedSint32_.MakeReadOnly(); + unpackedSint64_.MakeReadOnly(); + unpackedFixed32_.MakeReadOnly(); + unpackedFixed64_.MakeReadOnly(); + unpackedSfixed32_.MakeReadOnly(); + unpackedSfixed64_.MakeReadOnly(); + unpackedFloat_.MakeReadOnly(); + unpackedDouble_.MakeReadOnly(); + unpackedBool_.MakeReadOnly(); + unpackedEnum_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestUnpackedTypesLite prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestUnpackedTypesLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestUnpackedTypesLite result; + + private TestUnpackedTypesLite PrepareBuilder() { + if (resultIsReadOnly) { + TestUnpackedTypesLite original = result; + result = new TestUnpackedTypesLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestUnpackedTypesLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestUnpackedTypesLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypesLite.DefaultInstance; } + } + + public override TestUnpackedTypesLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestUnpackedTypesLite) { + return MergeFrom((TestUnpackedTypesLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestUnpackedTypesLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypesLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.unpackedInt32_.Count != 0) { + result.unpackedInt32_.Add(other.unpackedInt32_); + } + if (other.unpackedInt64_.Count != 0) { + result.unpackedInt64_.Add(other.unpackedInt64_); + } + if (other.unpackedUint32_.Count != 0) { + result.unpackedUint32_.Add(other.unpackedUint32_); + } + if (other.unpackedUint64_.Count != 0) { + result.unpackedUint64_.Add(other.unpackedUint64_); + } + if (other.unpackedSint32_.Count != 0) { + result.unpackedSint32_.Add(other.unpackedSint32_); + } + if (other.unpackedSint64_.Count != 0) { + result.unpackedSint64_.Add(other.unpackedSint64_); + } + if (other.unpackedFixed32_.Count != 0) { + result.unpackedFixed32_.Add(other.unpackedFixed32_); + } + if (other.unpackedFixed64_.Count != 0) { + result.unpackedFixed64_.Add(other.unpackedFixed64_); + } + if (other.unpackedSfixed32_.Count != 0) { + result.unpackedSfixed32_.Add(other.unpackedSfixed32_); + } + if (other.unpackedSfixed64_.Count != 0) { + result.unpackedSfixed64_.Add(other.unpackedSfixed64_); + } + if (other.unpackedFloat_.Count != 0) { + result.unpackedFloat_.Add(other.unpackedFloat_); + } + if (other.unpackedDouble_.Count != 0) { + result.unpackedDouble_.Add(other.unpackedDouble_); + } + if (other.unpackedBool_.Count != 0) { + result.unpackedBool_.Add(other.unpackedBool_); + } + if (other.unpackedEnum_.Count != 0) { + result.unpackedEnum_.Add(other.unpackedEnum_); + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testUnpackedTypesLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testUnpackedTypesLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 722: + case 720: { + input.ReadInt32Array(tag, field_name, result.unpackedInt32_); + break; + } + case 730: + case 728: { + input.ReadInt64Array(tag, field_name, result.unpackedInt64_); + break; + } + case 738: + case 736: { + input.ReadUInt32Array(tag, field_name, result.unpackedUint32_); + break; + } + case 746: + case 744: { + input.ReadUInt64Array(tag, field_name, result.unpackedUint64_); + break; + } + case 754: + case 752: { + input.ReadSInt32Array(tag, field_name, result.unpackedSint32_); + break; + } + case 762: + case 760: { + input.ReadSInt64Array(tag, field_name, result.unpackedSint64_); + break; + } + case 770: + case 773: { + input.ReadFixed32Array(tag, field_name, result.unpackedFixed32_); + break; + } + case 778: + case 777: { + input.ReadFixed64Array(tag, field_name, result.unpackedFixed64_); + break; + } + case 786: + case 789: { + input.ReadSFixed32Array(tag, field_name, result.unpackedSfixed32_); + break; + } + case 794: + case 793: { + input.ReadSFixed64Array(tag, field_name, result.unpackedSfixed64_); + break; + } + case 802: + case 805: { + input.ReadFloatArray(tag, field_name, result.unpackedFloat_); + break; + } + case 810: + case 809: { + input.ReadDoubleArray(tag, field_name, result.unpackedDouble_); + break; + } + case 818: + case 816: { + input.ReadBoolArray(tag, field_name, result.unpackedBool_); + break; + } + case 826: + case 824: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.unpackedEnum_, out unknownItems); + break; + } + } + } + + return this; + } + + + public pbc::IPopsicleList UnpackedInt32List { + get { return PrepareBuilder().unpackedInt32_; } + } + public int UnpackedInt32Count { + get { return result.UnpackedInt32Count; } + } + public int GetUnpackedInt32(int index) { + return result.GetUnpackedInt32(index); + } + public Builder SetUnpackedInt32(int index, int value) { + PrepareBuilder(); + result.unpackedInt32_[index] = value; + return this; + } + public Builder AddUnpackedInt32(int value) { + PrepareBuilder(); + result.unpackedInt32_.Add(value); + return this; + } + public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedInt32_.Add(values); + return this; + } + public Builder ClearUnpackedInt32() { + PrepareBuilder(); + result.unpackedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedInt64List { + get { return PrepareBuilder().unpackedInt64_; } + } + public int UnpackedInt64Count { + get { return result.UnpackedInt64Count; } + } + public long GetUnpackedInt64(int index) { + return result.GetUnpackedInt64(index); + } + public Builder SetUnpackedInt64(int index, long value) { + PrepareBuilder(); + result.unpackedInt64_[index] = value; + return this; + } + public Builder AddUnpackedInt64(long value) { + PrepareBuilder(); + result.unpackedInt64_.Add(value); + return this; + } + public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedInt64_.Add(values); + return this; + } + public Builder ClearUnpackedInt64() { + PrepareBuilder(); + result.unpackedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedUint32List { + get { return PrepareBuilder().unpackedUint32_; } + } + public int UnpackedUint32Count { + get { return result.UnpackedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedUint32(int index) { + return result.GetUnpackedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedUint32(int index, uint value) { + PrepareBuilder(); + result.unpackedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedUint32(uint value) { + PrepareBuilder(); + result.unpackedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedUint32_.Add(values); + return this; + } + public Builder ClearUnpackedUint32() { + PrepareBuilder(); + result.unpackedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedUint64List { + get { return PrepareBuilder().unpackedUint64_; } + } + public int UnpackedUint64Count { + get { return result.UnpackedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedUint64(int index) { + return result.GetUnpackedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedUint64(int index, ulong value) { + PrepareBuilder(); + result.unpackedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedUint64(ulong value) { + PrepareBuilder(); + result.unpackedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedUint64_.Add(values); + return this; + } + public Builder ClearUnpackedUint64() { + PrepareBuilder(); + result.unpackedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSint32List { + get { return PrepareBuilder().unpackedSint32_; } + } + public int UnpackedSint32Count { + get { return result.UnpackedSint32Count; } + } + public int GetUnpackedSint32(int index) { + return result.GetUnpackedSint32(index); + } + public Builder SetUnpackedSint32(int index, int value) { + PrepareBuilder(); + result.unpackedSint32_[index] = value; + return this; + } + public Builder AddUnpackedSint32(int value) { + PrepareBuilder(); + result.unpackedSint32_.Add(value); + return this; + } + public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSint32_.Add(values); + return this; + } + public Builder ClearUnpackedSint32() { + PrepareBuilder(); + result.unpackedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSint64List { + get { return PrepareBuilder().unpackedSint64_; } + } + public int UnpackedSint64Count { + get { return result.UnpackedSint64Count; } + } + public long GetUnpackedSint64(int index) { + return result.GetUnpackedSint64(index); + } + public Builder SetUnpackedSint64(int index, long value) { + PrepareBuilder(); + result.unpackedSint64_[index] = value; + return this; + } + public Builder AddUnpackedSint64(long value) { + PrepareBuilder(); + result.unpackedSint64_.Add(value); + return this; + } + public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSint64_.Add(values); + return this; + } + public Builder ClearUnpackedSint64() { + PrepareBuilder(); + result.unpackedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedFixed32List { + get { return PrepareBuilder().unpackedFixed32_; } + } + public int UnpackedFixed32Count { + get { return result.UnpackedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedFixed32(int index) { + return result.GetUnpackedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedFixed32(int index, uint value) { + PrepareBuilder(); + result.unpackedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedFixed32(uint value) { + PrepareBuilder(); + result.unpackedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFixed32_.Add(values); + return this; + } + public Builder ClearUnpackedFixed32() { + PrepareBuilder(); + result.unpackedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedFixed64List { + get { return PrepareBuilder().unpackedFixed64_; } + } + public int UnpackedFixed64Count { + get { return result.UnpackedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedFixed64(int index) { + return result.GetUnpackedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedFixed64(int index, ulong value) { + PrepareBuilder(); + result.unpackedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedFixed64(ulong value) { + PrepareBuilder(); + result.unpackedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFixed64_.Add(values); + return this; + } + public Builder ClearUnpackedFixed64() { + PrepareBuilder(); + result.unpackedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSfixed32List { + get { return PrepareBuilder().unpackedSfixed32_; } + } + public int UnpackedSfixed32Count { + get { return result.UnpackedSfixed32Count; } + } + public int GetUnpackedSfixed32(int index) { + return result.GetUnpackedSfixed32(index); + } + public Builder SetUnpackedSfixed32(int index, int value) { + PrepareBuilder(); + result.unpackedSfixed32_[index] = value; + return this; + } + public Builder AddUnpackedSfixed32(int value) { + PrepareBuilder(); + result.unpackedSfixed32_.Add(value); + return this; + } + public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSfixed32_.Add(values); + return this; + } + public Builder ClearUnpackedSfixed32() { + PrepareBuilder(); + result.unpackedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSfixed64List { + get { return PrepareBuilder().unpackedSfixed64_; } + } + public int UnpackedSfixed64Count { + get { return result.UnpackedSfixed64Count; } + } + public long GetUnpackedSfixed64(int index) { + return result.GetUnpackedSfixed64(index); + } + public Builder SetUnpackedSfixed64(int index, long value) { + PrepareBuilder(); + result.unpackedSfixed64_[index] = value; + return this; + } + public Builder AddUnpackedSfixed64(long value) { + PrepareBuilder(); + result.unpackedSfixed64_.Add(value); + return this; + } + public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSfixed64_.Add(values); + return this; + } + public Builder ClearUnpackedSfixed64() { + PrepareBuilder(); + result.unpackedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedFloatList { + get { return PrepareBuilder().unpackedFloat_; } + } + public int UnpackedFloatCount { + get { return result.UnpackedFloatCount; } + } + public float GetUnpackedFloat(int index) { + return result.GetUnpackedFloat(index); + } + public Builder SetUnpackedFloat(int index, float value) { + PrepareBuilder(); + result.unpackedFloat_[index] = value; + return this; + } + public Builder AddUnpackedFloat(float value) { + PrepareBuilder(); + result.unpackedFloat_.Add(value); + return this; + } + public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFloat_.Add(values); + return this; + } + public Builder ClearUnpackedFloat() { + PrepareBuilder(); + result.unpackedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedDoubleList { + get { return PrepareBuilder().unpackedDouble_; } + } + public int UnpackedDoubleCount { + get { return result.UnpackedDoubleCount; } + } + public double GetUnpackedDouble(int index) { + return result.GetUnpackedDouble(index); + } + public Builder SetUnpackedDouble(int index, double value) { + PrepareBuilder(); + result.unpackedDouble_[index] = value; + return this; + } + public Builder AddUnpackedDouble(double value) { + PrepareBuilder(); + result.unpackedDouble_.Add(value); + return this; + } + public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedDouble_.Add(values); + return this; + } + public Builder ClearUnpackedDouble() { + PrepareBuilder(); + result.unpackedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedBoolList { + get { return PrepareBuilder().unpackedBool_; } + } + public int UnpackedBoolCount { + get { return result.UnpackedBoolCount; } + } + public bool GetUnpackedBool(int index) { + return result.GetUnpackedBool(index); + } + public Builder SetUnpackedBool(int index, bool value) { + PrepareBuilder(); + result.unpackedBool_[index] = value; + return this; + } + public Builder AddUnpackedBool(bool value) { + PrepareBuilder(); + result.unpackedBool_.Add(value); + return this; + } + public Builder AddRangeUnpackedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedBool_.Add(values); + return this; + } + public Builder ClearUnpackedBool() { + PrepareBuilder(); + result.unpackedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedEnumList { + get { return PrepareBuilder().unpackedEnum_; } + } + public int UnpackedEnumCount { + get { return result.UnpackedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.UnpackedTypesForeignEnumLite GetUnpackedEnum(int index) { + return result.GetUnpackedEnum(index); + } + public Builder SetUnpackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.UnpackedTypesForeignEnumLite value) { + PrepareBuilder(); + result.unpackedEnum_[index] = value; + return this; + } + public Builder AddUnpackedEnum(global::Google.ProtocolBuffers.TestProtos.UnpackedTypesForeignEnumLite value) { + PrepareBuilder(); + result.unpackedEnum_.Add(value); + return this; + } + public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedEnum_.Add(values); + return this; + } + public Builder ClearUnpackedEnum() { + PrepareBuilder(); + result.unpackedEnum_.Clear(); + return this; + } + } + static TestUnpackedTypesLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class BucketOfBytes : pb::GeneratedMessageLite { + private BucketOfBytes() { } + private static readonly BucketOfBytes defaultInstance = new BucketOfBytes().MakeReadOnly(); + private static readonly string[] _bucketOfBytesFieldNames = new string[] { "value" }; + private static readonly uint[] _bucketOfBytesFieldTags = new uint[] { 10 }; + public static BucketOfBytes DefaultInstance { + get { return defaultInstance; } + } + + public override BucketOfBytes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override BucketOfBytes ThisMessage { + get { return this; } + } + + public const int ValueFieldNumber = 1; + private bool hasValue; + private pb::ByteString value_ = pb::ByteString.Empty; + public bool HasValue { + get { return hasValue; } + } + public pb::ByteString Value { + get { return value_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _bucketOfBytesFieldNames; + if (hasValue) { + output.WriteBytes(1, field_names[0], Value); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasValue) { + size += pb::CodedOutputStream.ComputeBytesSize(1, Value); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasValue) hash ^= value_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + BucketOfBytes other = obj as BucketOfBytes; + if (other == null) return false; + if (hasValue != other.hasValue || (hasValue && !value_.Equals(other.value_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("value", hasValue, value_, writer); + } + #endregion + + public static BucketOfBytes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BucketOfBytes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BucketOfBytes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BucketOfBytes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BucketOfBytes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BucketOfBytes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static BucketOfBytes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static BucketOfBytes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static BucketOfBytes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BucketOfBytes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private BucketOfBytes MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(BucketOfBytes prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(BucketOfBytes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private BucketOfBytes result; + + private BucketOfBytes PrepareBuilder() { + if (resultIsReadOnly) { + BucketOfBytes original = result; + result = new BucketOfBytes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override BucketOfBytes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override BucketOfBytes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.BucketOfBytes.DefaultInstance; } + } + + public override BucketOfBytes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is BucketOfBytes) { + return MergeFrom((BucketOfBytes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(BucketOfBytes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.BucketOfBytes.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasValue) { + Value = other.Value; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_bucketOfBytesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _bucketOfBytesFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasValue = input.ReadBytes(ref result.value_); + break; + } + } + } + + return this; + } + + + public bool HasValue { + get { return result.hasValue; } + } + public pb::ByteString Value { + get { return result.Value; } + set { SetValue(value); } + } + public Builder SetValue(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = value; + return this; + } + public Builder ClearValue() { + PrepareBuilder(); + result.hasValue = false; + result.value_ = pb::ByteString.Empty; + return this; + } + } + static BucketOfBytes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null); + } + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class BucketOfBytesEx : pb::GeneratedMessageLite { + private BucketOfBytesEx() { } + private static readonly BucketOfBytesEx defaultInstance = new BucketOfBytesEx().MakeReadOnly(); + private static readonly string[] _bucketOfBytesExFieldNames = new string[] { "value", "value2" }; + private static readonly uint[] _bucketOfBytesExFieldTags = new uint[] { 10, 2042 }; + public static BucketOfBytesEx DefaultInstance { + get { return defaultInstance; } + } + + public override BucketOfBytesEx DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override BucketOfBytesEx ThisMessage { + get { return this; } + } + + public const int ValueFieldNumber = 1; + private bool hasValue; + private pb::ByteString value_ = pb::ByteString.Empty; + public bool HasValue { + get { return hasValue; } + } + public pb::ByteString Value { + get { return value_; } + } + + public const int Value2FieldNumber = 255; + private bool hasValue2; + private pb::ByteString value2_ = pb::ByteString.Empty; + public bool HasValue2 { + get { return hasValue2; } + } + public pb::ByteString Value2 { + get { return value2_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _bucketOfBytesExFieldNames; + if (hasValue) { + output.WriteBytes(1, field_names[0], Value); + } + if (hasValue2) { + output.WriteBytes(255, field_names[1], Value2); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasValue) { + size += pb::CodedOutputStream.ComputeBytesSize(1, Value); + } + if (hasValue2) { + size += pb::CodedOutputStream.ComputeBytesSize(255, Value2); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasValue) hash ^= value_.GetHashCode(); + if (hasValue2) hash ^= value2_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + BucketOfBytesEx other = obj as BucketOfBytesEx; + if (other == null) return false; + if (hasValue != other.hasValue || (hasValue && !value_.Equals(other.value_))) return false; + if (hasValue2 != other.hasValue2 || (hasValue2 && !value2_.Equals(other.value2_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("value", hasValue, value_, writer); + PrintField("value2", hasValue2, value2_, writer); + } + #endregion + + public static BucketOfBytesEx ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BucketOfBytesEx ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BucketOfBytesEx ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BucketOfBytesEx ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BucketOfBytesEx ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BucketOfBytesEx ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static BucketOfBytesEx ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static BucketOfBytesEx ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static BucketOfBytesEx ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BucketOfBytesEx ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private BucketOfBytesEx MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(BucketOfBytesEx prototype) { + return new Builder(prototype); + } + + [global::System.SerializableAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(BucketOfBytesEx cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private BucketOfBytesEx result; + + private BucketOfBytesEx PrepareBuilder() { + if (resultIsReadOnly) { + BucketOfBytesEx original = result; + result = new BucketOfBytesEx(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override BucketOfBytesEx MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override BucketOfBytesEx DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.BucketOfBytesEx.DefaultInstance; } + } + + public override BucketOfBytesEx BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is BucketOfBytesEx) { + return MergeFrom((BucketOfBytesEx) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(BucketOfBytesEx other) { + if (other == global::Google.ProtocolBuffers.TestProtos.BucketOfBytesEx.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasValue) { + Value = other.Value; + } + if (other.HasValue2) { + Value2 = other.Value2; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_bucketOfBytesExFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _bucketOfBytesExFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasValue = input.ReadBytes(ref result.value_); + break; + } + case 2042: { + result.hasValue2 = input.ReadBytes(ref result.value2_); + break; + } + } + } + + return this; + } + + + public bool HasValue { + get { return result.hasValue; } + } + public pb::ByteString Value { + get { return result.Value; } + set { SetValue(value); } + } + public Builder SetValue(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasValue = true; + result.value_ = value; + return this; + } + public Builder ClearValue() { + PrepareBuilder(); + result.hasValue = false; + result.value_ = pb::ByteString.Empty; + return this; + } + + public bool HasValue2 { + get { return result.hasValue2; } + } + public pb::ByteString Value2 { + get { return result.Value2; } + set { SetValue2(value); } + } + public Builder SetValue2(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasValue2 = true; + result.value2_ = value; + return this; + } + public Builder ClearValue2() { + PrepareBuilder(); + result.hasValue2 = false; + result.value2_ = pb::ByteString.Empty; + return this; + } + } + static BucketOfBytesEx() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestExtrasLiteProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs new file mode 100644 index 00000000..fe1f408f --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportLiteProtoFile.cs @@ -0,0 +1,308 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestImportLiteProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + #endregion + #region Extensions + internal static readonly object Descriptor; + static UnitTestImportLiteProtoFile() { + Descriptor = null; + } + #endregion + + } + #region Enums + public enum ImportEnumLite { + IMPORT_LITE_FOO = 7, + IMPORT_LITE_BAR = 8, + IMPORT_LITE_BAZ = 9, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ImportMessageLite : pb::GeneratedMessageLite { + private ImportMessageLite() { } + private static readonly ImportMessageLite defaultInstance = new ImportMessageLite().MakeReadOnly(); + private static readonly string[] _importMessageLiteFieldNames = new string[] { "d" }; + private static readonly uint[] _importMessageLiteFieldTags = new uint[] { 8 }; + public static ImportMessageLite DefaultInstance { + get { return defaultInstance; } + } + + public override ImportMessageLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ImportMessageLite ThisMessage { + get { return this; } + } + + public const int DFieldNumber = 1; + private bool hasD; + private int d_; + public bool HasD { + get { return hasD; } + } + public int D { + get { return d_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _importMessageLiteFieldNames; + if (hasD) { + output.WriteInt32(1, field_names[0], D); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasD) { + size += pb::CodedOutputStream.ComputeInt32Size(1, D); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasD) hash ^= d_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + ImportMessageLite other = obj as ImportMessageLite; + if (other == null) return false; + if (hasD != other.hasD || (hasD && !d_.Equals(other.d_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("d", hasD, d_, writer); + } + #endregion + + public static ImportMessageLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ImportMessageLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ImportMessageLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ImportMessageLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessageLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ImportMessageLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ImportMessageLite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ImportMessageLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ImportMessageLite result; + + private ImportMessageLite PrepareBuilder() { + if (resultIsReadOnly) { + ImportMessageLite original = result; + result = new ImportMessageLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ImportMessageLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override ImportMessageLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; } + } + + public override ImportMessageLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is ImportMessageLite) { + return MergeFrom((ImportMessageLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ImportMessageLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasD) { + D = other.D; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_importMessageLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _importMessageLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasD = input.ReadInt32(ref result.d_); + break; + } + } + } + + return this; + } + + + public bool HasD { + get { return result.hasD; } + } + public int D { + get { return result.D; } + set { SetD(value); } + } + public Builder SetD(int value) { + PrepareBuilder(); + result.hasD = true; + result.d_ = value; + return this; + } + public Builder ClearD() { + PrepareBuilder(); + result.hasD = false; + result.d_ = 0; + return this; + } + } + static ImportMessageLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestImportLiteProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs new file mode 100644 index 00000000..4cae2b8b --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestImportProtoFile.cs @@ -0,0 +1,346 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestImportProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_import_ImportMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestImportProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfaW1wb3J0LnByb3RvEhhwcm90", + "b2J1Zl91bml0dGVzdF9pbXBvcnQaJGdvb2dsZS9wcm90b2J1Zi9jc2hhcnBf", + "b3B0aW9ucy5wcm90byIaCg1JbXBvcnRNZXNzYWdlEgkKAWQYASABKAUqPAoK", + "SW1wb3J0RW51bRIOCgpJTVBPUlRfRk9PEAcSDgoKSU1QT1JUX0JBUhAIEg4K", + "CklNUE9SVF9CQVoQCUJbChhjb20uZ29vZ2xlLnByb3RvYnVmLnRlc3RIAcI+", + "PAohR29vZ2xlLlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9zEhdVbml0VGVz", + "dEltcG9ydFByb3RvRmlsZQ==")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_import_ImportMessage__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_import_ImportMessage__Descriptor, + new string[] { "D", }); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum ImportEnum { + IMPORT_FOO = 7, + IMPORT_BAR = 8, + IMPORT_BAZ = 9, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ImportMessage : pb::GeneratedMessage { + private ImportMessage() { } + private static readonly ImportMessage defaultInstance = new ImportMessage().MakeReadOnly(); + private static readonly string[] _importMessageFieldNames = new string[] { "d" }; + private static readonly uint[] _importMessageFieldTags = new uint[] { 8 }; + public static ImportMessage DefaultInstance { + get { return defaultInstance; } + } + + public override ImportMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ImportMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.internal__static_protobuf_unittest_import_ImportMessage__FieldAccessorTable; } + } + + public const int DFieldNumber = 1; + private bool hasD; + private int d_; + public bool HasD { + get { return hasD; } + } + public int D { + get { return d_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _importMessageFieldNames; + if (hasD) { + output.WriteInt32(1, field_names[0], D); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasD) { + size += pb::CodedOutputStream.ComputeInt32Size(1, D); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ImportMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ImportMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ImportMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ImportMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ImportMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ImportMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ImportMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ImportMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ImportMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ImportMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ImportMessage result; + + private ImportMessage PrepareBuilder() { + if (resultIsReadOnly) { + ImportMessage original = result; + result = new ImportMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ImportMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.Descriptor; } + } + + public override ImportMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } + } + + public override ImportMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ImportMessage) { + return MergeFrom((ImportMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ImportMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasD) { + D = other.D; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_importMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _importMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasD = input.ReadInt32(ref result.d_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasD { + get { return result.hasD; } + } + public int D { + get { return result.D; } + set { SetD(value); } + } + public Builder SetD(int value) { + PrepareBuilder(); + result.hasD = true; + result.d_ = value; + return this; + } + public Builder ClearD() { + PrepareBuilder(); + result.hasD = false; + result.d_ = 0; + return this; + } + } + static ImportMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs new file mode 100644 index 00000000..1ed29692 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteImportNonLiteProtoFile.cs @@ -0,0 +1,324 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestLiteImportNonLiteProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + #endregion + #region Extensions + internal static readonly object Descriptor; + static UnitTestLiteImportNonLiteProtoFile() { + Descriptor = null; + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestLiteImportsNonlite : pb::GeneratedMessageLite { + private TestLiteImportsNonlite() { } + private static readonly TestLiteImportsNonlite defaultInstance = new TestLiteImportsNonlite().MakeReadOnly(); + private static readonly string[] _testLiteImportsNonliteFieldNames = new string[] { "message" }; + private static readonly uint[] _testLiteImportsNonliteFieldTags = new uint[] { 10 }; + public static TestLiteImportsNonlite DefaultInstance { + get { return defaultInstance; } + } + + public override TestLiteImportsNonlite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestLiteImportsNonlite ThisMessage { + get { return this; } + } + + public const int MessageFieldNumber = 1; + private bool hasMessage; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes message_; + public bool HasMessage { + get { return hasMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes Message { + get { return message_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testLiteImportsNonliteFieldNames; + if (hasMessage) { + output.WriteMessage(1, field_names[0], Message); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Message); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasMessage) hash ^= message_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestLiteImportsNonlite other = obj as TestLiteImportsNonlite; + if (other == null) return false; + if (hasMessage != other.hasMessage || (hasMessage && !message_.Equals(other.message_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("message", hasMessage, message_, writer); + } + #endregion + + public static TestLiteImportsNonlite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestLiteImportsNonlite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestLiteImportsNonlite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestLiteImportsNonlite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestLiteImportsNonlite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestLiteImportsNonlite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestLiteImportsNonlite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestLiteImportsNonlite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestLiteImportsNonlite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestLiteImportsNonlite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestLiteImportsNonlite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestLiteImportsNonlite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestLiteImportsNonlite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestLiteImportsNonlite result; + + private TestLiteImportsNonlite PrepareBuilder() { + if (resultIsReadOnly) { + TestLiteImportsNonlite original = result; + result = new TestLiteImportsNonlite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestLiteImportsNonlite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestLiteImportsNonlite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestLiteImportsNonlite.DefaultInstance; } + } + + public override TestLiteImportsNonlite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestLiteImportsNonlite) { + return MergeFrom((TestLiteImportsNonlite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestLiteImportsNonlite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestLiteImportsNonlite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasMessage) { + MergeMessage(other.Message); + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testLiteImportsNonliteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testLiteImportsNonliteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.CreateBuilder(); + if (result.hasMessage) { + subBuilder.MergeFrom(Message); + } + input.ReadMessage(subBuilder, extensionRegistry); + Message = subBuilder.BuildPartial(); + break; + } + } + } + + return this; + } + + + public bool HasMessage { + get { return result.hasMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes Message { + get { return result.Message; } + set { SetMessage(value); } + } + public Builder SetMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessage = true; + result.message_ = value; + return this; + } + public Builder SetMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMessage = true; + result.message_ = builderForValue.Build(); + return this; + } + public Builder MergeMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMessage && + result.message_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) { + result.message_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.CreateBuilder(result.message_).MergeFrom(value).BuildPartial(); + } else { + result.message_ = value; + } + result.hasMessage = true; + return this; + } + public Builder ClearMessage() { + PrepareBuilder(); + result.hasMessage = false; + result.message_ = null; + return this; + } + } + static TestLiteImportsNonlite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteImportNonLiteProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs new file mode 100644 index 00000000..5ddc7279 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestLiteProtoFile.cs @@ -0,0 +1,8948 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestLiteProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFloatExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalDoubleExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBoolExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBytesExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalGroupExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedMessageExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignMessageExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportMessageExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringPieceExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalCordExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFloatExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedDoubleExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBoolExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBytesExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedGroupExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedMessageExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignMessageExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportMessageExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringPieceExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedCordExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFloatExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultDoubleExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBoolExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBytesExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultNestedEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultForeignEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultImportEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringPieceExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultCordExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed32ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed64ExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFloatExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedDoubleExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedBoolExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedEnumExtensionLite); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestNestedExtensionLite.NestedExtension); + } + #endregion + #region Extensions + public const int OptionalInt32ExtensionLiteFieldNumber = 1; + public static pb::GeneratedExtensionLite OptionalInt32ExtensionLite; + public const int OptionalInt64ExtensionLiteFieldNumber = 2; + public static pb::GeneratedExtensionLite OptionalInt64ExtensionLite; + public const int OptionalUint32ExtensionLiteFieldNumber = 3; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionLite OptionalUint32ExtensionLite; + public const int OptionalUint64ExtensionLiteFieldNumber = 4; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionLite OptionalUint64ExtensionLite; + public const int OptionalSint32ExtensionLiteFieldNumber = 5; + public static pb::GeneratedExtensionLite OptionalSint32ExtensionLite; + public const int OptionalSint64ExtensionLiteFieldNumber = 6; + public static pb::GeneratedExtensionLite OptionalSint64ExtensionLite; + public const int OptionalFixed32ExtensionLiteFieldNumber = 7; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionLite OptionalFixed32ExtensionLite; + public const int OptionalFixed64ExtensionLiteFieldNumber = 8; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionLite OptionalFixed64ExtensionLite; + public const int OptionalSfixed32ExtensionLiteFieldNumber = 9; + public static pb::GeneratedExtensionLite OptionalSfixed32ExtensionLite; + public const int OptionalSfixed64ExtensionLiteFieldNumber = 10; + public static pb::GeneratedExtensionLite OptionalSfixed64ExtensionLite; + public const int OptionalFloatExtensionLiteFieldNumber = 11; + public static pb::GeneratedExtensionLite OptionalFloatExtensionLite; + public const int OptionalDoubleExtensionLiteFieldNumber = 12; + public static pb::GeneratedExtensionLite OptionalDoubleExtensionLite; + public const int OptionalBoolExtensionLiteFieldNumber = 13; + public static pb::GeneratedExtensionLite OptionalBoolExtensionLite; + public const int OptionalStringExtensionLiteFieldNumber = 14; + public static pb::GeneratedExtensionLite OptionalStringExtensionLite; + public const int OptionalBytesExtensionLiteFieldNumber = 15; + public static pb::GeneratedExtensionLite OptionalBytesExtensionLite; + public const int OptionalGroupExtensionLiteFieldNumber = 16; + public static pb::GeneratedExtensionLite OptionalGroupExtensionLite; + public const int OptionalNestedMessageExtensionLiteFieldNumber = 18; + public static pb::GeneratedExtensionLite OptionalNestedMessageExtensionLite; + public const int OptionalForeignMessageExtensionLiteFieldNumber = 19; + public static pb::GeneratedExtensionLite OptionalForeignMessageExtensionLite; + public const int OptionalImportMessageExtensionLiteFieldNumber = 20; + public static pb::GeneratedExtensionLite OptionalImportMessageExtensionLite; + public const int OptionalNestedEnumExtensionLiteFieldNumber = 21; + public static pb::GeneratedExtensionLite OptionalNestedEnumExtensionLite; + public const int OptionalForeignEnumExtensionLiteFieldNumber = 22; + public static pb::GeneratedExtensionLite OptionalForeignEnumExtensionLite; + public const int OptionalImportEnumExtensionLiteFieldNumber = 23; + public static pb::GeneratedExtensionLite OptionalImportEnumExtensionLite; + public const int OptionalStringPieceExtensionLiteFieldNumber = 24; + public static pb::GeneratedExtensionLite OptionalStringPieceExtensionLite; + public const int OptionalCordExtensionLiteFieldNumber = 25; + public static pb::GeneratedExtensionLite OptionalCordExtensionLite; + public const int RepeatedInt32ExtensionLiteFieldNumber = 31; + public static pb::GeneratedRepeatExtensionLite RepeatedInt32ExtensionLite; + public const int RepeatedInt64ExtensionLiteFieldNumber = 32; + public static pb::GeneratedRepeatExtensionLite RepeatedInt64ExtensionLite; + public const int RepeatedUint32ExtensionLiteFieldNumber = 33; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite RepeatedUint32ExtensionLite; + public const int RepeatedUint64ExtensionLiteFieldNumber = 34; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite RepeatedUint64ExtensionLite; + public const int RepeatedSint32ExtensionLiteFieldNumber = 35; + public static pb::GeneratedRepeatExtensionLite RepeatedSint32ExtensionLite; + public const int RepeatedSint64ExtensionLiteFieldNumber = 36; + public static pb::GeneratedRepeatExtensionLite RepeatedSint64ExtensionLite; + public const int RepeatedFixed32ExtensionLiteFieldNumber = 37; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite RepeatedFixed32ExtensionLite; + public const int RepeatedFixed64ExtensionLiteFieldNumber = 38; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite RepeatedFixed64ExtensionLite; + public const int RepeatedSfixed32ExtensionLiteFieldNumber = 39; + public static pb::GeneratedRepeatExtensionLite RepeatedSfixed32ExtensionLite; + public const int RepeatedSfixed64ExtensionLiteFieldNumber = 40; + public static pb::GeneratedRepeatExtensionLite RepeatedSfixed64ExtensionLite; + public const int RepeatedFloatExtensionLiteFieldNumber = 41; + public static pb::GeneratedRepeatExtensionLite RepeatedFloatExtensionLite; + public const int RepeatedDoubleExtensionLiteFieldNumber = 42; + public static pb::GeneratedRepeatExtensionLite RepeatedDoubleExtensionLite; + public const int RepeatedBoolExtensionLiteFieldNumber = 43; + public static pb::GeneratedRepeatExtensionLite RepeatedBoolExtensionLite; + public const int RepeatedStringExtensionLiteFieldNumber = 44; + public static pb::GeneratedRepeatExtensionLite RepeatedStringExtensionLite; + public const int RepeatedBytesExtensionLiteFieldNumber = 45; + public static pb::GeneratedRepeatExtensionLite RepeatedBytesExtensionLite; + public const int RepeatedGroupExtensionLiteFieldNumber = 46; + public static pb::GeneratedRepeatExtensionLite RepeatedGroupExtensionLite; + public const int RepeatedNestedMessageExtensionLiteFieldNumber = 48; + public static pb::GeneratedRepeatExtensionLite RepeatedNestedMessageExtensionLite; + public const int RepeatedForeignMessageExtensionLiteFieldNumber = 49; + public static pb::GeneratedRepeatExtensionLite RepeatedForeignMessageExtensionLite; + public const int RepeatedImportMessageExtensionLiteFieldNumber = 50; + public static pb::GeneratedRepeatExtensionLite RepeatedImportMessageExtensionLite; + public const int RepeatedNestedEnumExtensionLiteFieldNumber = 51; + public static pb::GeneratedRepeatExtensionLite RepeatedNestedEnumExtensionLite; + public const int RepeatedForeignEnumExtensionLiteFieldNumber = 52; + public static pb::GeneratedRepeatExtensionLite RepeatedForeignEnumExtensionLite; + public const int RepeatedImportEnumExtensionLiteFieldNumber = 53; + public static pb::GeneratedRepeatExtensionLite RepeatedImportEnumExtensionLite; + public const int RepeatedStringPieceExtensionLiteFieldNumber = 54; + public static pb::GeneratedRepeatExtensionLite RepeatedStringPieceExtensionLite; + public const int RepeatedCordExtensionLiteFieldNumber = 55; + public static pb::GeneratedRepeatExtensionLite RepeatedCordExtensionLite; + public const int DefaultInt32ExtensionLiteFieldNumber = 61; + public static pb::GeneratedExtensionLite DefaultInt32ExtensionLite; + public const int DefaultInt64ExtensionLiteFieldNumber = 62; + public static pb::GeneratedExtensionLite DefaultInt64ExtensionLite; + public const int DefaultUint32ExtensionLiteFieldNumber = 63; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionLite DefaultUint32ExtensionLite; + public const int DefaultUint64ExtensionLiteFieldNumber = 64; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionLite DefaultUint64ExtensionLite; + public const int DefaultSint32ExtensionLiteFieldNumber = 65; + public static pb::GeneratedExtensionLite DefaultSint32ExtensionLite; + public const int DefaultSint64ExtensionLiteFieldNumber = 66; + public static pb::GeneratedExtensionLite DefaultSint64ExtensionLite; + public const int DefaultFixed32ExtensionLiteFieldNumber = 67; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionLite DefaultFixed32ExtensionLite; + public const int DefaultFixed64ExtensionLiteFieldNumber = 68; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionLite DefaultFixed64ExtensionLite; + public const int DefaultSfixed32ExtensionLiteFieldNumber = 69; + public static pb::GeneratedExtensionLite DefaultSfixed32ExtensionLite; + public const int DefaultSfixed64ExtensionLiteFieldNumber = 70; + public static pb::GeneratedExtensionLite DefaultSfixed64ExtensionLite; + public const int DefaultFloatExtensionLiteFieldNumber = 71; + public static pb::GeneratedExtensionLite DefaultFloatExtensionLite; + public const int DefaultDoubleExtensionLiteFieldNumber = 72; + public static pb::GeneratedExtensionLite DefaultDoubleExtensionLite; + public const int DefaultBoolExtensionLiteFieldNumber = 73; + public static pb::GeneratedExtensionLite DefaultBoolExtensionLite; + public const int DefaultStringExtensionLiteFieldNumber = 74; + public static pb::GeneratedExtensionLite DefaultStringExtensionLite; + public const int DefaultBytesExtensionLiteFieldNumber = 75; + public static pb::GeneratedExtensionLite DefaultBytesExtensionLite; + public const int DefaultNestedEnumExtensionLiteFieldNumber = 81; + public static pb::GeneratedExtensionLite DefaultNestedEnumExtensionLite; + public const int DefaultForeignEnumExtensionLiteFieldNumber = 82; + public static pb::GeneratedExtensionLite DefaultForeignEnumExtensionLite; + public const int DefaultImportEnumExtensionLiteFieldNumber = 83; + public static pb::GeneratedExtensionLite DefaultImportEnumExtensionLite; + public const int DefaultStringPieceExtensionLiteFieldNumber = 84; + public static pb::GeneratedExtensionLite DefaultStringPieceExtensionLite; + public const int DefaultCordExtensionLiteFieldNumber = 85; + public static pb::GeneratedExtensionLite DefaultCordExtensionLite; + public const int PackedInt32ExtensionLiteFieldNumber = 90; + public static pb::GeneratedRepeatExtensionLite PackedInt32ExtensionLite; + public const int PackedInt64ExtensionLiteFieldNumber = 91; + public static pb::GeneratedRepeatExtensionLite PackedInt64ExtensionLite; + public const int PackedUint32ExtensionLiteFieldNumber = 92; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite PackedUint32ExtensionLite; + public const int PackedUint64ExtensionLiteFieldNumber = 93; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite PackedUint64ExtensionLite; + public const int PackedSint32ExtensionLiteFieldNumber = 94; + public static pb::GeneratedRepeatExtensionLite PackedSint32ExtensionLite; + public const int PackedSint64ExtensionLiteFieldNumber = 95; + public static pb::GeneratedRepeatExtensionLite PackedSint64ExtensionLite; + public const int PackedFixed32ExtensionLiteFieldNumber = 96; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite PackedFixed32ExtensionLite; + public const int PackedFixed64ExtensionLiteFieldNumber = 97; + [global::System.CLSCompliant(false)] + public static pb::GeneratedRepeatExtensionLite PackedFixed64ExtensionLite; + public const int PackedSfixed32ExtensionLiteFieldNumber = 98; + public static pb::GeneratedRepeatExtensionLite PackedSfixed32ExtensionLite; + public const int PackedSfixed64ExtensionLiteFieldNumber = 99; + public static pb::GeneratedRepeatExtensionLite PackedSfixed64ExtensionLite; + public const int PackedFloatExtensionLiteFieldNumber = 100; + public static pb::GeneratedRepeatExtensionLite PackedFloatExtensionLite; + public const int PackedDoubleExtensionLiteFieldNumber = 101; + public static pb::GeneratedRepeatExtensionLite PackedDoubleExtensionLite; + public const int PackedBoolExtensionLiteFieldNumber = 102; + public static pb::GeneratedRepeatExtensionLite PackedBoolExtensionLite; + public const int PackedEnumExtensionLiteFieldNumber = 103; + public static pb::GeneratedRepeatExtensionLite PackedEnumExtensionLite; + #endregion + + #region Static variables + #endregion + #region Extensions + internal static readonly object Descriptor; + static UnitTestLiteProtoFile() { + Descriptor = null; + global::Google.ProtocolBuffers.TestProtos.TestNestedExtensionLite.NestedExtension = + new pb::GeneratedExtensionLite( + "protobuf_unittest.TestNestedExtensionLite.nested_extension", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(int), + null, + null, + global::Google.ProtocolBuffers.TestProtos.TestNestedExtensionLite.NestedExtensionFieldNumber, + pbd::FieldType.Int32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_int32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(int), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt32ExtensionLiteFieldNumber, + pbd::FieldType.Int32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_int64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(long), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalInt64ExtensionLiteFieldNumber, + pbd::FieldType.Int64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_uint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(uint), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint32ExtensionLiteFieldNumber, + pbd::FieldType.UInt32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_uint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(ulong), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalUint64ExtensionLiteFieldNumber, + pbd::FieldType.UInt64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_sint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(int), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint32ExtensionLiteFieldNumber, + pbd::FieldType.SInt32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_sint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(long), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSint64ExtensionLiteFieldNumber, + pbd::FieldType.SInt64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_fixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(uint), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed32ExtensionLiteFieldNumber, + pbd::FieldType.Fixed32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_fixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(ulong), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFixed64ExtensionLiteFieldNumber, + pbd::FieldType.Fixed64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_sfixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(int), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed32ExtensionLiteFieldNumber, + pbd::FieldType.SFixed32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_sfixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(long), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalSfixed64ExtensionLiteFieldNumber, + pbd::FieldType.SFixed64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFloatExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_float_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(float), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalFloatExtensionLiteFieldNumber, + pbd::FieldType.Float); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalDoubleExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_double_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(double), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalDoubleExtensionLiteFieldNumber, + pbd::FieldType.Double); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBoolExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_bool_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(bool), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBoolExtensionLiteFieldNumber, + pbd::FieldType.Bool); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_string_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringExtensionLiteFieldNumber, + pbd::FieldType.String); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBytesExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_bytes_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalBytesExtensionLiteFieldNumber, + pbd::FieldType.Bytes); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalGroupExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optionalgroup_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension_lite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalGroupExtensionLiteFieldNumber, + pbd::FieldType.Group); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedMessageExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_nested_message_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedMessageExtensionLiteFieldNumber, + pbd::FieldType.Message); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignMessageExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_foreign_message_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignMessageExtensionLiteFieldNumber, + pbd::FieldType.Message); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportMessageExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_import_message_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportMessageExtensionLiteFieldNumber, + pbd::FieldType.Message); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedEnumExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_nested_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum), + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalNestedEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignEnumExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_foreign_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite), + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalForeignEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportEnumExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_import_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + default(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite), + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalImportEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringPieceExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_string_piece_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalStringPieceExtensionLiteFieldNumber, + pbd::FieldType.String); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalCordExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.optional_cord_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.OptionalCordExtensionLiteFieldNumber, + pbd::FieldType.String); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_int32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt32ExtensionLiteFieldNumber, + pbd::FieldType.Int32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_int64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedInt64ExtensionLiteFieldNumber, + pbd::FieldType.Int64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_uint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint32ExtensionLiteFieldNumber, + pbd::FieldType.UInt32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_uint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedUint64ExtensionLiteFieldNumber, + pbd::FieldType.UInt64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_sint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint32ExtensionLiteFieldNumber, + pbd::FieldType.SInt32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_sint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSint64ExtensionLiteFieldNumber, + pbd::FieldType.SInt64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_fixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed32ExtensionLiteFieldNumber, + pbd::FieldType.Fixed32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_fixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFixed64ExtensionLiteFieldNumber, + pbd::FieldType.Fixed64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_sfixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed32ExtensionLiteFieldNumber, + pbd::FieldType.SFixed32, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_sfixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedSfixed64ExtensionLiteFieldNumber, + pbd::FieldType.SFixed64, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFloatExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_float_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedFloatExtensionLiteFieldNumber, + pbd::FieldType.Float, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedDoubleExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_double_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedDoubleExtensionLiteFieldNumber, + pbd::FieldType.Double, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBoolExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_bool_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBoolExtensionLiteFieldNumber, + pbd::FieldType.Bool, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_string_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringExtensionLiteFieldNumber, + pbd::FieldType.String, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBytesExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_bytes_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedBytesExtensionLiteFieldNumber, + pbd::FieldType.Bytes, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedGroupExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeatedgroup_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension_lite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedGroupExtensionLiteFieldNumber, + pbd::FieldType.Group, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedMessageExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_nested_message_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedMessageExtensionLiteFieldNumber, + pbd::FieldType.Message, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignMessageExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_foreign_message_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignMessageExtensionLiteFieldNumber, + pbd::FieldType.Message, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportMessageExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_import_message_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportMessageExtensionLiteFieldNumber, + pbd::FieldType.Message, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_nested_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedNestedEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_foreign_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedForeignEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportEnumExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_import_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedImportEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringPieceExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_string_piece_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedStringPieceExtensionLiteFieldNumber, + pbd::FieldType.String, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedCordExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.repeated_cord_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.RepeatedCordExtensionLiteFieldNumber, + pbd::FieldType.String, + false); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_int32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 41, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt32ExtensionLiteFieldNumber, + pbd::FieldType.Int32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_int64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 42L, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultInt64ExtensionLiteFieldNumber, + pbd::FieldType.Int64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_uint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 43, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint32ExtensionLiteFieldNumber, + pbd::FieldType.UInt32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_uint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 44UL, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultUint64ExtensionLiteFieldNumber, + pbd::FieldType.UInt64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_sint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + -45, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint32ExtensionLiteFieldNumber, + pbd::FieldType.SInt32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_sint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 46, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSint64ExtensionLiteFieldNumber, + pbd::FieldType.SInt64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_fixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 47, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed32ExtensionLiteFieldNumber, + pbd::FieldType.Fixed32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_fixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 48, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFixed64ExtensionLiteFieldNumber, + pbd::FieldType.Fixed64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed32ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_sfixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 49, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed32ExtensionLiteFieldNumber, + pbd::FieldType.SFixed32); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed64ExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_sfixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + -50, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultSfixed64ExtensionLiteFieldNumber, + pbd::FieldType.SFixed64); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFloatExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_float_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 51.5F, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultFloatExtensionLiteFieldNumber, + pbd::FieldType.Float); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultDoubleExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_double_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + 52000D, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultDoubleExtensionLiteFieldNumber, + pbd::FieldType.Double); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBoolExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_bool_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + true, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBoolExtensionLiteFieldNumber, + pbd::FieldType.Bool); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_string_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + "hello", + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringExtensionLiteFieldNumber, + pbd::FieldType.String); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBytesExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_bytes_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + pb::ByteString.FromBase64("d29ybGQ="), + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultBytesExtensionLiteFieldNumber, + pbd::FieldType.Bytes); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultNestedEnumExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_nested_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.BAR, + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultNestedEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultForeignEnumExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_foreign_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_BAR, + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultForeignEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultImportEnumExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_import_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_BAR, + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultImportEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringPieceExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_string_piece_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + "abc", + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultStringPieceExtensionLiteFieldNumber, + pbd::FieldType.String); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultCordExtensionLite = + new pb::GeneratedExtensionLite( + "protobuf_unittest.default_cord_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance, + "123", + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.DefaultCordExtensionLiteFieldNumber, + pbd::FieldType.String); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_int32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt32ExtensionLiteFieldNumber, + pbd::FieldType.Int32, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_int64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedInt64ExtensionLiteFieldNumber, + pbd::FieldType.Int64, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_uint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint32ExtensionLiteFieldNumber, + pbd::FieldType.UInt32, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_uint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedUint64ExtensionLiteFieldNumber, + pbd::FieldType.UInt64, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_sint32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint32ExtensionLiteFieldNumber, + pbd::FieldType.SInt32, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_sint64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSint64ExtensionLiteFieldNumber, + pbd::FieldType.SInt64, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_fixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed32ExtensionLiteFieldNumber, + pbd::FieldType.Fixed32, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_fixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFixed64ExtensionLiteFieldNumber, + pbd::FieldType.Fixed64, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed32ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_sfixed32_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed32ExtensionLiteFieldNumber, + pbd::FieldType.SFixed32, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed64ExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_sfixed64_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedSfixed64ExtensionLiteFieldNumber, + pbd::FieldType.SFixed64, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFloatExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_float_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedFloatExtensionLiteFieldNumber, + pbd::FieldType.Float, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedDoubleExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_double_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedDoubleExtensionLiteFieldNumber, + pbd::FieldType.Double, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedBoolExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_bool_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + null, + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedBoolExtensionLiteFieldNumber, + pbd::FieldType.Bool, + true); + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedEnumExtensionLite = + new pb::GeneratedRepeatExtensionLite( + "protobuf_unittest.packed_enum_extension_lite", + global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance, + null, + new EnumLiteMap(), + global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.PackedEnumExtensionLiteFieldNumber, + pbd::FieldType.Enum, + true); + } + #endregion + + } + #region Enums + public enum ForeignEnumLite { + FOREIGN_LITE_FOO = 4, + FOREIGN_LITE_BAR = 5, + FOREIGN_LITE_BAZ = 6, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestAllTypesLite : pb::GeneratedMessageLite { + private TestAllTypesLite() { } + private static readonly TestAllTypesLite defaultInstance = new TestAllTypesLite().MakeReadOnly(); + private static readonly string[] _testAllTypesLiteFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; + private static readonly uint[] _testAllTypesLiteFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; + public static TestAllTypesLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestAllTypesLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestAllTypesLite ThisMessage { + get { return this; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum NestedEnum { + FOO = 1, + BAR = 2, + BAZ = 3, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NestedMessage : pb::GeneratedMessageLite { + private NestedMessage() { } + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); + private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; + private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; + public static NestedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override NestedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NestedMessage ThisMessage { + get { return this; } + } + + public const int BbFieldNumber = 1; + private bool hasBb; + private int bb_; + public bool HasBb { + get { return hasBb; } + } + public int Bb { + get { return bb_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _nestedMessageFieldNames; + if (hasBb) { + output.WriteInt32(1, field_names[0], Bb); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasBb) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Bb); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasBb) hash ^= bb_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + NestedMessage other = obj as NestedMessage; + if (other == null) return false; + if (hasBb != other.hasBb || (hasBb && !bb_.Equals(other.bb_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("bb", hasBb, bb_, writer); + } + #endregion + + public static NestedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NestedMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NestedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (resultIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NestedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override NestedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance; } + } + + public override NestedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is NestedMessage) { + return MergeFrom((NestedMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NestedMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasBb) { + Bb = other.Bb; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_nestedMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _nestedMessageFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasBb = input.ReadInt32(ref result.bb_); + break; + } + } + } + + return this; + } + + + public bool HasBb { + get { return result.hasBb; } + } + public int Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(int value) { + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = 0; + return this; + } + } + static NestedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OptionalGroup : pb::GeneratedMessageLite { + private OptionalGroup() { } + private static readonly OptionalGroup defaultInstance = new OptionalGroup().MakeReadOnly(); + private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; + private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; + public static OptionalGroup DefaultInstance { + get { return defaultInstance; } + } + + public override OptionalGroup DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OptionalGroup ThisMessage { + get { return this; } + } + + public const int AFieldNumber = 17; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _optionalGroupFieldNames; + if (hasA) { + output.WriteInt32(17, field_names[0], A); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(17, A); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasA) hash ^= a_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + OptionalGroup other = obj as OptionalGroup; + if (other == null) return false; + if (hasA != other.hasA || (hasA && !a_.Equals(other.a_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("a", hasA, a_, writer); + } + #endregion + + public static OptionalGroup ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OptionalGroup ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OptionalGroup MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OptionalGroup prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OptionalGroup cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OptionalGroup result; + + private OptionalGroup PrepareBuilder() { + if (resultIsReadOnly) { + OptionalGroup original = result; + result = new OptionalGroup(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OptionalGroup MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override OptionalGroup DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance; } + } + + public override OptionalGroup BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is OptionalGroup) { + return MergeFrom((OptionalGroup) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OptionalGroup other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_optionalGroupFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _optionalGroupFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 136: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static OptionalGroup() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RepeatedGroup : pb::GeneratedMessageLite { + private RepeatedGroup() { } + private static readonly RepeatedGroup defaultInstance = new RepeatedGroup().MakeReadOnly(); + private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; + private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; + public static RepeatedGroup DefaultInstance { + get { return defaultInstance; } + } + + public override RepeatedGroup DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RepeatedGroup ThisMessage { + get { return this; } + } + + public const int AFieldNumber = 47; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _repeatedGroupFieldNames; + if (hasA) { + output.WriteInt32(47, field_names[0], A); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(47, A); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasA) hash ^= a_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + RepeatedGroup other = obj as RepeatedGroup; + if (other == null) return false; + if (hasA != other.hasA || (hasA && !a_.Equals(other.a_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("a", hasA, a_, writer); + } + #endregion + + public static RepeatedGroup ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RepeatedGroup ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RepeatedGroup MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RepeatedGroup prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RepeatedGroup cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RepeatedGroup result; + + private RepeatedGroup PrepareBuilder() { + if (resultIsReadOnly) { + RepeatedGroup original = result; + result = new RepeatedGroup(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RepeatedGroup MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override RepeatedGroup DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.DefaultInstance; } + } + + public override RepeatedGroup BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is RepeatedGroup) { + return MergeFrom((RepeatedGroup) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RepeatedGroup other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_repeatedGroupFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _repeatedGroupFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 376: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static RepeatedGroup() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int OptionalInt32FieldNumber = 1; + private bool hasOptionalInt32; + private int optionalInt32_; + public bool HasOptionalInt32 { + get { return hasOptionalInt32; } + } + public int OptionalInt32 { + get { return optionalInt32_; } + } + + public const int OptionalInt64FieldNumber = 2; + private bool hasOptionalInt64; + private long optionalInt64_; + public bool HasOptionalInt64 { + get { return hasOptionalInt64; } + } + public long OptionalInt64 { + get { return optionalInt64_; } + } + + public const int OptionalUint32FieldNumber = 3; + private bool hasOptionalUint32; + private uint optionalUint32_; + public bool HasOptionalUint32 { + get { return hasOptionalUint32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalUint32 { + get { return optionalUint32_; } + } + + public const int OptionalUint64FieldNumber = 4; + private bool hasOptionalUint64; + private ulong optionalUint64_; + public bool HasOptionalUint64 { + get { return hasOptionalUint64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalUint64 { + get { return optionalUint64_; } + } + + public const int OptionalSint32FieldNumber = 5; + private bool hasOptionalSint32; + private int optionalSint32_; + public bool HasOptionalSint32 { + get { return hasOptionalSint32; } + } + public int OptionalSint32 { + get { return optionalSint32_; } + } + + public const int OptionalSint64FieldNumber = 6; + private bool hasOptionalSint64; + private long optionalSint64_; + public bool HasOptionalSint64 { + get { return hasOptionalSint64; } + } + public long OptionalSint64 { + get { return optionalSint64_; } + } + + public const int OptionalFixed32FieldNumber = 7; + private bool hasOptionalFixed32; + private uint optionalFixed32_; + public bool HasOptionalFixed32 { + get { return hasOptionalFixed32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalFixed32 { + get { return optionalFixed32_; } + } + + public const int OptionalFixed64FieldNumber = 8; + private bool hasOptionalFixed64; + private ulong optionalFixed64_; + public bool HasOptionalFixed64 { + get { return hasOptionalFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalFixed64 { + get { return optionalFixed64_; } + } + + public const int OptionalSfixed32FieldNumber = 9; + private bool hasOptionalSfixed32; + private int optionalSfixed32_; + public bool HasOptionalSfixed32 { + get { return hasOptionalSfixed32; } + } + public int OptionalSfixed32 { + get { return optionalSfixed32_; } + } + + public const int OptionalSfixed64FieldNumber = 10; + private bool hasOptionalSfixed64; + private long optionalSfixed64_; + public bool HasOptionalSfixed64 { + get { return hasOptionalSfixed64; } + } + public long OptionalSfixed64 { + get { return optionalSfixed64_; } + } + + public const int OptionalFloatFieldNumber = 11; + private bool hasOptionalFloat; + private float optionalFloat_; + public bool HasOptionalFloat { + get { return hasOptionalFloat; } + } + public float OptionalFloat { + get { return optionalFloat_; } + } + + public const int OptionalDoubleFieldNumber = 12; + private bool hasOptionalDouble; + private double optionalDouble_; + public bool HasOptionalDouble { + get { return hasOptionalDouble; } + } + public double OptionalDouble { + get { return optionalDouble_; } + } + + public const int OptionalBoolFieldNumber = 13; + private bool hasOptionalBool; + private bool optionalBool_; + public bool HasOptionalBool { + get { return hasOptionalBool; } + } + public bool OptionalBool { + get { return optionalBool_; } + } + + public const int OptionalStringFieldNumber = 14; + private bool hasOptionalString; + private string optionalString_ = ""; + public bool HasOptionalString { + get { return hasOptionalString; } + } + public string OptionalString { + get { return optionalString_; } + } + + public const int OptionalBytesFieldNumber = 15; + private bool hasOptionalBytes; + private pb::ByteString optionalBytes_ = pb::ByteString.Empty; + public bool HasOptionalBytes { + get { return hasOptionalBytes; } + } + public pb::ByteString OptionalBytes { + get { return optionalBytes_; } + } + + public const int OptionalGroupFieldNumber = 16; + private bool hasOptionalGroup; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup optionalGroup_; + public bool HasOptionalGroup { + get { return hasOptionalGroup; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup OptionalGroup { + get { return optionalGroup_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance; } + } + + public const int OptionalNestedMessageFieldNumber = 18; + private bool hasOptionalNestedMessage; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage optionalNestedMessage_; + public bool HasOptionalNestedMessage { + get { return hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage OptionalNestedMessage { + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance; } + } + + public const int OptionalForeignMessageFieldNumber = 19; + private bool hasOptionalForeignMessage; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite optionalForeignMessage_; + public bool HasOptionalForeignMessage { + get { return hasOptionalForeignMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite OptionalForeignMessage { + get { return optionalForeignMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance; } + } + + public const int OptionalImportMessageFieldNumber = 20; + private bool hasOptionalImportMessage; + private global::Google.ProtocolBuffers.TestProtos.ImportMessageLite optionalImportMessage_; + public bool HasOptionalImportMessage { + get { return hasOptionalImportMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessageLite OptionalImportMessage { + get { return optionalImportMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance; } + } + + public const int OptionalNestedEnumFieldNumber = 21; + private bool hasOptionalNestedEnum; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.FOO; + public bool HasOptionalNestedEnum { + get { return hasOptionalNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum OptionalNestedEnum { + get { return optionalNestedEnum_; } + } + + public const int OptionalForeignEnumFieldNumber = 22; + private bool hasOptionalForeignEnum; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_FOO; + public bool HasOptionalForeignEnum { + get { return hasOptionalForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite OptionalForeignEnum { + get { return optionalForeignEnum_; } + } + + public const int OptionalImportEnumFieldNumber = 23; + private bool hasOptionalImportEnum; + private global::Google.ProtocolBuffers.TestProtos.ImportEnumLite optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_FOO; + public bool HasOptionalImportEnum { + get { return hasOptionalImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnumLite OptionalImportEnum { + get { return optionalImportEnum_; } + } + + public const int OptionalStringPieceFieldNumber = 24; + private bool hasOptionalStringPiece; + private string optionalStringPiece_ = ""; + public bool HasOptionalStringPiece { + get { return hasOptionalStringPiece; } + } + public string OptionalStringPiece { + get { return optionalStringPiece_; } + } + + public const int OptionalCordFieldNumber = 25; + private bool hasOptionalCord; + private string optionalCord_ = ""; + public bool HasOptionalCord { + get { return hasOptionalCord; } + } + public string OptionalCord { + get { return optionalCord_; } + } + + public const int RepeatedInt32FieldNumber = 31; + private pbc::PopsicleList repeatedInt32_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt32List { + get { return pbc::Lists.AsReadOnly(repeatedInt32_); } + } + public int RepeatedInt32Count { + get { return repeatedInt32_.Count; } + } + public int GetRepeatedInt32(int index) { + return repeatedInt32_[index]; + } + + public const int RepeatedInt64FieldNumber = 32; + private pbc::PopsicleList repeatedInt64_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt64List { + get { return pbc::Lists.AsReadOnly(repeatedInt64_); } + } + public int RepeatedInt64Count { + get { return repeatedInt64_.Count; } + } + public long GetRepeatedInt64(int index) { + return repeatedInt64_[index]; + } + + public const int RepeatedUint32FieldNumber = 33; + private pbc::PopsicleList repeatedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint32List { + get { return pbc::Lists.AsReadOnly(repeatedUint32_); } + } + public int RepeatedUint32Count { + get { return repeatedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedUint32(int index) { + return repeatedUint32_[index]; + } + + public const int RepeatedUint64FieldNumber = 34; + private pbc::PopsicleList repeatedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint64List { + get { return pbc::Lists.AsReadOnly(repeatedUint64_); } + } + public int RepeatedUint64Count { + get { return repeatedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return repeatedUint64_[index]; + } + + public const int RepeatedSint32FieldNumber = 35; + private pbc::PopsicleList repeatedSint32_ = new pbc::PopsicleList(); + public scg::IList RepeatedSint32List { + get { return pbc::Lists.AsReadOnly(repeatedSint32_); } + } + public int RepeatedSint32Count { + get { return repeatedSint32_.Count; } + } + public int GetRepeatedSint32(int index) { + return repeatedSint32_[index]; + } + + public const int RepeatedSint64FieldNumber = 36; + private pbc::PopsicleList repeatedSint64_ = new pbc::PopsicleList(); + public scg::IList RepeatedSint64List { + get { return pbc::Lists.AsReadOnly(repeatedSint64_); } + } + public int RepeatedSint64Count { + get { return repeatedSint64_.Count; } + } + public long GetRepeatedSint64(int index) { + return repeatedSint64_[index]; + } + + public const int RepeatedFixed32FieldNumber = 37; + private pbc::PopsicleList repeatedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed32List { + get { return pbc::Lists.AsReadOnly(repeatedFixed32_); } + } + public int RepeatedFixed32Count { + get { return repeatedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return repeatedFixed32_[index]; + } + + public const int RepeatedFixed64FieldNumber = 38; + private pbc::PopsicleList repeatedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed64List { + get { return pbc::Lists.AsReadOnly(repeatedFixed64_); } + } + public int RepeatedFixed64Count { + get { return repeatedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return repeatedFixed64_[index]; + } + + public const int RepeatedSfixed32FieldNumber = 39; + private pbc::PopsicleList repeatedSfixed32_ = new pbc::PopsicleList(); + public scg::IList RepeatedSfixed32List { + get { return pbc::Lists.AsReadOnly(repeatedSfixed32_); } + } + public int RepeatedSfixed32Count { + get { return repeatedSfixed32_.Count; } + } + public int GetRepeatedSfixed32(int index) { + return repeatedSfixed32_[index]; + } + + public const int RepeatedSfixed64FieldNumber = 40; + private pbc::PopsicleList repeatedSfixed64_ = new pbc::PopsicleList(); + public scg::IList RepeatedSfixed64List { + get { return pbc::Lists.AsReadOnly(repeatedSfixed64_); } + } + public int RepeatedSfixed64Count { + get { return repeatedSfixed64_.Count; } + } + public long GetRepeatedSfixed64(int index) { + return repeatedSfixed64_[index]; + } + + public const int RepeatedFloatFieldNumber = 41; + private pbc::PopsicleList repeatedFloat_ = new pbc::PopsicleList(); + public scg::IList RepeatedFloatList { + get { return pbc::Lists.AsReadOnly(repeatedFloat_); } + } + public int RepeatedFloatCount { + get { return repeatedFloat_.Count; } + } + public float GetRepeatedFloat(int index) { + return repeatedFloat_[index]; + } + + public const int RepeatedDoubleFieldNumber = 42; + private pbc::PopsicleList repeatedDouble_ = new pbc::PopsicleList(); + public scg::IList RepeatedDoubleList { + get { return pbc::Lists.AsReadOnly(repeatedDouble_); } + } + public int RepeatedDoubleCount { + get { return repeatedDouble_.Count; } + } + public double GetRepeatedDouble(int index) { + return repeatedDouble_[index]; + } + + public const int RepeatedBoolFieldNumber = 43; + private pbc::PopsicleList repeatedBool_ = new pbc::PopsicleList(); + public scg::IList RepeatedBoolList { + get { return pbc::Lists.AsReadOnly(repeatedBool_); } + } + public int RepeatedBoolCount { + get { return repeatedBool_.Count; } + } + public bool GetRepeatedBool(int index) { + return repeatedBool_[index]; + } + + public const int RepeatedStringFieldNumber = 44; + private pbc::PopsicleList repeatedString_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringList { + get { return pbc::Lists.AsReadOnly(repeatedString_); } + } + public int RepeatedStringCount { + get { return repeatedString_.Count; } + } + public string GetRepeatedString(int index) { + return repeatedString_[index]; + } + + public const int RepeatedBytesFieldNumber = 45; + private pbc::PopsicleList repeatedBytes_ = new pbc::PopsicleList(); + public scg::IList RepeatedBytesList { + get { return pbc::Lists.AsReadOnly(repeatedBytes_); } + } + public int RepeatedBytesCount { + get { return repeatedBytes_.Count; } + } + public pb::ByteString GetRepeatedBytes(int index) { + return repeatedBytes_[index]; + } + + public const int RepeatedGroupFieldNumber = 46; + private pbc::PopsicleList repeatedGroup_ = new pbc::PopsicleList(); + public scg::IList RepeatedGroupList { + get { return repeatedGroup_; } + } + public int RepeatedGroupCount { + get { return repeatedGroup_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup GetRepeatedGroup(int index) { + return repeatedGroup_[index]; + } + + public const int RepeatedNestedMessageFieldNumber = 48; + private pbc::PopsicleList repeatedNestedMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedNestedMessageList { + get { return repeatedNestedMessage_; } + } + public int RepeatedNestedMessageCount { + get { return repeatedNestedMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage GetRepeatedNestedMessage(int index) { + return repeatedNestedMessage_[index]; + } + + public const int RepeatedForeignMessageFieldNumber = 49; + private pbc::PopsicleList repeatedForeignMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedForeignMessageList { + get { return repeatedForeignMessage_; } + } + public int RepeatedForeignMessageCount { + get { return repeatedForeignMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite GetRepeatedForeignMessage(int index) { + return repeatedForeignMessage_[index]; + } + + public const int RepeatedImportMessageFieldNumber = 50; + private pbc::PopsicleList repeatedImportMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedImportMessageList { + get { return repeatedImportMessage_; } + } + public int RepeatedImportMessageCount { + get { return repeatedImportMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessageLite GetRepeatedImportMessage(int index) { + return repeatedImportMessage_[index]; + } + + public const int RepeatedNestedEnumFieldNumber = 51; + private pbc::PopsicleList repeatedNestedEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedNestedEnumList { + get { return pbc::Lists.AsReadOnly(repeatedNestedEnum_); } + } + public int RepeatedNestedEnumCount { + get { return repeatedNestedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum GetRepeatedNestedEnum(int index) { + return repeatedNestedEnum_[index]; + } + + public const int RepeatedForeignEnumFieldNumber = 52; + private pbc::PopsicleList repeatedForeignEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedForeignEnumList { + get { return pbc::Lists.AsReadOnly(repeatedForeignEnum_); } + } + public int RepeatedForeignEnumCount { + get { return repeatedForeignEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite GetRepeatedForeignEnum(int index) { + return repeatedForeignEnum_[index]; + } + + public const int RepeatedImportEnumFieldNumber = 53; + private pbc::PopsicleList repeatedImportEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedImportEnumList { + get { return pbc::Lists.AsReadOnly(repeatedImportEnum_); } + } + public int RepeatedImportEnumCount { + get { return repeatedImportEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnumLite GetRepeatedImportEnum(int index) { + return repeatedImportEnum_[index]; + } + + public const int RepeatedStringPieceFieldNumber = 54; + private pbc::PopsicleList repeatedStringPiece_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringPieceList { + get { return pbc::Lists.AsReadOnly(repeatedStringPiece_); } + } + public int RepeatedStringPieceCount { + get { return repeatedStringPiece_.Count; } + } + public string GetRepeatedStringPiece(int index) { + return repeatedStringPiece_[index]; + } + + public const int RepeatedCordFieldNumber = 55; + private pbc::PopsicleList repeatedCord_ = new pbc::PopsicleList(); + public scg::IList RepeatedCordList { + get { return pbc::Lists.AsReadOnly(repeatedCord_); } + } + public int RepeatedCordCount { + get { return repeatedCord_.Count; } + } + public string GetRepeatedCord(int index) { + return repeatedCord_[index]; + } + + public const int DefaultInt32FieldNumber = 61; + private bool hasDefaultInt32; + private int defaultInt32_ = 41; + public bool HasDefaultInt32 { + get { return hasDefaultInt32; } + } + public int DefaultInt32 { + get { return defaultInt32_; } + } + + public const int DefaultInt64FieldNumber = 62; + private bool hasDefaultInt64; + private long defaultInt64_ = 42L; + public bool HasDefaultInt64 { + get { return hasDefaultInt64; } + } + public long DefaultInt64 { + get { return defaultInt64_; } + } + + public const int DefaultUint32FieldNumber = 63; + private bool hasDefaultUint32; + private uint defaultUint32_ = 43; + public bool HasDefaultUint32 { + get { return hasDefaultUint32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultUint32 { + get { return defaultUint32_; } + } + + public const int DefaultUint64FieldNumber = 64; + private bool hasDefaultUint64; + private ulong defaultUint64_ = 44UL; + public bool HasDefaultUint64 { + get { return hasDefaultUint64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultUint64 { + get { return defaultUint64_; } + } + + public const int DefaultSint32FieldNumber = 65; + private bool hasDefaultSint32; + private int defaultSint32_ = -45; + public bool HasDefaultSint32 { + get { return hasDefaultSint32; } + } + public int DefaultSint32 { + get { return defaultSint32_; } + } + + public const int DefaultSint64FieldNumber = 66; + private bool hasDefaultSint64; + private long defaultSint64_ = 46; + public bool HasDefaultSint64 { + get { return hasDefaultSint64; } + } + public long DefaultSint64 { + get { return defaultSint64_; } + } + + public const int DefaultFixed32FieldNumber = 67; + private bool hasDefaultFixed32; + private uint defaultFixed32_ = 47; + public bool HasDefaultFixed32 { + get { return hasDefaultFixed32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultFixed32 { + get { return defaultFixed32_; } + } + + public const int DefaultFixed64FieldNumber = 68; + private bool hasDefaultFixed64; + private ulong defaultFixed64_ = 48; + public bool HasDefaultFixed64 { + get { return hasDefaultFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultFixed64 { + get { return defaultFixed64_; } + } + + public const int DefaultSfixed32FieldNumber = 69; + private bool hasDefaultSfixed32; + private int defaultSfixed32_ = 49; + public bool HasDefaultSfixed32 { + get { return hasDefaultSfixed32; } + } + public int DefaultSfixed32 { + get { return defaultSfixed32_; } + } + + public const int DefaultSfixed64FieldNumber = 70; + private bool hasDefaultSfixed64; + private long defaultSfixed64_ = -50; + public bool HasDefaultSfixed64 { + get { return hasDefaultSfixed64; } + } + public long DefaultSfixed64 { + get { return defaultSfixed64_; } + } + + public const int DefaultFloatFieldNumber = 71; + private bool hasDefaultFloat; + private float defaultFloat_ = 51.5F; + public bool HasDefaultFloat { + get { return hasDefaultFloat; } + } + public float DefaultFloat { + get { return defaultFloat_; } + } + + public const int DefaultDoubleFieldNumber = 72; + private bool hasDefaultDouble; + private double defaultDouble_ = 52000D; + public bool HasDefaultDouble { + get { return hasDefaultDouble; } + } + public double DefaultDouble { + get { return defaultDouble_; } + } + + public const int DefaultBoolFieldNumber = 73; + private bool hasDefaultBool; + private bool defaultBool_ = true; + public bool HasDefaultBool { + get { return hasDefaultBool; } + } + public bool DefaultBool { + get { return defaultBool_; } + } + + public const int DefaultStringFieldNumber = 74; + private bool hasDefaultString; + private string defaultString_ = "hello"; + public bool HasDefaultString { + get { return hasDefaultString; } + } + public string DefaultString { + get { return defaultString_; } + } + + public const int DefaultBytesFieldNumber = 75; + private bool hasDefaultBytes; + private pb::ByteString defaultBytes_ = pb::ByteString.FromBase64("d29ybGQ="); + public bool HasDefaultBytes { + get { return hasDefaultBytes; } + } + public pb::ByteString DefaultBytes { + get { return defaultBytes_; } + } + + public const int DefaultNestedEnumFieldNumber = 81; + private bool hasDefaultNestedEnum; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.BAR; + public bool HasDefaultNestedEnum { + get { return hasDefaultNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum DefaultNestedEnum { + get { return defaultNestedEnum_; } + } + + public const int DefaultForeignEnumFieldNumber = 82; + private bool hasDefaultForeignEnum; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_BAR; + public bool HasDefaultForeignEnum { + get { return hasDefaultForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite DefaultForeignEnum { + get { return defaultForeignEnum_; } + } + + public const int DefaultImportEnumFieldNumber = 83; + private bool hasDefaultImportEnum; + private global::Google.ProtocolBuffers.TestProtos.ImportEnumLite defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_BAR; + public bool HasDefaultImportEnum { + get { return hasDefaultImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnumLite DefaultImportEnum { + get { return defaultImportEnum_; } + } + + public const int DefaultStringPieceFieldNumber = 84; + private bool hasDefaultStringPiece; + private string defaultStringPiece_ = "abc"; + public bool HasDefaultStringPiece { + get { return hasDefaultStringPiece; } + } + public string DefaultStringPiece { + get { return defaultStringPiece_; } + } + + public const int DefaultCordFieldNumber = 85; + private bool hasDefaultCord; + private string defaultCord_ = "123"; + public bool HasDefaultCord { + get { return hasDefaultCord; } + } + public string DefaultCord { + get { return defaultCord_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testAllTypesLiteFieldNames; + if (hasOptionalInt32) { + output.WriteInt32(1, field_names[31], OptionalInt32); + } + if (hasOptionalInt64) { + output.WriteInt64(2, field_names[32], OptionalInt64); + } + if (hasOptionalUint32) { + output.WriteUInt32(3, field_names[41], OptionalUint32); + } + if (hasOptionalUint64) { + output.WriteUInt64(4, field_names[42], OptionalUint64); + } + if (hasOptionalSint32) { + output.WriteSInt32(5, field_names[37], OptionalSint32); + } + if (hasOptionalSint64) { + output.WriteSInt64(6, field_names[38], OptionalSint64); + } + if (hasOptionalFixed32) { + output.WriteFixed32(7, field_names[24], OptionalFixed32); + } + if (hasOptionalFixed64) { + output.WriteFixed64(8, field_names[25], OptionalFixed64); + } + if (hasOptionalSfixed32) { + output.WriteSFixed32(9, field_names[35], OptionalSfixed32); + } + if (hasOptionalSfixed64) { + output.WriteSFixed64(10, field_names[36], OptionalSfixed64); + } + if (hasOptionalFloat) { + output.WriteFloat(11, field_names[26], OptionalFloat); + } + if (hasOptionalDouble) { + output.WriteDouble(12, field_names[23], OptionalDouble); + } + if (hasOptionalBool) { + output.WriteBool(13, field_names[20], OptionalBool); + } + if (hasOptionalString) { + output.WriteString(14, field_names[39], OptionalString); + } + if (hasOptionalBytes) { + output.WriteBytes(15, field_names[21], OptionalBytes); + } + if (hasOptionalGroup) { + output.WriteGroup(16, field_names[43], OptionalGroup); + } + if (hasOptionalNestedMessage) { + output.WriteMessage(18, field_names[34], OptionalNestedMessage); + } + if (hasOptionalForeignMessage) { + output.WriteMessage(19, field_names[28], OptionalForeignMessage); + } + if (hasOptionalImportMessage) { + output.WriteMessage(20, field_names[30], OptionalImportMessage); + } + if (hasOptionalNestedEnum) { + output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum); + } + if (hasOptionalForeignEnum) { + output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum); + } + if (hasOptionalImportEnum) { + output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum); + } + if (hasOptionalStringPiece) { + output.WriteString(24, field_names[40], OptionalStringPiece); + } + if (hasOptionalCord) { + output.WriteString(25, field_names[22], OptionalCord); + } + if (repeatedInt32_.Count > 0) { + output.WriteInt32Array(31, field_names[55], repeatedInt32_); + } + if (repeatedInt64_.Count > 0) { + output.WriteInt64Array(32, field_names[56], repeatedInt64_); + } + if (repeatedUint32_.Count > 0) { + output.WriteUInt32Array(33, field_names[65], repeatedUint32_); + } + if (repeatedUint64_.Count > 0) { + output.WriteUInt64Array(34, field_names[66], repeatedUint64_); + } + if (repeatedSint32_.Count > 0) { + output.WriteSInt32Array(35, field_names[61], repeatedSint32_); + } + if (repeatedSint64_.Count > 0) { + output.WriteSInt64Array(36, field_names[62], repeatedSint64_); + } + if (repeatedFixed32_.Count > 0) { + output.WriteFixed32Array(37, field_names[48], repeatedFixed32_); + } + if (repeatedFixed64_.Count > 0) { + output.WriteFixed64Array(38, field_names[49], repeatedFixed64_); + } + if (repeatedSfixed32_.Count > 0) { + output.WriteSFixed32Array(39, field_names[59], repeatedSfixed32_); + } + if (repeatedSfixed64_.Count > 0) { + output.WriteSFixed64Array(40, field_names[60], repeatedSfixed64_); + } + if (repeatedFloat_.Count > 0) { + output.WriteFloatArray(41, field_names[50], repeatedFloat_); + } + if (repeatedDouble_.Count > 0) { + output.WriteDoubleArray(42, field_names[47], repeatedDouble_); + } + if (repeatedBool_.Count > 0) { + output.WriteBoolArray(43, field_names[44], repeatedBool_); + } + if (repeatedString_.Count > 0) { + output.WriteStringArray(44, field_names[63], repeatedString_); + } + if (repeatedBytes_.Count > 0) { + output.WriteBytesArray(45, field_names[45], repeatedBytes_); + } + if (repeatedGroup_.Count > 0) { + output.WriteGroupArray(46, field_names[67], repeatedGroup_); + } + if (repeatedNestedMessage_.Count > 0) { + output.WriteMessageArray(48, field_names[58], repeatedNestedMessage_); + } + if (repeatedForeignMessage_.Count > 0) { + output.WriteMessageArray(49, field_names[52], repeatedForeignMessage_); + } + if (repeatedImportMessage_.Count > 0) { + output.WriteMessageArray(50, field_names[54], repeatedImportMessage_); + } + if (repeatedNestedEnum_.Count > 0) { + output.WriteEnumArray(51, field_names[57], repeatedNestedEnum_); + } + if (repeatedForeignEnum_.Count > 0) { + output.WriteEnumArray(52, field_names[51], repeatedForeignEnum_); + } + if (repeatedImportEnum_.Count > 0) { + output.WriteEnumArray(53, field_names[53], repeatedImportEnum_); + } + if (repeatedStringPiece_.Count > 0) { + output.WriteStringArray(54, field_names[64], repeatedStringPiece_); + } + if (repeatedCord_.Count > 0) { + output.WriteStringArray(55, field_names[46], repeatedCord_); + } + if (hasDefaultInt32) { + output.WriteInt32(61, field_names[9], DefaultInt32); + } + if (hasDefaultInt64) { + output.WriteInt64(62, field_names[10], DefaultInt64); + } + if (hasDefaultUint32) { + output.WriteUInt32(63, field_names[18], DefaultUint32); + } + if (hasDefaultUint64) { + output.WriteUInt64(64, field_names[19], DefaultUint64); + } + if (hasDefaultSint32) { + output.WriteSInt32(65, field_names[14], DefaultSint32); + } + if (hasDefaultSint64) { + output.WriteSInt64(66, field_names[15], DefaultSint64); + } + if (hasDefaultFixed32) { + output.WriteFixed32(67, field_names[4], DefaultFixed32); + } + if (hasDefaultFixed64) { + output.WriteFixed64(68, field_names[5], DefaultFixed64); + } + if (hasDefaultSfixed32) { + output.WriteSFixed32(69, field_names[12], DefaultSfixed32); + } + if (hasDefaultSfixed64) { + output.WriteSFixed64(70, field_names[13], DefaultSfixed64); + } + if (hasDefaultFloat) { + output.WriteFloat(71, field_names[6], DefaultFloat); + } + if (hasDefaultDouble) { + output.WriteDouble(72, field_names[3], DefaultDouble); + } + if (hasDefaultBool) { + output.WriteBool(73, field_names[0], DefaultBool); + } + if (hasDefaultString) { + output.WriteString(74, field_names[16], DefaultString); + } + if (hasDefaultBytes) { + output.WriteBytes(75, field_names[1], DefaultBytes); + } + if (hasDefaultNestedEnum) { + output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum); + } + if (hasDefaultForeignEnum) { + output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum); + } + if (hasDefaultImportEnum) { + output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum); + } + if (hasDefaultStringPiece) { + output.WriteString(84, field_names[17], DefaultStringPiece); + } + if (hasDefaultCord) { + output.WriteString(85, field_names[2], DefaultCord); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(1, OptionalInt32); + } + if (hasOptionalInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(2, OptionalInt64); + } + if (hasOptionalUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(3, OptionalUint32); + } + if (hasOptionalUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(4, OptionalUint64); + } + if (hasOptionalSint32) { + size += pb::CodedOutputStream.ComputeSInt32Size(5, OptionalSint32); + } + if (hasOptionalSint64) { + size += pb::CodedOutputStream.ComputeSInt64Size(6, OptionalSint64); + } + if (hasOptionalFixed32) { + size += pb::CodedOutputStream.ComputeFixed32Size(7, OptionalFixed32); + } + if (hasOptionalFixed64) { + size += pb::CodedOutputStream.ComputeFixed64Size(8, OptionalFixed64); + } + if (hasOptionalSfixed32) { + size += pb::CodedOutputStream.ComputeSFixed32Size(9, OptionalSfixed32); + } + if (hasOptionalSfixed64) { + size += pb::CodedOutputStream.ComputeSFixed64Size(10, OptionalSfixed64); + } + if (hasOptionalFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(11, OptionalFloat); + } + if (hasOptionalDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(12, OptionalDouble); + } + if (hasOptionalBool) { + size += pb::CodedOutputStream.ComputeBoolSize(13, OptionalBool); + } + if (hasOptionalString) { + size += pb::CodedOutputStream.ComputeStringSize(14, OptionalString); + } + if (hasOptionalBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(15, OptionalBytes); + } + if (hasOptionalGroup) { + size += pb::CodedOutputStream.ComputeGroupSize(16, OptionalGroup); + } + if (hasOptionalNestedMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(18, OptionalNestedMessage); + } + if (hasOptionalForeignMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(19, OptionalForeignMessage); + } + if (hasOptionalImportMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(20, OptionalImportMessage); + } + if (hasOptionalNestedEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(21, (int) OptionalNestedEnum); + } + if (hasOptionalForeignEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(22, (int) OptionalForeignEnum); + } + if (hasOptionalImportEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(23, (int) OptionalImportEnum); + } + if (hasOptionalStringPiece) { + size += pb::CodedOutputStream.ComputeStringSize(24, OptionalStringPiece); + } + if (hasOptionalCord) { + size += pb::CodedOutputStream.ComputeStringSize(25, OptionalCord); + } + { + int dataSize = 0; + foreach (int element in RepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt32_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt64_.Count; + } + { + int dataSize = 0; + foreach (uint element in RepeatedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedUint32_.Count; + } + { + int dataSize = 0; + foreach (ulong element in RepeatedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedUint64_.Count; + } + { + int dataSize = 0; + foreach (int element in RepeatedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedSint32_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedSint64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFixed32_.Count; + size += dataSize; + size += 2 * repeatedFixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedFixed64_.Count; + size += dataSize; + size += 2 * repeatedFixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedSfixed32_.Count; + size += dataSize; + size += 2 * repeatedSfixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedSfixed64_.Count; + size += dataSize; + size += 2 * repeatedSfixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFloat_.Count; + size += dataSize; + size += 2 * repeatedFloat_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedDouble_.Count; + size += dataSize; + size += 2 * repeatedDouble_.Count; + } + { + int dataSize = 0; + dataSize = 1 * repeatedBool_.Count; + size += dataSize; + size += 2 * repeatedBool_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedStringList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedString_.Count; + } + { + int dataSize = 0; + foreach (pb::ByteString element in RepeatedBytesList) { + dataSize += pb::CodedOutputStream.ComputeBytesSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedBytes_.Count; + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup element in RepeatedGroupList) { + size += pb::CodedOutputStream.ComputeGroupSize(46, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage element in RepeatedNestedMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(48, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite element in RepeatedForeignMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(49, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.ImportMessageLite element in RepeatedImportMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(50, element); + } + { + int dataSize = 0; + if (repeatedNestedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum element in repeatedNestedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedNestedEnum_.Count; + } + } + { + int dataSize = 0; + if (repeatedForeignEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite element in repeatedForeignEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedForeignEnum_.Count; + } + } + { + int dataSize = 0; + if (repeatedImportEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ImportEnumLite element in repeatedImportEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedImportEnum_.Count; + } + } + { + int dataSize = 0; + foreach (string element in RepeatedStringPieceList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedStringPiece_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedCordList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedCord_.Count; + } + if (hasDefaultInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(61, DefaultInt32); + } + if (hasDefaultInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(62, DefaultInt64); + } + if (hasDefaultUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(63, DefaultUint32); + } + if (hasDefaultUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(64, DefaultUint64); + } + if (hasDefaultSint32) { + size += pb::CodedOutputStream.ComputeSInt32Size(65, DefaultSint32); + } + if (hasDefaultSint64) { + size += pb::CodedOutputStream.ComputeSInt64Size(66, DefaultSint64); + } + if (hasDefaultFixed32) { + size += pb::CodedOutputStream.ComputeFixed32Size(67, DefaultFixed32); + } + if (hasDefaultFixed64) { + size += pb::CodedOutputStream.ComputeFixed64Size(68, DefaultFixed64); + } + if (hasDefaultSfixed32) { + size += pb::CodedOutputStream.ComputeSFixed32Size(69, DefaultSfixed32); + } + if (hasDefaultSfixed64) { + size += pb::CodedOutputStream.ComputeSFixed64Size(70, DefaultSfixed64); + } + if (hasDefaultFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(71, DefaultFloat); + } + if (hasDefaultDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(72, DefaultDouble); + } + if (hasDefaultBool) { + size += pb::CodedOutputStream.ComputeBoolSize(73, DefaultBool); + } + if (hasDefaultString) { + size += pb::CodedOutputStream.ComputeStringSize(74, DefaultString); + } + if (hasDefaultBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(75, DefaultBytes); + } + if (hasDefaultNestedEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(81, (int) DefaultNestedEnum); + } + if (hasDefaultForeignEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(82, (int) DefaultForeignEnum); + } + if (hasDefaultImportEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(83, (int) DefaultImportEnum); + } + if (hasDefaultStringPiece) { + size += pb::CodedOutputStream.ComputeStringSize(84, DefaultStringPiece); + } + if (hasDefaultCord) { + size += pb::CodedOutputStream.ComputeStringSize(85, DefaultCord); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasOptionalInt32) hash ^= optionalInt32_.GetHashCode(); + if (hasOptionalInt64) hash ^= optionalInt64_.GetHashCode(); + if (hasOptionalUint32) hash ^= optionalUint32_.GetHashCode(); + if (hasOptionalUint64) hash ^= optionalUint64_.GetHashCode(); + if (hasOptionalSint32) hash ^= optionalSint32_.GetHashCode(); + if (hasOptionalSint64) hash ^= optionalSint64_.GetHashCode(); + if (hasOptionalFixed32) hash ^= optionalFixed32_.GetHashCode(); + if (hasOptionalFixed64) hash ^= optionalFixed64_.GetHashCode(); + if (hasOptionalSfixed32) hash ^= optionalSfixed32_.GetHashCode(); + if (hasOptionalSfixed64) hash ^= optionalSfixed64_.GetHashCode(); + if (hasOptionalFloat) hash ^= optionalFloat_.GetHashCode(); + if (hasOptionalDouble) hash ^= optionalDouble_.GetHashCode(); + if (hasOptionalBool) hash ^= optionalBool_.GetHashCode(); + if (hasOptionalString) hash ^= optionalString_.GetHashCode(); + if (hasOptionalBytes) hash ^= optionalBytes_.GetHashCode(); + if (hasOptionalGroup) hash ^= optionalGroup_.GetHashCode(); + if (hasOptionalNestedMessage) hash ^= optionalNestedMessage_.GetHashCode(); + if (hasOptionalForeignMessage) hash ^= optionalForeignMessage_.GetHashCode(); + if (hasOptionalImportMessage) hash ^= optionalImportMessage_.GetHashCode(); + if (hasOptionalNestedEnum) hash ^= optionalNestedEnum_.GetHashCode(); + if (hasOptionalForeignEnum) hash ^= optionalForeignEnum_.GetHashCode(); + if (hasOptionalImportEnum) hash ^= optionalImportEnum_.GetHashCode(); + if (hasOptionalStringPiece) hash ^= optionalStringPiece_.GetHashCode(); + if (hasOptionalCord) hash ^= optionalCord_.GetHashCode(); + foreach(int i in repeatedInt32_) + hash ^= i.GetHashCode(); + foreach(long i in repeatedInt64_) + hash ^= i.GetHashCode(); + foreach(uint i in repeatedUint32_) + hash ^= i.GetHashCode(); + foreach(ulong i in repeatedUint64_) + hash ^= i.GetHashCode(); + foreach(int i in repeatedSint32_) + hash ^= i.GetHashCode(); + foreach(long i in repeatedSint64_) + hash ^= i.GetHashCode(); + foreach(uint i in repeatedFixed32_) + hash ^= i.GetHashCode(); + foreach(ulong i in repeatedFixed64_) + hash ^= i.GetHashCode(); + foreach(int i in repeatedSfixed32_) + hash ^= i.GetHashCode(); + foreach(long i in repeatedSfixed64_) + hash ^= i.GetHashCode(); + foreach(float i in repeatedFloat_) + hash ^= i.GetHashCode(); + foreach(double i in repeatedDouble_) + hash ^= i.GetHashCode(); + foreach(bool i in repeatedBool_) + hash ^= i.GetHashCode(); + foreach(string i in repeatedString_) + hash ^= i.GetHashCode(); + foreach(pb::ByteString i in repeatedBytes_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup i in repeatedGroup_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage i in repeatedNestedMessage_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite i in repeatedForeignMessage_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite i in repeatedImportMessage_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum i in repeatedNestedEnum_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite i in repeatedForeignEnum_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite i in repeatedImportEnum_) + hash ^= i.GetHashCode(); + foreach(string i in repeatedStringPiece_) + hash ^= i.GetHashCode(); + foreach(string i in repeatedCord_) + hash ^= i.GetHashCode(); + if (hasDefaultInt32) hash ^= defaultInt32_.GetHashCode(); + if (hasDefaultInt64) hash ^= defaultInt64_.GetHashCode(); + if (hasDefaultUint32) hash ^= defaultUint32_.GetHashCode(); + if (hasDefaultUint64) hash ^= defaultUint64_.GetHashCode(); + if (hasDefaultSint32) hash ^= defaultSint32_.GetHashCode(); + if (hasDefaultSint64) hash ^= defaultSint64_.GetHashCode(); + if (hasDefaultFixed32) hash ^= defaultFixed32_.GetHashCode(); + if (hasDefaultFixed64) hash ^= defaultFixed64_.GetHashCode(); + if (hasDefaultSfixed32) hash ^= defaultSfixed32_.GetHashCode(); + if (hasDefaultSfixed64) hash ^= defaultSfixed64_.GetHashCode(); + if (hasDefaultFloat) hash ^= defaultFloat_.GetHashCode(); + if (hasDefaultDouble) hash ^= defaultDouble_.GetHashCode(); + if (hasDefaultBool) hash ^= defaultBool_.GetHashCode(); + if (hasDefaultString) hash ^= defaultString_.GetHashCode(); + if (hasDefaultBytes) hash ^= defaultBytes_.GetHashCode(); + if (hasDefaultNestedEnum) hash ^= defaultNestedEnum_.GetHashCode(); + if (hasDefaultForeignEnum) hash ^= defaultForeignEnum_.GetHashCode(); + if (hasDefaultImportEnum) hash ^= defaultImportEnum_.GetHashCode(); + if (hasDefaultStringPiece) hash ^= defaultStringPiece_.GetHashCode(); + if (hasDefaultCord) hash ^= defaultCord_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestAllTypesLite other = obj as TestAllTypesLite; + if (other == null) return false; + if (hasOptionalInt32 != other.hasOptionalInt32 || (hasOptionalInt32 && !optionalInt32_.Equals(other.optionalInt32_))) return false; + if (hasOptionalInt64 != other.hasOptionalInt64 || (hasOptionalInt64 && !optionalInt64_.Equals(other.optionalInt64_))) return false; + if (hasOptionalUint32 != other.hasOptionalUint32 || (hasOptionalUint32 && !optionalUint32_.Equals(other.optionalUint32_))) return false; + if (hasOptionalUint64 != other.hasOptionalUint64 || (hasOptionalUint64 && !optionalUint64_.Equals(other.optionalUint64_))) return false; + if (hasOptionalSint32 != other.hasOptionalSint32 || (hasOptionalSint32 && !optionalSint32_.Equals(other.optionalSint32_))) return false; + if (hasOptionalSint64 != other.hasOptionalSint64 || (hasOptionalSint64 && !optionalSint64_.Equals(other.optionalSint64_))) return false; + if (hasOptionalFixed32 != other.hasOptionalFixed32 || (hasOptionalFixed32 && !optionalFixed32_.Equals(other.optionalFixed32_))) return false; + if (hasOptionalFixed64 != other.hasOptionalFixed64 || (hasOptionalFixed64 && !optionalFixed64_.Equals(other.optionalFixed64_))) return false; + if (hasOptionalSfixed32 != other.hasOptionalSfixed32 || (hasOptionalSfixed32 && !optionalSfixed32_.Equals(other.optionalSfixed32_))) return false; + if (hasOptionalSfixed64 != other.hasOptionalSfixed64 || (hasOptionalSfixed64 && !optionalSfixed64_.Equals(other.optionalSfixed64_))) return false; + if (hasOptionalFloat != other.hasOptionalFloat || (hasOptionalFloat && !optionalFloat_.Equals(other.optionalFloat_))) return false; + if (hasOptionalDouble != other.hasOptionalDouble || (hasOptionalDouble && !optionalDouble_.Equals(other.optionalDouble_))) return false; + if (hasOptionalBool != other.hasOptionalBool || (hasOptionalBool && !optionalBool_.Equals(other.optionalBool_))) return false; + if (hasOptionalString != other.hasOptionalString || (hasOptionalString && !optionalString_.Equals(other.optionalString_))) return false; + if (hasOptionalBytes != other.hasOptionalBytes || (hasOptionalBytes && !optionalBytes_.Equals(other.optionalBytes_))) return false; + if (hasOptionalGroup != other.hasOptionalGroup || (hasOptionalGroup && !optionalGroup_.Equals(other.optionalGroup_))) return false; + if (hasOptionalNestedMessage != other.hasOptionalNestedMessage || (hasOptionalNestedMessage && !optionalNestedMessage_.Equals(other.optionalNestedMessage_))) return false; + if (hasOptionalForeignMessage != other.hasOptionalForeignMessage || (hasOptionalForeignMessage && !optionalForeignMessage_.Equals(other.optionalForeignMessage_))) return false; + if (hasOptionalImportMessage != other.hasOptionalImportMessage || (hasOptionalImportMessage && !optionalImportMessage_.Equals(other.optionalImportMessage_))) return false; + if (hasOptionalNestedEnum != other.hasOptionalNestedEnum || (hasOptionalNestedEnum && !optionalNestedEnum_.Equals(other.optionalNestedEnum_))) return false; + if (hasOptionalForeignEnum != other.hasOptionalForeignEnum || (hasOptionalForeignEnum && !optionalForeignEnum_.Equals(other.optionalForeignEnum_))) return false; + if (hasOptionalImportEnum != other.hasOptionalImportEnum || (hasOptionalImportEnum && !optionalImportEnum_.Equals(other.optionalImportEnum_))) return false; + if (hasOptionalStringPiece != other.hasOptionalStringPiece || (hasOptionalStringPiece && !optionalStringPiece_.Equals(other.optionalStringPiece_))) return false; + if (hasOptionalCord != other.hasOptionalCord || (hasOptionalCord && !optionalCord_.Equals(other.optionalCord_))) return false; + if(repeatedInt32_.Count != other.repeatedInt32_.Count) return false; + for(int ix=0; ix < repeatedInt32_.Count; ix++) + if(!repeatedInt32_[ix].Equals(other.repeatedInt32_[ix])) return false; + if(repeatedInt64_.Count != other.repeatedInt64_.Count) return false; + for(int ix=0; ix < repeatedInt64_.Count; ix++) + if(!repeatedInt64_[ix].Equals(other.repeatedInt64_[ix])) return false; + if(repeatedUint32_.Count != other.repeatedUint32_.Count) return false; + for(int ix=0; ix < repeatedUint32_.Count; ix++) + if(!repeatedUint32_[ix].Equals(other.repeatedUint32_[ix])) return false; + if(repeatedUint64_.Count != other.repeatedUint64_.Count) return false; + for(int ix=0; ix < repeatedUint64_.Count; ix++) + if(!repeatedUint64_[ix].Equals(other.repeatedUint64_[ix])) return false; + if(repeatedSint32_.Count != other.repeatedSint32_.Count) return false; + for(int ix=0; ix < repeatedSint32_.Count; ix++) + if(!repeatedSint32_[ix].Equals(other.repeatedSint32_[ix])) return false; + if(repeatedSint64_.Count != other.repeatedSint64_.Count) return false; + for(int ix=0; ix < repeatedSint64_.Count; ix++) + if(!repeatedSint64_[ix].Equals(other.repeatedSint64_[ix])) return false; + if(repeatedFixed32_.Count != other.repeatedFixed32_.Count) return false; + for(int ix=0; ix < repeatedFixed32_.Count; ix++) + if(!repeatedFixed32_[ix].Equals(other.repeatedFixed32_[ix])) return false; + if(repeatedFixed64_.Count != other.repeatedFixed64_.Count) return false; + for(int ix=0; ix < repeatedFixed64_.Count; ix++) + if(!repeatedFixed64_[ix].Equals(other.repeatedFixed64_[ix])) return false; + if(repeatedSfixed32_.Count != other.repeatedSfixed32_.Count) return false; + for(int ix=0; ix < repeatedSfixed32_.Count; ix++) + if(!repeatedSfixed32_[ix].Equals(other.repeatedSfixed32_[ix])) return false; + if(repeatedSfixed64_.Count != other.repeatedSfixed64_.Count) return false; + for(int ix=0; ix < repeatedSfixed64_.Count; ix++) + if(!repeatedSfixed64_[ix].Equals(other.repeatedSfixed64_[ix])) return false; + if(repeatedFloat_.Count != other.repeatedFloat_.Count) return false; + for(int ix=0; ix < repeatedFloat_.Count; ix++) + if(!repeatedFloat_[ix].Equals(other.repeatedFloat_[ix])) return false; + if(repeatedDouble_.Count != other.repeatedDouble_.Count) return false; + for(int ix=0; ix < repeatedDouble_.Count; ix++) + if(!repeatedDouble_[ix].Equals(other.repeatedDouble_[ix])) return false; + if(repeatedBool_.Count != other.repeatedBool_.Count) return false; + for(int ix=0; ix < repeatedBool_.Count; ix++) + if(!repeatedBool_[ix].Equals(other.repeatedBool_[ix])) return false; + if(repeatedString_.Count != other.repeatedString_.Count) return false; + for(int ix=0; ix < repeatedString_.Count; ix++) + if(!repeatedString_[ix].Equals(other.repeatedString_[ix])) return false; + if(repeatedBytes_.Count != other.repeatedBytes_.Count) return false; + for(int ix=0; ix < repeatedBytes_.Count; ix++) + if(!repeatedBytes_[ix].Equals(other.repeatedBytes_[ix])) return false; + if(repeatedGroup_.Count != other.repeatedGroup_.Count) return false; + for(int ix=0; ix < repeatedGroup_.Count; ix++) + if(!repeatedGroup_[ix].Equals(other.repeatedGroup_[ix])) return false; + if(repeatedNestedMessage_.Count != other.repeatedNestedMessage_.Count) return false; + for(int ix=0; ix < repeatedNestedMessage_.Count; ix++) + if(!repeatedNestedMessage_[ix].Equals(other.repeatedNestedMessage_[ix])) return false; + if(repeatedForeignMessage_.Count != other.repeatedForeignMessage_.Count) return false; + for(int ix=0; ix < repeatedForeignMessage_.Count; ix++) + if(!repeatedForeignMessage_[ix].Equals(other.repeatedForeignMessage_[ix])) return false; + if(repeatedImportMessage_.Count != other.repeatedImportMessage_.Count) return false; + for(int ix=0; ix < repeatedImportMessage_.Count; ix++) + if(!repeatedImportMessage_[ix].Equals(other.repeatedImportMessage_[ix])) return false; + if(repeatedNestedEnum_.Count != other.repeatedNestedEnum_.Count) return false; + for(int ix=0; ix < repeatedNestedEnum_.Count; ix++) + if(!repeatedNestedEnum_[ix].Equals(other.repeatedNestedEnum_[ix])) return false; + if(repeatedForeignEnum_.Count != other.repeatedForeignEnum_.Count) return false; + for(int ix=0; ix < repeatedForeignEnum_.Count; ix++) + if(!repeatedForeignEnum_[ix].Equals(other.repeatedForeignEnum_[ix])) return false; + if(repeatedImportEnum_.Count != other.repeatedImportEnum_.Count) return false; + for(int ix=0; ix < repeatedImportEnum_.Count; ix++) + if(!repeatedImportEnum_[ix].Equals(other.repeatedImportEnum_[ix])) return false; + if(repeatedStringPiece_.Count != other.repeatedStringPiece_.Count) return false; + for(int ix=0; ix < repeatedStringPiece_.Count; ix++) + if(!repeatedStringPiece_[ix].Equals(other.repeatedStringPiece_[ix])) return false; + if(repeatedCord_.Count != other.repeatedCord_.Count) return false; + for(int ix=0; ix < repeatedCord_.Count; ix++) + if(!repeatedCord_[ix].Equals(other.repeatedCord_[ix])) return false; + if (hasDefaultInt32 != other.hasDefaultInt32 || (hasDefaultInt32 && !defaultInt32_.Equals(other.defaultInt32_))) return false; + if (hasDefaultInt64 != other.hasDefaultInt64 || (hasDefaultInt64 && !defaultInt64_.Equals(other.defaultInt64_))) return false; + if (hasDefaultUint32 != other.hasDefaultUint32 || (hasDefaultUint32 && !defaultUint32_.Equals(other.defaultUint32_))) return false; + if (hasDefaultUint64 != other.hasDefaultUint64 || (hasDefaultUint64 && !defaultUint64_.Equals(other.defaultUint64_))) return false; + if (hasDefaultSint32 != other.hasDefaultSint32 || (hasDefaultSint32 && !defaultSint32_.Equals(other.defaultSint32_))) return false; + if (hasDefaultSint64 != other.hasDefaultSint64 || (hasDefaultSint64 && !defaultSint64_.Equals(other.defaultSint64_))) return false; + if (hasDefaultFixed32 != other.hasDefaultFixed32 || (hasDefaultFixed32 && !defaultFixed32_.Equals(other.defaultFixed32_))) return false; + if (hasDefaultFixed64 != other.hasDefaultFixed64 || (hasDefaultFixed64 && !defaultFixed64_.Equals(other.defaultFixed64_))) return false; + if (hasDefaultSfixed32 != other.hasDefaultSfixed32 || (hasDefaultSfixed32 && !defaultSfixed32_.Equals(other.defaultSfixed32_))) return false; + if (hasDefaultSfixed64 != other.hasDefaultSfixed64 || (hasDefaultSfixed64 && !defaultSfixed64_.Equals(other.defaultSfixed64_))) return false; + if (hasDefaultFloat != other.hasDefaultFloat || (hasDefaultFloat && !defaultFloat_.Equals(other.defaultFloat_))) return false; + if (hasDefaultDouble != other.hasDefaultDouble || (hasDefaultDouble && !defaultDouble_.Equals(other.defaultDouble_))) return false; + if (hasDefaultBool != other.hasDefaultBool || (hasDefaultBool && !defaultBool_.Equals(other.defaultBool_))) return false; + if (hasDefaultString != other.hasDefaultString || (hasDefaultString && !defaultString_.Equals(other.defaultString_))) return false; + if (hasDefaultBytes != other.hasDefaultBytes || (hasDefaultBytes && !defaultBytes_.Equals(other.defaultBytes_))) return false; + if (hasDefaultNestedEnum != other.hasDefaultNestedEnum || (hasDefaultNestedEnum && !defaultNestedEnum_.Equals(other.defaultNestedEnum_))) return false; + if (hasDefaultForeignEnum != other.hasDefaultForeignEnum || (hasDefaultForeignEnum && !defaultForeignEnum_.Equals(other.defaultForeignEnum_))) return false; + if (hasDefaultImportEnum != other.hasDefaultImportEnum || (hasDefaultImportEnum && !defaultImportEnum_.Equals(other.defaultImportEnum_))) return false; + if (hasDefaultStringPiece != other.hasDefaultStringPiece || (hasDefaultStringPiece && !defaultStringPiece_.Equals(other.defaultStringPiece_))) return false; + if (hasDefaultCord != other.hasDefaultCord || (hasDefaultCord && !defaultCord_.Equals(other.defaultCord_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("optional_int32", hasOptionalInt32, optionalInt32_, writer); + PrintField("optional_int64", hasOptionalInt64, optionalInt64_, writer); + PrintField("optional_uint32", hasOptionalUint32, optionalUint32_, writer); + PrintField("optional_uint64", hasOptionalUint64, optionalUint64_, writer); + PrintField("optional_sint32", hasOptionalSint32, optionalSint32_, writer); + PrintField("optional_sint64", hasOptionalSint64, optionalSint64_, writer); + PrintField("optional_fixed32", hasOptionalFixed32, optionalFixed32_, writer); + PrintField("optional_fixed64", hasOptionalFixed64, optionalFixed64_, writer); + PrintField("optional_sfixed32", hasOptionalSfixed32, optionalSfixed32_, writer); + PrintField("optional_sfixed64", hasOptionalSfixed64, optionalSfixed64_, writer); + PrintField("optional_float", hasOptionalFloat, optionalFloat_, writer); + PrintField("optional_double", hasOptionalDouble, optionalDouble_, writer); + PrintField("optional_bool", hasOptionalBool, optionalBool_, writer); + PrintField("optional_string", hasOptionalString, optionalString_, writer); + PrintField("optional_bytes", hasOptionalBytes, optionalBytes_, writer); + PrintField("OptionalGroup", hasOptionalGroup, optionalGroup_, writer); + PrintField("optional_nested_message", hasOptionalNestedMessage, optionalNestedMessage_, writer); + PrintField("optional_foreign_message", hasOptionalForeignMessage, optionalForeignMessage_, writer); + PrintField("optional_import_message", hasOptionalImportMessage, optionalImportMessage_, writer); + PrintField("optional_nested_enum", hasOptionalNestedEnum, optionalNestedEnum_, writer); + PrintField("optional_foreign_enum", hasOptionalForeignEnum, optionalForeignEnum_, writer); + PrintField("optional_import_enum", hasOptionalImportEnum, optionalImportEnum_, writer); + PrintField("optional_string_piece", hasOptionalStringPiece, optionalStringPiece_, writer); + PrintField("optional_cord", hasOptionalCord, optionalCord_, writer); + PrintField("repeated_int32", repeatedInt32_, writer); + PrintField("repeated_int64", repeatedInt64_, writer); + PrintField("repeated_uint32", repeatedUint32_, writer); + PrintField("repeated_uint64", repeatedUint64_, writer); + PrintField("repeated_sint32", repeatedSint32_, writer); + PrintField("repeated_sint64", repeatedSint64_, writer); + PrintField("repeated_fixed32", repeatedFixed32_, writer); + PrintField("repeated_fixed64", repeatedFixed64_, writer); + PrintField("repeated_sfixed32", repeatedSfixed32_, writer); + PrintField("repeated_sfixed64", repeatedSfixed64_, writer); + PrintField("repeated_float", repeatedFloat_, writer); + PrintField("repeated_double", repeatedDouble_, writer); + PrintField("repeated_bool", repeatedBool_, writer); + PrintField("repeated_string", repeatedString_, writer); + PrintField("repeated_bytes", repeatedBytes_, writer); + PrintField("RepeatedGroup", repeatedGroup_, writer); + PrintField("repeated_nested_message", repeatedNestedMessage_, writer); + PrintField("repeated_foreign_message", repeatedForeignMessage_, writer); + PrintField("repeated_import_message", repeatedImportMessage_, writer); + PrintField("repeated_nested_enum", repeatedNestedEnum_, writer); + PrintField("repeated_foreign_enum", repeatedForeignEnum_, writer); + PrintField("repeated_import_enum", repeatedImportEnum_, writer); + PrintField("repeated_string_piece", repeatedStringPiece_, writer); + PrintField("repeated_cord", repeatedCord_, writer); + PrintField("default_int32", hasDefaultInt32, defaultInt32_, writer); + PrintField("default_int64", hasDefaultInt64, defaultInt64_, writer); + PrintField("default_uint32", hasDefaultUint32, defaultUint32_, writer); + PrintField("default_uint64", hasDefaultUint64, defaultUint64_, writer); + PrintField("default_sint32", hasDefaultSint32, defaultSint32_, writer); + PrintField("default_sint64", hasDefaultSint64, defaultSint64_, writer); + PrintField("default_fixed32", hasDefaultFixed32, defaultFixed32_, writer); + PrintField("default_fixed64", hasDefaultFixed64, defaultFixed64_, writer); + PrintField("default_sfixed32", hasDefaultSfixed32, defaultSfixed32_, writer); + PrintField("default_sfixed64", hasDefaultSfixed64, defaultSfixed64_, writer); + PrintField("default_float", hasDefaultFloat, defaultFloat_, writer); + PrintField("default_double", hasDefaultDouble, defaultDouble_, writer); + PrintField("default_bool", hasDefaultBool, defaultBool_, writer); + PrintField("default_string", hasDefaultString, defaultString_, writer); + PrintField("default_bytes", hasDefaultBytes, defaultBytes_, writer); + PrintField("default_nested_enum", hasDefaultNestedEnum, defaultNestedEnum_, writer); + PrintField("default_foreign_enum", hasDefaultForeignEnum, defaultForeignEnum_, writer); + PrintField("default_import_enum", hasDefaultImportEnum, defaultImportEnum_, writer); + PrintField("default_string_piece", hasDefaultStringPiece, defaultStringPiece_, writer); + PrintField("default_cord", hasDefaultCord, defaultCord_, writer); + } + #endregion + + public static TestAllTypesLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllTypesLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllTypesLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllTypesLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllTypesLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllTypesLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestAllTypesLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestAllTypesLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestAllTypesLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllTypesLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestAllTypesLite MakeReadOnly() { + repeatedInt32_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedUint32_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + repeatedSint32_.MakeReadOnly(); + repeatedSint64_.MakeReadOnly(); + repeatedFixed32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedSfixed32_.MakeReadOnly(); + repeatedSfixed64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedDouble_.MakeReadOnly(); + repeatedBool_.MakeReadOnly(); + repeatedString_.MakeReadOnly(); + repeatedBytes_.MakeReadOnly(); + repeatedGroup_.MakeReadOnly(); + repeatedNestedMessage_.MakeReadOnly(); + repeatedForeignMessage_.MakeReadOnly(); + repeatedImportMessage_.MakeReadOnly(); + repeatedNestedEnum_.MakeReadOnly(); + repeatedForeignEnum_.MakeReadOnly(); + repeatedImportEnum_.MakeReadOnly(); + repeatedStringPiece_.MakeReadOnly(); + repeatedCord_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestAllTypesLite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestAllTypesLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestAllTypesLite result; + + private TestAllTypesLite PrepareBuilder() { + if (resultIsReadOnly) { + TestAllTypesLite original = result; + result = new TestAllTypesLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestAllTypesLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestAllTypesLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.DefaultInstance; } + } + + public override TestAllTypesLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestAllTypesLite) { + return MergeFrom((TestAllTypesLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestAllTypesLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalInt32) { + OptionalInt32 = other.OptionalInt32; + } + if (other.HasOptionalInt64) { + OptionalInt64 = other.OptionalInt64; + } + if (other.HasOptionalUint32) { + OptionalUint32 = other.OptionalUint32; + } + if (other.HasOptionalUint64) { + OptionalUint64 = other.OptionalUint64; + } + if (other.HasOptionalSint32) { + OptionalSint32 = other.OptionalSint32; + } + if (other.HasOptionalSint64) { + OptionalSint64 = other.OptionalSint64; + } + if (other.HasOptionalFixed32) { + OptionalFixed32 = other.OptionalFixed32; + } + if (other.HasOptionalFixed64) { + OptionalFixed64 = other.OptionalFixed64; + } + if (other.HasOptionalSfixed32) { + OptionalSfixed32 = other.OptionalSfixed32; + } + if (other.HasOptionalSfixed64) { + OptionalSfixed64 = other.OptionalSfixed64; + } + if (other.HasOptionalFloat) { + OptionalFloat = other.OptionalFloat; + } + if (other.HasOptionalDouble) { + OptionalDouble = other.OptionalDouble; + } + if (other.HasOptionalBool) { + OptionalBool = other.OptionalBool; + } + if (other.HasOptionalString) { + OptionalString = other.OptionalString; + } + if (other.HasOptionalBytes) { + OptionalBytes = other.OptionalBytes; + } + if (other.HasOptionalGroup) { + MergeOptionalGroup(other.OptionalGroup); + } + if (other.HasOptionalNestedMessage) { + MergeOptionalNestedMessage(other.OptionalNestedMessage); + } + if (other.HasOptionalForeignMessage) { + MergeOptionalForeignMessage(other.OptionalForeignMessage); + } + if (other.HasOptionalImportMessage) { + MergeOptionalImportMessage(other.OptionalImportMessage); + } + if (other.HasOptionalNestedEnum) { + OptionalNestedEnum = other.OptionalNestedEnum; + } + if (other.HasOptionalForeignEnum) { + OptionalForeignEnum = other.OptionalForeignEnum; + } + if (other.HasOptionalImportEnum) { + OptionalImportEnum = other.OptionalImportEnum; + } + if (other.HasOptionalStringPiece) { + OptionalStringPiece = other.OptionalStringPiece; + } + if (other.HasOptionalCord) { + OptionalCord = other.OptionalCord; + } + if (other.repeatedInt32_.Count != 0) { + result.repeatedInt32_.Add(other.repeatedInt32_); + } + if (other.repeatedInt64_.Count != 0) { + result.repeatedInt64_.Add(other.repeatedInt64_); + } + if (other.repeatedUint32_.Count != 0) { + result.repeatedUint32_.Add(other.repeatedUint32_); + } + if (other.repeatedUint64_.Count != 0) { + result.repeatedUint64_.Add(other.repeatedUint64_); + } + if (other.repeatedSint32_.Count != 0) { + result.repeatedSint32_.Add(other.repeatedSint32_); + } + if (other.repeatedSint64_.Count != 0) { + result.repeatedSint64_.Add(other.repeatedSint64_); + } + if (other.repeatedFixed32_.Count != 0) { + result.repeatedFixed32_.Add(other.repeatedFixed32_); + } + if (other.repeatedFixed64_.Count != 0) { + result.repeatedFixed64_.Add(other.repeatedFixed64_); + } + if (other.repeatedSfixed32_.Count != 0) { + result.repeatedSfixed32_.Add(other.repeatedSfixed32_); + } + if (other.repeatedSfixed64_.Count != 0) { + result.repeatedSfixed64_.Add(other.repeatedSfixed64_); + } + if (other.repeatedFloat_.Count != 0) { + result.repeatedFloat_.Add(other.repeatedFloat_); + } + if (other.repeatedDouble_.Count != 0) { + result.repeatedDouble_.Add(other.repeatedDouble_); + } + if (other.repeatedBool_.Count != 0) { + result.repeatedBool_.Add(other.repeatedBool_); + } + if (other.repeatedString_.Count != 0) { + result.repeatedString_.Add(other.repeatedString_); + } + if (other.repeatedBytes_.Count != 0) { + result.repeatedBytes_.Add(other.repeatedBytes_); + } + if (other.repeatedGroup_.Count != 0) { + result.repeatedGroup_.Add(other.repeatedGroup_); + } + if (other.repeatedNestedMessage_.Count != 0) { + result.repeatedNestedMessage_.Add(other.repeatedNestedMessage_); + } + if (other.repeatedForeignMessage_.Count != 0) { + result.repeatedForeignMessage_.Add(other.repeatedForeignMessage_); + } + if (other.repeatedImportMessage_.Count != 0) { + result.repeatedImportMessage_.Add(other.repeatedImportMessage_); + } + if (other.repeatedNestedEnum_.Count != 0) { + result.repeatedNestedEnum_.Add(other.repeatedNestedEnum_); + } + if (other.repeatedForeignEnum_.Count != 0) { + result.repeatedForeignEnum_.Add(other.repeatedForeignEnum_); + } + if (other.repeatedImportEnum_.Count != 0) { + result.repeatedImportEnum_.Add(other.repeatedImportEnum_); + } + if (other.repeatedStringPiece_.Count != 0) { + result.repeatedStringPiece_.Add(other.repeatedStringPiece_); + } + if (other.repeatedCord_.Count != 0) { + result.repeatedCord_.Add(other.repeatedCord_); + } + if (other.HasDefaultInt32) { + DefaultInt32 = other.DefaultInt32; + } + if (other.HasDefaultInt64) { + DefaultInt64 = other.DefaultInt64; + } + if (other.HasDefaultUint32) { + DefaultUint32 = other.DefaultUint32; + } + if (other.HasDefaultUint64) { + DefaultUint64 = other.DefaultUint64; + } + if (other.HasDefaultSint32) { + DefaultSint32 = other.DefaultSint32; + } + if (other.HasDefaultSint64) { + DefaultSint64 = other.DefaultSint64; + } + if (other.HasDefaultFixed32) { + DefaultFixed32 = other.DefaultFixed32; + } + if (other.HasDefaultFixed64) { + DefaultFixed64 = other.DefaultFixed64; + } + if (other.HasDefaultSfixed32) { + DefaultSfixed32 = other.DefaultSfixed32; + } + if (other.HasDefaultSfixed64) { + DefaultSfixed64 = other.DefaultSfixed64; + } + if (other.HasDefaultFloat) { + DefaultFloat = other.DefaultFloat; + } + if (other.HasDefaultDouble) { + DefaultDouble = other.DefaultDouble; + } + if (other.HasDefaultBool) { + DefaultBool = other.DefaultBool; + } + if (other.HasDefaultString) { + DefaultString = other.DefaultString; + } + if (other.HasDefaultBytes) { + DefaultBytes = other.DefaultBytes; + } + if (other.HasDefaultNestedEnum) { + DefaultNestedEnum = other.DefaultNestedEnum; + } + if (other.HasDefaultForeignEnum) { + DefaultForeignEnum = other.DefaultForeignEnum; + } + if (other.HasDefaultImportEnum) { + DefaultImportEnum = other.DefaultImportEnum; + } + if (other.HasDefaultStringPiece) { + DefaultStringPiece = other.DefaultStringPiece; + } + if (other.HasDefaultCord) { + DefaultCord = other.DefaultCord; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testAllTypesLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testAllTypesLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasOptionalInt32 = input.ReadInt32(ref result.optionalInt32_); + break; + } + case 16: { + result.hasOptionalInt64 = input.ReadInt64(ref result.optionalInt64_); + break; + } + case 24: { + result.hasOptionalUint32 = input.ReadUInt32(ref result.optionalUint32_); + break; + } + case 32: { + result.hasOptionalUint64 = input.ReadUInt64(ref result.optionalUint64_); + break; + } + case 40: { + result.hasOptionalSint32 = input.ReadSInt32(ref result.optionalSint32_); + break; + } + case 48: { + result.hasOptionalSint64 = input.ReadSInt64(ref result.optionalSint64_); + break; + } + case 61: { + result.hasOptionalFixed32 = input.ReadFixed32(ref result.optionalFixed32_); + break; + } + case 65: { + result.hasOptionalFixed64 = input.ReadFixed64(ref result.optionalFixed64_); + break; + } + case 77: { + result.hasOptionalSfixed32 = input.ReadSFixed32(ref result.optionalSfixed32_); + break; + } + case 81: { + result.hasOptionalSfixed64 = input.ReadSFixed64(ref result.optionalSfixed64_); + break; + } + case 93: { + result.hasOptionalFloat = input.ReadFloat(ref result.optionalFloat_); + break; + } + case 97: { + result.hasOptionalDouble = input.ReadDouble(ref result.optionalDouble_); + break; + } + case 104: { + result.hasOptionalBool = input.ReadBool(ref result.optionalBool_); + break; + } + case 114: { + result.hasOptionalString = input.ReadString(ref result.optionalString_); + break; + } + case 122: { + result.hasOptionalBytes = input.ReadBytes(ref result.optionalBytes_); + break; + } + case 131: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.CreateBuilder(); + if (result.hasOptionalGroup) { + subBuilder.MergeFrom(OptionalGroup); + } + input.ReadGroup(16, subBuilder, extensionRegistry); + OptionalGroup = subBuilder.BuildPartial(); + break; + } + case 146: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.CreateBuilder(); + if (result.hasOptionalNestedMessage) { + subBuilder.MergeFrom(OptionalNestedMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalNestedMessage = subBuilder.BuildPartial(); + break; + } + case 154: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.CreateBuilder(); + if (result.hasOptionalForeignMessage) { + subBuilder.MergeFrom(OptionalForeignMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalForeignMessage = subBuilder.BuildPartial(); + break; + } + case 162: { + global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.CreateBuilder(); + if (result.hasOptionalImportMessage) { + subBuilder.MergeFrom(OptionalImportMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalImportMessage = subBuilder.BuildPartial(); + break; + } + case 168: { + object unknown; + if(input.ReadEnum(ref result.optionalNestedEnum_, out unknown)) { + result.hasOptionalNestedEnum = true; + } else if(unknown is int) { + } + break; + } + case 176: { + object unknown; + if(input.ReadEnum(ref result.optionalForeignEnum_, out unknown)) { + result.hasOptionalForeignEnum = true; + } else if(unknown is int) { + } + break; + } + case 184: { + object unknown; + if(input.ReadEnum(ref result.optionalImportEnum_, out unknown)) { + result.hasOptionalImportEnum = true; + } else if(unknown is int) { + } + break; + } + case 194: { + result.hasOptionalStringPiece = input.ReadString(ref result.optionalStringPiece_); + break; + } + case 202: { + result.hasOptionalCord = input.ReadString(ref result.optionalCord_); + break; + } + case 250: + case 248: { + input.ReadInt32Array(tag, field_name, result.repeatedInt32_); + break; + } + case 258: + case 256: { + input.ReadInt64Array(tag, field_name, result.repeatedInt64_); + break; + } + case 266: + case 264: { + input.ReadUInt32Array(tag, field_name, result.repeatedUint32_); + break; + } + case 274: + case 272: { + input.ReadUInt64Array(tag, field_name, result.repeatedUint64_); + break; + } + case 282: + case 280: { + input.ReadSInt32Array(tag, field_name, result.repeatedSint32_); + break; + } + case 290: + case 288: { + input.ReadSInt64Array(tag, field_name, result.repeatedSint64_); + break; + } + case 298: + case 301: { + input.ReadFixed32Array(tag, field_name, result.repeatedFixed32_); + break; + } + case 306: + case 305: { + input.ReadFixed64Array(tag, field_name, result.repeatedFixed64_); + break; + } + case 314: + case 317: { + input.ReadSFixed32Array(tag, field_name, result.repeatedSfixed32_); + break; + } + case 322: + case 321: { + input.ReadSFixed64Array(tag, field_name, result.repeatedSfixed64_); + break; + } + case 330: + case 333: { + input.ReadFloatArray(tag, field_name, result.repeatedFloat_); + break; + } + case 338: + case 337: { + input.ReadDoubleArray(tag, field_name, result.repeatedDouble_); + break; + } + case 346: + case 344: { + input.ReadBoolArray(tag, field_name, result.repeatedBool_); + break; + } + case 354: { + input.ReadStringArray(tag, field_name, result.repeatedString_); + break; + } + case 362: { + input.ReadBytesArray(tag, field_name, result.repeatedBytes_); + break; + } + case 371: { + input.ReadGroupArray(tag, field_name, result.repeatedGroup_, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.DefaultInstance, extensionRegistry); + break; + } + case 386: { + input.ReadMessageArray(tag, field_name, result.repeatedNestedMessage_, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance, extensionRegistry); + break; + } + case 394: { + input.ReadMessageArray(tag, field_name, result.repeatedForeignMessage_, global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance, extensionRegistry); + break; + } + case 402: { + input.ReadMessageArray(tag, field_name, result.repeatedImportMessage_, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance, extensionRegistry); + break; + } + case 410: + case 408: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedNestedEnum_, out unknownItems); + break; + } + case 418: + case 416: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedForeignEnum_, out unknownItems); + break; + } + case 426: + case 424: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedImportEnum_, out unknownItems); + break; + } + case 434: { + input.ReadStringArray(tag, field_name, result.repeatedStringPiece_); + break; + } + case 442: { + input.ReadStringArray(tag, field_name, result.repeatedCord_); + break; + } + case 488: { + result.hasDefaultInt32 = input.ReadInt32(ref result.defaultInt32_); + break; + } + case 496: { + result.hasDefaultInt64 = input.ReadInt64(ref result.defaultInt64_); + break; + } + case 504: { + result.hasDefaultUint32 = input.ReadUInt32(ref result.defaultUint32_); + break; + } + case 512: { + result.hasDefaultUint64 = input.ReadUInt64(ref result.defaultUint64_); + break; + } + case 520: { + result.hasDefaultSint32 = input.ReadSInt32(ref result.defaultSint32_); + break; + } + case 528: { + result.hasDefaultSint64 = input.ReadSInt64(ref result.defaultSint64_); + break; + } + case 541: { + result.hasDefaultFixed32 = input.ReadFixed32(ref result.defaultFixed32_); + break; + } + case 545: { + result.hasDefaultFixed64 = input.ReadFixed64(ref result.defaultFixed64_); + break; + } + case 557: { + result.hasDefaultSfixed32 = input.ReadSFixed32(ref result.defaultSfixed32_); + break; + } + case 561: { + result.hasDefaultSfixed64 = input.ReadSFixed64(ref result.defaultSfixed64_); + break; + } + case 573: { + result.hasDefaultFloat = input.ReadFloat(ref result.defaultFloat_); + break; + } + case 577: { + result.hasDefaultDouble = input.ReadDouble(ref result.defaultDouble_); + break; + } + case 584: { + result.hasDefaultBool = input.ReadBool(ref result.defaultBool_); + break; + } + case 594: { + result.hasDefaultString = input.ReadString(ref result.defaultString_); + break; + } + case 602: { + result.hasDefaultBytes = input.ReadBytes(ref result.defaultBytes_); + break; + } + case 648: { + object unknown; + if(input.ReadEnum(ref result.defaultNestedEnum_, out unknown)) { + result.hasDefaultNestedEnum = true; + } else if(unknown is int) { + } + break; + } + case 656: { + object unknown; + if(input.ReadEnum(ref result.defaultForeignEnum_, out unknown)) { + result.hasDefaultForeignEnum = true; + } else if(unknown is int) { + } + break; + } + case 664: { + object unknown; + if(input.ReadEnum(ref result.defaultImportEnum_, out unknown)) { + result.hasDefaultImportEnum = true; + } else if(unknown is int) { + } + break; + } + case 674: { + result.hasDefaultStringPiece = input.ReadString(ref result.defaultStringPiece_); + break; + } + case 682: { + result.hasDefaultCord = input.ReadString(ref result.defaultCord_); + break; + } + } + } + + return this; + } + + + public bool HasOptionalInt32 { + get { return result.hasOptionalInt32; } + } + public int OptionalInt32 { + get { return result.OptionalInt32; } + set { SetOptionalInt32(value); } + } + public Builder SetOptionalInt32(int value) { + PrepareBuilder(); + result.hasOptionalInt32 = true; + result.optionalInt32_ = value; + return this; + } + public Builder ClearOptionalInt32() { + PrepareBuilder(); + result.hasOptionalInt32 = false; + result.optionalInt32_ = 0; + return this; + } + + public bool HasOptionalInt64 { + get { return result.hasOptionalInt64; } + } + public long OptionalInt64 { + get { return result.OptionalInt64; } + set { SetOptionalInt64(value); } + } + public Builder SetOptionalInt64(long value) { + PrepareBuilder(); + result.hasOptionalInt64 = true; + result.optionalInt64_ = value; + return this; + } + public Builder ClearOptionalInt64() { + PrepareBuilder(); + result.hasOptionalInt64 = false; + result.optionalInt64_ = 0L; + return this; + } + + public bool HasOptionalUint32 { + get { return result.hasOptionalUint32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalUint32 { + get { return result.OptionalUint32; } + set { SetOptionalUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalUint32(uint value) { + PrepareBuilder(); + result.hasOptionalUint32 = true; + result.optionalUint32_ = value; + return this; + } + public Builder ClearOptionalUint32() { + PrepareBuilder(); + result.hasOptionalUint32 = false; + result.optionalUint32_ = 0; + return this; + } + + public bool HasOptionalUint64 { + get { return result.hasOptionalUint64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalUint64 { + get { return result.OptionalUint64; } + set { SetOptionalUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalUint64(ulong value) { + PrepareBuilder(); + result.hasOptionalUint64 = true; + result.optionalUint64_ = value; + return this; + } + public Builder ClearOptionalUint64() { + PrepareBuilder(); + result.hasOptionalUint64 = false; + result.optionalUint64_ = 0UL; + return this; + } + + public bool HasOptionalSint32 { + get { return result.hasOptionalSint32; } + } + public int OptionalSint32 { + get { return result.OptionalSint32; } + set { SetOptionalSint32(value); } + } + public Builder SetOptionalSint32(int value) { + PrepareBuilder(); + result.hasOptionalSint32 = true; + result.optionalSint32_ = value; + return this; + } + public Builder ClearOptionalSint32() { + PrepareBuilder(); + result.hasOptionalSint32 = false; + result.optionalSint32_ = 0; + return this; + } + + public bool HasOptionalSint64 { + get { return result.hasOptionalSint64; } + } + public long OptionalSint64 { + get { return result.OptionalSint64; } + set { SetOptionalSint64(value); } + } + public Builder SetOptionalSint64(long value) { + PrepareBuilder(); + result.hasOptionalSint64 = true; + result.optionalSint64_ = value; + return this; + } + public Builder ClearOptionalSint64() { + PrepareBuilder(); + result.hasOptionalSint64 = false; + result.optionalSint64_ = 0; + return this; + } + + public bool HasOptionalFixed32 { + get { return result.hasOptionalFixed32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalFixed32 { + get { return result.OptionalFixed32; } + set { SetOptionalFixed32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalFixed32(uint value) { + PrepareBuilder(); + result.hasOptionalFixed32 = true; + result.optionalFixed32_ = value; + return this; + } + public Builder ClearOptionalFixed32() { + PrepareBuilder(); + result.hasOptionalFixed32 = false; + result.optionalFixed32_ = 0; + return this; + } + + public bool HasOptionalFixed64 { + get { return result.hasOptionalFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalFixed64 { + get { return result.OptionalFixed64; } + set { SetOptionalFixed64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalFixed64(ulong value) { + PrepareBuilder(); + result.hasOptionalFixed64 = true; + result.optionalFixed64_ = value; + return this; + } + public Builder ClearOptionalFixed64() { + PrepareBuilder(); + result.hasOptionalFixed64 = false; + result.optionalFixed64_ = 0; + return this; + } + + public bool HasOptionalSfixed32 { + get { return result.hasOptionalSfixed32; } + } + public int OptionalSfixed32 { + get { return result.OptionalSfixed32; } + set { SetOptionalSfixed32(value); } + } + public Builder SetOptionalSfixed32(int value) { + PrepareBuilder(); + result.hasOptionalSfixed32 = true; + result.optionalSfixed32_ = value; + return this; + } + public Builder ClearOptionalSfixed32() { + PrepareBuilder(); + result.hasOptionalSfixed32 = false; + result.optionalSfixed32_ = 0; + return this; + } + + public bool HasOptionalSfixed64 { + get { return result.hasOptionalSfixed64; } + } + public long OptionalSfixed64 { + get { return result.OptionalSfixed64; } + set { SetOptionalSfixed64(value); } + } + public Builder SetOptionalSfixed64(long value) { + PrepareBuilder(); + result.hasOptionalSfixed64 = true; + result.optionalSfixed64_ = value; + return this; + } + public Builder ClearOptionalSfixed64() { + PrepareBuilder(); + result.hasOptionalSfixed64 = false; + result.optionalSfixed64_ = 0; + return this; + } + + public bool HasOptionalFloat { + get { return result.hasOptionalFloat; } + } + public float OptionalFloat { + get { return result.OptionalFloat; } + set { SetOptionalFloat(value); } + } + public Builder SetOptionalFloat(float value) { + PrepareBuilder(); + result.hasOptionalFloat = true; + result.optionalFloat_ = value; + return this; + } + public Builder ClearOptionalFloat() { + PrepareBuilder(); + result.hasOptionalFloat = false; + result.optionalFloat_ = 0F; + return this; + } + + public bool HasOptionalDouble { + get { return result.hasOptionalDouble; } + } + public double OptionalDouble { + get { return result.OptionalDouble; } + set { SetOptionalDouble(value); } + } + public Builder SetOptionalDouble(double value) { + PrepareBuilder(); + result.hasOptionalDouble = true; + result.optionalDouble_ = value; + return this; + } + public Builder ClearOptionalDouble() { + PrepareBuilder(); + result.hasOptionalDouble = false; + result.optionalDouble_ = 0D; + return this; + } + + public bool HasOptionalBool { + get { return result.hasOptionalBool; } + } + public bool OptionalBool { + get { return result.OptionalBool; } + set { SetOptionalBool(value); } + } + public Builder SetOptionalBool(bool value) { + PrepareBuilder(); + result.hasOptionalBool = true; + result.optionalBool_ = value; + return this; + } + public Builder ClearOptionalBool() { + PrepareBuilder(); + result.hasOptionalBool = false; + result.optionalBool_ = false; + return this; + } + + public bool HasOptionalString { + get { return result.hasOptionalString; } + } + public string OptionalString { + get { return result.OptionalString; } + set { SetOptionalString(value); } + } + public Builder SetOptionalString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalString = true; + result.optionalString_ = value; + return this; + } + public Builder ClearOptionalString() { + PrepareBuilder(); + result.hasOptionalString = false; + result.optionalString_ = ""; + return this; + } + + public bool HasOptionalBytes { + get { return result.hasOptionalBytes; } + } + public pb::ByteString OptionalBytes { + get { return result.OptionalBytes; } + set { SetOptionalBytes(value); } + } + public Builder SetOptionalBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalBytes = true; + result.optionalBytes_ = value; + return this; + } + public Builder ClearOptionalBytes() { + PrepareBuilder(); + result.hasOptionalBytes = false; + result.optionalBytes_ = pb::ByteString.Empty; + return this; + } + + public bool HasOptionalGroup { + get { return result.hasOptionalGroup; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup OptionalGroup { + get { return result.OptionalGroup; } + set { SetOptionalGroup(value); } + } + public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalGroup = true; + result.optionalGroup_ = value; + return this; + } + public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalGroup = true; + result.optionalGroup_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalGroup && + result.optionalGroup_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.DefaultInstance) { + result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.OptionalGroup.CreateBuilder(result.optionalGroup_).MergeFrom(value).BuildPartial(); + } else { + result.optionalGroup_ = value; + } + result.hasOptionalGroup = true; + return this; + } + public Builder ClearOptionalGroup() { + PrepareBuilder(); + result.hasOptionalGroup = false; + result.optionalGroup_ = null; + return this; + } + + public bool HasOptionalNestedMessage { + get { return result.hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage OptionalNestedMessage { + get { return result.OptionalNestedMessage; } + set { SetOptionalNestedMessage(value); } + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = value; + return this; + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalNestedMessage && + result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.DefaultInstance) { + result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalNestedMessage_ = value; + } + result.hasOptionalNestedMessage = true; + return this; + } + public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); + result.hasOptionalNestedMessage = false; + result.optionalNestedMessage_ = null; + return this; + } + + public bool HasOptionalForeignMessage { + get { return result.hasOptionalForeignMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite OptionalForeignMessage { + get { return result.OptionalForeignMessage; } + set { SetOptionalForeignMessage(value); } + } + public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalForeignMessage = true; + result.optionalForeignMessage_ = value; + return this; + } + public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalForeignMessage = true; + result.optionalForeignMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalForeignMessage && + result.optionalForeignMessage_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance) { + result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.CreateBuilder(result.optionalForeignMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalForeignMessage_ = value; + } + result.hasOptionalForeignMessage = true; + return this; + } + public Builder ClearOptionalForeignMessage() { + PrepareBuilder(); + result.hasOptionalForeignMessage = false; + result.optionalForeignMessage_ = null; + return this; + } + + public bool HasOptionalImportMessage { + get { return result.hasOptionalImportMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessageLite OptionalImportMessage { + get { return result.OptionalImportMessage; } + set { SetOptionalImportMessage(value); } + } + public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalImportMessage = true; + result.optionalImportMessage_ = value; + return this; + } + public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalImportMessage = true; + result.optionalImportMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalImportMessage && + result.optionalImportMessage_ != global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.DefaultInstance) { + result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.CreateBuilder(result.optionalImportMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalImportMessage_ = value; + } + result.hasOptionalImportMessage = true; + return this; + } + public Builder ClearOptionalImportMessage() { + PrepareBuilder(); + result.hasOptionalImportMessage = false; + result.optionalImportMessage_ = null; + return this; + } + + public bool HasOptionalNestedEnum { + get { return result.hasOptionalNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum OptionalNestedEnum { + get { return result.OptionalNestedEnum; } + set { SetOptionalNestedEnum(value); } + } + public Builder SetOptionalNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) { + PrepareBuilder(); + result.hasOptionalNestedEnum = true; + result.optionalNestedEnum_ = value; + return this; + } + public Builder ClearOptionalNestedEnum() { + PrepareBuilder(); + result.hasOptionalNestedEnum = false; + result.optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.FOO; + return this; + } + + public bool HasOptionalForeignEnum { + get { return result.hasOptionalForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite OptionalForeignEnum { + get { return result.OptionalForeignEnum; } + set { SetOptionalForeignEnum(value); } + } + public Builder SetOptionalForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); + result.hasOptionalForeignEnum = true; + result.optionalForeignEnum_ = value; + return this; + } + public Builder ClearOptionalForeignEnum() { + PrepareBuilder(); + result.hasOptionalForeignEnum = false; + result.optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_FOO; + return this; + } + + public bool HasOptionalImportEnum { + get { return result.hasOptionalImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnumLite OptionalImportEnum { + get { return result.OptionalImportEnum; } + set { SetOptionalImportEnum(value); } + } + public Builder SetOptionalImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) { + PrepareBuilder(); + result.hasOptionalImportEnum = true; + result.optionalImportEnum_ = value; + return this; + } + public Builder ClearOptionalImportEnum() { + PrepareBuilder(); + result.hasOptionalImportEnum = false; + result.optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_FOO; + return this; + } + + public bool HasOptionalStringPiece { + get { return result.hasOptionalStringPiece; } + } + public string OptionalStringPiece { + get { return result.OptionalStringPiece; } + set { SetOptionalStringPiece(value); } + } + public Builder SetOptionalStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalStringPiece = true; + result.optionalStringPiece_ = value; + return this; + } + public Builder ClearOptionalStringPiece() { + PrepareBuilder(); + result.hasOptionalStringPiece = false; + result.optionalStringPiece_ = ""; + return this; + } + + public bool HasOptionalCord { + get { return result.hasOptionalCord; } + } + public string OptionalCord { + get { return result.OptionalCord; } + set { SetOptionalCord(value); } + } + public Builder SetOptionalCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalCord = true; + result.optionalCord_ = value; + return this; + } + public Builder ClearOptionalCord() { + PrepareBuilder(); + result.hasOptionalCord = false; + result.optionalCord_ = ""; + return this; + } + + public pbc::IPopsicleList RepeatedInt32List { + get { return PrepareBuilder().repeatedInt32_; } + } + public int RepeatedInt32Count { + get { return result.RepeatedInt32Count; } + } + public int GetRepeatedInt32(int index) { + return result.GetRepeatedInt32(index); + } + public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.repeatedInt32_[index] = value; + return this; + } + public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); + result.repeatedInt32_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt32_.Add(values); + return this; + } + public Builder ClearRepeatedInt32() { + PrepareBuilder(); + result.repeatedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt64List { + get { return PrepareBuilder().repeatedInt64_; } + } + public int RepeatedInt64Count { + get { return result.RepeatedInt64Count; } + } + public long GetRepeatedInt64(int index) { + return result.GetRepeatedInt64(index); + } + public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); + result.repeatedInt64_[index] = value; + return this; + } + public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); + result.repeatedInt64_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt64_.Add(values); + return this; + } + public Builder ClearRepeatedInt64() { + PrepareBuilder(); + result.repeatedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint32List { + get { return PrepareBuilder().repeatedUint32_; } + } + public int RepeatedUint32Count { + get { return result.RepeatedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedUint32(int index) { + return result.GetRepeatedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint32(int index, uint value) { + PrepareBuilder(); + result.repeatedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint32(uint value) { + PrepareBuilder(); + result.repeatedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint32_.Add(values); + return this; + } + public Builder ClearRepeatedUint32() { + PrepareBuilder(); + result.repeatedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint64List { + get { return PrepareBuilder().repeatedUint64_; } + } + public int RepeatedUint64Count { + get { return result.RepeatedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return result.GetRepeatedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); + result.repeatedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); + result.repeatedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint64_.Add(values); + return this; + } + public Builder ClearRepeatedUint64() { + PrepareBuilder(); + result.repeatedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSint32List { + get { return PrepareBuilder().repeatedSint32_; } + } + public int RepeatedSint32Count { + get { return result.RepeatedSint32Count; } + } + public int GetRepeatedSint32(int index) { + return result.GetRepeatedSint32(index); + } + public Builder SetRepeatedSint32(int index, int value) { + PrepareBuilder(); + result.repeatedSint32_[index] = value; + return this; + } + public Builder AddRepeatedSint32(int value) { + PrepareBuilder(); + result.repeatedSint32_.Add(value); + return this; + } + public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSint32_.Add(values); + return this; + } + public Builder ClearRepeatedSint32() { + PrepareBuilder(); + result.repeatedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSint64List { + get { return PrepareBuilder().repeatedSint64_; } + } + public int RepeatedSint64Count { + get { return result.RepeatedSint64Count; } + } + public long GetRepeatedSint64(int index) { + return result.GetRepeatedSint64(index); + } + public Builder SetRepeatedSint64(int index, long value) { + PrepareBuilder(); + result.repeatedSint64_[index] = value; + return this; + } + public Builder AddRepeatedSint64(long value) { + PrepareBuilder(); + result.repeatedSint64_.Add(value); + return this; + } + public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSint64_.Add(values); + return this; + } + public Builder ClearRepeatedSint64() { + PrepareBuilder(); + result.repeatedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed32List { + get { return PrepareBuilder().repeatedFixed32_; } + } + public int RepeatedFixed32Count { + get { return result.RepeatedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return result.GetRepeatedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); + result.repeatedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); + result.repeatedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed32_.Add(values); + return this; + } + public Builder ClearRepeatedFixed32() { + PrepareBuilder(); + result.repeatedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed64List { + get { return PrepareBuilder().repeatedFixed64_; } + } + public int RepeatedFixed64Count { + get { return result.RepeatedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return result.GetRepeatedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); + result.repeatedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); + result.repeatedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed64_.Add(values); + return this; + } + public Builder ClearRepeatedFixed64() { + PrepareBuilder(); + result.repeatedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSfixed32List { + get { return PrepareBuilder().repeatedSfixed32_; } + } + public int RepeatedSfixed32Count { + get { return result.RepeatedSfixed32Count; } + } + public int GetRepeatedSfixed32(int index) { + return result.GetRepeatedSfixed32(index); + } + public Builder SetRepeatedSfixed32(int index, int value) { + PrepareBuilder(); + result.repeatedSfixed32_[index] = value; + return this; + } + public Builder AddRepeatedSfixed32(int value) { + PrepareBuilder(); + result.repeatedSfixed32_.Add(value); + return this; + } + public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSfixed32_.Add(values); + return this; + } + public Builder ClearRepeatedSfixed32() { + PrepareBuilder(); + result.repeatedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSfixed64List { + get { return PrepareBuilder().repeatedSfixed64_; } + } + public int RepeatedSfixed64Count { + get { return result.RepeatedSfixed64Count; } + } + public long GetRepeatedSfixed64(int index) { + return result.GetRepeatedSfixed64(index); + } + public Builder SetRepeatedSfixed64(int index, long value) { + PrepareBuilder(); + result.repeatedSfixed64_[index] = value; + return this; + } + public Builder AddRepeatedSfixed64(long value) { + PrepareBuilder(); + result.repeatedSfixed64_.Add(value); + return this; + } + public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSfixed64_.Add(values); + return this; + } + public Builder ClearRepeatedSfixed64() { + PrepareBuilder(); + result.repeatedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedFloatList { + get { return PrepareBuilder().repeatedFloat_; } + } + public int RepeatedFloatCount { + get { return result.RepeatedFloatCount; } + } + public float GetRepeatedFloat(int index) { + return result.GetRepeatedFloat(index); + } + public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); + result.repeatedFloat_[index] = value; + return this; + } + public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); + result.repeatedFloat_.Add(value); + return this; + } + public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFloat_.Add(values); + return this; + } + public Builder ClearRepeatedFloat() { + PrepareBuilder(); + result.repeatedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedDoubleList { + get { return PrepareBuilder().repeatedDouble_; } + } + public int RepeatedDoubleCount { + get { return result.RepeatedDoubleCount; } + } + public double GetRepeatedDouble(int index) { + return result.GetRepeatedDouble(index); + } + public Builder SetRepeatedDouble(int index, double value) { + PrepareBuilder(); + result.repeatedDouble_[index] = value; + return this; + } + public Builder AddRepeatedDouble(double value) { + PrepareBuilder(); + result.repeatedDouble_.Add(value); + return this; + } + public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedDouble_.Add(values); + return this; + } + public Builder ClearRepeatedDouble() { + PrepareBuilder(); + result.repeatedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedBoolList { + get { return PrepareBuilder().repeatedBool_; } + } + public int RepeatedBoolCount { + get { return result.RepeatedBoolCount; } + } + public bool GetRepeatedBool(int index) { + return result.GetRepeatedBool(index); + } + public Builder SetRepeatedBool(int index, bool value) { + PrepareBuilder(); + result.repeatedBool_[index] = value; + return this; + } + public Builder AddRepeatedBool(bool value) { + PrepareBuilder(); + result.repeatedBool_.Add(value); + return this; + } + public Builder AddRangeRepeatedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedBool_.Add(values); + return this; + } + public Builder ClearRepeatedBool() { + PrepareBuilder(); + result.repeatedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringList { + get { return PrepareBuilder().repeatedString_; } + } + public int RepeatedStringCount { + get { return result.RepeatedStringCount; } + } + public string GetRepeatedString(int index) { + return result.GetRepeatedString(index); + } + public Builder SetRepeatedString(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedString_[index] = value; + return this; + } + public Builder AddRepeatedString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedString_.Add(value); + return this; + } + public Builder AddRangeRepeatedString(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedString_.Add(values); + return this; + } + public Builder ClearRepeatedString() { + PrepareBuilder(); + result.repeatedString_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedBytesList { + get { return PrepareBuilder().repeatedBytes_; } + } + public int RepeatedBytesCount { + get { return result.RepeatedBytesCount; } + } + public pb::ByteString GetRepeatedBytes(int index) { + return result.GetRepeatedBytes(index); + } + public Builder SetRepeatedBytes(int index, pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedBytes_[index] = value; + return this; + } + public Builder AddRepeatedBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedBytes_.Add(value); + return this; + } + public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedBytes_.Add(values); + return this; + } + public Builder ClearRepeatedBytes() { + PrepareBuilder(); + result.repeatedBytes_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedGroupList { + get { return PrepareBuilder().repeatedGroup_; } + } + public int RepeatedGroupCount { + get { return result.RepeatedGroupCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup GetRepeatedGroup(int index) { + return result.GetRepeatedGroup(index); + } + public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedGroup_[index] = value; + return this; + } + public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedGroup_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedGroup_.Add(value); + return this; + } + public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.RepeatedGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedGroup_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedGroup_.Add(values); + return this; + } + public Builder ClearRepeatedGroup() { + PrepareBuilder(); + result.repeatedGroup_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedNestedMessageList { + get { return PrepareBuilder().repeatedNestedMessage_; } + } + public int RepeatedNestedMessageCount { + get { return result.RepeatedNestedMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage GetRepeatedNestedMessage(int index) { + return result.GetRepeatedNestedMessage(index); + } + public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedNestedMessage_[index] = value; + return this; + } + public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedNestedMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedNestedMessage_.Add(value); + return this; + } + public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedNestedMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedNestedMessage_.Add(values); + return this; + } + public Builder ClearRepeatedNestedMessage() { + PrepareBuilder(); + result.repeatedNestedMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedForeignMessageList { + get { return PrepareBuilder().repeatedForeignMessage_; } + } + public int RepeatedForeignMessageCount { + get { return result.RepeatedForeignMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite GetRepeatedForeignMessage(int index) { + return result.GetRepeatedForeignMessage(index); + } + public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedForeignMessage_[index] = value; + return this; + } + public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedForeignMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedForeignMessage_.Add(value); + return this; + } + public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedForeignMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedForeignMessage_.Add(values); + return this; + } + public Builder ClearRepeatedForeignMessage() { + PrepareBuilder(); + result.repeatedForeignMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedImportMessageList { + get { return PrepareBuilder().repeatedImportMessage_; } + } + public int RepeatedImportMessageCount { + get { return result.RepeatedImportMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessageLite GetRepeatedImportMessage(int index) { + return result.GetRepeatedImportMessage(index); + } + public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedImportMessage_[index] = value; + return this; + } + public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedImportMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedImportMessage_.Add(value); + return this; + } + public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessageLite.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedImportMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedImportMessage_.Add(values); + return this; + } + public Builder ClearRepeatedImportMessage() { + PrepareBuilder(); + result.repeatedImportMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedNestedEnumList { + get { return PrepareBuilder().repeatedNestedEnum_; } + } + public int RepeatedNestedEnumCount { + get { return result.RepeatedNestedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum GetRepeatedNestedEnum(int index) { + return result.GetRepeatedNestedEnum(index); + } + public Builder SetRepeatedNestedEnum(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) { + PrepareBuilder(); + result.repeatedNestedEnum_[index] = value; + return this; + } + public Builder AddRepeatedNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) { + PrepareBuilder(); + result.repeatedNestedEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedNestedEnum_.Add(values); + return this; + } + public Builder ClearRepeatedNestedEnum() { + PrepareBuilder(); + result.repeatedNestedEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedForeignEnumList { + get { return PrepareBuilder().repeatedForeignEnum_; } + } + public int RepeatedForeignEnumCount { + get { return result.RepeatedForeignEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite GetRepeatedForeignEnum(int index) { + return result.GetRepeatedForeignEnum(index); + } + public Builder SetRepeatedForeignEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); + result.repeatedForeignEnum_[index] = value; + return this; + } + public Builder AddRepeatedForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); + result.repeatedForeignEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedForeignEnum_.Add(values); + return this; + } + public Builder ClearRepeatedForeignEnum() { + PrepareBuilder(); + result.repeatedForeignEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedImportEnumList { + get { return PrepareBuilder().repeatedImportEnum_; } + } + public int RepeatedImportEnumCount { + get { return result.RepeatedImportEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnumLite GetRepeatedImportEnum(int index) { + return result.GetRepeatedImportEnum(index); + } + public Builder SetRepeatedImportEnum(int index, global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) { + PrepareBuilder(); + result.repeatedImportEnum_[index] = value; + return this; + } + public Builder AddRepeatedImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) { + PrepareBuilder(); + result.repeatedImportEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedImportEnum_.Add(values); + return this; + } + public Builder ClearRepeatedImportEnum() { + PrepareBuilder(); + result.repeatedImportEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringPieceList { + get { return PrepareBuilder().repeatedStringPiece_; } + } + public int RepeatedStringPieceCount { + get { return result.RepeatedStringPieceCount; } + } + public string GetRepeatedStringPiece(int index) { + return result.GetRepeatedStringPiece(index); + } + public Builder SetRepeatedStringPiece(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPiece_[index] = value; + return this; + } + public Builder AddRepeatedStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPiece_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringPiece_.Add(values); + return this; + } + public Builder ClearRepeatedStringPiece() { + PrepareBuilder(); + result.repeatedStringPiece_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedCordList { + get { return PrepareBuilder().repeatedCord_; } + } + public int RepeatedCordCount { + get { return result.RepeatedCordCount; } + } + public string GetRepeatedCord(int index) { + return result.GetRepeatedCord(index); + } + public Builder SetRepeatedCord(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCord_[index] = value; + return this; + } + public Builder AddRepeatedCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCord_.Add(value); + return this; + } + public Builder AddRangeRepeatedCord(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedCord_.Add(values); + return this; + } + public Builder ClearRepeatedCord() { + PrepareBuilder(); + result.repeatedCord_.Clear(); + return this; + } + + public bool HasDefaultInt32 { + get { return result.hasDefaultInt32; } + } + public int DefaultInt32 { + get { return result.DefaultInt32; } + set { SetDefaultInt32(value); } + } + public Builder SetDefaultInt32(int value) { + PrepareBuilder(); + result.hasDefaultInt32 = true; + result.defaultInt32_ = value; + return this; + } + public Builder ClearDefaultInt32() { + PrepareBuilder(); + result.hasDefaultInt32 = false; + result.defaultInt32_ = 41; + return this; + } + + public bool HasDefaultInt64 { + get { return result.hasDefaultInt64; } + } + public long DefaultInt64 { + get { return result.DefaultInt64; } + set { SetDefaultInt64(value); } + } + public Builder SetDefaultInt64(long value) { + PrepareBuilder(); + result.hasDefaultInt64 = true; + result.defaultInt64_ = value; + return this; + } + public Builder ClearDefaultInt64() { + PrepareBuilder(); + result.hasDefaultInt64 = false; + result.defaultInt64_ = 42L; + return this; + } + + public bool HasDefaultUint32 { + get { return result.hasDefaultUint32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultUint32 { + get { return result.DefaultUint32; } + set { SetDefaultUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultUint32(uint value) { + PrepareBuilder(); + result.hasDefaultUint32 = true; + result.defaultUint32_ = value; + return this; + } + public Builder ClearDefaultUint32() { + PrepareBuilder(); + result.hasDefaultUint32 = false; + result.defaultUint32_ = 43; + return this; + } + + public bool HasDefaultUint64 { + get { return result.hasDefaultUint64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultUint64 { + get { return result.DefaultUint64; } + set { SetDefaultUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultUint64(ulong value) { + PrepareBuilder(); + result.hasDefaultUint64 = true; + result.defaultUint64_ = value; + return this; + } + public Builder ClearDefaultUint64() { + PrepareBuilder(); + result.hasDefaultUint64 = false; + result.defaultUint64_ = 44UL; + return this; + } + + public bool HasDefaultSint32 { + get { return result.hasDefaultSint32; } + } + public int DefaultSint32 { + get { return result.DefaultSint32; } + set { SetDefaultSint32(value); } + } + public Builder SetDefaultSint32(int value) { + PrepareBuilder(); + result.hasDefaultSint32 = true; + result.defaultSint32_ = value; + return this; + } + public Builder ClearDefaultSint32() { + PrepareBuilder(); + result.hasDefaultSint32 = false; + result.defaultSint32_ = -45; + return this; + } + + public bool HasDefaultSint64 { + get { return result.hasDefaultSint64; } + } + public long DefaultSint64 { + get { return result.DefaultSint64; } + set { SetDefaultSint64(value); } + } + public Builder SetDefaultSint64(long value) { + PrepareBuilder(); + result.hasDefaultSint64 = true; + result.defaultSint64_ = value; + return this; + } + public Builder ClearDefaultSint64() { + PrepareBuilder(); + result.hasDefaultSint64 = false; + result.defaultSint64_ = 46; + return this; + } + + public bool HasDefaultFixed32 { + get { return result.hasDefaultFixed32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultFixed32 { + get { return result.DefaultFixed32; } + set { SetDefaultFixed32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultFixed32(uint value) { + PrepareBuilder(); + result.hasDefaultFixed32 = true; + result.defaultFixed32_ = value; + return this; + } + public Builder ClearDefaultFixed32() { + PrepareBuilder(); + result.hasDefaultFixed32 = false; + result.defaultFixed32_ = 47; + return this; + } + + public bool HasDefaultFixed64 { + get { return result.hasDefaultFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultFixed64 { + get { return result.DefaultFixed64; } + set { SetDefaultFixed64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultFixed64(ulong value) { + PrepareBuilder(); + result.hasDefaultFixed64 = true; + result.defaultFixed64_ = value; + return this; + } + public Builder ClearDefaultFixed64() { + PrepareBuilder(); + result.hasDefaultFixed64 = false; + result.defaultFixed64_ = 48; + return this; + } + + public bool HasDefaultSfixed32 { + get { return result.hasDefaultSfixed32; } + } + public int DefaultSfixed32 { + get { return result.DefaultSfixed32; } + set { SetDefaultSfixed32(value); } + } + public Builder SetDefaultSfixed32(int value) { + PrepareBuilder(); + result.hasDefaultSfixed32 = true; + result.defaultSfixed32_ = value; + return this; + } + public Builder ClearDefaultSfixed32() { + PrepareBuilder(); + result.hasDefaultSfixed32 = false; + result.defaultSfixed32_ = 49; + return this; + } + + public bool HasDefaultSfixed64 { + get { return result.hasDefaultSfixed64; } + } + public long DefaultSfixed64 { + get { return result.DefaultSfixed64; } + set { SetDefaultSfixed64(value); } + } + public Builder SetDefaultSfixed64(long value) { + PrepareBuilder(); + result.hasDefaultSfixed64 = true; + result.defaultSfixed64_ = value; + return this; + } + public Builder ClearDefaultSfixed64() { + PrepareBuilder(); + result.hasDefaultSfixed64 = false; + result.defaultSfixed64_ = -50; + return this; + } + + public bool HasDefaultFloat { + get { return result.hasDefaultFloat; } + } + public float DefaultFloat { + get { return result.DefaultFloat; } + set { SetDefaultFloat(value); } + } + public Builder SetDefaultFloat(float value) { + PrepareBuilder(); + result.hasDefaultFloat = true; + result.defaultFloat_ = value; + return this; + } + public Builder ClearDefaultFloat() { + PrepareBuilder(); + result.hasDefaultFloat = false; + result.defaultFloat_ = 51.5F; + return this; + } + + public bool HasDefaultDouble { + get { return result.hasDefaultDouble; } + } + public double DefaultDouble { + get { return result.DefaultDouble; } + set { SetDefaultDouble(value); } + } + public Builder SetDefaultDouble(double value) { + PrepareBuilder(); + result.hasDefaultDouble = true; + result.defaultDouble_ = value; + return this; + } + public Builder ClearDefaultDouble() { + PrepareBuilder(); + result.hasDefaultDouble = false; + result.defaultDouble_ = 52000D; + return this; + } + + public bool HasDefaultBool { + get { return result.hasDefaultBool; } + } + public bool DefaultBool { + get { return result.DefaultBool; } + set { SetDefaultBool(value); } + } + public Builder SetDefaultBool(bool value) { + PrepareBuilder(); + result.hasDefaultBool = true; + result.defaultBool_ = value; + return this; + } + public Builder ClearDefaultBool() { + PrepareBuilder(); + result.hasDefaultBool = false; + result.defaultBool_ = true; + return this; + } + + public bool HasDefaultString { + get { return result.hasDefaultString; } + } + public string DefaultString { + get { return result.DefaultString; } + set { SetDefaultString(value); } + } + public Builder SetDefaultString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultString = true; + result.defaultString_ = value; + return this; + } + public Builder ClearDefaultString() { + PrepareBuilder(); + result.hasDefaultString = false; + result.defaultString_ = "hello"; + return this; + } + + public bool HasDefaultBytes { + get { return result.hasDefaultBytes; } + } + public pb::ByteString DefaultBytes { + get { return result.DefaultBytes; } + set { SetDefaultBytes(value); } + } + public Builder SetDefaultBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultBytes = true; + result.defaultBytes_ = value; + return this; + } + public Builder ClearDefaultBytes() { + PrepareBuilder(); + result.hasDefaultBytes = false; + result.defaultBytes_ = pb::ByteString.FromBase64("d29ybGQ="); + return this; + } + + public bool HasDefaultNestedEnum { + get { return result.hasDefaultNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum DefaultNestedEnum { + get { return result.DefaultNestedEnum; } + set { SetDefaultNestedEnum(value); } + } + public Builder SetDefaultNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum value) { + PrepareBuilder(); + result.hasDefaultNestedEnum = true; + result.defaultNestedEnum_ = value; + return this; + } + public Builder ClearDefaultNestedEnum() { + PrepareBuilder(); + result.hasDefaultNestedEnum = false; + result.defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypesLite.Types.NestedEnum.BAR; + return this; + } + + public bool HasDefaultForeignEnum { + get { return result.hasDefaultForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite DefaultForeignEnum { + get { return result.DefaultForeignEnum; } + set { SetDefaultForeignEnum(value); } + } + public Builder SetDefaultForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); + result.hasDefaultForeignEnum = true; + result.defaultForeignEnum_ = value; + return this; + } + public Builder ClearDefaultForeignEnum() { + PrepareBuilder(); + result.hasDefaultForeignEnum = false; + result.defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite.FOREIGN_LITE_BAR; + return this; + } + + public bool HasDefaultImportEnum { + get { return result.hasDefaultImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnumLite DefaultImportEnum { + get { return result.DefaultImportEnum; } + set { SetDefaultImportEnum(value); } + } + public Builder SetDefaultImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnumLite value) { + PrepareBuilder(); + result.hasDefaultImportEnum = true; + result.defaultImportEnum_ = value; + return this; + } + public Builder ClearDefaultImportEnum() { + PrepareBuilder(); + result.hasDefaultImportEnum = false; + result.defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnumLite.IMPORT_LITE_BAR; + return this; + } + + public bool HasDefaultStringPiece { + get { return result.hasDefaultStringPiece; } + } + public string DefaultStringPiece { + get { return result.DefaultStringPiece; } + set { SetDefaultStringPiece(value); } + } + public Builder SetDefaultStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultStringPiece = true; + result.defaultStringPiece_ = value; + return this; + } + public Builder ClearDefaultStringPiece() { + PrepareBuilder(); + result.hasDefaultStringPiece = false; + result.defaultStringPiece_ = "abc"; + return this; + } + + public bool HasDefaultCord { + get { return result.hasDefaultCord; } + } + public string DefaultCord { + get { return result.DefaultCord; } + set { SetDefaultCord(value); } + } + public Builder SetDefaultCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultCord = true; + result.defaultCord_ = value; + return this; + } + public Builder ClearDefaultCord() { + PrepareBuilder(); + result.hasDefaultCord = false; + result.defaultCord_ = "123"; + return this; + } + } + static TestAllTypesLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ForeignMessageLite : pb::GeneratedMessageLite { + private ForeignMessageLite() { } + private static readonly ForeignMessageLite defaultInstance = new ForeignMessageLite().MakeReadOnly(); + private static readonly string[] _foreignMessageLiteFieldNames = new string[] { "c" }; + private static readonly uint[] _foreignMessageLiteFieldTags = new uint[] { 8 }; + public static ForeignMessageLite DefaultInstance { + get { return defaultInstance; } + } + + public override ForeignMessageLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ForeignMessageLite ThisMessage { + get { return this; } + } + + public const int CFieldNumber = 1; + private bool hasC; + private int c_; + public bool HasC { + get { return hasC; } + } + public int C { + get { return c_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _foreignMessageLiteFieldNames; + if (hasC) { + output.WriteInt32(1, field_names[0], C); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasC) { + size += pb::CodedOutputStream.ComputeInt32Size(1, C); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasC) hash ^= c_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + ForeignMessageLite other = obj as ForeignMessageLite; + if (other == null) return false; + if (hasC != other.hasC || (hasC && !c_.Equals(other.c_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("c", hasC, c_, writer); + } + #endregion + + public static ForeignMessageLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ForeignMessageLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ForeignMessageLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ForeignMessageLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ForeignMessageLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ForeignMessageLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ForeignMessageLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ForeignMessageLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ForeignMessageLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ForeignMessageLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ForeignMessageLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ForeignMessageLite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ForeignMessageLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ForeignMessageLite result; + + private ForeignMessageLite PrepareBuilder() { + if (resultIsReadOnly) { + ForeignMessageLite original = result; + result = new ForeignMessageLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ForeignMessageLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override ForeignMessageLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance; } + } + + public override ForeignMessageLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is ForeignMessageLite) { + return MergeFrom((ForeignMessageLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ForeignMessageLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ForeignMessageLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasC) { + C = other.C; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_foreignMessageLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _foreignMessageLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasC = input.ReadInt32(ref result.c_); + break; + } + } + } + + return this; + } + + + public bool HasC { + get { return result.hasC; } + } + public int C { + get { return result.C; } + set { SetC(value); } + } + public Builder SetC(int value) { + PrepareBuilder(); + result.hasC = true; + result.c_ = value; + return this; + } + public Builder ClearC() { + PrepareBuilder(); + result.hasC = false; + result.c_ = 0; + return this; + } + } + static ForeignMessageLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestPackedTypesLite : pb::GeneratedMessageLite { + private TestPackedTypesLite() { } + private static readonly TestPackedTypesLite defaultInstance = new TestPackedTypesLite().MakeReadOnly(); + private static readonly string[] _testPackedTypesLiteFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; + private static readonly uint[] _testPackedTypesLiteFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; + public static TestPackedTypesLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestPackedTypesLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestPackedTypesLite ThisMessage { + get { return this; } + } + + public const int PackedInt32FieldNumber = 90; + private int packedInt32MemoizedSerializedSize; + private pbc::PopsicleList packedInt32_ = new pbc::PopsicleList(); + public scg::IList PackedInt32List { + get { return pbc::Lists.AsReadOnly(packedInt32_); } + } + public int PackedInt32Count { + get { return packedInt32_.Count; } + } + public int GetPackedInt32(int index) { + return packedInt32_[index]; + } + + public const int PackedInt64FieldNumber = 91; + private int packedInt64MemoizedSerializedSize; + private pbc::PopsicleList packedInt64_ = new pbc::PopsicleList(); + public scg::IList PackedInt64List { + get { return pbc::Lists.AsReadOnly(packedInt64_); } + } + public int PackedInt64Count { + get { return packedInt64_.Count; } + } + public long GetPackedInt64(int index) { + return packedInt64_[index]; + } + + public const int PackedUint32FieldNumber = 92; + private int packedUint32MemoizedSerializedSize; + private pbc::PopsicleList packedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedUint32List { + get { return pbc::Lists.AsReadOnly(packedUint32_); } + } + public int PackedUint32Count { + get { return packedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedUint32(int index) { + return packedUint32_[index]; + } + + public const int PackedUint64FieldNumber = 93; + private int packedUint64MemoizedSerializedSize; + private pbc::PopsicleList packedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedUint64List { + get { return pbc::Lists.AsReadOnly(packedUint64_); } + } + public int PackedUint64Count { + get { return packedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedUint64(int index) { + return packedUint64_[index]; + } + + public const int PackedSint32FieldNumber = 94; + private int packedSint32MemoizedSerializedSize; + private pbc::PopsicleList packedSint32_ = new pbc::PopsicleList(); + public scg::IList PackedSint32List { + get { return pbc::Lists.AsReadOnly(packedSint32_); } + } + public int PackedSint32Count { + get { return packedSint32_.Count; } + } + public int GetPackedSint32(int index) { + return packedSint32_[index]; + } + + public const int PackedSint64FieldNumber = 95; + private int packedSint64MemoizedSerializedSize; + private pbc::PopsicleList packedSint64_ = new pbc::PopsicleList(); + public scg::IList PackedSint64List { + get { return pbc::Lists.AsReadOnly(packedSint64_); } + } + public int PackedSint64Count { + get { return packedSint64_.Count; } + } + public long GetPackedSint64(int index) { + return packedSint64_[index]; + } + + public const int PackedFixed32FieldNumber = 96; + private int packedFixed32MemoizedSerializedSize; + private pbc::PopsicleList packedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedFixed32List { + get { return pbc::Lists.AsReadOnly(packedFixed32_); } + } + public int PackedFixed32Count { + get { return packedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedFixed32(int index) { + return packedFixed32_[index]; + } + + public const int PackedFixed64FieldNumber = 97; + private int packedFixed64MemoizedSerializedSize; + private pbc::PopsicleList packedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedFixed64List { + get { return pbc::Lists.AsReadOnly(packedFixed64_); } + } + public int PackedFixed64Count { + get { return packedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedFixed64(int index) { + return packedFixed64_[index]; + } + + public const int PackedSfixed32FieldNumber = 98; + private int packedSfixed32MemoizedSerializedSize; + private pbc::PopsicleList packedSfixed32_ = new pbc::PopsicleList(); + public scg::IList PackedSfixed32List { + get { return pbc::Lists.AsReadOnly(packedSfixed32_); } + } + public int PackedSfixed32Count { + get { return packedSfixed32_.Count; } + } + public int GetPackedSfixed32(int index) { + return packedSfixed32_[index]; + } + + public const int PackedSfixed64FieldNumber = 99; + private int packedSfixed64MemoizedSerializedSize; + private pbc::PopsicleList packedSfixed64_ = new pbc::PopsicleList(); + public scg::IList PackedSfixed64List { + get { return pbc::Lists.AsReadOnly(packedSfixed64_); } + } + public int PackedSfixed64Count { + get { return packedSfixed64_.Count; } + } + public long GetPackedSfixed64(int index) { + return packedSfixed64_[index]; + } + + public const int PackedFloatFieldNumber = 100; + private int packedFloatMemoizedSerializedSize; + private pbc::PopsicleList packedFloat_ = new pbc::PopsicleList(); + public scg::IList PackedFloatList { + get { return pbc::Lists.AsReadOnly(packedFloat_); } + } + public int PackedFloatCount { + get { return packedFloat_.Count; } + } + public float GetPackedFloat(int index) { + return packedFloat_[index]; + } + + public const int PackedDoubleFieldNumber = 101; + private int packedDoubleMemoizedSerializedSize; + private pbc::PopsicleList packedDouble_ = new pbc::PopsicleList(); + public scg::IList PackedDoubleList { + get { return pbc::Lists.AsReadOnly(packedDouble_); } + } + public int PackedDoubleCount { + get { return packedDouble_.Count; } + } + public double GetPackedDouble(int index) { + return packedDouble_[index]; + } + + public const int PackedBoolFieldNumber = 102; + private int packedBoolMemoizedSerializedSize; + private pbc::PopsicleList packedBool_ = new pbc::PopsicleList(); + public scg::IList PackedBoolList { + get { return pbc::Lists.AsReadOnly(packedBool_); } + } + public int PackedBoolCount { + get { return packedBool_.Count; } + } + public bool GetPackedBool(int index) { + return packedBool_[index]; + } + + public const int PackedEnumFieldNumber = 103; + private int packedEnumMemoizedSerializedSize; + private pbc::PopsicleList packedEnum_ = new pbc::PopsicleList(); + public scg::IList PackedEnumList { + get { return pbc::Lists.AsReadOnly(packedEnum_); } + } + public int PackedEnumCount { + get { return packedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite GetPackedEnum(int index) { + return packedEnum_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testPackedTypesLiteFieldNames; + if (packedInt32_.Count > 0) { + output.WritePackedInt32Array(90, field_names[6], packedInt32MemoizedSerializedSize, packedInt32_); + } + if (packedInt64_.Count > 0) { + output.WritePackedInt64Array(91, field_names[7], packedInt64MemoizedSerializedSize, packedInt64_); + } + if (packedUint32_.Count > 0) { + output.WritePackedUInt32Array(92, field_names[12], packedUint32MemoizedSerializedSize, packedUint32_); + } + if (packedUint64_.Count > 0) { + output.WritePackedUInt64Array(93, field_names[13], packedUint64MemoizedSerializedSize, packedUint64_); + } + if (packedSint32_.Count > 0) { + output.WritePackedSInt32Array(94, field_names[10], packedSint32MemoizedSerializedSize, packedSint32_); + } + if (packedSint64_.Count > 0) { + output.WritePackedSInt64Array(95, field_names[11], packedSint64MemoizedSerializedSize, packedSint64_); + } + if (packedFixed32_.Count > 0) { + output.WritePackedFixed32Array(96, field_names[3], packedFixed32MemoizedSerializedSize, packedFixed32_); + } + if (packedFixed64_.Count > 0) { + output.WritePackedFixed64Array(97, field_names[4], packedFixed64MemoizedSerializedSize, packedFixed64_); + } + if (packedSfixed32_.Count > 0) { + output.WritePackedSFixed32Array(98, field_names[8], packedSfixed32MemoizedSerializedSize, packedSfixed32_); + } + if (packedSfixed64_.Count > 0) { + output.WritePackedSFixed64Array(99, field_names[9], packedSfixed64MemoizedSerializedSize, packedSfixed64_); + } + if (packedFloat_.Count > 0) { + output.WritePackedFloatArray(100, field_names[5], packedFloatMemoizedSerializedSize, packedFloat_); + } + if (packedDouble_.Count > 0) { + output.WritePackedDoubleArray(101, field_names[1], packedDoubleMemoizedSerializedSize, packedDouble_); + } + if (packedBool_.Count > 0) { + output.WritePackedBoolArray(102, field_names[0], packedBoolMemoizedSerializedSize, packedBool_); + } + if (packedEnum_.Count > 0) { + output.WritePackedEnumArray(103, field_names[2], packedEnumMemoizedSerializedSize, packedEnum_); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in PackedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + if (packedInt32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedInt32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (long element in PackedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + if (packedInt64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedInt64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (uint element in PackedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + if (packedUint32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedUint32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (ulong element in PackedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + if (packedUint64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedUint64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (int element in PackedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + if (packedSint32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSint32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (long element in PackedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + if (packedSint64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSint64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedFixed32_.Count; + size += dataSize; + if (packedFixed32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFixed32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedFixed64_.Count; + size += dataSize; + if (packedFixed64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFixed64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedSfixed32_.Count; + size += dataSize; + if (packedSfixed32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSfixed32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedSfixed64_.Count; + size += dataSize; + if (packedSfixed64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSfixed64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedFloat_.Count; + size += dataSize; + if (packedFloat_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFloatMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedDouble_.Count; + size += dataSize; + if (packedDouble_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedDoubleMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 1 * packedBool_.Count; + size += dataSize; + if (packedBool_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedBoolMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + if (packedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite element in packedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + packedEnumMemoizedSerializedSize = dataSize; + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + foreach(int i in packedInt32_) + hash ^= i.GetHashCode(); + foreach(long i in packedInt64_) + hash ^= i.GetHashCode(); + foreach(uint i in packedUint32_) + hash ^= i.GetHashCode(); + foreach(ulong i in packedUint64_) + hash ^= i.GetHashCode(); + foreach(int i in packedSint32_) + hash ^= i.GetHashCode(); + foreach(long i in packedSint64_) + hash ^= i.GetHashCode(); + foreach(uint i in packedFixed32_) + hash ^= i.GetHashCode(); + foreach(ulong i in packedFixed64_) + hash ^= i.GetHashCode(); + foreach(int i in packedSfixed32_) + hash ^= i.GetHashCode(); + foreach(long i in packedSfixed64_) + hash ^= i.GetHashCode(); + foreach(float i in packedFloat_) + hash ^= i.GetHashCode(); + foreach(double i in packedDouble_) + hash ^= i.GetHashCode(); + foreach(bool i in packedBool_) + hash ^= i.GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite i in packedEnum_) + hash ^= i.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestPackedTypesLite other = obj as TestPackedTypesLite; + if (other == null) return false; + if(packedInt32_.Count != other.packedInt32_.Count) return false; + for(int ix=0; ix < packedInt32_.Count; ix++) + if(!packedInt32_[ix].Equals(other.packedInt32_[ix])) return false; + if(packedInt64_.Count != other.packedInt64_.Count) return false; + for(int ix=0; ix < packedInt64_.Count; ix++) + if(!packedInt64_[ix].Equals(other.packedInt64_[ix])) return false; + if(packedUint32_.Count != other.packedUint32_.Count) return false; + for(int ix=0; ix < packedUint32_.Count; ix++) + if(!packedUint32_[ix].Equals(other.packedUint32_[ix])) return false; + if(packedUint64_.Count != other.packedUint64_.Count) return false; + for(int ix=0; ix < packedUint64_.Count; ix++) + if(!packedUint64_[ix].Equals(other.packedUint64_[ix])) return false; + if(packedSint32_.Count != other.packedSint32_.Count) return false; + for(int ix=0; ix < packedSint32_.Count; ix++) + if(!packedSint32_[ix].Equals(other.packedSint32_[ix])) return false; + if(packedSint64_.Count != other.packedSint64_.Count) return false; + for(int ix=0; ix < packedSint64_.Count; ix++) + if(!packedSint64_[ix].Equals(other.packedSint64_[ix])) return false; + if(packedFixed32_.Count != other.packedFixed32_.Count) return false; + for(int ix=0; ix < packedFixed32_.Count; ix++) + if(!packedFixed32_[ix].Equals(other.packedFixed32_[ix])) return false; + if(packedFixed64_.Count != other.packedFixed64_.Count) return false; + for(int ix=0; ix < packedFixed64_.Count; ix++) + if(!packedFixed64_[ix].Equals(other.packedFixed64_[ix])) return false; + if(packedSfixed32_.Count != other.packedSfixed32_.Count) return false; + for(int ix=0; ix < packedSfixed32_.Count; ix++) + if(!packedSfixed32_[ix].Equals(other.packedSfixed32_[ix])) return false; + if(packedSfixed64_.Count != other.packedSfixed64_.Count) return false; + for(int ix=0; ix < packedSfixed64_.Count; ix++) + if(!packedSfixed64_[ix].Equals(other.packedSfixed64_[ix])) return false; + if(packedFloat_.Count != other.packedFloat_.Count) return false; + for(int ix=0; ix < packedFloat_.Count; ix++) + if(!packedFloat_[ix].Equals(other.packedFloat_[ix])) return false; + if(packedDouble_.Count != other.packedDouble_.Count) return false; + for(int ix=0; ix < packedDouble_.Count; ix++) + if(!packedDouble_[ix].Equals(other.packedDouble_[ix])) return false; + if(packedBool_.Count != other.packedBool_.Count) return false; + for(int ix=0; ix < packedBool_.Count; ix++) + if(!packedBool_[ix].Equals(other.packedBool_[ix])) return false; + if(packedEnum_.Count != other.packedEnum_.Count) return false; + for(int ix=0; ix < packedEnum_.Count; ix++) + if(!packedEnum_[ix].Equals(other.packedEnum_[ix])) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("packed_int32", packedInt32_, writer); + PrintField("packed_int64", packedInt64_, writer); + PrintField("packed_uint32", packedUint32_, writer); + PrintField("packed_uint64", packedUint64_, writer); + PrintField("packed_sint32", packedSint32_, writer); + PrintField("packed_sint64", packedSint64_, writer); + PrintField("packed_fixed32", packedFixed32_, writer); + PrintField("packed_fixed64", packedFixed64_, writer); + PrintField("packed_sfixed32", packedSfixed32_, writer); + PrintField("packed_sfixed64", packedSfixed64_, writer); + PrintField("packed_float", packedFloat_, writer); + PrintField("packed_double", packedDouble_, writer); + PrintField("packed_bool", packedBool_, writer); + PrintField("packed_enum", packedEnum_, writer); + } + #endregion + + public static TestPackedTypesLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedTypesLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypesLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedTypesLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypesLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedTypesLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypesLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestPackedTypesLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestPackedTypesLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedTypesLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestPackedTypesLite MakeReadOnly() { + packedInt32_.MakeReadOnly(); + packedInt64_.MakeReadOnly(); + packedUint32_.MakeReadOnly(); + packedUint64_.MakeReadOnly(); + packedSint32_.MakeReadOnly(); + packedSint64_.MakeReadOnly(); + packedFixed32_.MakeReadOnly(); + packedFixed64_.MakeReadOnly(); + packedSfixed32_.MakeReadOnly(); + packedSfixed64_.MakeReadOnly(); + packedFloat_.MakeReadOnly(); + packedDouble_.MakeReadOnly(); + packedBool_.MakeReadOnly(); + packedEnum_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestPackedTypesLite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestPackedTypesLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestPackedTypesLite result; + + private TestPackedTypesLite PrepareBuilder() { + if (resultIsReadOnly) { + TestPackedTypesLite original = result; + result = new TestPackedTypesLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestPackedTypesLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestPackedTypesLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedTypesLite.DefaultInstance; } + } + + public override TestPackedTypesLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestPackedTypesLite) { + return MergeFrom((TestPackedTypesLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestPackedTypesLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypesLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.packedInt32_.Count != 0) { + result.packedInt32_.Add(other.packedInt32_); + } + if (other.packedInt64_.Count != 0) { + result.packedInt64_.Add(other.packedInt64_); + } + if (other.packedUint32_.Count != 0) { + result.packedUint32_.Add(other.packedUint32_); + } + if (other.packedUint64_.Count != 0) { + result.packedUint64_.Add(other.packedUint64_); + } + if (other.packedSint32_.Count != 0) { + result.packedSint32_.Add(other.packedSint32_); + } + if (other.packedSint64_.Count != 0) { + result.packedSint64_.Add(other.packedSint64_); + } + if (other.packedFixed32_.Count != 0) { + result.packedFixed32_.Add(other.packedFixed32_); + } + if (other.packedFixed64_.Count != 0) { + result.packedFixed64_.Add(other.packedFixed64_); + } + if (other.packedSfixed32_.Count != 0) { + result.packedSfixed32_.Add(other.packedSfixed32_); + } + if (other.packedSfixed64_.Count != 0) { + result.packedSfixed64_.Add(other.packedSfixed64_); + } + if (other.packedFloat_.Count != 0) { + result.packedFloat_.Add(other.packedFloat_); + } + if (other.packedDouble_.Count != 0) { + result.packedDouble_.Add(other.packedDouble_); + } + if (other.packedBool_.Count != 0) { + result.packedBool_.Add(other.packedBool_); + } + if (other.packedEnum_.Count != 0) { + result.packedEnum_.Add(other.packedEnum_); + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testPackedTypesLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testPackedTypesLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 722: + case 720: { + input.ReadInt32Array(tag, field_name, result.packedInt32_); + break; + } + case 730: + case 728: { + input.ReadInt64Array(tag, field_name, result.packedInt64_); + break; + } + case 738: + case 736: { + input.ReadUInt32Array(tag, field_name, result.packedUint32_); + break; + } + case 746: + case 744: { + input.ReadUInt64Array(tag, field_name, result.packedUint64_); + break; + } + case 754: + case 752: { + input.ReadSInt32Array(tag, field_name, result.packedSint32_); + break; + } + case 762: + case 760: { + input.ReadSInt64Array(tag, field_name, result.packedSint64_); + break; + } + case 770: + case 773: { + input.ReadFixed32Array(tag, field_name, result.packedFixed32_); + break; + } + case 778: + case 777: { + input.ReadFixed64Array(tag, field_name, result.packedFixed64_); + break; + } + case 786: + case 789: { + input.ReadSFixed32Array(tag, field_name, result.packedSfixed32_); + break; + } + case 794: + case 793: { + input.ReadSFixed64Array(tag, field_name, result.packedSfixed64_); + break; + } + case 802: + case 805: { + input.ReadFloatArray(tag, field_name, result.packedFloat_); + break; + } + case 810: + case 809: { + input.ReadDoubleArray(tag, field_name, result.packedDouble_); + break; + } + case 818: + case 816: { + input.ReadBoolArray(tag, field_name, result.packedBool_); + break; + } + case 826: + case 824: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.packedEnum_, out unknownItems); + break; + } + } + } + + return this; + } + + + public pbc::IPopsicleList PackedInt32List { + get { return PrepareBuilder().packedInt32_; } + } + public int PackedInt32Count { + get { return result.PackedInt32Count; } + } + public int GetPackedInt32(int index) { + return result.GetPackedInt32(index); + } + public Builder SetPackedInt32(int index, int value) { + PrepareBuilder(); + result.packedInt32_[index] = value; + return this; + } + public Builder AddPackedInt32(int value) { + PrepareBuilder(); + result.packedInt32_.Add(value); + return this; + } + public Builder AddRangePackedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedInt32_.Add(values); + return this; + } + public Builder ClearPackedInt32() { + PrepareBuilder(); + result.packedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedInt64List { + get { return PrepareBuilder().packedInt64_; } + } + public int PackedInt64Count { + get { return result.PackedInt64Count; } + } + public long GetPackedInt64(int index) { + return result.GetPackedInt64(index); + } + public Builder SetPackedInt64(int index, long value) { + PrepareBuilder(); + result.packedInt64_[index] = value; + return this; + } + public Builder AddPackedInt64(long value) { + PrepareBuilder(); + result.packedInt64_.Add(value); + return this; + } + public Builder AddRangePackedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedInt64_.Add(values); + return this; + } + public Builder ClearPackedInt64() { + PrepareBuilder(); + result.packedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedUint32List { + get { return PrepareBuilder().packedUint32_; } + } + public int PackedUint32Count { + get { return result.PackedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedUint32(int index) { + return result.GetPackedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedUint32(int index, uint value) { + PrepareBuilder(); + result.packedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedUint32(uint value) { + PrepareBuilder(); + result.packedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedUint32_.Add(values); + return this; + } + public Builder ClearPackedUint32() { + PrepareBuilder(); + result.packedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedUint64List { + get { return PrepareBuilder().packedUint64_; } + } + public int PackedUint64Count { + get { return result.PackedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedUint64(int index) { + return result.GetPackedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedUint64(int index, ulong value) { + PrepareBuilder(); + result.packedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedUint64(ulong value) { + PrepareBuilder(); + result.packedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedUint64_.Add(values); + return this; + } + public Builder ClearPackedUint64() { + PrepareBuilder(); + result.packedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSint32List { + get { return PrepareBuilder().packedSint32_; } + } + public int PackedSint32Count { + get { return result.PackedSint32Count; } + } + public int GetPackedSint32(int index) { + return result.GetPackedSint32(index); + } + public Builder SetPackedSint32(int index, int value) { + PrepareBuilder(); + result.packedSint32_[index] = value; + return this; + } + public Builder AddPackedSint32(int value) { + PrepareBuilder(); + result.packedSint32_.Add(value); + return this; + } + public Builder AddRangePackedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSint32_.Add(values); + return this; + } + public Builder ClearPackedSint32() { + PrepareBuilder(); + result.packedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSint64List { + get { return PrepareBuilder().packedSint64_; } + } + public int PackedSint64Count { + get { return result.PackedSint64Count; } + } + public long GetPackedSint64(int index) { + return result.GetPackedSint64(index); + } + public Builder SetPackedSint64(int index, long value) { + PrepareBuilder(); + result.packedSint64_[index] = value; + return this; + } + public Builder AddPackedSint64(long value) { + PrepareBuilder(); + result.packedSint64_.Add(value); + return this; + } + public Builder AddRangePackedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSint64_.Add(values); + return this; + } + public Builder ClearPackedSint64() { + PrepareBuilder(); + result.packedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedFixed32List { + get { return PrepareBuilder().packedFixed32_; } + } + public int PackedFixed32Count { + get { return result.PackedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedFixed32(int index) { + return result.GetPackedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedFixed32(int index, uint value) { + PrepareBuilder(); + result.packedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedFixed32(uint value) { + PrepareBuilder(); + result.packedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFixed32_.Add(values); + return this; + } + public Builder ClearPackedFixed32() { + PrepareBuilder(); + result.packedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedFixed64List { + get { return PrepareBuilder().packedFixed64_; } + } + public int PackedFixed64Count { + get { return result.PackedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedFixed64(int index) { + return result.GetPackedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedFixed64(int index, ulong value) { + PrepareBuilder(); + result.packedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedFixed64(ulong value) { + PrepareBuilder(); + result.packedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFixed64_.Add(values); + return this; + } + public Builder ClearPackedFixed64() { + PrepareBuilder(); + result.packedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSfixed32List { + get { return PrepareBuilder().packedSfixed32_; } + } + public int PackedSfixed32Count { + get { return result.PackedSfixed32Count; } + } + public int GetPackedSfixed32(int index) { + return result.GetPackedSfixed32(index); + } + public Builder SetPackedSfixed32(int index, int value) { + PrepareBuilder(); + result.packedSfixed32_[index] = value; + return this; + } + public Builder AddPackedSfixed32(int value) { + PrepareBuilder(); + result.packedSfixed32_.Add(value); + return this; + } + public Builder AddRangePackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSfixed32_.Add(values); + return this; + } + public Builder ClearPackedSfixed32() { + PrepareBuilder(); + result.packedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSfixed64List { + get { return PrepareBuilder().packedSfixed64_; } + } + public int PackedSfixed64Count { + get { return result.PackedSfixed64Count; } + } + public long GetPackedSfixed64(int index) { + return result.GetPackedSfixed64(index); + } + public Builder SetPackedSfixed64(int index, long value) { + PrepareBuilder(); + result.packedSfixed64_[index] = value; + return this; + } + public Builder AddPackedSfixed64(long value) { + PrepareBuilder(); + result.packedSfixed64_.Add(value); + return this; + } + public Builder AddRangePackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSfixed64_.Add(values); + return this; + } + public Builder ClearPackedSfixed64() { + PrepareBuilder(); + result.packedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedFloatList { + get { return PrepareBuilder().packedFloat_; } + } + public int PackedFloatCount { + get { return result.PackedFloatCount; } + } + public float GetPackedFloat(int index) { + return result.GetPackedFloat(index); + } + public Builder SetPackedFloat(int index, float value) { + PrepareBuilder(); + result.packedFloat_[index] = value; + return this; + } + public Builder AddPackedFloat(float value) { + PrepareBuilder(); + result.packedFloat_.Add(value); + return this; + } + public Builder AddRangePackedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFloat_.Add(values); + return this; + } + public Builder ClearPackedFloat() { + PrepareBuilder(); + result.packedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedDoubleList { + get { return PrepareBuilder().packedDouble_; } + } + public int PackedDoubleCount { + get { return result.PackedDoubleCount; } + } + public double GetPackedDouble(int index) { + return result.GetPackedDouble(index); + } + public Builder SetPackedDouble(int index, double value) { + PrepareBuilder(); + result.packedDouble_[index] = value; + return this; + } + public Builder AddPackedDouble(double value) { + PrepareBuilder(); + result.packedDouble_.Add(value); + return this; + } + public Builder AddRangePackedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.packedDouble_.Add(values); + return this; + } + public Builder ClearPackedDouble() { + PrepareBuilder(); + result.packedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedBoolList { + get { return PrepareBuilder().packedBool_; } + } + public int PackedBoolCount { + get { return result.PackedBoolCount; } + } + public bool GetPackedBool(int index) { + return result.GetPackedBool(index); + } + public Builder SetPackedBool(int index, bool value) { + PrepareBuilder(); + result.packedBool_[index] = value; + return this; + } + public Builder AddPackedBool(bool value) { + PrepareBuilder(); + result.packedBool_.Add(value); + return this; + } + public Builder AddRangePackedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.packedBool_.Add(values); + return this; + } + public Builder ClearPackedBool() { + PrepareBuilder(); + result.packedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedEnumList { + get { return PrepareBuilder().packedEnum_; } + } + public int PackedEnumCount { + get { return result.PackedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite GetPackedEnum(int index) { + return result.GetPackedEnum(index); + } + public Builder SetPackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); + result.packedEnum_[index] = value; + return this; + } + public Builder AddPackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnumLite value) { + PrepareBuilder(); + result.packedEnum_.Add(value); + return this; + } + public Builder AddRangePackedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.packedEnum_.Add(values); + return this; + } + public Builder ClearPackedEnum() { + PrepareBuilder(); + result.packedEnum_.Clear(); + return this; + } + } + static TestPackedTypesLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestAllExtensionsLite : pb::ExtendableMessageLite { + private TestAllExtensionsLite() { } + private static readonly TestAllExtensionsLite defaultInstance = new TestAllExtensionsLite().MakeReadOnly(); + private static readonly string[] _testAllExtensionsLiteFieldNames = new string[] { }; + private static readonly uint[] _testAllExtensionsLiteFieldTags = new uint[] { }; + public static TestAllExtensionsLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestAllExtensionsLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestAllExtensionsLite ThisMessage { + get { return this; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testAllExtensionsLiteFieldNames; + pb::ExtendableMessageLite.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + hash ^= base.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestAllExtensionsLite other = obj as TestAllExtensionsLite; + if (other == null) return false; + if (!base.Equals(other)) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + base.PrintTo(writer); + } + #endregion + + public static TestAllExtensionsLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllExtensionsLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensionsLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllExtensionsLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensionsLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllExtensionsLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensionsLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestAllExtensionsLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestAllExtensionsLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllExtensionsLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestAllExtensionsLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestAllExtensionsLite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestAllExtensionsLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestAllExtensionsLite result; + + private TestAllExtensionsLite PrepareBuilder() { + if (resultIsReadOnly) { + TestAllExtensionsLite original = result; + result = new TestAllExtensionsLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestAllExtensionsLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestAllExtensionsLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance; } + } + + public override TestAllExtensionsLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestAllExtensionsLite) { + return MergeFrom((TestAllExtensionsLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestAllExtensionsLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllExtensionsLite.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testAllExtensionsLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testAllExtensionsLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + } + } + + return this; + } + + } + static TestAllExtensionsLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OptionalGroup_extension_lite : pb::GeneratedMessageLite { + private OptionalGroup_extension_lite() { } + private static readonly OptionalGroup_extension_lite defaultInstance = new OptionalGroup_extension_lite().MakeReadOnly(); + private static readonly string[] _optionalGroupExtensionLiteFieldNames = new string[] { "a" }; + private static readonly uint[] _optionalGroupExtensionLiteFieldTags = new uint[] { 136 }; + public static OptionalGroup_extension_lite DefaultInstance { + get { return defaultInstance; } + } + + public override OptionalGroup_extension_lite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OptionalGroup_extension_lite ThisMessage { + get { return this; } + } + + public const int AFieldNumber = 17; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _optionalGroupExtensionLiteFieldNames; + if (hasA) { + output.WriteInt32(17, field_names[0], A); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(17, A); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasA) hash ^= a_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + OptionalGroup_extension_lite other = obj as OptionalGroup_extension_lite; + if (other == null) return false; + if (hasA != other.hasA || (hasA && !a_.Equals(other.a_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("a", hasA, a_, writer); + } + #endregion + + public static OptionalGroup_extension_lite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup_extension_lite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension_lite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup_extension_lite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension_lite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup_extension_lite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension_lite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OptionalGroup_extension_lite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OptionalGroup_extension_lite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup_extension_lite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OptionalGroup_extension_lite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OptionalGroup_extension_lite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OptionalGroup_extension_lite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OptionalGroup_extension_lite result; + + private OptionalGroup_extension_lite PrepareBuilder() { + if (resultIsReadOnly) { + OptionalGroup_extension_lite original = result; + result = new OptionalGroup_extension_lite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OptionalGroup_extension_lite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override OptionalGroup_extension_lite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension_lite.DefaultInstance; } + } + + public override OptionalGroup_extension_lite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is OptionalGroup_extension_lite) { + return MergeFrom((OptionalGroup_extension_lite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OptionalGroup_extension_lite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension_lite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_optionalGroupExtensionLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _optionalGroupExtensionLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 136: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static OptionalGroup_extension_lite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RepeatedGroup_extension_lite : pb::GeneratedMessageLite { + private RepeatedGroup_extension_lite() { } + private static readonly RepeatedGroup_extension_lite defaultInstance = new RepeatedGroup_extension_lite().MakeReadOnly(); + private static readonly string[] _repeatedGroupExtensionLiteFieldNames = new string[] { "a" }; + private static readonly uint[] _repeatedGroupExtensionLiteFieldTags = new uint[] { 376 }; + public static RepeatedGroup_extension_lite DefaultInstance { + get { return defaultInstance; } + } + + public override RepeatedGroup_extension_lite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RepeatedGroup_extension_lite ThisMessage { + get { return this; } + } + + public const int AFieldNumber = 47; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _repeatedGroupExtensionLiteFieldNames; + if (hasA) { + output.WriteInt32(47, field_names[0], A); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(47, A); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasA) hash ^= a_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + RepeatedGroup_extension_lite other = obj as RepeatedGroup_extension_lite; + if (other == null) return false; + if (hasA != other.hasA || (hasA && !a_.Equals(other.a_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("a", hasA, a_, writer); + } + #endregion + + public static RepeatedGroup_extension_lite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup_extension_lite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension_lite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup_extension_lite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension_lite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup_extension_lite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension_lite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RepeatedGroup_extension_lite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RepeatedGroup_extension_lite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup_extension_lite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RepeatedGroup_extension_lite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RepeatedGroup_extension_lite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RepeatedGroup_extension_lite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RepeatedGroup_extension_lite result; + + private RepeatedGroup_extension_lite PrepareBuilder() { + if (resultIsReadOnly) { + RepeatedGroup_extension_lite original = result; + result = new RepeatedGroup_extension_lite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RepeatedGroup_extension_lite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override RepeatedGroup_extension_lite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension_lite.DefaultInstance; } + } + + public override RepeatedGroup_extension_lite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is RepeatedGroup_extension_lite) { + return MergeFrom((RepeatedGroup_extension_lite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RepeatedGroup_extension_lite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension_lite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_repeatedGroupExtensionLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _repeatedGroupExtensionLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 376: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static RepeatedGroup_extension_lite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestPackedExtensionsLite : pb::ExtendableMessageLite { + private TestPackedExtensionsLite() { } + private static readonly TestPackedExtensionsLite defaultInstance = new TestPackedExtensionsLite().MakeReadOnly(); + private static readonly string[] _testPackedExtensionsLiteFieldNames = new string[] { }; + private static readonly uint[] _testPackedExtensionsLiteFieldTags = new uint[] { }; + public static TestPackedExtensionsLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestPackedExtensionsLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestPackedExtensionsLite ThisMessage { + get { return this; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testPackedExtensionsLiteFieldNames; + pb::ExtendableMessageLite.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + hash ^= base.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestPackedExtensionsLite other = obj as TestPackedExtensionsLite; + if (other == null) return false; + if (!base.Equals(other)) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + base.PrintTo(writer); + } + #endregion + + public static TestPackedExtensionsLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedExtensionsLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensionsLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedExtensionsLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensionsLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedExtensionsLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensionsLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestPackedExtensionsLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestPackedExtensionsLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedExtensionsLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestPackedExtensionsLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestPackedExtensionsLite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestPackedExtensionsLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestPackedExtensionsLite result; + + private TestPackedExtensionsLite PrepareBuilder() { + if (resultIsReadOnly) { + TestPackedExtensionsLite original = result; + result = new TestPackedExtensionsLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestPackedExtensionsLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestPackedExtensionsLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance; } + } + + public override TestPackedExtensionsLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestPackedExtensionsLite) { + return MergeFrom((TestPackedExtensionsLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestPackedExtensionsLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedExtensionsLite.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testPackedExtensionsLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testPackedExtensionsLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + } + } + + return this; + } + + } + static TestPackedExtensionsLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestNestedExtensionLite : pb::GeneratedMessageLite { + private TestNestedExtensionLite() { } + private static readonly TestNestedExtensionLite defaultInstance = new TestNestedExtensionLite().MakeReadOnly(); + private static readonly string[] _testNestedExtensionLiteFieldNames = new string[] { }; + private static readonly uint[] _testNestedExtensionLiteFieldTags = new uint[] { }; + public static TestNestedExtensionLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestNestedExtensionLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestNestedExtensionLite ThisMessage { + get { return this; } + } + + public const int NestedExtensionFieldNumber = 12345; + public static pb::GeneratedExtensionLite NestedExtension; + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testNestedExtensionLiteFieldNames; + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestNestedExtensionLite other = obj as TestNestedExtensionLite; + if (other == null) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + } + #endregion + + public static TestNestedExtensionLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedExtensionLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtensionLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedExtensionLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtensionLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedExtensionLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtensionLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestNestedExtensionLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestNestedExtensionLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedExtensionLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestNestedExtensionLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestNestedExtensionLite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestNestedExtensionLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestNestedExtensionLite result; + + private TestNestedExtensionLite PrepareBuilder() { + if (resultIsReadOnly) { + TestNestedExtensionLite original = result; + result = new TestNestedExtensionLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestNestedExtensionLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestNestedExtensionLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedExtensionLite.DefaultInstance; } + } + + public override TestNestedExtensionLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestNestedExtensionLite) { + return MergeFrom((TestNestedExtensionLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestNestedExtensionLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedExtensionLite.DefaultInstance) return this; + PrepareBuilder(); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testNestedExtensionLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testNestedExtensionLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + } + } + + return this; + } + + } + static TestNestedExtensionLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDeprecatedLite : pb::GeneratedMessageLite { + private TestDeprecatedLite() { } + private static readonly TestDeprecatedLite defaultInstance = new TestDeprecatedLite().MakeReadOnly(); + private static readonly string[] _testDeprecatedLiteFieldNames = new string[] { "deprecated_field" }; + private static readonly uint[] _testDeprecatedLiteFieldTags = new uint[] { 8 }; + public static TestDeprecatedLite DefaultInstance { + get { return defaultInstance; } + } + + public override TestDeprecatedLite DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDeprecatedLite ThisMessage { + get { return this; } + } + + public const int DeprecatedFieldFieldNumber = 1; + private bool hasDeprecatedField; + private int deprecatedField_; + [global::System.ObsoleteAttribute()] + public bool HasDeprecatedField { + get { return hasDeprecatedField; } + } + [global::System.ObsoleteAttribute()] + public int DeprecatedField { + get { return deprecatedField_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDeprecatedLiteFieldNames; + if (hasDeprecatedField) { + output.WriteInt32(1, field_names[0], DeprecatedField); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasDeprecatedField) { + size += pb::CodedOutputStream.ComputeInt32Size(1, DeprecatedField); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasDeprecatedField) hash ^= deprecatedField_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + TestDeprecatedLite other = obj as TestDeprecatedLite; + if (other == null) return false; + if (hasDeprecatedField != other.hasDeprecatedField || (hasDeprecatedField && !deprecatedField_.Equals(other.deprecatedField_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("deprecated_field", hasDeprecatedField, deprecatedField_, writer); + } + #endregion + + public static TestDeprecatedLite ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDeprecatedLite ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedLite ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDeprecatedLite ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedLite ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDeprecatedLite ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedLite ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDeprecatedLite ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDeprecatedLite ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDeprecatedLite ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDeprecatedLite MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDeprecatedLite prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDeprecatedLite cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDeprecatedLite result; + + private TestDeprecatedLite PrepareBuilder() { + if (resultIsReadOnly) { + TestDeprecatedLite original = result; + result = new TestDeprecatedLite(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDeprecatedLite MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override TestDeprecatedLite DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDeprecatedLite.DefaultInstance; } + } + + public override TestDeprecatedLite BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is TestDeprecatedLite) { + return MergeFrom((TestDeprecatedLite) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDeprecatedLite other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDeprecatedLite.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasDeprecatedField) { + DeprecatedField = other.DeprecatedField; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDeprecatedLiteFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDeprecatedLiteFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasDeprecatedField = input.ReadInt32(ref result.deprecatedField_); + break; + } + } + } + + return this; + } + + + [global::System.ObsoleteAttribute()] + public bool HasDeprecatedField { + get { return result.hasDeprecatedField; } + } + [global::System.ObsoleteAttribute()] + public int DeprecatedField { + get { return result.DeprecatedField; } + set { SetDeprecatedField(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetDeprecatedField(int value) { + PrepareBuilder(); + result.hasDeprecatedField = true; + result.deprecatedField_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearDeprecatedField() { + PrepareBuilder(); + result.hasDeprecatedField = false; + result.deprecatedField_ = 0; + return this; + } + } + static TestDeprecatedLite() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestLiteProtoFile.Descriptor, null); + } + } + + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs new file mode 100644 index 00000000..dd31c675 --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestProtoFile.cs @@ -0,0 +1,21602 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestProtoFile { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBytesExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalGroupExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringPieceExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalCordExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBytesExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedGroupExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportMessageExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringPieceExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedCordExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBytesExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultNestedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultForeignEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultImportEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringPieceExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultCordExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionString); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionInt); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed32Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed64Extension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFloatExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedDoubleExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedBoolExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedEnumExtension); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Test); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestRequired.Single); + registry.Add(global::Google.ProtocolBuffers.TestProtos.TestRequired.Multi); + } + #endregion + #region Extensions + public const int OptionalInt32ExtensionFieldNumber = 1; + public static pb::GeneratedExtensionBase OptionalInt32Extension; + public const int OptionalInt64ExtensionFieldNumber = 2; + public static pb::GeneratedExtensionBase OptionalInt64Extension; + public const int OptionalUint32ExtensionFieldNumber = 3; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalUint32Extension; + public const int OptionalUint64ExtensionFieldNumber = 4; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalUint64Extension; + public const int OptionalSint32ExtensionFieldNumber = 5; + public static pb::GeneratedExtensionBase OptionalSint32Extension; + public const int OptionalSint64ExtensionFieldNumber = 6; + public static pb::GeneratedExtensionBase OptionalSint64Extension; + public const int OptionalFixed32ExtensionFieldNumber = 7; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalFixed32Extension; + public const int OptionalFixed64ExtensionFieldNumber = 8; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase OptionalFixed64Extension; + public const int OptionalSfixed32ExtensionFieldNumber = 9; + public static pb::GeneratedExtensionBase OptionalSfixed32Extension; + public const int OptionalSfixed64ExtensionFieldNumber = 10; + public static pb::GeneratedExtensionBase OptionalSfixed64Extension; + public const int OptionalFloatExtensionFieldNumber = 11; + public static pb::GeneratedExtensionBase OptionalFloatExtension; + public const int OptionalDoubleExtensionFieldNumber = 12; + public static pb::GeneratedExtensionBase OptionalDoubleExtension; + public const int OptionalBoolExtensionFieldNumber = 13; + public static pb::GeneratedExtensionBase OptionalBoolExtension; + public const int OptionalStringExtensionFieldNumber = 14; + public static pb::GeneratedExtensionBase OptionalStringExtension; + public const int OptionalBytesExtensionFieldNumber = 15; + public static pb::GeneratedExtensionBase OptionalBytesExtension; + public const int OptionalGroupExtensionFieldNumber = 16; + public static pb::GeneratedExtensionBase OptionalGroupExtension; + public const int OptionalNestedMessageExtensionFieldNumber = 18; + public static pb::GeneratedExtensionBase OptionalNestedMessageExtension; + public const int OptionalForeignMessageExtensionFieldNumber = 19; + public static pb::GeneratedExtensionBase OptionalForeignMessageExtension; + public const int OptionalImportMessageExtensionFieldNumber = 20; + public static pb::GeneratedExtensionBase OptionalImportMessageExtension; + public const int OptionalNestedEnumExtensionFieldNumber = 21; + public static pb::GeneratedExtensionBase OptionalNestedEnumExtension; + public const int OptionalForeignEnumExtensionFieldNumber = 22; + public static pb::GeneratedExtensionBase OptionalForeignEnumExtension; + public const int OptionalImportEnumExtensionFieldNumber = 23; + public static pb::GeneratedExtensionBase OptionalImportEnumExtension; + public const int OptionalStringPieceExtensionFieldNumber = 24; + public static pb::GeneratedExtensionBase OptionalStringPieceExtension; + public const int OptionalCordExtensionFieldNumber = 25; + public static pb::GeneratedExtensionBase OptionalCordExtension; + public const int RepeatedInt32ExtensionFieldNumber = 31; + public static pb::GeneratedExtensionBase> RepeatedInt32Extension; + public const int RepeatedInt64ExtensionFieldNumber = 32; + public static pb::GeneratedExtensionBase> RepeatedInt64Extension; + public const int RepeatedUint32ExtensionFieldNumber = 33; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedUint32Extension; + public const int RepeatedUint64ExtensionFieldNumber = 34; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedUint64Extension; + public const int RepeatedSint32ExtensionFieldNumber = 35; + public static pb::GeneratedExtensionBase> RepeatedSint32Extension; + public const int RepeatedSint64ExtensionFieldNumber = 36; + public static pb::GeneratedExtensionBase> RepeatedSint64Extension; + public const int RepeatedFixed32ExtensionFieldNumber = 37; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedFixed32Extension; + public const int RepeatedFixed64ExtensionFieldNumber = 38; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> RepeatedFixed64Extension; + public const int RepeatedSfixed32ExtensionFieldNumber = 39; + public static pb::GeneratedExtensionBase> RepeatedSfixed32Extension; + public const int RepeatedSfixed64ExtensionFieldNumber = 40; + public static pb::GeneratedExtensionBase> RepeatedSfixed64Extension; + public const int RepeatedFloatExtensionFieldNumber = 41; + public static pb::GeneratedExtensionBase> RepeatedFloatExtension; + public const int RepeatedDoubleExtensionFieldNumber = 42; + public static pb::GeneratedExtensionBase> RepeatedDoubleExtension; + public const int RepeatedBoolExtensionFieldNumber = 43; + public static pb::GeneratedExtensionBase> RepeatedBoolExtension; + public const int RepeatedStringExtensionFieldNumber = 44; + public static pb::GeneratedExtensionBase> RepeatedStringExtension; + public const int RepeatedBytesExtensionFieldNumber = 45; + public static pb::GeneratedExtensionBase> RepeatedBytesExtension; + public const int RepeatedGroupExtensionFieldNumber = 46; + public static pb::GeneratedExtensionBase> RepeatedGroupExtension; + public const int RepeatedNestedMessageExtensionFieldNumber = 48; + public static pb::GeneratedExtensionBase> RepeatedNestedMessageExtension; + public const int RepeatedForeignMessageExtensionFieldNumber = 49; + public static pb::GeneratedExtensionBase> RepeatedForeignMessageExtension; + public const int RepeatedImportMessageExtensionFieldNumber = 50; + public static pb::GeneratedExtensionBase> RepeatedImportMessageExtension; + public const int RepeatedNestedEnumExtensionFieldNumber = 51; + public static pb::GeneratedExtensionBase> RepeatedNestedEnumExtension; + public const int RepeatedForeignEnumExtensionFieldNumber = 52; + public static pb::GeneratedExtensionBase> RepeatedForeignEnumExtension; + public const int RepeatedImportEnumExtensionFieldNumber = 53; + public static pb::GeneratedExtensionBase> RepeatedImportEnumExtension; + public const int RepeatedStringPieceExtensionFieldNumber = 54; + public static pb::GeneratedExtensionBase> RepeatedStringPieceExtension; + public const int RepeatedCordExtensionFieldNumber = 55; + public static pb::GeneratedExtensionBase> RepeatedCordExtension; + public const int DefaultInt32ExtensionFieldNumber = 61; + public static pb::GeneratedExtensionBase DefaultInt32Extension; + public const int DefaultInt64ExtensionFieldNumber = 62; + public static pb::GeneratedExtensionBase DefaultInt64Extension; + public const int DefaultUint32ExtensionFieldNumber = 63; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultUint32Extension; + public const int DefaultUint64ExtensionFieldNumber = 64; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultUint64Extension; + public const int DefaultSint32ExtensionFieldNumber = 65; + public static pb::GeneratedExtensionBase DefaultSint32Extension; + public const int DefaultSint64ExtensionFieldNumber = 66; + public static pb::GeneratedExtensionBase DefaultSint64Extension; + public const int DefaultFixed32ExtensionFieldNumber = 67; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultFixed32Extension; + public const int DefaultFixed64ExtensionFieldNumber = 68; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase DefaultFixed64Extension; + public const int DefaultSfixed32ExtensionFieldNumber = 69; + public static pb::GeneratedExtensionBase DefaultSfixed32Extension; + public const int DefaultSfixed64ExtensionFieldNumber = 70; + public static pb::GeneratedExtensionBase DefaultSfixed64Extension; + public const int DefaultFloatExtensionFieldNumber = 71; + public static pb::GeneratedExtensionBase DefaultFloatExtension; + public const int DefaultDoubleExtensionFieldNumber = 72; + public static pb::GeneratedExtensionBase DefaultDoubleExtension; + public const int DefaultBoolExtensionFieldNumber = 73; + public static pb::GeneratedExtensionBase DefaultBoolExtension; + public const int DefaultStringExtensionFieldNumber = 74; + public static pb::GeneratedExtensionBase DefaultStringExtension; + public const int DefaultBytesExtensionFieldNumber = 75; + public static pb::GeneratedExtensionBase DefaultBytesExtension; + public const int DefaultNestedEnumExtensionFieldNumber = 81; + public static pb::GeneratedExtensionBase DefaultNestedEnumExtension; + public const int DefaultForeignEnumExtensionFieldNumber = 82; + public static pb::GeneratedExtensionBase DefaultForeignEnumExtension; + public const int DefaultImportEnumExtensionFieldNumber = 83; + public static pb::GeneratedExtensionBase DefaultImportEnumExtension; + public const int DefaultStringPieceExtensionFieldNumber = 84; + public static pb::GeneratedExtensionBase DefaultStringPieceExtension; + public const int DefaultCordExtensionFieldNumber = 85; + public static pb::GeneratedExtensionBase DefaultCordExtension; + public const int MyExtensionStringFieldNumber = 50; + public static pb::GeneratedExtensionBase MyExtensionString; + public const int MyExtensionIntFieldNumber = 5; + public static pb::GeneratedExtensionBase MyExtensionInt; + public const int PackedInt32ExtensionFieldNumber = 90; + public static pb::GeneratedExtensionBase> PackedInt32Extension; + public const int PackedInt64ExtensionFieldNumber = 91; + public static pb::GeneratedExtensionBase> PackedInt64Extension; + public const int PackedUint32ExtensionFieldNumber = 92; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedUint32Extension; + public const int PackedUint64ExtensionFieldNumber = 93; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedUint64Extension; + public const int PackedSint32ExtensionFieldNumber = 94; + public static pb::GeneratedExtensionBase> PackedSint32Extension; + public const int PackedSint64ExtensionFieldNumber = 95; + public static pb::GeneratedExtensionBase> PackedSint64Extension; + public const int PackedFixed32ExtensionFieldNumber = 96; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedFixed32Extension; + public const int PackedFixed64ExtensionFieldNumber = 97; + [global::System.CLSCompliant(false)] + public static pb::GeneratedExtensionBase> PackedFixed64Extension; + public const int PackedSfixed32ExtensionFieldNumber = 98; + public static pb::GeneratedExtensionBase> PackedSfixed32Extension; + public const int PackedSfixed64ExtensionFieldNumber = 99; + public static pb::GeneratedExtensionBase> PackedSfixed64Extension; + public const int PackedFloatExtensionFieldNumber = 100; + public static pb::GeneratedExtensionBase> PackedFloatExtension; + public const int PackedDoubleExtensionFieldNumber = 101; + public static pb::GeneratedExtensionBase> PackedDoubleExtension; + public const int PackedBoolExtensionFieldNumber = 102; + public static pb::GeneratedExtensionBase> PackedBoolExtension; + public const int PackedEnumExtensionFieldNumber = 103; + public static pb::GeneratedExtensionBase> PackedEnumExtension; + #endregion + + #region Static variables + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_ForeignMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestAllExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestAllExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OptionalGroup_extension__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_RepeatedGroup_extension__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestNestedExtension__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestNestedExtension__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRequired__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRequired__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRequiredForeign__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRequiredForeign__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestForeignNested__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestEmptyMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestEmptyMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMultipleExtensionRanges__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDupFieldNumber__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDupFieldNumber_Foo__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDupFieldNumber_Bar__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestNestedMessageHasBits__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestFieldOrderings__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestExtremeDefaultValues__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_SparseEnumMessage__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OneString__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OneString__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_OneBytes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_OneBytes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestPackedTypes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestPackedExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestPackedExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDynamicExtensions__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_FooRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_FooResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_FooResponse__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_BarRequest__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_BarRequest__FieldAccessorTable; + internal static pbd::MessageDescriptor internal__static_protobuf_unittest_BarResponse__Descriptor; + internal static pb::FieldAccess.FieldAccessorTable internal__static_protobuf_unittest_BarResponse__FieldAccessorTable; + #endregion + #region Descriptor + public static pbd::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbd::FileDescriptor descriptor; + + static UnitTestProtoFile() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch5nb29nbGUvcHJvdG9idWYvdW5pdHRlc3QucHJvdG8SEXByb3RvYnVmX3Vu", + "aXR0ZXN0GiRnb29nbGUvcHJvdG9idWYvY3NoYXJwX29wdGlvbnMucHJvdG8a", + "JWdvb2dsZS9wcm90b2J1Zi91bml0dGVzdF9pbXBvcnQucHJvdG8iuxUKDFRl", + "c3RBbGxUeXBlcxIWCg5vcHRpb25hbF9pbnQzMhgBIAEoBRIWCg5vcHRpb25h", + "bF9pbnQ2NBgCIAEoAxIXCg9vcHRpb25hbF91aW50MzIYAyABKA0SFwoPb3B0", + "aW9uYWxfdWludDY0GAQgASgEEhcKD29wdGlvbmFsX3NpbnQzMhgFIAEoERIX", + "Cg9vcHRpb25hbF9zaW50NjQYBiABKBISGAoQb3B0aW9uYWxfZml4ZWQzMhgH", + "IAEoBxIYChBvcHRpb25hbF9maXhlZDY0GAggASgGEhkKEW9wdGlvbmFsX3Nm", + "aXhlZDMyGAkgASgPEhkKEW9wdGlvbmFsX3NmaXhlZDY0GAogASgQEhYKDm9w", + "dGlvbmFsX2Zsb2F0GAsgASgCEhcKD29wdGlvbmFsX2RvdWJsZRgMIAEoARIV", + "Cg1vcHRpb25hbF9ib29sGA0gASgIEhcKD29wdGlvbmFsX3N0cmluZxgOIAEo", + "CRIWCg5vcHRpb25hbF9ieXRlcxgPIAEoDBJECg1vcHRpb25hbGdyb3VwGBAg", + "ASgKMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbFR5cGVzLk9wdGlvbmFs", + "R3JvdXASTgoXb3B0aW9uYWxfbmVzdGVkX21lc3NhZ2UYEiABKAsyLS5wcm90", + "b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZRJDChhv", + "cHRpb25hbF9mb3JlaWduX21lc3NhZ2UYEyABKAsyIS5wcm90b2J1Zl91bml0", + "dGVzdC5Gb3JlaWduTWVzc2FnZRJIChdvcHRpb25hbF9pbXBvcnRfbWVzc2Fn", + "ZRgUIAEoCzInLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRNZXNz", + "YWdlEkgKFG9wdGlvbmFsX25lc3RlZF9lbnVtGBUgASgOMioucHJvdG9idWZf", + "dW5pdHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW0SPQoVb3B0aW9uYWxf", + "Zm9yZWlnbl9lbnVtGBYgASgOMh4ucHJvdG9idWZfdW5pdHRlc3QuRm9yZWln", + "bkVudW0SQgoUb3B0aW9uYWxfaW1wb3J0X2VudW0YFyABKA4yJC5wcm90b2J1", + "Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0RW51bRIhChVvcHRpb25hbF9zdHJp", + "bmdfcGllY2UYGCABKAlCAggCEhkKDW9wdGlvbmFsX2NvcmQYGSABKAlCAggB", + "EhYKDnJlcGVhdGVkX2ludDMyGB8gAygFEhYKDnJlcGVhdGVkX2ludDY0GCAg", + "AygDEhcKD3JlcGVhdGVkX3VpbnQzMhghIAMoDRIXCg9yZXBlYXRlZF91aW50", + "NjQYIiADKAQSFwoPcmVwZWF0ZWRfc2ludDMyGCMgAygREhcKD3JlcGVhdGVk", + "X3NpbnQ2NBgkIAMoEhIYChByZXBlYXRlZF9maXhlZDMyGCUgAygHEhgKEHJl", + "cGVhdGVkX2ZpeGVkNjQYJiADKAYSGQoRcmVwZWF0ZWRfc2ZpeGVkMzIYJyAD", + "KA8SGQoRcmVwZWF0ZWRfc2ZpeGVkNjQYKCADKBASFgoOcmVwZWF0ZWRfZmxv", + "YXQYKSADKAISFwoPcmVwZWF0ZWRfZG91YmxlGCogAygBEhUKDXJlcGVhdGVk", + "X2Jvb2wYKyADKAgSFwoPcmVwZWF0ZWRfc3RyaW5nGCwgAygJEhYKDnJlcGVh", + "dGVkX2J5dGVzGC0gAygMEkQKDXJlcGVhdGVkZ3JvdXAYLiADKAoyLS5wcm90", + "b2J1Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuUmVwZWF0ZWRHcm91cBJOChdy", + "ZXBlYXRlZF9uZXN0ZWRfbWVzc2FnZRgwIAMoCzItLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxUeXBlcy5OZXN0ZWRNZXNzYWdlEkMKGHJlcGVhdGVkX2Zv", + "cmVpZ25fbWVzc2FnZRgxIAMoCzIhLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVp", + "Z25NZXNzYWdlEkgKF3JlcGVhdGVkX2ltcG9ydF9tZXNzYWdlGDIgAygLMicu", + "cHJvdG9idWZfdW5pdHRlc3RfaW1wb3J0LkltcG9ydE1lc3NhZ2USSAoUcmVw", + "ZWF0ZWRfbmVzdGVkX2VudW0YMyADKA4yKi5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0QWxsVHlwZXMuTmVzdGVkRW51bRI9ChVyZXBlYXRlZF9mb3JlaWduX2Vu", + "dW0YNCADKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bRJCChRy", + "ZXBlYXRlZF9pbXBvcnRfZW51bRg1IAMoDjIkLnByb3RvYnVmX3VuaXR0ZXN0", + "X2ltcG9ydC5JbXBvcnRFbnVtEiEKFXJlcGVhdGVkX3N0cmluZ19waWVjZRg2", + "IAMoCUICCAISGQoNcmVwZWF0ZWRfY29yZBg3IAMoCUICCAESGQoNZGVmYXVs", + "dF9pbnQzMhg9IAEoBToCNDESGQoNZGVmYXVsdF9pbnQ2NBg+IAEoAzoCNDIS", + "GgoOZGVmYXVsdF91aW50MzIYPyABKA06AjQzEhoKDmRlZmF1bHRfdWludDY0", + "GEAgASgEOgI0NBIbCg5kZWZhdWx0X3NpbnQzMhhBIAEoEToDLTQ1EhoKDmRl", + "ZmF1bHRfc2ludDY0GEIgASgSOgI0NhIbCg9kZWZhdWx0X2ZpeGVkMzIYQyAB", + "KAc6AjQ3EhsKD2RlZmF1bHRfZml4ZWQ2NBhEIAEoBjoCNDgSHAoQZGVmYXVs", + "dF9zZml4ZWQzMhhFIAEoDzoCNDkSHQoQZGVmYXVsdF9zZml4ZWQ2NBhGIAEo", + "EDoDLTUwEhsKDWRlZmF1bHRfZmxvYXQYRyABKAI6BDUxLjUSHQoOZGVmYXVs", + "dF9kb3VibGUYSCABKAE6BTUyMDAwEhoKDGRlZmF1bHRfYm9vbBhJIAEoCDoE", + "dHJ1ZRIdCg5kZWZhdWx0X3N0cmluZxhKIAEoCToFaGVsbG8SHAoNZGVmYXVs", + "dF9ieXRlcxhLIAEoDDoFd29ybGQSTAoTZGVmYXVsdF9uZXN0ZWRfZW51bRhR", + "IAEoDjIqLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxUeXBlcy5OZXN0ZWRF", + "bnVtOgNCQVISSQoUZGVmYXVsdF9mb3JlaWduX2VudW0YUiABKA4yHi5wcm90", + "b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51bToLRk9SRUlHTl9CQVISTQoTZGVm", + "YXVsdF9pbXBvcnRfZW51bRhTIAEoDjIkLnByb3RvYnVmX3VuaXR0ZXN0X2lt", + "cG9ydC5JbXBvcnRFbnVtOgpJTVBPUlRfQkFSEiUKFGRlZmF1bHRfc3RyaW5n", + "X3BpZWNlGFQgASgJOgNhYmNCAggCEh0KDGRlZmF1bHRfY29yZBhVIAEoCToD", + "MTIzQgIIARobCg1OZXN0ZWRNZXNzYWdlEgoKAmJiGAEgASgFGhoKDU9wdGlv", + "bmFsR3JvdXASCQoBYRgRIAEoBRoaCg1SZXBlYXRlZEdyb3VwEgkKAWEYLyAB", + "KAUiJwoKTmVzdGVkRW51bRIHCgNGT08QARIHCgNCQVIQAhIHCgNCQVoQAyI0", + "ChRUZXN0RGVwcmVjYXRlZEZpZWxkcxIcChBkZXByZWNhdGVkX2ludDMyGAEg", + "ASgFQgIYASIbCg5Gb3JlaWduTWVzc2FnZRIJCgFjGAEgASgFIh0KEVRlc3RB", + "bGxFeHRlbnNpb25zKggIARCAgICAAiIkChdPcHRpb25hbEdyb3VwX2V4dGVu", + "c2lvbhIJCgFhGBEgASgFIiQKF1JlcGVhdGVkR3JvdXBfZXh0ZW5zaW9uEgkK", + "AWEYLyABKAUiUAoTVGVzdE5lc3RlZEV4dGVuc2lvbjI5CgR0ZXN0EiQucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMY6gcgASgJOgR0ZXN0", + "ItUFCgxUZXN0UmVxdWlyZWQSCQoBYRgBIAIoBRIOCgZkdW1teTIYAiABKAUS", + "CQoBYhgDIAIoBRIOCgZkdW1teTQYBCABKAUSDgoGZHVtbXk1GAUgASgFEg4K", + "BmR1bW15NhgGIAEoBRIOCgZkdW1teTcYByABKAUSDgoGZHVtbXk4GAggASgF", + "Eg4KBmR1bW15ORgJIAEoBRIPCgdkdW1teTEwGAogASgFEg8KB2R1bW15MTEY", + "CyABKAUSDwoHZHVtbXkxMhgMIAEoBRIPCgdkdW1teTEzGA0gASgFEg8KB2R1", + "bW15MTQYDiABKAUSDwoHZHVtbXkxNRgPIAEoBRIPCgdkdW1teTE2GBAgASgF", + "Eg8KB2R1bW15MTcYESABKAUSDwoHZHVtbXkxOBgSIAEoBRIPCgdkdW1teTE5", + "GBMgASgFEg8KB2R1bW15MjAYFCABKAUSDwoHZHVtbXkyMRgVIAEoBRIPCgdk", + "dW1teTIyGBYgASgFEg8KB2R1bW15MjMYFyABKAUSDwoHZHVtbXkyNBgYIAEo", + "BRIPCgdkdW1teTI1GBkgASgFEg8KB2R1bW15MjYYGiABKAUSDwoHZHVtbXky", + "NxgbIAEoBRIPCgdkdW1teTI4GBwgASgFEg8KB2R1bW15MjkYHSABKAUSDwoH", + "ZHVtbXkzMBgeIAEoBRIPCgdkdW1teTMxGB8gASgFEg8KB2R1bW15MzIYICAB", + "KAUSCQoBYxghIAIoBTJWCgZzaW5nbGUSJC5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0QWxsRXh0ZW5zaW9ucxjoByABKAsyHy5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0UmVxdWlyZWQyVQoFbXVsdGkSJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxjpByADKAsyHy5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "UmVxdWlyZWQimgEKE1Rlc3RSZXF1aXJlZEZvcmVpZ24SOQoQb3B0aW9uYWxf", + "bWVzc2FnZRgBIAEoCzIfLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RSZXF1aXJl", + "ZBI5ChByZXBlYXRlZF9tZXNzYWdlGAIgAygLMh8ucHJvdG9idWZfdW5pdHRl", + "c3QuVGVzdFJlcXVpcmVkEg0KBWR1bW15GAMgASgFIloKEVRlc3RGb3JlaWdu", + "TmVzdGVkEkUKDmZvcmVpZ25fbmVzdGVkGAEgASgLMi0ucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZE1lc3NhZ2UiEgoQVGVzdEVtcHR5", + "TWVzc2FnZSIqCh5UZXN0RW1wdHlNZXNzYWdlV2l0aEV4dGVuc2lvbnMqCAgB", + "EICAgIACIjcKG1Rlc3RNdWx0aXBsZUV4dGVuc2lvblJhbmdlcyoECCoQKyoG", + "CK8gEJQhKgoIgIAEEICAgIACIjQKGFRlc3RSZWFsbHlMYXJnZVRhZ051bWJl", + "chIJCgFhGAEgASgFEg0KAmJiGP///38gASgFIlUKFFRlc3RSZWN1cnNpdmVN", + "ZXNzYWdlEjIKAWEYASABKAsyJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UmVj", + "dXJzaXZlTWVzc2FnZRIJCgFpGAIgASgFIksKFFRlc3RNdXR1YWxSZWN1cnNp", + "b25BEjMKAmJiGAEgASgLMicucHJvdG9idWZfdW5pdHRlc3QuVGVzdE11dHVh", + "bFJlY3Vyc2lvbkIiYgoUVGVzdE11dHVhbFJlY3Vyc2lvbkISMgoBYRgBIAEo", + "CzInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RNdXR1YWxSZWN1cnNpb25BEhYK", + "Dm9wdGlvbmFsX2ludDMyGAIgASgFIrMBChJUZXN0RHVwRmllbGROdW1iZXIS", + "CQoBYRgBIAEoBRI2CgNmb28YAiABKAoyKS5wcm90b2J1Zl91bml0dGVzdC5U", + "ZXN0RHVwRmllbGROdW1iZXIuRm9vEjYKA2JhchgDIAEoCjIpLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3REdXBGaWVsZE51bWJlci5CYXIaEAoDRm9vEgkKAWEY", + "ASABKAUaEAoDQmFyEgkKAWEYASABKAUigAIKGFRlc3ROZXN0ZWRNZXNzYWdl", + "SGFzQml0cxJaChdvcHRpb25hbF9uZXN0ZWRfbWVzc2FnZRgBIAEoCzI5LnBy", + "b3RvYnVmX3VuaXR0ZXN0LlRlc3ROZXN0ZWRNZXNzYWdlSGFzQml0cy5OZXN0", + "ZWRNZXNzYWdlGocBCg1OZXN0ZWRNZXNzYWdlEiQKHG5lc3RlZG1lc3NhZ2Vf", + "cmVwZWF0ZWRfaW50MzIYASADKAUSUAolbmVzdGVkbWVzc2FnZV9yZXBlYXRl", + "ZF9mb3JlaWdubWVzc2FnZRgCIAMoCzIhLnByb3RvYnVmX3VuaXR0ZXN0LkZv", + "cmVpZ25NZXNzYWdlIuUDChdUZXN0Q2FtZWxDYXNlRmllbGROYW1lcxIWCg5Q", + "cmltaXRpdmVGaWVsZBgBIAEoBRITCgtTdHJpbmdGaWVsZBgCIAEoCRIxCglF", + "bnVtRmllbGQYAyABKA4yHi5wcm90b2J1Zl91bml0dGVzdC5Gb3JlaWduRW51", + "bRI3CgxNZXNzYWdlRmllbGQYBCABKAsyIS5wcm90b2J1Zl91bml0dGVzdC5G", + "b3JlaWduTWVzc2FnZRIcChBTdHJpbmdQaWVjZUZpZWxkGAUgASgJQgIIAhIV", + "CglDb3JkRmllbGQYBiABKAlCAggBEh4KFlJlcGVhdGVkUHJpbWl0aXZlRmll", + "bGQYByADKAUSGwoTUmVwZWF0ZWRTdHJpbmdGaWVsZBgIIAMoCRI5ChFSZXBl", + "YXRlZEVudW1GaWVsZBgJIAMoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVp", + "Z25FbnVtEj8KFFJlcGVhdGVkTWVzc2FnZUZpZWxkGAogAygLMiEucHJvdG9i", + "dWZfdW5pdHRlc3QuRm9yZWlnbk1lc3NhZ2USJAoYUmVwZWF0ZWRTdHJpbmdQ", + "aWVjZUZpZWxkGAsgAygJQgIIAhIdChFSZXBlYXRlZENvcmRGaWVsZBgMIAMo", + "CUICCAEiVQoSVGVzdEZpZWxkT3JkZXJpbmdzEhEKCW15X3N0cmluZxgLIAEo", + "CRIOCgZteV9pbnQYASABKAMSEAoIbXlfZmxvYXQYZSABKAIqBAgCEAsqBAgM", + "EGUiowUKGFRlc3RFeHRyZW1lRGVmYXVsdFZhbHVlcxI/Cg1lc2NhcGVkX2J5", + "dGVzGAEgASgMOihcMDAwXDAwMVwwMDdcMDEwXDAxNFxuXHJcdFwwMTNcXFwn", + "XCJcMzc2EiAKDGxhcmdlX3VpbnQzMhgCIAEoDToKNDI5NDk2NzI5NRIqCgxs", + "YXJnZV91aW50NjQYAyABKAQ6FDE4NDQ2NzQ0MDczNzA5NTUxNjE1EiAKC3Nt", + "YWxsX2ludDMyGAQgASgFOgstMjE0NzQ4MzY0NxIpCgtzbWFsbF9pbnQ2NBgF", + "IAEoAzoULTkyMjMzNzIwMzY4NTQ3NzU4MDcSGAoLdXRmOF9zdHJpbmcYBiAB", + "KAk6A+GItBIVCgp6ZXJvX2Zsb2F0GAcgASgCOgEwEhQKCW9uZV9mbG9hdBgI", + "IAEoAjoBMRIYCgtzbWFsbF9mbG9hdBgJIAEoAjoDMS41Eh4KEm5lZ2F0aXZl", + "X29uZV9mbG9hdBgKIAEoAjoCLTESHAoObmVnYXRpdmVfZmxvYXQYCyABKAI6", + "BC0xLjUSGwoLbGFyZ2VfZmxvYXQYDCABKAI6BjJlKzAwOBIlChRzbWFsbF9u", + "ZWdhdGl2ZV9mbG9hdBgNIAEoAjoHLThlLTAyOBIXCgppbmZfZG91YmxlGA4g", + "ASgBOgNpbmYSHAoObmVnX2luZl9kb3VibGUYDyABKAE6BC1pbmYSFwoKbmFu", + "X2RvdWJsZRgQIAEoAToDbmFuEhYKCWluZl9mbG9hdBgRIAEoAjoDaW5mEhsK", + "DW5lZ19pbmZfZmxvYXQYEiABKAI6BC1pbmYSFgoJbmFuX2Zsb2F0GBMgASgC", + "OgNuYW4SKwoMY3BwX3RyaWdyYXBoGBQgASgJOhU/ID8gPz8gPz8gPz8/ID8/", + "LyA/Py0iSwoRU3BhcnNlRW51bU1lc3NhZ2USNgoLc3BhcnNlX2VudW0YASAB", + "KA4yIS5wcm90b2J1Zl91bml0dGVzdC5UZXN0U3BhcnNlRW51bSIZCglPbmVT", + "dHJpbmcSDAoEZGF0YRgBIAEoCSIYCghPbmVCeXRlcxIMCgRkYXRhGAEgASgM", + "IqoDCg9UZXN0UGFja2VkVHlwZXMSGAoMcGFja2VkX2ludDMyGFogAygFQgIQ", + "ARIYCgxwYWNrZWRfaW50NjQYWyADKANCAhABEhkKDXBhY2tlZF91aW50MzIY", + "XCADKA1CAhABEhkKDXBhY2tlZF91aW50NjQYXSADKARCAhABEhkKDXBhY2tl", + "ZF9zaW50MzIYXiADKBFCAhABEhkKDXBhY2tlZF9zaW50NjQYXyADKBJCAhAB", + "EhoKDnBhY2tlZF9maXhlZDMyGGAgAygHQgIQARIaCg5wYWNrZWRfZml4ZWQ2", + "NBhhIAMoBkICEAESGwoPcGFja2VkX3NmaXhlZDMyGGIgAygPQgIQARIbCg9w", + "YWNrZWRfc2ZpeGVkNjQYYyADKBBCAhABEhgKDHBhY2tlZF9mbG9hdBhkIAMo", + "AkICEAESGQoNcGFja2VkX2RvdWJsZRhlIAMoAUICEAESFwoLcGFja2VkX2Jv", + "b2wYZiADKAhCAhABEjcKC3BhY2tlZF9lbnVtGGcgAygOMh4ucHJvdG9idWZf", + "dW5pdHRlc3QuRm9yZWlnbkVudW1CAhABIsgDChFUZXN0VW5wYWNrZWRUeXBl", + "cxIaCg51bnBhY2tlZF9pbnQzMhhaIAMoBUICEAASGgoOdW5wYWNrZWRfaW50", + "NjQYWyADKANCAhAAEhsKD3VucGFja2VkX3VpbnQzMhhcIAMoDUICEAASGwoP", + "dW5wYWNrZWRfdWludDY0GF0gAygEQgIQABIbCg91bnBhY2tlZF9zaW50MzIY", + "XiADKBFCAhAAEhsKD3VucGFja2VkX3NpbnQ2NBhfIAMoEkICEAASHAoQdW5w", + "YWNrZWRfZml4ZWQzMhhgIAMoB0ICEAASHAoQdW5wYWNrZWRfZml4ZWQ2NBhh", + "IAMoBkICEAASHQoRdW5wYWNrZWRfc2ZpeGVkMzIYYiADKA9CAhAAEh0KEXVu", + "cGFja2VkX3NmaXhlZDY0GGMgAygQQgIQABIaCg51bnBhY2tlZF9mbG9hdBhk", + "IAMoAkICEAASGwoPdW5wYWNrZWRfZG91YmxlGGUgAygBQgIQABIZCg11bnBh", + "Y2tlZF9ib29sGGYgAygIQgIQABI5Cg11bnBhY2tlZF9lbnVtGGcgAygOMh4u", + "cHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbkVudW1CAhAAIiAKFFRlc3RQYWNr", + "ZWRFeHRlbnNpb25zKggIARCAgICAAiKZBAoVVGVzdER5bmFtaWNFeHRlbnNp", + "b25zEhkKEHNjYWxhcl9leHRlbnNpb24Y0A8gASgHEjcKDmVudW1fZXh0ZW5z", + "aW9uGNEPIAEoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25FbnVtElkK", + "FmR5bmFtaWNfZW51bV9leHRlbnNpb24Y0g8gASgOMjgucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdER5bmFtaWNFeHRlbnNpb25zLkR5bmFtaWNFbnVtVHlwZRI9", + "ChFtZXNzYWdlX2V4dGVuc2lvbhjTDyABKAsyIS5wcm90b2J1Zl91bml0dGVz", + "dC5Gb3JlaWduTWVzc2FnZRJfChlkeW5hbWljX21lc3NhZ2VfZXh0ZW5zaW9u", + "GNQPIAEoCzI7LnByb3RvYnVmX3VuaXR0ZXN0LlRlc3REeW5hbWljRXh0ZW5z", + "aW9ucy5EeW5hbWljTWVzc2FnZVR5cGUSGwoScmVwZWF0ZWRfZXh0ZW5zaW9u", + "GNUPIAMoCRIdChBwYWNrZWRfZXh0ZW5zaW9uGNYPIAMoEUICEAEaLAoSRHlu", + "YW1pY01lc3NhZ2VUeXBlEhYKDWR5bmFtaWNfZmllbGQYtBAgASgFIkcKD0R5", + "bmFtaWNFbnVtVHlwZRIQCgtEWU5BTUlDX0ZPTxCYERIQCgtEWU5BTUlDX0JB", + "UhCZERIQCgtEWU5BTUlDX0JBWhCaESLAAQojVGVzdFJlcGVhdGVkU2NhbGFy", + "RGlmZmVyZW50VGFnU2l6ZXMSGAoQcmVwZWF0ZWRfZml4ZWQzMhgMIAMoBxIW", + "Cg5yZXBlYXRlZF9pbnQzMhgNIAMoBRIZChByZXBlYXRlZF9maXhlZDY0GP4P", + "IAMoBhIXCg5yZXBlYXRlZF9pbnQ2NBj/DyADKAMSGAoOcmVwZWF0ZWRfZmxv", + "YXQY/v8PIAMoAhIZCg9yZXBlYXRlZF91aW50NjQY//8PIAMoBCIMCgpGb29S", + "ZXF1ZXN0Ig0KC0Zvb1Jlc3BvbnNlIgwKCkJhclJlcXVlc3QiDQoLQmFyUmVz", + "cG9uc2UqQAoLRm9yZWlnbkVudW0SDwoLRk9SRUlHTl9GT08QBBIPCgtGT1JF", + "SUdOX0JBUhAFEg8KC0ZPUkVJR05fQkFaEAYqRwoUVGVzdEVudW1XaXRoRHVw", + "VmFsdWUSCAoERk9PMRABEggKBEJBUjEQAhIHCgNCQVoQAxIICgRGT08yEAES", + "CAoEQkFSMhACKokBCg5UZXN0U3BhcnNlRW51bRIMCghTUEFSU0VfQRB7Eg4K", + "CFNQQVJTRV9CEKbnAxIPCghTUEFSU0VfQxCysYAGEhUKCFNQQVJTRV9EEPH/", + "/////////wESFQoIU1BBUlNFX0UQtN78////////ARIMCghTUEFSU0VfRhAA", + "EgwKCFNQQVJTRV9HEAIymQEKC1Rlc3RTZXJ2aWNlEkQKA0ZvbxIdLnByb3Rv", + "YnVmX3VuaXR0ZXN0LkZvb1JlcXVlc3QaHi5wcm90b2J1Zl91bml0dGVzdC5G", + "b29SZXNwb25zZRJECgNCYXISHS5wcm90b2J1Zl91bml0dGVzdC5CYXJSZXF1", + "ZXN0Gh4ucHJvdG9idWZfdW5pdHRlc3QuQmFyUmVzcG9uc2U6RgoYb3B0aW9u", + "YWxfaW50MzJfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFs", + "bEV4dGVuc2lvbnMYASABKAU6RgoYb3B0aW9uYWxfaW50NjRfZXh0ZW5zaW9u", + "EiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYAiABKAM6", + "RwoZb3B0aW9uYWxfdWludDMyX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxFeHRlbnNpb25zGAMgASgNOkcKGW9wdGlvbmFsX3VpbnQ2", + "NF9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5z", + "aW9ucxgEIAEoBDpHChlvcHRpb25hbF9zaW50MzJfZXh0ZW5zaW9uEiQucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYBSABKBE6RwoZb3B0", + "aW9uYWxfc2ludDY0X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RBbGxFeHRlbnNpb25zGAYgASgSOkgKGm9wdGlvbmFsX2ZpeGVkMzJfZXh0", + "ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMY", + "ByABKAc6SAoab3B0aW9uYWxfZml4ZWQ2NF9leHRlbnNpb24SJC5wcm90b2J1", + "Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgIIAEoBjpJChtvcHRpb25h", + "bF9zZml4ZWQzMl9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxgJIAEoDzpJChtvcHRpb25hbF9zZml4ZWQ2NF9leHRl", + "bnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgK", + "IAEoEDpGChhvcHRpb25hbF9mbG9hdF9leHRlbnNpb24SJC5wcm90b2J1Zl91", + "bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgLIAEoAjpHChlvcHRpb25hbF9k", + "b3VibGVfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYDCABKAE6RQoXb3B0aW9uYWxfYm9vbF9leHRlbnNpb24SJC5w", + "cm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgNIAEoCDpHChlv", + "cHRpb25hbF9zdHJpbmdfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3Qu", + "VGVzdEFsbEV4dGVuc2lvbnMYDiABKAk6RgoYb3B0aW9uYWxfYnl0ZXNfZXh0", + "ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMY", + "DyABKAw6cQoXb3B0aW9uYWxncm91cF9leHRlbnNpb24SJC5wcm90b2J1Zl91", + "bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgQIAEoCjIqLnByb3RvYnVmX3Vu", + "aXR0ZXN0Lk9wdGlvbmFsR3JvdXBfZXh0ZW5zaW9uOn4KIW9wdGlvbmFsX25l", + "c3RlZF9tZXNzYWdlX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RBbGxFeHRlbnNpb25zGBIgASgLMi0ucHJvdG9idWZfdW5pdHRlc3QuVGVz", + "dEFsbFR5cGVzLk5lc3RlZE1lc3NhZ2U6cwoib3B0aW9uYWxfZm9yZWlnbl9t", + "ZXNzYWdlX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxF", + "eHRlbnNpb25zGBMgASgLMiEucHJvdG9idWZfdW5pdHRlc3QuRm9yZWlnbk1l", + "c3NhZ2U6eAohb3B0aW9uYWxfaW1wb3J0X21lc3NhZ2VfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYFCABKAsyJy5w", + "cm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0TWVzc2FnZTp4Ch5vcHRp", + "b25hbF9uZXN0ZWRfZW51bV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVz", + "dC5UZXN0QWxsRXh0ZW5zaW9ucxgVIAEoDjIqLnByb3RvYnVmX3VuaXR0ZXN0", + "LlRlc3RBbGxUeXBlcy5OZXN0ZWRFbnVtOm0KH29wdGlvbmFsX2ZvcmVpZ25f", + "ZW51bV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0", + "ZW5zaW9ucxgWIAEoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25FbnVt", + "OnIKHm9wdGlvbmFsX2ltcG9ydF9lbnVtX2V4dGVuc2lvbhIkLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGBcgASgOMiQucHJvdG9idWZf", + "dW5pdHRlc3RfaW1wb3J0LkltcG9ydEVudW06UQofb3B0aW9uYWxfc3RyaW5n", + "X3BpZWNlX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxF", + "eHRlbnNpb25zGBggASgJQgIIAjpJChdvcHRpb25hbF9jb3JkX2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGBkgASgJ", + "QgIIATpGChhyZXBlYXRlZF9pbnQzMl9leHRlbnNpb24SJC5wcm90b2J1Zl91", + "bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgfIAMoBTpGChhyZXBlYXRlZF9p", + "bnQ2NF9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0", + "ZW5zaW9ucxggIAMoAzpHChlyZXBlYXRlZF91aW50MzJfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYISADKA06RwoZ", + "cmVwZWF0ZWRfdWludDY0X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0", + "LlRlc3RBbGxFeHRlbnNpb25zGCIgAygEOkcKGXJlcGVhdGVkX3NpbnQzMl9l", + "eHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9u", + "cxgjIAMoETpHChlyZXBlYXRlZF9zaW50NjRfZXh0ZW5zaW9uEiQucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYJCADKBI6SAoacmVwZWF0", + "ZWRfZml4ZWQzMl9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxglIAMoBzpIChpyZXBlYXRlZF9maXhlZDY0X2V4dGVu", + "c2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGCYg", + "AygGOkkKG3JlcGVhdGVkX3NmaXhlZDMyX2V4dGVuc2lvbhIkLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGCcgAygPOkkKG3JlcGVhdGVk", + "X3NmaXhlZDY0X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RB", + "bGxFeHRlbnNpb25zGCggAygQOkYKGHJlcGVhdGVkX2Zsb2F0X2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGCkgAygC", + "OkcKGXJlcGVhdGVkX2RvdWJsZV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0", + "dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgqIAMoATpFChdyZXBlYXRlZF9ib29s", + "X2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNp", + "b25zGCsgAygIOkcKGXJlcGVhdGVkX3N0cmluZ19leHRlbnNpb24SJC5wcm90", + "b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxgsIAMoCTpGChhyZXBl", + "YXRlZF9ieXRlc19leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxgtIAMoDDpxChdyZXBlYXRlZGdyb3VwX2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGC4gAygK", + "MioucHJvdG9idWZfdW5pdHRlc3QuUmVwZWF0ZWRHcm91cF9leHRlbnNpb246", + "fgohcmVwZWF0ZWRfbmVzdGVkX21lc3NhZ2VfZXh0ZW5zaW9uEiQucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYMCADKAsyLS5wcm90b2J1", + "Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkTWVzc2FnZTpzCiJyZXBl", + "YXRlZF9mb3JlaWduX21lc3NhZ2VfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYMSADKAsyIS5wcm90b2J1Zl91bml0", + "dGVzdC5Gb3JlaWduTWVzc2FnZTp4CiFyZXBlYXRlZF9pbXBvcnRfbWVzc2Fn", + "ZV9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5z", + "aW9ucxgyIAMoCzInLnByb3RvYnVmX3VuaXR0ZXN0X2ltcG9ydC5JbXBvcnRN", + "ZXNzYWdlOngKHnJlcGVhdGVkX25lc3RlZF9lbnVtX2V4dGVuc2lvbhIkLnBy", + "b3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGDMgAygOMioucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbFR5cGVzLk5lc3RlZEVudW06bQofcmVw", + "ZWF0ZWRfZm9yZWlnbl9lbnVtX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxFeHRlbnNpb25zGDQgAygOMh4ucHJvdG9idWZfdW5pdHRl", + "c3QuRm9yZWlnbkVudW06cgoecmVwZWF0ZWRfaW1wb3J0X2VudW1fZXh0ZW5z", + "aW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYNSAD", + "KA4yJC5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1wb3J0RW51bTpRCh9y", + "ZXBlYXRlZF9zdHJpbmdfcGllY2VfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYNiADKAlCAggCOkkKF3JlcGVhdGVk", + "X2NvcmRfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYNyADKAlCAggBOkkKF2RlZmF1bHRfaW50MzJfZXh0ZW5zaW9u", + "EiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYPSABKAU6", + "AjQxOkkKF2RlZmF1bHRfaW50NjRfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5p", + "dHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYPiABKAM6AjQyOkoKGGRlZmF1bHRf", + "dWludDMyX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxF", + "eHRlbnNpb25zGD8gASgNOgI0MzpKChhkZWZhdWx0X3VpbnQ2NF9leHRlbnNp", + "b24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9ucxhAIAEo", + "BDoCNDQ6SwoYZGVmYXVsdF9zaW50MzJfZXh0ZW5zaW9uEiQucHJvdG9idWZf", + "dW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYQSABKBE6Ay00NTpKChhkZWZh", + "dWx0X3NpbnQ2NF9leHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0", + "QWxsRXh0ZW5zaW9ucxhCIAEoEjoCNDY6SwoZZGVmYXVsdF9maXhlZDMyX2V4", + "dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25z", + "GEMgASgHOgI0NzpLChlkZWZhdWx0X2ZpeGVkNjRfZXh0ZW5zaW9uEiQucHJv", + "dG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYRCABKAY6AjQ4OkwK", + "GmRlZmF1bHRfc2ZpeGVkMzJfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRl", + "c3QuVGVzdEFsbEV4dGVuc2lvbnMYRSABKA86AjQ5Ok0KGmRlZmF1bHRfc2Zp", + "eGVkNjRfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYRiABKBA6Ay01MDpLChdkZWZhdWx0X2Zsb2F0X2V4dGVuc2lv", + "bhIkLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGEcgASgC", + "OgQ1MS41Ok0KGGRlZmF1bHRfZG91YmxlX2V4dGVuc2lvbhIkLnByb3RvYnVm", + "X3VuaXR0ZXN0LlRlc3RBbGxFeHRlbnNpb25zGEggASgBOgU1MjAwMDpKChZk", + "ZWZhdWx0X2Jvb2xfZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVz", + "dEFsbEV4dGVuc2lvbnMYSSABKAg6BHRydWU6TQoYZGVmYXVsdF9zdHJpbmdf", + "ZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lv", + "bnMYSiABKAk6BWhlbGxvOkwKF2RlZmF1bHRfYnl0ZXNfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYSyABKAw6BXdv", + "cmxkOnwKHWRlZmF1bHRfbmVzdGVkX2VudW1fZXh0ZW5zaW9uEiQucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYUSABKA4yKi5wcm90b2J1", + "Zl91bml0dGVzdC5UZXN0QWxsVHlwZXMuTmVzdGVkRW51bToDQkFSOnkKHmRl", + "ZmF1bHRfZm9yZWlnbl9lbnVtX2V4dGVuc2lvbhIkLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RBbGxFeHRlbnNpb25zGFIgASgOMh4ucHJvdG9idWZfdW5pdHRl", + "c3QuRm9yZWlnbkVudW06C0ZPUkVJR05fQkFSOn0KHWRlZmF1bHRfaW1wb3J0", + "X2VudW1fZXh0ZW5zaW9uEiQucHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4", + "dGVuc2lvbnMYUyABKA4yJC5wcm90b2J1Zl91bml0dGVzdF9pbXBvcnQuSW1w", + "b3J0RW51bToKSU1QT1JUX0JBUjpVCh5kZWZhdWx0X3N0cmluZ19waWVjZV9l", + "eHRlbnNpb24SJC5wcm90b2J1Zl91bml0dGVzdC5UZXN0QWxsRXh0ZW5zaW9u", + "cxhUIAEoCToDYWJjQgIIAjpNChZkZWZhdWx0X2NvcmRfZXh0ZW5zaW9uEiQu", + "cHJvdG9idWZfdW5pdHRlc3QuVGVzdEFsbEV4dGVuc2lvbnMYVSABKAk6AzEy", + "M0ICCAE6QgoTbXlfZXh0ZW5zaW9uX3N0cmluZxIlLnByb3RvYnVmX3VuaXR0", + "ZXN0LlRlc3RGaWVsZE9yZGVyaW5ncxgyIAEoCTo/ChBteV9leHRlbnNpb25f", + "aW50EiUucHJvdG9idWZfdW5pdHRlc3QuVGVzdEZpZWxkT3JkZXJpbmdzGAUg", + "ASgFOksKFnBhY2tlZF9pbnQzMl9leHRlbnNpb24SJy5wcm90b2J1Zl91bml0", + "dGVzdC5UZXN0UGFja2VkRXh0ZW5zaW9ucxhaIAMoBUICEAE6SwoWcGFja2Vk", + "X2ludDY0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNr", + "ZWRFeHRlbnNpb25zGFsgAygDQgIQATpMChdwYWNrZWRfdWludDMyX2V4dGVu", + "c2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNrZWRFeHRlbnNpb25z", + "GFwgAygNQgIQATpMChdwYWNrZWRfdWludDY0X2V4dGVuc2lvbhInLnByb3Rv", + "YnVmX3VuaXR0ZXN0LlRlc3RQYWNrZWRFeHRlbnNpb25zGF0gAygEQgIQATpM", + "ChdwYWNrZWRfc2ludDMyX2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0", + "LlRlc3RQYWNrZWRFeHRlbnNpb25zGF4gAygRQgIQATpMChdwYWNrZWRfc2lu", + "dDY0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNrZWRF", + "eHRlbnNpb25zGF8gAygSQgIQATpNChhwYWNrZWRfZml4ZWQzMl9leHRlbnNp", + "b24SJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UGFja2VkRXh0ZW5zaW9ucxhg", + "IAMoB0ICEAE6TQoYcGFja2VkX2ZpeGVkNjRfZXh0ZW5zaW9uEicucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdFBhY2tlZEV4dGVuc2lvbnMYYSADKAZCAhABOk4K", + "GXBhY2tlZF9zZml4ZWQzMl9leHRlbnNpb24SJy5wcm90b2J1Zl91bml0dGVz", + "dC5UZXN0UGFja2VkRXh0ZW5zaW9ucxhiIAMoD0ICEAE6TgoZcGFja2VkX3Nm", + "aXhlZDY0X2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRlc3RQYWNr", + "ZWRFeHRlbnNpb25zGGMgAygQQgIQATpLChZwYWNrZWRfZmxvYXRfZXh0ZW5z", + "aW9uEicucHJvdG9idWZfdW5pdHRlc3QuVGVzdFBhY2tlZEV4dGVuc2lvbnMY", + "ZCADKAJCAhABOkwKF3BhY2tlZF9kb3VibGVfZXh0ZW5zaW9uEicucHJvdG9i", + "dWZfdW5pdHRlc3QuVGVzdFBhY2tlZEV4dGVuc2lvbnMYZSADKAFCAhABOkoK", + "FXBhY2tlZF9ib29sX2V4dGVuc2lvbhInLnByb3RvYnVmX3VuaXR0ZXN0LlRl", + "c3RQYWNrZWRFeHRlbnNpb25zGGYgAygIQgIQATpqChVwYWNrZWRfZW51bV9l", + "eHRlbnNpb24SJy5wcm90b2J1Zl91bml0dGVzdC5UZXN0UGFja2VkRXh0ZW5z", + "aW9ucxhnIAMoDjIeLnByb3RvYnVmX3VuaXR0ZXN0LkZvcmVpZ25FbnVtQgIQ", + "AUJTQg1Vbml0dGVzdFByb3RvSAGAAQGIAQGQAQHCPjYKIUdvb2dsZS5Qcm90", + "b2NvbEJ1ZmZlcnMuVGVzdFByb3RvcxIRVW5pdFRlc3RQcm90b0ZpbGU=")); + pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) { + descriptor = root; + internal__static_protobuf_unittest_TestAllTypes__Descriptor = Descriptor.MessageTypes[0]; + internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes__Descriptor, + new string[] { "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalGroup", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalImportMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalImportEnum", "OptionalStringPiece", "OptionalCord", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedGroup", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedImportMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedImportEnum", "RepeatedStringPiece", "RepeatedCord", "DefaultInt32", "DefaultInt64", "DefaultUint32", "DefaultUint64", "DefaultSint32", "DefaultSint64", "DefaultFixed32", "DefaultFixed64", "DefaultSfixed32", "DefaultSfixed64", "DefaultFloat", "DefaultDouble", "DefaultBool", "DefaultString", "DefaultBytes", "DefaultNestedEnum", "DefaultForeignEnum", "DefaultImportEnum", "DefaultStringPiece", "DefaultCord", }); + internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor = internal__static_protobuf_unittest_TestAllTypes__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor, + new string[] { "Bb", }); + internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor = internal__static_protobuf_unittest_TestAllTypes__Descriptor.NestedTypes[1]; + internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor = internal__static_protobuf_unittest_TestAllTypes__Descriptor.NestedTypes[2]; + internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor = Descriptor.MessageTypes[1]; + internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor, + new string[] { "DeprecatedInt32", }); + internal__static_protobuf_unittest_ForeignMessage__Descriptor = Descriptor.MessageTypes[2]; + internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_ForeignMessage__Descriptor, + new string[] { "C", }); + internal__static_protobuf_unittest_TestAllExtensions__Descriptor = Descriptor.MessageTypes[3]; + internal__static_protobuf_unittest_TestAllExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestAllExtensions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor = Descriptor.MessageTypes[4]; + internal__static_protobuf_unittest_OptionalGroup_extension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor = Descriptor.MessageTypes[5]; + internal__static_protobuf_unittest_RepeatedGroup_extension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestNestedExtension__Descriptor = Descriptor.MessageTypes[6]; + internal__static_protobuf_unittest_TestNestedExtension__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestNestedExtension__Descriptor, + new string[] { }); + global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Test = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Descriptor.Extensions[0]); + internal__static_protobuf_unittest_TestRequired__Descriptor = Descriptor.MessageTypes[7]; + internal__static_protobuf_unittest_TestRequired__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRequired__Descriptor, + new string[] { "A", "Dummy2", "B", "Dummy4", "Dummy5", "Dummy6", "Dummy7", "Dummy8", "Dummy9", "Dummy10", "Dummy11", "Dummy12", "Dummy13", "Dummy14", "Dummy15", "Dummy16", "Dummy17", "Dummy18", "Dummy19", "Dummy20", "Dummy21", "Dummy22", "Dummy23", "Dummy24", "Dummy25", "Dummy26", "Dummy27", "Dummy28", "Dummy29", "Dummy30", "Dummy31", "Dummy32", "C", }); + global::Google.ProtocolBuffers.TestProtos.TestRequired.Single = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestRequired.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.TestRequired.Multi = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.TestRequired.Descriptor.Extensions[1]); + internal__static_protobuf_unittest_TestRequiredForeign__Descriptor = Descriptor.MessageTypes[8]; + internal__static_protobuf_unittest_TestRequiredForeign__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRequiredForeign__Descriptor, + new string[] { "OptionalMessage", "RepeatedMessage", "Dummy", }); + internal__static_protobuf_unittest_TestForeignNested__Descriptor = Descriptor.MessageTypes[9]; + internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestForeignNested__Descriptor, + new string[] { "ForeignNested", }); + internal__static_protobuf_unittest_TestEmptyMessage__Descriptor = Descriptor.MessageTypes[10]; + internal__static_protobuf_unittest_TestEmptyMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestEmptyMessage__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor = Descriptor.MessageTypes[11]; + internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor = Descriptor.MessageTypes[12]; + internal__static_protobuf_unittest_TestMultipleExtensionRanges__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor = Descriptor.MessageTypes[13]; + internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor, + new string[] { "A", "Bb", }); + internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor = Descriptor.MessageTypes[14]; + internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor, + new string[] { "A", "I", }); + internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor = Descriptor.MessageTypes[15]; + internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor, + new string[] { "Bb", }); + internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor = Descriptor.MessageTypes[16]; + internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor, + new string[] { "A", "OptionalInt32", }); + internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor = Descriptor.MessageTypes[17]; + internal__static_protobuf_unittest_TestDupFieldNumber__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor, + new string[] { "A", "Foo", "Bar", }); + internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor = internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestDupFieldNumber_Foo__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor = internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor.NestedTypes[1]; + internal__static_protobuf_unittest_TestDupFieldNumber_Bar__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor, + new string[] { "A", }); + internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor = Descriptor.MessageTypes[18]; + internal__static_protobuf_unittest_TestNestedMessageHasBits__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor, + new string[] { "OptionalNestedMessage", }); + internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor = internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor, + new string[] { "NestedmessageRepeatedInt32", "NestedmessageRepeatedForeignmessage", }); + internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor = Descriptor.MessageTypes[19]; + internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor, + new string[] { "PrimitiveField", "StringField", "EnumField", "MessageField", "StringPieceField", "CordField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedStringPieceField", "RepeatedCordField", }); + internal__static_protobuf_unittest_TestFieldOrderings__Descriptor = Descriptor.MessageTypes[20]; + internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestFieldOrderings__Descriptor, + new string[] { "MyString", "MyInt", "MyFloat", }); + internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor = Descriptor.MessageTypes[21]; + internal__static_protobuf_unittest_TestExtremeDefaultValues__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor, + new string[] { "EscapedBytes", "LargeUint32", "LargeUint64", "SmallInt32", "SmallInt64", "Utf8String", "ZeroFloat", "OneFloat", "SmallFloat", "NegativeOneFloat", "NegativeFloat", "LargeFloat", "SmallNegativeFloat", "InfDouble", "NegInfDouble", "NanDouble", "InfFloat", "NegInfFloat", "NanFloat", "CppTrigraph", }); + internal__static_protobuf_unittest_SparseEnumMessage__Descriptor = Descriptor.MessageTypes[22]; + internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_SparseEnumMessage__Descriptor, + new string[] { "SparseEnum", }); + internal__static_protobuf_unittest_OneString__Descriptor = Descriptor.MessageTypes[23]; + internal__static_protobuf_unittest_OneString__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OneString__Descriptor, + new string[] { "Data", }); + internal__static_protobuf_unittest_OneBytes__Descriptor = Descriptor.MessageTypes[24]; + internal__static_protobuf_unittest_OneBytes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_OneBytes__Descriptor, + new string[] { "Data", }); + internal__static_protobuf_unittest_TestPackedTypes__Descriptor = Descriptor.MessageTypes[25]; + internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestPackedTypes__Descriptor, + new string[] { "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedEnum", }); + internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor = Descriptor.MessageTypes[26]; + internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor, + new string[] { "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedEnum", }); + internal__static_protobuf_unittest_TestPackedExtensions__Descriptor = Descriptor.MessageTypes[27]; + internal__static_protobuf_unittest_TestPackedExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestPackedExtensions__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor = Descriptor.MessageTypes[28]; + internal__static_protobuf_unittest_TestDynamicExtensions__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor, + new string[] { "ScalarExtension", "EnumExtension", "DynamicEnumExtension", "MessageExtension", "DynamicMessageExtension", "RepeatedExtension", "PackedExtension", }); + internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor = internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor.NestedTypes[0]; + internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor, + new string[] { "DynamicField", }); + internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor = Descriptor.MessageTypes[29]; + internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor, + new string[] { "RepeatedFixed32", "RepeatedInt32", "RepeatedFixed64", "RepeatedInt64", "RepeatedFloat", "RepeatedUint64", }); + internal__static_protobuf_unittest_FooRequest__Descriptor = Descriptor.MessageTypes[30]; + internal__static_protobuf_unittest_FooRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_FooRequest__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_FooResponse__Descriptor = Descriptor.MessageTypes[31]; + internal__static_protobuf_unittest_FooResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_FooResponse__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_BarRequest__Descriptor = Descriptor.MessageTypes[32]; + internal__static_protobuf_unittest_BarRequest__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_BarRequest__Descriptor, + new string[] { }); + internal__static_protobuf_unittest_BarResponse__Descriptor = Descriptor.MessageTypes[33]; + internal__static_protobuf_unittest_BarResponse__FieldAccessorTable = + new pb::FieldAccess.FieldAccessorTable(internal__static_protobuf_unittest_BarResponse__Descriptor, + new string[] { }); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[0]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalInt64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[1]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[2]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalUint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[3]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[4]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[5]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[6]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[7]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[8]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalSfixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[9]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalFloatExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[10]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalDoubleExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[11]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBoolExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[12]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[13]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalBytesExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[14]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalGroupExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[15]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedMessageExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[16]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignMessageExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[17]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportMessageExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[18]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalNestedEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[19]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalForeignEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[20]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalImportEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[21]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalStringPieceExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[22]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.OptionalCordExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[23]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[24]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedInt64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[25]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[26]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedUint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[27]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[28]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[29]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[30]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[31]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[32]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedSfixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[33]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedFloatExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[34]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedDoubleExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[35]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBoolExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[36]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[37]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedBytesExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[38]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedGroupExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[39]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedMessageExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[40]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignMessageExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[41]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportMessageExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[42]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedNestedEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[43]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedForeignEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[44]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedImportEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[45]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedStringPieceExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[46]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.RepeatedCordExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[47]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[48]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultInt64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[49]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[50]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultUint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[51]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[52]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSint64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[53]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[54]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[55]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed32Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[56]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultSfixed64Extension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[57]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultFloatExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[58]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultDoubleExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[59]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBoolExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[60]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[61]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultBytesExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[62]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultNestedEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[63]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultForeignEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[64]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultImportEnumExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[65]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultStringPieceExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[66]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.DefaultCordExtension = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[67]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionString = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[68]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.MyExtensionInt = pb::GeneratedSingleExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[69]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[70]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedInt64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[71]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[72]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedUint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[73]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[74]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSint64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[75]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[76]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[77]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed32Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[78]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedSfixed64Extension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[79]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedFloatExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[80]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedDoubleExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[81]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedBoolExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[82]); + global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.PackedEnumExtension = pb::GeneratedRepeatExtension.CreateInstance(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor.Extensions[83]); + pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance(); + RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.RegisterAllExtensions(registry); + global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.RegisterAllExtensions(registry); + return registry; + }; + pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData, + new pbd::FileDescriptor[] { + global::Google.ProtocolBuffers.DescriptorProtos.CSharpOptions.Descriptor, + global::Google.ProtocolBuffers.TestProtos.UnitTestImportProtoFile.Descriptor, + }, assigner); + } + #endregion + + } + #region Enums + public enum ForeignEnum { + FOREIGN_FOO = 4, + FOREIGN_BAR = 5, + FOREIGN_BAZ = 6, + } + + public enum TestEnumWithDupValue { + FOO1 = 1, + BAR1 = 2, + BAZ = 3, + FOO2 = 1, + BAR2 = 2, + } + + public enum TestSparseEnum { + SPARSE_A = 123, + SPARSE_B = 62374, + SPARSE_C = 12589234, + SPARSE_D = -15, + SPARSE_E = -53452, + SPARSE_F = 0, + SPARSE_G = 2, + } + + #endregion + + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestAllTypes : pb::GeneratedMessage { + private TestAllTypes() { } + private static readonly TestAllTypes defaultInstance = new TestAllTypes().MakeReadOnly(); + private static readonly string[] _testAllTypesFieldNames = new string[] { "default_bool", "default_bytes", "default_cord", "default_double", "default_fixed32", "default_fixed64", "default_float", "default_foreign_enum", "default_import_enum", "default_int32", "default_int64", "default_nested_enum", "default_sfixed32", "default_sfixed64", "default_sint32", "default_sint64", "default_string", "default_string_piece", "default_uint32", "default_uint64", "optional_bool", "optional_bytes", "optional_cord", "optional_double", "optional_fixed32", "optional_fixed64", "optional_float", "optional_foreign_enum", "optional_foreign_message", "optional_import_enum", "optional_import_message", "optional_int32", "optional_int64", "optional_nested_enum", "optional_nested_message", "optional_sfixed32", "optional_sfixed64", "optional_sint32", "optional_sint64", "optional_string", "optional_string_piece", "optional_uint32", "optional_uint64", "optionalgroup", "repeated_bool", "repeated_bytes", "repeated_cord", "repeated_double", "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_foreign_enum", "repeated_foreign_message", "repeated_import_enum", "repeated_import_message", "repeated_int32", "repeated_int64", "repeated_nested_enum", "repeated_nested_message", "repeated_sfixed32", "repeated_sfixed64", "repeated_sint32", "repeated_sint64", "repeated_string", "repeated_string_piece", "repeated_uint32", "repeated_uint64", "repeatedgroup" }; + private static readonly uint[] _testAllTypesFieldTags = new uint[] { 584, 602, 682, 577, 541, 545, 573, 656, 664, 488, 496, 648, 557, 561, 520, 528, 594, 674, 504, 512, 104, 122, 202, 97, 61, 65, 93, 176, 154, 184, 162, 8, 16, 168, 146, 77, 81, 40, 48, 114, 194, 24, 32, 131, 344, 362, 442, 337, 301, 305, 333, 416, 394, 424, 402, 248, 256, 408, 386, 317, 321, 280, 288, 354, 434, 264, 272, 371 }; + public static TestAllTypes DefaultInstance { + get { return defaultInstance; } + } + + public override TestAllTypes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestAllTypes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum NestedEnum { + FOO = 1, + BAR = 2, + BAZ = 3, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); + private static readonly string[] _nestedMessageFieldNames = new string[] { "bb" }; + private static readonly uint[] _nestedMessageFieldTags = new uint[] { 8 }; + public static NestedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override NestedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NestedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_NestedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_NestedMessage__FieldAccessorTable; } + } + + public const int BbFieldNumber = 1; + private bool hasBb; + private int bb_; + public bool HasBb { + get { return hasBb; } + } + public int Bb { + get { return bb_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _nestedMessageFieldNames; + if (hasBb) { + output.WriteInt32(1, field_names[0], Bb); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasBb) { + size += pb::CodedOutputStream.ComputeInt32Size(1, Bb); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static NestedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NestedMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NestedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (resultIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NestedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Descriptor; } + } + + public override NestedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } + } + + public override NestedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NestedMessage) { + return MergeFrom((NestedMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NestedMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasBb) { + Bb = other.Bb; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_nestedMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _nestedMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasBb = input.ReadInt32(ref result.bb_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasBb { + get { return result.hasBb; } + } + public int Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(int value) { + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = 0; + return this; + } + } + static NestedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OptionalGroup : pb::GeneratedMessage { + private OptionalGroup() { } + private static readonly OptionalGroup defaultInstance = new OptionalGroup().MakeReadOnly(); + private static readonly string[] _optionalGroupFieldNames = new string[] { "a" }; + private static readonly uint[] _optionalGroupFieldTags = new uint[] { 136 }; + public static OptionalGroup DefaultInstance { + get { return defaultInstance; } + } + + public override OptionalGroup DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OptionalGroup ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_OptionalGroup__FieldAccessorTable; } + } + + public const int AFieldNumber = 17; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _optionalGroupFieldNames; + if (hasA) { + output.WriteInt32(17, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(17, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OptionalGroup ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OptionalGroup ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OptionalGroup MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OptionalGroup prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OptionalGroup cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OptionalGroup result; + + private OptionalGroup PrepareBuilder() { + if (resultIsReadOnly) { + OptionalGroup original = result; + result = new OptionalGroup(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OptionalGroup MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Descriptor; } + } + + public override OptionalGroup DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; } + } + + public override OptionalGroup BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OptionalGroup) { + return MergeFrom((OptionalGroup) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OptionalGroup other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_optionalGroupFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _optionalGroupFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 136: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static OptionalGroup() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RepeatedGroup : pb::GeneratedMessage { + private RepeatedGroup() { } + private static readonly RepeatedGroup defaultInstance = new RepeatedGroup().MakeReadOnly(); + private static readonly string[] _repeatedGroupFieldNames = new string[] { "a" }; + private static readonly uint[] _repeatedGroupFieldTags = new uint[] { 376 }; + public static RepeatedGroup DefaultInstance { + get { return defaultInstance; } + } + + public override RepeatedGroup DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RepeatedGroup ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllTypes_RepeatedGroup__FieldAccessorTable; } + } + + public const int AFieldNumber = 47; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _repeatedGroupFieldNames; + if (hasA) { + output.WriteInt32(47, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(47, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static RepeatedGroup ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RepeatedGroup ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RepeatedGroup MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RepeatedGroup prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RepeatedGroup cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RepeatedGroup result; + + private RepeatedGroup PrepareBuilder() { + if (resultIsReadOnly) { + RepeatedGroup original = result; + result = new RepeatedGroup(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RepeatedGroup MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Descriptor; } + } + + public override RepeatedGroup DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance; } + } + + public override RepeatedGroup BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is RepeatedGroup) { + return MergeFrom((RepeatedGroup) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RepeatedGroup other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_repeatedGroupFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _repeatedGroupFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 376: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static RepeatedGroup() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int OptionalInt32FieldNumber = 1; + private bool hasOptionalInt32; + private int optionalInt32_; + public bool HasOptionalInt32 { + get { return hasOptionalInt32; } + } + public int OptionalInt32 { + get { return optionalInt32_; } + } + + public const int OptionalInt64FieldNumber = 2; + private bool hasOptionalInt64; + private long optionalInt64_; + public bool HasOptionalInt64 { + get { return hasOptionalInt64; } + } + public long OptionalInt64 { + get { return optionalInt64_; } + } + + public const int OptionalUint32FieldNumber = 3; + private bool hasOptionalUint32; + private uint optionalUint32_; + public bool HasOptionalUint32 { + get { return hasOptionalUint32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalUint32 { + get { return optionalUint32_; } + } + + public const int OptionalUint64FieldNumber = 4; + private bool hasOptionalUint64; + private ulong optionalUint64_; + public bool HasOptionalUint64 { + get { return hasOptionalUint64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalUint64 { + get { return optionalUint64_; } + } + + public const int OptionalSint32FieldNumber = 5; + private bool hasOptionalSint32; + private int optionalSint32_; + public bool HasOptionalSint32 { + get { return hasOptionalSint32; } + } + public int OptionalSint32 { + get { return optionalSint32_; } + } + + public const int OptionalSint64FieldNumber = 6; + private bool hasOptionalSint64; + private long optionalSint64_; + public bool HasOptionalSint64 { + get { return hasOptionalSint64; } + } + public long OptionalSint64 { + get { return optionalSint64_; } + } + + public const int OptionalFixed32FieldNumber = 7; + private bool hasOptionalFixed32; + private uint optionalFixed32_; + public bool HasOptionalFixed32 { + get { return hasOptionalFixed32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalFixed32 { + get { return optionalFixed32_; } + } + + public const int OptionalFixed64FieldNumber = 8; + private bool hasOptionalFixed64; + private ulong optionalFixed64_; + public bool HasOptionalFixed64 { + get { return hasOptionalFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalFixed64 { + get { return optionalFixed64_; } + } + + public const int OptionalSfixed32FieldNumber = 9; + private bool hasOptionalSfixed32; + private int optionalSfixed32_; + public bool HasOptionalSfixed32 { + get { return hasOptionalSfixed32; } + } + public int OptionalSfixed32 { + get { return optionalSfixed32_; } + } + + public const int OptionalSfixed64FieldNumber = 10; + private bool hasOptionalSfixed64; + private long optionalSfixed64_; + public bool HasOptionalSfixed64 { + get { return hasOptionalSfixed64; } + } + public long OptionalSfixed64 { + get { return optionalSfixed64_; } + } + + public const int OptionalFloatFieldNumber = 11; + private bool hasOptionalFloat; + private float optionalFloat_; + public bool HasOptionalFloat { + get { return hasOptionalFloat; } + } + public float OptionalFloat { + get { return optionalFloat_; } + } + + public const int OptionalDoubleFieldNumber = 12; + private bool hasOptionalDouble; + private double optionalDouble_; + public bool HasOptionalDouble { + get { return hasOptionalDouble; } + } + public double OptionalDouble { + get { return optionalDouble_; } + } + + public const int OptionalBoolFieldNumber = 13; + private bool hasOptionalBool; + private bool optionalBool_; + public bool HasOptionalBool { + get { return hasOptionalBool; } + } + public bool OptionalBool { + get { return optionalBool_; } + } + + public const int OptionalStringFieldNumber = 14; + private bool hasOptionalString; + private string optionalString_ = ""; + public bool HasOptionalString { + get { return hasOptionalString; } + } + public string OptionalString { + get { return optionalString_; } + } + + public const int OptionalBytesFieldNumber = 15; + private bool hasOptionalBytes; + private pb::ByteString optionalBytes_ = pb::ByteString.Empty; + public bool HasOptionalBytes { + get { return hasOptionalBytes; } + } + public pb::ByteString OptionalBytes { + get { return optionalBytes_; } + } + + public const int OptionalGroupFieldNumber = 16; + private bool hasOptionalGroup; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup optionalGroup_; + public bool HasOptionalGroup { + get { return hasOptionalGroup; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup OptionalGroup { + get { return optionalGroup_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance; } + } + + public const int OptionalNestedMessageFieldNumber = 18; + private bool hasOptionalNestedMessage; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage optionalNestedMessage_; + public bool HasOptionalNestedMessage { + get { return hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage OptionalNestedMessage { + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } + } + + public const int OptionalForeignMessageFieldNumber = 19; + private bool hasOptionalForeignMessage; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage optionalForeignMessage_; + public bool HasOptionalForeignMessage { + get { return hasOptionalForeignMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage OptionalForeignMessage { + get { return optionalForeignMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public const int OptionalImportMessageFieldNumber = 20; + private bool hasOptionalImportMessage; + private global::Google.ProtocolBuffers.TestProtos.ImportMessage optionalImportMessage_; + public bool HasOptionalImportMessage { + get { return hasOptionalImportMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage OptionalImportMessage { + get { return optionalImportMessage_ ?? global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance; } + } + + public const int OptionalNestedEnumFieldNumber = 21; + private bool hasOptionalNestedEnum; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.FOO; + public bool HasOptionalNestedEnum { + get { return hasOptionalNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum OptionalNestedEnum { + get { return optionalNestedEnum_; } + } + + public const int OptionalForeignEnumFieldNumber = 22; + private bool hasOptionalForeignEnum; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + public bool HasOptionalForeignEnum { + get { return hasOptionalForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum OptionalForeignEnum { + get { return optionalForeignEnum_; } + } + + public const int OptionalImportEnumFieldNumber = 23; + private bool hasOptionalImportEnum; + private global::Google.ProtocolBuffers.TestProtos.ImportEnum optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_FOO; + public bool HasOptionalImportEnum { + get { return hasOptionalImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum OptionalImportEnum { + get { return optionalImportEnum_; } + } + + public const int OptionalStringPieceFieldNumber = 24; + private bool hasOptionalStringPiece; + private string optionalStringPiece_ = ""; + public bool HasOptionalStringPiece { + get { return hasOptionalStringPiece; } + } + public string OptionalStringPiece { + get { return optionalStringPiece_; } + } + + public const int OptionalCordFieldNumber = 25; + private bool hasOptionalCord; + private string optionalCord_ = ""; + public bool HasOptionalCord { + get { return hasOptionalCord; } + } + public string OptionalCord { + get { return optionalCord_; } + } + + public const int RepeatedInt32FieldNumber = 31; + private pbc::PopsicleList repeatedInt32_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt32List { + get { return pbc::Lists.AsReadOnly(repeatedInt32_); } + } + public int RepeatedInt32Count { + get { return repeatedInt32_.Count; } + } + public int GetRepeatedInt32(int index) { + return repeatedInt32_[index]; + } + + public const int RepeatedInt64FieldNumber = 32; + private pbc::PopsicleList repeatedInt64_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt64List { + get { return pbc::Lists.AsReadOnly(repeatedInt64_); } + } + public int RepeatedInt64Count { + get { return repeatedInt64_.Count; } + } + public long GetRepeatedInt64(int index) { + return repeatedInt64_[index]; + } + + public const int RepeatedUint32FieldNumber = 33; + private pbc::PopsicleList repeatedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint32List { + get { return pbc::Lists.AsReadOnly(repeatedUint32_); } + } + public int RepeatedUint32Count { + get { return repeatedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedUint32(int index) { + return repeatedUint32_[index]; + } + + public const int RepeatedUint64FieldNumber = 34; + private pbc::PopsicleList repeatedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint64List { + get { return pbc::Lists.AsReadOnly(repeatedUint64_); } + } + public int RepeatedUint64Count { + get { return repeatedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return repeatedUint64_[index]; + } + + public const int RepeatedSint32FieldNumber = 35; + private pbc::PopsicleList repeatedSint32_ = new pbc::PopsicleList(); + public scg::IList RepeatedSint32List { + get { return pbc::Lists.AsReadOnly(repeatedSint32_); } + } + public int RepeatedSint32Count { + get { return repeatedSint32_.Count; } + } + public int GetRepeatedSint32(int index) { + return repeatedSint32_[index]; + } + + public const int RepeatedSint64FieldNumber = 36; + private pbc::PopsicleList repeatedSint64_ = new pbc::PopsicleList(); + public scg::IList RepeatedSint64List { + get { return pbc::Lists.AsReadOnly(repeatedSint64_); } + } + public int RepeatedSint64Count { + get { return repeatedSint64_.Count; } + } + public long GetRepeatedSint64(int index) { + return repeatedSint64_[index]; + } + + public const int RepeatedFixed32FieldNumber = 37; + private pbc::PopsicleList repeatedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed32List { + get { return pbc::Lists.AsReadOnly(repeatedFixed32_); } + } + public int RepeatedFixed32Count { + get { return repeatedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return repeatedFixed32_[index]; + } + + public const int RepeatedFixed64FieldNumber = 38; + private pbc::PopsicleList repeatedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed64List { + get { return pbc::Lists.AsReadOnly(repeatedFixed64_); } + } + public int RepeatedFixed64Count { + get { return repeatedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return repeatedFixed64_[index]; + } + + public const int RepeatedSfixed32FieldNumber = 39; + private pbc::PopsicleList repeatedSfixed32_ = new pbc::PopsicleList(); + public scg::IList RepeatedSfixed32List { + get { return pbc::Lists.AsReadOnly(repeatedSfixed32_); } + } + public int RepeatedSfixed32Count { + get { return repeatedSfixed32_.Count; } + } + public int GetRepeatedSfixed32(int index) { + return repeatedSfixed32_[index]; + } + + public const int RepeatedSfixed64FieldNumber = 40; + private pbc::PopsicleList repeatedSfixed64_ = new pbc::PopsicleList(); + public scg::IList RepeatedSfixed64List { + get { return pbc::Lists.AsReadOnly(repeatedSfixed64_); } + } + public int RepeatedSfixed64Count { + get { return repeatedSfixed64_.Count; } + } + public long GetRepeatedSfixed64(int index) { + return repeatedSfixed64_[index]; + } + + public const int RepeatedFloatFieldNumber = 41; + private pbc::PopsicleList repeatedFloat_ = new pbc::PopsicleList(); + public scg::IList RepeatedFloatList { + get { return pbc::Lists.AsReadOnly(repeatedFloat_); } + } + public int RepeatedFloatCount { + get { return repeatedFloat_.Count; } + } + public float GetRepeatedFloat(int index) { + return repeatedFloat_[index]; + } + + public const int RepeatedDoubleFieldNumber = 42; + private pbc::PopsicleList repeatedDouble_ = new pbc::PopsicleList(); + public scg::IList RepeatedDoubleList { + get { return pbc::Lists.AsReadOnly(repeatedDouble_); } + } + public int RepeatedDoubleCount { + get { return repeatedDouble_.Count; } + } + public double GetRepeatedDouble(int index) { + return repeatedDouble_[index]; + } + + public const int RepeatedBoolFieldNumber = 43; + private pbc::PopsicleList repeatedBool_ = new pbc::PopsicleList(); + public scg::IList RepeatedBoolList { + get { return pbc::Lists.AsReadOnly(repeatedBool_); } + } + public int RepeatedBoolCount { + get { return repeatedBool_.Count; } + } + public bool GetRepeatedBool(int index) { + return repeatedBool_[index]; + } + + public const int RepeatedStringFieldNumber = 44; + private pbc::PopsicleList repeatedString_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringList { + get { return pbc::Lists.AsReadOnly(repeatedString_); } + } + public int RepeatedStringCount { + get { return repeatedString_.Count; } + } + public string GetRepeatedString(int index) { + return repeatedString_[index]; + } + + public const int RepeatedBytesFieldNumber = 45; + private pbc::PopsicleList repeatedBytes_ = new pbc::PopsicleList(); + public scg::IList RepeatedBytesList { + get { return pbc::Lists.AsReadOnly(repeatedBytes_); } + } + public int RepeatedBytesCount { + get { return repeatedBytes_.Count; } + } + public pb::ByteString GetRepeatedBytes(int index) { + return repeatedBytes_[index]; + } + + public const int RepeatedGroupFieldNumber = 46; + private pbc::PopsicleList repeatedGroup_ = new pbc::PopsicleList(); + public scg::IList RepeatedGroupList { + get { return repeatedGroup_; } + } + public int RepeatedGroupCount { + get { return repeatedGroup_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup GetRepeatedGroup(int index) { + return repeatedGroup_[index]; + } + + public const int RepeatedNestedMessageFieldNumber = 48; + private pbc::PopsicleList repeatedNestedMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedNestedMessageList { + get { return repeatedNestedMessage_; } + } + public int RepeatedNestedMessageCount { + get { return repeatedNestedMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage GetRepeatedNestedMessage(int index) { + return repeatedNestedMessage_[index]; + } + + public const int RepeatedForeignMessageFieldNumber = 49; + private pbc::PopsicleList repeatedForeignMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedForeignMessageList { + get { return repeatedForeignMessage_; } + } + public int RepeatedForeignMessageCount { + get { return repeatedForeignMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedForeignMessage(int index) { + return repeatedForeignMessage_[index]; + } + + public const int RepeatedImportMessageFieldNumber = 50; + private pbc::PopsicleList repeatedImportMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedImportMessageList { + get { return repeatedImportMessage_; } + } + public int RepeatedImportMessageCount { + get { return repeatedImportMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage GetRepeatedImportMessage(int index) { + return repeatedImportMessage_[index]; + } + + public const int RepeatedNestedEnumFieldNumber = 51; + private pbc::PopsicleList repeatedNestedEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedNestedEnumList { + get { return pbc::Lists.AsReadOnly(repeatedNestedEnum_); } + } + public int RepeatedNestedEnumCount { + get { return repeatedNestedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum GetRepeatedNestedEnum(int index) { + return repeatedNestedEnum_[index]; + } + + public const int RepeatedForeignEnumFieldNumber = 52; + private pbc::PopsicleList repeatedForeignEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedForeignEnumList { + get { return pbc::Lists.AsReadOnly(repeatedForeignEnum_); } + } + public int RepeatedForeignEnumCount { + get { return repeatedForeignEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedForeignEnum(int index) { + return repeatedForeignEnum_[index]; + } + + public const int RepeatedImportEnumFieldNumber = 53; + private pbc::PopsicleList repeatedImportEnum_ = new pbc::PopsicleList(); + public scg::IList RepeatedImportEnumList { + get { return pbc::Lists.AsReadOnly(repeatedImportEnum_); } + } + public int RepeatedImportEnumCount { + get { return repeatedImportEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum GetRepeatedImportEnum(int index) { + return repeatedImportEnum_[index]; + } + + public const int RepeatedStringPieceFieldNumber = 54; + private pbc::PopsicleList repeatedStringPiece_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringPieceList { + get { return pbc::Lists.AsReadOnly(repeatedStringPiece_); } + } + public int RepeatedStringPieceCount { + get { return repeatedStringPiece_.Count; } + } + public string GetRepeatedStringPiece(int index) { + return repeatedStringPiece_[index]; + } + + public const int RepeatedCordFieldNumber = 55; + private pbc::PopsicleList repeatedCord_ = new pbc::PopsicleList(); + public scg::IList RepeatedCordList { + get { return pbc::Lists.AsReadOnly(repeatedCord_); } + } + public int RepeatedCordCount { + get { return repeatedCord_.Count; } + } + public string GetRepeatedCord(int index) { + return repeatedCord_[index]; + } + + public const int DefaultInt32FieldNumber = 61; + private bool hasDefaultInt32; + private int defaultInt32_ = 41; + public bool HasDefaultInt32 { + get { return hasDefaultInt32; } + } + public int DefaultInt32 { + get { return defaultInt32_; } + } + + public const int DefaultInt64FieldNumber = 62; + private bool hasDefaultInt64; + private long defaultInt64_ = 42L; + public bool HasDefaultInt64 { + get { return hasDefaultInt64; } + } + public long DefaultInt64 { + get { return defaultInt64_; } + } + + public const int DefaultUint32FieldNumber = 63; + private bool hasDefaultUint32; + private uint defaultUint32_ = 43; + public bool HasDefaultUint32 { + get { return hasDefaultUint32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultUint32 { + get { return defaultUint32_; } + } + + public const int DefaultUint64FieldNumber = 64; + private bool hasDefaultUint64; + private ulong defaultUint64_ = 44UL; + public bool HasDefaultUint64 { + get { return hasDefaultUint64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultUint64 { + get { return defaultUint64_; } + } + + public const int DefaultSint32FieldNumber = 65; + private bool hasDefaultSint32; + private int defaultSint32_ = -45; + public bool HasDefaultSint32 { + get { return hasDefaultSint32; } + } + public int DefaultSint32 { + get { return defaultSint32_; } + } + + public const int DefaultSint64FieldNumber = 66; + private bool hasDefaultSint64; + private long defaultSint64_ = 46; + public bool HasDefaultSint64 { + get { return hasDefaultSint64; } + } + public long DefaultSint64 { + get { return defaultSint64_; } + } + + public const int DefaultFixed32FieldNumber = 67; + private bool hasDefaultFixed32; + private uint defaultFixed32_ = 47; + public bool HasDefaultFixed32 { + get { return hasDefaultFixed32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultFixed32 { + get { return defaultFixed32_; } + } + + public const int DefaultFixed64FieldNumber = 68; + private bool hasDefaultFixed64; + private ulong defaultFixed64_ = 48; + public bool HasDefaultFixed64 { + get { return hasDefaultFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultFixed64 { + get { return defaultFixed64_; } + } + + public const int DefaultSfixed32FieldNumber = 69; + private bool hasDefaultSfixed32; + private int defaultSfixed32_ = 49; + public bool HasDefaultSfixed32 { + get { return hasDefaultSfixed32; } + } + public int DefaultSfixed32 { + get { return defaultSfixed32_; } + } + + public const int DefaultSfixed64FieldNumber = 70; + private bool hasDefaultSfixed64; + private long defaultSfixed64_ = -50; + public bool HasDefaultSfixed64 { + get { return hasDefaultSfixed64; } + } + public long DefaultSfixed64 { + get { return defaultSfixed64_; } + } + + public const int DefaultFloatFieldNumber = 71; + private bool hasDefaultFloat; + private float defaultFloat_ = 51.5F; + public bool HasDefaultFloat { + get { return hasDefaultFloat; } + } + public float DefaultFloat { + get { return defaultFloat_; } + } + + public const int DefaultDoubleFieldNumber = 72; + private bool hasDefaultDouble; + private double defaultDouble_ = 52000D; + public bool HasDefaultDouble { + get { return hasDefaultDouble; } + } + public double DefaultDouble { + get { return defaultDouble_; } + } + + public const int DefaultBoolFieldNumber = 73; + private bool hasDefaultBool; + private bool defaultBool_ = true; + public bool HasDefaultBool { + get { return hasDefaultBool; } + } + public bool DefaultBool { + get { return defaultBool_; } + } + + public const int DefaultStringFieldNumber = 74; + private bool hasDefaultString; + private string defaultString_ = "hello"; + public bool HasDefaultString { + get { return hasDefaultString; } + } + public string DefaultString { + get { return defaultString_; } + } + + public const int DefaultBytesFieldNumber = 75; + private bool hasDefaultBytes; + private pb::ByteString defaultBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor.Fields[62].DefaultValue; + public bool HasDefaultBytes { + get { return hasDefaultBytes; } + } + public pb::ByteString DefaultBytes { + get { return defaultBytes_; } + } + + public const int DefaultNestedEnumFieldNumber = 81; + private bool hasDefaultNestedEnum; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.BAR; + public bool HasDefaultNestedEnum { + get { return hasDefaultNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum DefaultNestedEnum { + get { return defaultNestedEnum_; } + } + + public const int DefaultForeignEnumFieldNumber = 82; + private bool hasDefaultForeignEnum; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_BAR; + public bool HasDefaultForeignEnum { + get { return hasDefaultForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum DefaultForeignEnum { + get { return defaultForeignEnum_; } + } + + public const int DefaultImportEnumFieldNumber = 83; + private bool hasDefaultImportEnum; + private global::Google.ProtocolBuffers.TestProtos.ImportEnum defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_BAR; + public bool HasDefaultImportEnum { + get { return hasDefaultImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum DefaultImportEnum { + get { return defaultImportEnum_; } + } + + public const int DefaultStringPieceFieldNumber = 84; + private bool hasDefaultStringPiece; + private string defaultStringPiece_ = "abc"; + public bool HasDefaultStringPiece { + get { return hasDefaultStringPiece; } + } + public string DefaultStringPiece { + get { return defaultStringPiece_; } + } + + public const int DefaultCordFieldNumber = 85; + private bool hasDefaultCord; + private string defaultCord_ = "123"; + public bool HasDefaultCord { + get { return hasDefaultCord; } + } + public string DefaultCord { + get { return defaultCord_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testAllTypesFieldNames; + if (hasOptionalInt32) { + output.WriteInt32(1, field_names[31], OptionalInt32); + } + if (hasOptionalInt64) { + output.WriteInt64(2, field_names[32], OptionalInt64); + } + if (hasOptionalUint32) { + output.WriteUInt32(3, field_names[41], OptionalUint32); + } + if (hasOptionalUint64) { + output.WriteUInt64(4, field_names[42], OptionalUint64); + } + if (hasOptionalSint32) { + output.WriteSInt32(5, field_names[37], OptionalSint32); + } + if (hasOptionalSint64) { + output.WriteSInt64(6, field_names[38], OptionalSint64); + } + if (hasOptionalFixed32) { + output.WriteFixed32(7, field_names[24], OptionalFixed32); + } + if (hasOptionalFixed64) { + output.WriteFixed64(8, field_names[25], OptionalFixed64); + } + if (hasOptionalSfixed32) { + output.WriteSFixed32(9, field_names[35], OptionalSfixed32); + } + if (hasOptionalSfixed64) { + output.WriteSFixed64(10, field_names[36], OptionalSfixed64); + } + if (hasOptionalFloat) { + output.WriteFloat(11, field_names[26], OptionalFloat); + } + if (hasOptionalDouble) { + output.WriteDouble(12, field_names[23], OptionalDouble); + } + if (hasOptionalBool) { + output.WriteBool(13, field_names[20], OptionalBool); + } + if (hasOptionalString) { + output.WriteString(14, field_names[39], OptionalString); + } + if (hasOptionalBytes) { + output.WriteBytes(15, field_names[21], OptionalBytes); + } + if (hasOptionalGroup) { + output.WriteGroup(16, field_names[43], OptionalGroup); + } + if (hasOptionalNestedMessage) { + output.WriteMessage(18, field_names[34], OptionalNestedMessage); + } + if (hasOptionalForeignMessage) { + output.WriteMessage(19, field_names[28], OptionalForeignMessage); + } + if (hasOptionalImportMessage) { + output.WriteMessage(20, field_names[30], OptionalImportMessage); + } + if (hasOptionalNestedEnum) { + output.WriteEnum(21, field_names[33], (int) OptionalNestedEnum, OptionalNestedEnum); + } + if (hasOptionalForeignEnum) { + output.WriteEnum(22, field_names[27], (int) OptionalForeignEnum, OptionalForeignEnum); + } + if (hasOptionalImportEnum) { + output.WriteEnum(23, field_names[29], (int) OptionalImportEnum, OptionalImportEnum); + } + if (hasOptionalStringPiece) { + output.WriteString(24, field_names[40], OptionalStringPiece); + } + if (hasOptionalCord) { + output.WriteString(25, field_names[22], OptionalCord); + } + if (repeatedInt32_.Count > 0) { + output.WriteInt32Array(31, field_names[55], repeatedInt32_); + } + if (repeatedInt64_.Count > 0) { + output.WriteInt64Array(32, field_names[56], repeatedInt64_); + } + if (repeatedUint32_.Count > 0) { + output.WriteUInt32Array(33, field_names[65], repeatedUint32_); + } + if (repeatedUint64_.Count > 0) { + output.WriteUInt64Array(34, field_names[66], repeatedUint64_); + } + if (repeatedSint32_.Count > 0) { + output.WriteSInt32Array(35, field_names[61], repeatedSint32_); + } + if (repeatedSint64_.Count > 0) { + output.WriteSInt64Array(36, field_names[62], repeatedSint64_); + } + if (repeatedFixed32_.Count > 0) { + output.WriteFixed32Array(37, field_names[48], repeatedFixed32_); + } + if (repeatedFixed64_.Count > 0) { + output.WriteFixed64Array(38, field_names[49], repeatedFixed64_); + } + if (repeatedSfixed32_.Count > 0) { + output.WriteSFixed32Array(39, field_names[59], repeatedSfixed32_); + } + if (repeatedSfixed64_.Count > 0) { + output.WriteSFixed64Array(40, field_names[60], repeatedSfixed64_); + } + if (repeatedFloat_.Count > 0) { + output.WriteFloatArray(41, field_names[50], repeatedFloat_); + } + if (repeatedDouble_.Count > 0) { + output.WriteDoubleArray(42, field_names[47], repeatedDouble_); + } + if (repeatedBool_.Count > 0) { + output.WriteBoolArray(43, field_names[44], repeatedBool_); + } + if (repeatedString_.Count > 0) { + output.WriteStringArray(44, field_names[63], repeatedString_); + } + if (repeatedBytes_.Count > 0) { + output.WriteBytesArray(45, field_names[45], repeatedBytes_); + } + if (repeatedGroup_.Count > 0) { + output.WriteGroupArray(46, field_names[67], repeatedGroup_); + } + if (repeatedNestedMessage_.Count > 0) { + output.WriteMessageArray(48, field_names[58], repeatedNestedMessage_); + } + if (repeatedForeignMessage_.Count > 0) { + output.WriteMessageArray(49, field_names[52], repeatedForeignMessage_); + } + if (repeatedImportMessage_.Count > 0) { + output.WriteMessageArray(50, field_names[54], repeatedImportMessage_); + } + if (repeatedNestedEnum_.Count > 0) { + output.WriteEnumArray(51, field_names[57], repeatedNestedEnum_); + } + if (repeatedForeignEnum_.Count > 0) { + output.WriteEnumArray(52, field_names[51], repeatedForeignEnum_); + } + if (repeatedImportEnum_.Count > 0) { + output.WriteEnumArray(53, field_names[53], repeatedImportEnum_); + } + if (repeatedStringPiece_.Count > 0) { + output.WriteStringArray(54, field_names[64], repeatedStringPiece_); + } + if (repeatedCord_.Count > 0) { + output.WriteStringArray(55, field_names[46], repeatedCord_); + } + if (hasDefaultInt32) { + output.WriteInt32(61, field_names[9], DefaultInt32); + } + if (hasDefaultInt64) { + output.WriteInt64(62, field_names[10], DefaultInt64); + } + if (hasDefaultUint32) { + output.WriteUInt32(63, field_names[18], DefaultUint32); + } + if (hasDefaultUint64) { + output.WriteUInt64(64, field_names[19], DefaultUint64); + } + if (hasDefaultSint32) { + output.WriteSInt32(65, field_names[14], DefaultSint32); + } + if (hasDefaultSint64) { + output.WriteSInt64(66, field_names[15], DefaultSint64); + } + if (hasDefaultFixed32) { + output.WriteFixed32(67, field_names[4], DefaultFixed32); + } + if (hasDefaultFixed64) { + output.WriteFixed64(68, field_names[5], DefaultFixed64); + } + if (hasDefaultSfixed32) { + output.WriteSFixed32(69, field_names[12], DefaultSfixed32); + } + if (hasDefaultSfixed64) { + output.WriteSFixed64(70, field_names[13], DefaultSfixed64); + } + if (hasDefaultFloat) { + output.WriteFloat(71, field_names[6], DefaultFloat); + } + if (hasDefaultDouble) { + output.WriteDouble(72, field_names[3], DefaultDouble); + } + if (hasDefaultBool) { + output.WriteBool(73, field_names[0], DefaultBool); + } + if (hasDefaultString) { + output.WriteString(74, field_names[16], DefaultString); + } + if (hasDefaultBytes) { + output.WriteBytes(75, field_names[1], DefaultBytes); + } + if (hasDefaultNestedEnum) { + output.WriteEnum(81, field_names[11], (int) DefaultNestedEnum, DefaultNestedEnum); + } + if (hasDefaultForeignEnum) { + output.WriteEnum(82, field_names[7], (int) DefaultForeignEnum, DefaultForeignEnum); + } + if (hasDefaultImportEnum) { + output.WriteEnum(83, field_names[8], (int) DefaultImportEnum, DefaultImportEnum); + } + if (hasDefaultStringPiece) { + output.WriteString(84, field_names[17], DefaultStringPiece); + } + if (hasDefaultCord) { + output.WriteString(85, field_names[2], DefaultCord); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(1, OptionalInt32); + } + if (hasOptionalInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(2, OptionalInt64); + } + if (hasOptionalUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(3, OptionalUint32); + } + if (hasOptionalUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(4, OptionalUint64); + } + if (hasOptionalSint32) { + size += pb::CodedOutputStream.ComputeSInt32Size(5, OptionalSint32); + } + if (hasOptionalSint64) { + size += pb::CodedOutputStream.ComputeSInt64Size(6, OptionalSint64); + } + if (hasOptionalFixed32) { + size += pb::CodedOutputStream.ComputeFixed32Size(7, OptionalFixed32); + } + if (hasOptionalFixed64) { + size += pb::CodedOutputStream.ComputeFixed64Size(8, OptionalFixed64); + } + if (hasOptionalSfixed32) { + size += pb::CodedOutputStream.ComputeSFixed32Size(9, OptionalSfixed32); + } + if (hasOptionalSfixed64) { + size += pb::CodedOutputStream.ComputeSFixed64Size(10, OptionalSfixed64); + } + if (hasOptionalFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(11, OptionalFloat); + } + if (hasOptionalDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(12, OptionalDouble); + } + if (hasOptionalBool) { + size += pb::CodedOutputStream.ComputeBoolSize(13, OptionalBool); + } + if (hasOptionalString) { + size += pb::CodedOutputStream.ComputeStringSize(14, OptionalString); + } + if (hasOptionalBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(15, OptionalBytes); + } + if (hasOptionalGroup) { + size += pb::CodedOutputStream.ComputeGroupSize(16, OptionalGroup); + } + if (hasOptionalNestedMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(18, OptionalNestedMessage); + } + if (hasOptionalForeignMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(19, OptionalForeignMessage); + } + if (hasOptionalImportMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(20, OptionalImportMessage); + } + if (hasOptionalNestedEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(21, (int) OptionalNestedEnum); + } + if (hasOptionalForeignEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(22, (int) OptionalForeignEnum); + } + if (hasOptionalImportEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(23, (int) OptionalImportEnum); + } + if (hasOptionalStringPiece) { + size += pb::CodedOutputStream.ComputeStringSize(24, OptionalStringPiece); + } + if (hasOptionalCord) { + size += pb::CodedOutputStream.ComputeStringSize(25, OptionalCord); + } + { + int dataSize = 0; + foreach (int element in RepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt32_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt64_.Count; + } + { + int dataSize = 0; + foreach (uint element in RepeatedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedUint32_.Count; + } + { + int dataSize = 0; + foreach (ulong element in RepeatedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedUint64_.Count; + } + { + int dataSize = 0; + foreach (int element in RepeatedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedSint32_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedSint64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFixed32_.Count; + size += dataSize; + size += 2 * repeatedFixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedFixed64_.Count; + size += dataSize; + size += 2 * repeatedFixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedSfixed32_.Count; + size += dataSize; + size += 2 * repeatedSfixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedSfixed64_.Count; + size += dataSize; + size += 2 * repeatedSfixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFloat_.Count; + size += dataSize; + size += 2 * repeatedFloat_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedDouble_.Count; + size += dataSize; + size += 2 * repeatedDouble_.Count; + } + { + int dataSize = 0; + dataSize = 1 * repeatedBool_.Count; + size += dataSize; + size += 2 * repeatedBool_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedStringList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedString_.Count; + } + { + int dataSize = 0; + foreach (pb::ByteString element in RepeatedBytesList) { + dataSize += pb::CodedOutputStream.ComputeBytesSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedBytes_.Count; + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup element in RepeatedGroupList) { + size += pb::CodedOutputStream.ComputeGroupSize(46, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage element in RepeatedNestedMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(48, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessage element in RepeatedForeignMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(49, element); + } + foreach (global::Google.ProtocolBuffers.TestProtos.ImportMessage element in RepeatedImportMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(50, element); + } + { + int dataSize = 0; + if (repeatedNestedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum element in repeatedNestedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedNestedEnum_.Count; + } + } + { + int dataSize = 0; + if (repeatedForeignEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in repeatedForeignEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedForeignEnum_.Count; + } + } + { + int dataSize = 0; + if (repeatedImportEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ImportEnum element in repeatedImportEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * repeatedImportEnum_.Count; + } + } + { + int dataSize = 0; + foreach (string element in RepeatedStringPieceList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedStringPiece_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedCordList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedCord_.Count; + } + if (hasDefaultInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(61, DefaultInt32); + } + if (hasDefaultInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(62, DefaultInt64); + } + if (hasDefaultUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(63, DefaultUint32); + } + if (hasDefaultUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(64, DefaultUint64); + } + if (hasDefaultSint32) { + size += pb::CodedOutputStream.ComputeSInt32Size(65, DefaultSint32); + } + if (hasDefaultSint64) { + size += pb::CodedOutputStream.ComputeSInt64Size(66, DefaultSint64); + } + if (hasDefaultFixed32) { + size += pb::CodedOutputStream.ComputeFixed32Size(67, DefaultFixed32); + } + if (hasDefaultFixed64) { + size += pb::CodedOutputStream.ComputeFixed64Size(68, DefaultFixed64); + } + if (hasDefaultSfixed32) { + size += pb::CodedOutputStream.ComputeSFixed32Size(69, DefaultSfixed32); + } + if (hasDefaultSfixed64) { + size += pb::CodedOutputStream.ComputeSFixed64Size(70, DefaultSfixed64); + } + if (hasDefaultFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(71, DefaultFloat); + } + if (hasDefaultDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(72, DefaultDouble); + } + if (hasDefaultBool) { + size += pb::CodedOutputStream.ComputeBoolSize(73, DefaultBool); + } + if (hasDefaultString) { + size += pb::CodedOutputStream.ComputeStringSize(74, DefaultString); + } + if (hasDefaultBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(75, DefaultBytes); + } + if (hasDefaultNestedEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(81, (int) DefaultNestedEnum); + } + if (hasDefaultForeignEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(82, (int) DefaultForeignEnum); + } + if (hasDefaultImportEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(83, (int) DefaultImportEnum); + } + if (hasDefaultStringPiece) { + size += pb::CodedOutputStream.ComputeStringSize(84, DefaultStringPiece); + } + if (hasDefaultCord) { + size += pb::CodedOutputStream.ComputeStringSize(85, DefaultCord); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestAllTypes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllTypes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllTypes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllTypes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllTypes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllTypes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestAllTypes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestAllTypes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestAllTypes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestAllTypes MakeReadOnly() { + repeatedInt32_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedUint32_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + repeatedSint32_.MakeReadOnly(); + repeatedSint64_.MakeReadOnly(); + repeatedFixed32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedSfixed32_.MakeReadOnly(); + repeatedSfixed64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedDouble_.MakeReadOnly(); + repeatedBool_.MakeReadOnly(); + repeatedString_.MakeReadOnly(); + repeatedBytes_.MakeReadOnly(); + repeatedGroup_.MakeReadOnly(); + repeatedNestedMessage_.MakeReadOnly(); + repeatedForeignMessage_.MakeReadOnly(); + repeatedImportMessage_.MakeReadOnly(); + repeatedNestedEnum_.MakeReadOnly(); + repeatedForeignEnum_.MakeReadOnly(); + repeatedImportEnum_.MakeReadOnly(); + repeatedStringPiece_.MakeReadOnly(); + repeatedCord_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestAllTypes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestAllTypes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestAllTypes result; + + private TestAllTypes PrepareBuilder() { + if (resultIsReadOnly) { + TestAllTypes original = result; + result = new TestAllTypes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestAllTypes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor; } + } + + public override TestAllTypes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance; } + } + + public override TestAllTypes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestAllTypes) { + return MergeFrom((TestAllTypes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestAllTypes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllTypes.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalInt32) { + OptionalInt32 = other.OptionalInt32; + } + if (other.HasOptionalInt64) { + OptionalInt64 = other.OptionalInt64; + } + if (other.HasOptionalUint32) { + OptionalUint32 = other.OptionalUint32; + } + if (other.HasOptionalUint64) { + OptionalUint64 = other.OptionalUint64; + } + if (other.HasOptionalSint32) { + OptionalSint32 = other.OptionalSint32; + } + if (other.HasOptionalSint64) { + OptionalSint64 = other.OptionalSint64; + } + if (other.HasOptionalFixed32) { + OptionalFixed32 = other.OptionalFixed32; + } + if (other.HasOptionalFixed64) { + OptionalFixed64 = other.OptionalFixed64; + } + if (other.HasOptionalSfixed32) { + OptionalSfixed32 = other.OptionalSfixed32; + } + if (other.HasOptionalSfixed64) { + OptionalSfixed64 = other.OptionalSfixed64; + } + if (other.HasOptionalFloat) { + OptionalFloat = other.OptionalFloat; + } + if (other.HasOptionalDouble) { + OptionalDouble = other.OptionalDouble; + } + if (other.HasOptionalBool) { + OptionalBool = other.OptionalBool; + } + if (other.HasOptionalString) { + OptionalString = other.OptionalString; + } + if (other.HasOptionalBytes) { + OptionalBytes = other.OptionalBytes; + } + if (other.HasOptionalGroup) { + MergeOptionalGroup(other.OptionalGroup); + } + if (other.HasOptionalNestedMessage) { + MergeOptionalNestedMessage(other.OptionalNestedMessage); + } + if (other.HasOptionalForeignMessage) { + MergeOptionalForeignMessage(other.OptionalForeignMessage); + } + if (other.HasOptionalImportMessage) { + MergeOptionalImportMessage(other.OptionalImportMessage); + } + if (other.HasOptionalNestedEnum) { + OptionalNestedEnum = other.OptionalNestedEnum; + } + if (other.HasOptionalForeignEnum) { + OptionalForeignEnum = other.OptionalForeignEnum; + } + if (other.HasOptionalImportEnum) { + OptionalImportEnum = other.OptionalImportEnum; + } + if (other.HasOptionalStringPiece) { + OptionalStringPiece = other.OptionalStringPiece; + } + if (other.HasOptionalCord) { + OptionalCord = other.OptionalCord; + } + if (other.repeatedInt32_.Count != 0) { + result.repeatedInt32_.Add(other.repeatedInt32_); + } + if (other.repeatedInt64_.Count != 0) { + result.repeatedInt64_.Add(other.repeatedInt64_); + } + if (other.repeatedUint32_.Count != 0) { + result.repeatedUint32_.Add(other.repeatedUint32_); + } + if (other.repeatedUint64_.Count != 0) { + result.repeatedUint64_.Add(other.repeatedUint64_); + } + if (other.repeatedSint32_.Count != 0) { + result.repeatedSint32_.Add(other.repeatedSint32_); + } + if (other.repeatedSint64_.Count != 0) { + result.repeatedSint64_.Add(other.repeatedSint64_); + } + if (other.repeatedFixed32_.Count != 0) { + result.repeatedFixed32_.Add(other.repeatedFixed32_); + } + if (other.repeatedFixed64_.Count != 0) { + result.repeatedFixed64_.Add(other.repeatedFixed64_); + } + if (other.repeatedSfixed32_.Count != 0) { + result.repeatedSfixed32_.Add(other.repeatedSfixed32_); + } + if (other.repeatedSfixed64_.Count != 0) { + result.repeatedSfixed64_.Add(other.repeatedSfixed64_); + } + if (other.repeatedFloat_.Count != 0) { + result.repeatedFloat_.Add(other.repeatedFloat_); + } + if (other.repeatedDouble_.Count != 0) { + result.repeatedDouble_.Add(other.repeatedDouble_); + } + if (other.repeatedBool_.Count != 0) { + result.repeatedBool_.Add(other.repeatedBool_); + } + if (other.repeatedString_.Count != 0) { + result.repeatedString_.Add(other.repeatedString_); + } + if (other.repeatedBytes_.Count != 0) { + result.repeatedBytes_.Add(other.repeatedBytes_); + } + if (other.repeatedGroup_.Count != 0) { + result.repeatedGroup_.Add(other.repeatedGroup_); + } + if (other.repeatedNestedMessage_.Count != 0) { + result.repeatedNestedMessage_.Add(other.repeatedNestedMessage_); + } + if (other.repeatedForeignMessage_.Count != 0) { + result.repeatedForeignMessage_.Add(other.repeatedForeignMessage_); + } + if (other.repeatedImportMessage_.Count != 0) { + result.repeatedImportMessage_.Add(other.repeatedImportMessage_); + } + if (other.repeatedNestedEnum_.Count != 0) { + result.repeatedNestedEnum_.Add(other.repeatedNestedEnum_); + } + if (other.repeatedForeignEnum_.Count != 0) { + result.repeatedForeignEnum_.Add(other.repeatedForeignEnum_); + } + if (other.repeatedImportEnum_.Count != 0) { + result.repeatedImportEnum_.Add(other.repeatedImportEnum_); + } + if (other.repeatedStringPiece_.Count != 0) { + result.repeatedStringPiece_.Add(other.repeatedStringPiece_); + } + if (other.repeatedCord_.Count != 0) { + result.repeatedCord_.Add(other.repeatedCord_); + } + if (other.HasDefaultInt32) { + DefaultInt32 = other.DefaultInt32; + } + if (other.HasDefaultInt64) { + DefaultInt64 = other.DefaultInt64; + } + if (other.HasDefaultUint32) { + DefaultUint32 = other.DefaultUint32; + } + if (other.HasDefaultUint64) { + DefaultUint64 = other.DefaultUint64; + } + if (other.HasDefaultSint32) { + DefaultSint32 = other.DefaultSint32; + } + if (other.HasDefaultSint64) { + DefaultSint64 = other.DefaultSint64; + } + if (other.HasDefaultFixed32) { + DefaultFixed32 = other.DefaultFixed32; + } + if (other.HasDefaultFixed64) { + DefaultFixed64 = other.DefaultFixed64; + } + if (other.HasDefaultSfixed32) { + DefaultSfixed32 = other.DefaultSfixed32; + } + if (other.HasDefaultSfixed64) { + DefaultSfixed64 = other.DefaultSfixed64; + } + if (other.HasDefaultFloat) { + DefaultFloat = other.DefaultFloat; + } + if (other.HasDefaultDouble) { + DefaultDouble = other.DefaultDouble; + } + if (other.HasDefaultBool) { + DefaultBool = other.DefaultBool; + } + if (other.HasDefaultString) { + DefaultString = other.DefaultString; + } + if (other.HasDefaultBytes) { + DefaultBytes = other.DefaultBytes; + } + if (other.HasDefaultNestedEnum) { + DefaultNestedEnum = other.DefaultNestedEnum; + } + if (other.HasDefaultForeignEnum) { + DefaultForeignEnum = other.DefaultForeignEnum; + } + if (other.HasDefaultImportEnum) { + DefaultImportEnum = other.DefaultImportEnum; + } + if (other.HasDefaultStringPiece) { + DefaultStringPiece = other.DefaultStringPiece; + } + if (other.HasDefaultCord) { + DefaultCord = other.DefaultCord; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testAllTypesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testAllTypesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasOptionalInt32 = input.ReadInt32(ref result.optionalInt32_); + break; + } + case 16: { + result.hasOptionalInt64 = input.ReadInt64(ref result.optionalInt64_); + break; + } + case 24: { + result.hasOptionalUint32 = input.ReadUInt32(ref result.optionalUint32_); + break; + } + case 32: { + result.hasOptionalUint64 = input.ReadUInt64(ref result.optionalUint64_); + break; + } + case 40: { + result.hasOptionalSint32 = input.ReadSInt32(ref result.optionalSint32_); + break; + } + case 48: { + result.hasOptionalSint64 = input.ReadSInt64(ref result.optionalSint64_); + break; + } + case 61: { + result.hasOptionalFixed32 = input.ReadFixed32(ref result.optionalFixed32_); + break; + } + case 65: { + result.hasOptionalFixed64 = input.ReadFixed64(ref result.optionalFixed64_); + break; + } + case 77: { + result.hasOptionalSfixed32 = input.ReadSFixed32(ref result.optionalSfixed32_); + break; + } + case 81: { + result.hasOptionalSfixed64 = input.ReadSFixed64(ref result.optionalSfixed64_); + break; + } + case 93: { + result.hasOptionalFloat = input.ReadFloat(ref result.optionalFloat_); + break; + } + case 97: { + result.hasOptionalDouble = input.ReadDouble(ref result.optionalDouble_); + break; + } + case 104: { + result.hasOptionalBool = input.ReadBool(ref result.optionalBool_); + break; + } + case 114: { + result.hasOptionalString = input.ReadString(ref result.optionalString_); + break; + } + case 122: { + result.hasOptionalBytes = input.ReadBytes(ref result.optionalBytes_); + break; + } + case 131: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.CreateBuilder(); + if (result.hasOptionalGroup) { + subBuilder.MergeFrom(OptionalGroup); + } + input.ReadGroup(16, subBuilder, extensionRegistry); + OptionalGroup = subBuilder.BuildPartial(); + break; + } + case 146: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(); + if (result.hasOptionalNestedMessage) { + subBuilder.MergeFrom(OptionalNestedMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalNestedMessage = subBuilder.BuildPartial(); + break; + } + case 154: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(); + if (result.hasOptionalForeignMessage) { + subBuilder.MergeFrom(OptionalForeignMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalForeignMessage = subBuilder.BuildPartial(); + break; + } + case 162: { + global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder(); + if (result.hasOptionalImportMessage) { + subBuilder.MergeFrom(OptionalImportMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalImportMessage = subBuilder.BuildPartial(); + break; + } + case 168: { + object unknown; + if(input.ReadEnum(ref result.optionalNestedEnum_, out unknown)) { + result.hasOptionalNestedEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(21, (ulong)(int)unknown); + } + break; + } + case 176: { + object unknown; + if(input.ReadEnum(ref result.optionalForeignEnum_, out unknown)) { + result.hasOptionalForeignEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(22, (ulong)(int)unknown); + } + break; + } + case 184: { + object unknown; + if(input.ReadEnum(ref result.optionalImportEnum_, out unknown)) { + result.hasOptionalImportEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(23, (ulong)(int)unknown); + } + break; + } + case 194: { + result.hasOptionalStringPiece = input.ReadString(ref result.optionalStringPiece_); + break; + } + case 202: { + result.hasOptionalCord = input.ReadString(ref result.optionalCord_); + break; + } + case 250: + case 248: { + input.ReadInt32Array(tag, field_name, result.repeatedInt32_); + break; + } + case 258: + case 256: { + input.ReadInt64Array(tag, field_name, result.repeatedInt64_); + break; + } + case 266: + case 264: { + input.ReadUInt32Array(tag, field_name, result.repeatedUint32_); + break; + } + case 274: + case 272: { + input.ReadUInt64Array(tag, field_name, result.repeatedUint64_); + break; + } + case 282: + case 280: { + input.ReadSInt32Array(tag, field_name, result.repeatedSint32_); + break; + } + case 290: + case 288: { + input.ReadSInt64Array(tag, field_name, result.repeatedSint64_); + break; + } + case 298: + case 301: { + input.ReadFixed32Array(tag, field_name, result.repeatedFixed32_); + break; + } + case 306: + case 305: { + input.ReadFixed64Array(tag, field_name, result.repeatedFixed64_); + break; + } + case 314: + case 317: { + input.ReadSFixed32Array(tag, field_name, result.repeatedSfixed32_); + break; + } + case 322: + case 321: { + input.ReadSFixed64Array(tag, field_name, result.repeatedSfixed64_); + break; + } + case 330: + case 333: { + input.ReadFloatArray(tag, field_name, result.repeatedFloat_); + break; + } + case 338: + case 337: { + input.ReadDoubleArray(tag, field_name, result.repeatedDouble_); + break; + } + case 346: + case 344: { + input.ReadBoolArray(tag, field_name, result.repeatedBool_); + break; + } + case 354: { + input.ReadStringArray(tag, field_name, result.repeatedString_); + break; + } + case 362: { + input.ReadBytesArray(tag, field_name, result.repeatedBytes_); + break; + } + case 371: { + input.ReadGroupArray(tag, field_name, result.repeatedGroup_, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.DefaultInstance, extensionRegistry); + break; + } + case 386: { + input.ReadMessageArray(tag, field_name, result.repeatedNestedMessage_, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance, extensionRegistry); + break; + } + case 394: { + input.ReadMessageArray(tag, field_name, result.repeatedForeignMessage_, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance, extensionRegistry); + break; + } + case 402: { + input.ReadMessageArray(tag, field_name, result.repeatedImportMessage_, global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance, extensionRegistry); + break; + } + case 410: + case 408: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedNestedEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(51, (ulong)(int)rawValue); + } + break; + } + case 418: + case 416: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedForeignEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(52, (ulong)(int)rawValue); + } + break; + } + case 426: + case 424: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedImportEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(53, (ulong)(int)rawValue); + } + break; + } + case 434: { + input.ReadStringArray(tag, field_name, result.repeatedStringPiece_); + break; + } + case 442: { + input.ReadStringArray(tag, field_name, result.repeatedCord_); + break; + } + case 488: { + result.hasDefaultInt32 = input.ReadInt32(ref result.defaultInt32_); + break; + } + case 496: { + result.hasDefaultInt64 = input.ReadInt64(ref result.defaultInt64_); + break; + } + case 504: { + result.hasDefaultUint32 = input.ReadUInt32(ref result.defaultUint32_); + break; + } + case 512: { + result.hasDefaultUint64 = input.ReadUInt64(ref result.defaultUint64_); + break; + } + case 520: { + result.hasDefaultSint32 = input.ReadSInt32(ref result.defaultSint32_); + break; + } + case 528: { + result.hasDefaultSint64 = input.ReadSInt64(ref result.defaultSint64_); + break; + } + case 541: { + result.hasDefaultFixed32 = input.ReadFixed32(ref result.defaultFixed32_); + break; + } + case 545: { + result.hasDefaultFixed64 = input.ReadFixed64(ref result.defaultFixed64_); + break; + } + case 557: { + result.hasDefaultSfixed32 = input.ReadSFixed32(ref result.defaultSfixed32_); + break; + } + case 561: { + result.hasDefaultSfixed64 = input.ReadSFixed64(ref result.defaultSfixed64_); + break; + } + case 573: { + result.hasDefaultFloat = input.ReadFloat(ref result.defaultFloat_); + break; + } + case 577: { + result.hasDefaultDouble = input.ReadDouble(ref result.defaultDouble_); + break; + } + case 584: { + result.hasDefaultBool = input.ReadBool(ref result.defaultBool_); + break; + } + case 594: { + result.hasDefaultString = input.ReadString(ref result.defaultString_); + break; + } + case 602: { + result.hasDefaultBytes = input.ReadBytes(ref result.defaultBytes_); + break; + } + case 648: { + object unknown; + if(input.ReadEnum(ref result.defaultNestedEnum_, out unknown)) { + result.hasDefaultNestedEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(81, (ulong)(int)unknown); + } + break; + } + case 656: { + object unknown; + if(input.ReadEnum(ref result.defaultForeignEnum_, out unknown)) { + result.hasDefaultForeignEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(82, (ulong)(int)unknown); + } + break; + } + case 664: { + object unknown; + if(input.ReadEnum(ref result.defaultImportEnum_, out unknown)) { + result.hasDefaultImportEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(83, (ulong)(int)unknown); + } + break; + } + case 674: { + result.hasDefaultStringPiece = input.ReadString(ref result.defaultStringPiece_); + break; + } + case 682: { + result.hasDefaultCord = input.ReadString(ref result.defaultCord_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalInt32 { + get { return result.hasOptionalInt32; } + } + public int OptionalInt32 { + get { return result.OptionalInt32; } + set { SetOptionalInt32(value); } + } + public Builder SetOptionalInt32(int value) { + PrepareBuilder(); + result.hasOptionalInt32 = true; + result.optionalInt32_ = value; + return this; + } + public Builder ClearOptionalInt32() { + PrepareBuilder(); + result.hasOptionalInt32 = false; + result.optionalInt32_ = 0; + return this; + } + + public bool HasOptionalInt64 { + get { return result.hasOptionalInt64; } + } + public long OptionalInt64 { + get { return result.OptionalInt64; } + set { SetOptionalInt64(value); } + } + public Builder SetOptionalInt64(long value) { + PrepareBuilder(); + result.hasOptionalInt64 = true; + result.optionalInt64_ = value; + return this; + } + public Builder ClearOptionalInt64() { + PrepareBuilder(); + result.hasOptionalInt64 = false; + result.optionalInt64_ = 0L; + return this; + } + + public bool HasOptionalUint32 { + get { return result.hasOptionalUint32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalUint32 { + get { return result.OptionalUint32; } + set { SetOptionalUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalUint32(uint value) { + PrepareBuilder(); + result.hasOptionalUint32 = true; + result.optionalUint32_ = value; + return this; + } + public Builder ClearOptionalUint32() { + PrepareBuilder(); + result.hasOptionalUint32 = false; + result.optionalUint32_ = 0; + return this; + } + + public bool HasOptionalUint64 { + get { return result.hasOptionalUint64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalUint64 { + get { return result.OptionalUint64; } + set { SetOptionalUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalUint64(ulong value) { + PrepareBuilder(); + result.hasOptionalUint64 = true; + result.optionalUint64_ = value; + return this; + } + public Builder ClearOptionalUint64() { + PrepareBuilder(); + result.hasOptionalUint64 = false; + result.optionalUint64_ = 0UL; + return this; + } + + public bool HasOptionalSint32 { + get { return result.hasOptionalSint32; } + } + public int OptionalSint32 { + get { return result.OptionalSint32; } + set { SetOptionalSint32(value); } + } + public Builder SetOptionalSint32(int value) { + PrepareBuilder(); + result.hasOptionalSint32 = true; + result.optionalSint32_ = value; + return this; + } + public Builder ClearOptionalSint32() { + PrepareBuilder(); + result.hasOptionalSint32 = false; + result.optionalSint32_ = 0; + return this; + } + + public bool HasOptionalSint64 { + get { return result.hasOptionalSint64; } + } + public long OptionalSint64 { + get { return result.OptionalSint64; } + set { SetOptionalSint64(value); } + } + public Builder SetOptionalSint64(long value) { + PrepareBuilder(); + result.hasOptionalSint64 = true; + result.optionalSint64_ = value; + return this; + } + public Builder ClearOptionalSint64() { + PrepareBuilder(); + result.hasOptionalSint64 = false; + result.optionalSint64_ = 0; + return this; + } + + public bool HasOptionalFixed32 { + get { return result.hasOptionalFixed32; } + } + [global::System.CLSCompliant(false)] + public uint OptionalFixed32 { + get { return result.OptionalFixed32; } + set { SetOptionalFixed32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalFixed32(uint value) { + PrepareBuilder(); + result.hasOptionalFixed32 = true; + result.optionalFixed32_ = value; + return this; + } + public Builder ClearOptionalFixed32() { + PrepareBuilder(); + result.hasOptionalFixed32 = false; + result.optionalFixed32_ = 0; + return this; + } + + public bool HasOptionalFixed64 { + get { return result.hasOptionalFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong OptionalFixed64 { + get { return result.OptionalFixed64; } + set { SetOptionalFixed64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetOptionalFixed64(ulong value) { + PrepareBuilder(); + result.hasOptionalFixed64 = true; + result.optionalFixed64_ = value; + return this; + } + public Builder ClearOptionalFixed64() { + PrepareBuilder(); + result.hasOptionalFixed64 = false; + result.optionalFixed64_ = 0; + return this; + } + + public bool HasOptionalSfixed32 { + get { return result.hasOptionalSfixed32; } + } + public int OptionalSfixed32 { + get { return result.OptionalSfixed32; } + set { SetOptionalSfixed32(value); } + } + public Builder SetOptionalSfixed32(int value) { + PrepareBuilder(); + result.hasOptionalSfixed32 = true; + result.optionalSfixed32_ = value; + return this; + } + public Builder ClearOptionalSfixed32() { + PrepareBuilder(); + result.hasOptionalSfixed32 = false; + result.optionalSfixed32_ = 0; + return this; + } + + public bool HasOptionalSfixed64 { + get { return result.hasOptionalSfixed64; } + } + public long OptionalSfixed64 { + get { return result.OptionalSfixed64; } + set { SetOptionalSfixed64(value); } + } + public Builder SetOptionalSfixed64(long value) { + PrepareBuilder(); + result.hasOptionalSfixed64 = true; + result.optionalSfixed64_ = value; + return this; + } + public Builder ClearOptionalSfixed64() { + PrepareBuilder(); + result.hasOptionalSfixed64 = false; + result.optionalSfixed64_ = 0; + return this; + } + + public bool HasOptionalFloat { + get { return result.hasOptionalFloat; } + } + public float OptionalFloat { + get { return result.OptionalFloat; } + set { SetOptionalFloat(value); } + } + public Builder SetOptionalFloat(float value) { + PrepareBuilder(); + result.hasOptionalFloat = true; + result.optionalFloat_ = value; + return this; + } + public Builder ClearOptionalFloat() { + PrepareBuilder(); + result.hasOptionalFloat = false; + result.optionalFloat_ = 0F; + return this; + } + + public bool HasOptionalDouble { + get { return result.hasOptionalDouble; } + } + public double OptionalDouble { + get { return result.OptionalDouble; } + set { SetOptionalDouble(value); } + } + public Builder SetOptionalDouble(double value) { + PrepareBuilder(); + result.hasOptionalDouble = true; + result.optionalDouble_ = value; + return this; + } + public Builder ClearOptionalDouble() { + PrepareBuilder(); + result.hasOptionalDouble = false; + result.optionalDouble_ = 0D; + return this; + } + + public bool HasOptionalBool { + get { return result.hasOptionalBool; } + } + public bool OptionalBool { + get { return result.OptionalBool; } + set { SetOptionalBool(value); } + } + public Builder SetOptionalBool(bool value) { + PrepareBuilder(); + result.hasOptionalBool = true; + result.optionalBool_ = value; + return this; + } + public Builder ClearOptionalBool() { + PrepareBuilder(); + result.hasOptionalBool = false; + result.optionalBool_ = false; + return this; + } + + public bool HasOptionalString { + get { return result.hasOptionalString; } + } + public string OptionalString { + get { return result.OptionalString; } + set { SetOptionalString(value); } + } + public Builder SetOptionalString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalString = true; + result.optionalString_ = value; + return this; + } + public Builder ClearOptionalString() { + PrepareBuilder(); + result.hasOptionalString = false; + result.optionalString_ = ""; + return this; + } + + public bool HasOptionalBytes { + get { return result.hasOptionalBytes; } + } + public pb::ByteString OptionalBytes { + get { return result.OptionalBytes; } + set { SetOptionalBytes(value); } + } + public Builder SetOptionalBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalBytes = true; + result.optionalBytes_ = value; + return this; + } + public Builder ClearOptionalBytes() { + PrepareBuilder(); + result.hasOptionalBytes = false; + result.optionalBytes_ = pb::ByteString.Empty; + return this; + } + + public bool HasOptionalGroup { + get { return result.hasOptionalGroup; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup OptionalGroup { + get { return result.OptionalGroup; } + set { SetOptionalGroup(value); } + } + public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalGroup = true; + result.optionalGroup_ = value; + return this; + } + public Builder SetOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalGroup = true; + result.optionalGroup_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalGroup && + result.optionalGroup_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.DefaultInstance) { + result.optionalGroup_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.OptionalGroup.CreateBuilder(result.optionalGroup_).MergeFrom(value).BuildPartial(); + } else { + result.optionalGroup_ = value; + } + result.hasOptionalGroup = true; + return this; + } + public Builder ClearOptionalGroup() { + PrepareBuilder(); + result.hasOptionalGroup = false; + result.optionalGroup_ = null; + return this; + } + + public bool HasOptionalNestedMessage { + get { return result.hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage OptionalNestedMessage { + get { return result.OptionalNestedMessage; } + set { SetOptionalNestedMessage(value); } + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = value; + return this; + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalNestedMessage && + result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { + result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalNestedMessage_ = value; + } + result.hasOptionalNestedMessage = true; + return this; + } + public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); + result.hasOptionalNestedMessage = false; + result.optionalNestedMessage_ = null; + return this; + } + + public bool HasOptionalForeignMessage { + get { return result.hasOptionalForeignMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage OptionalForeignMessage { + get { return result.OptionalForeignMessage; } + set { SetOptionalForeignMessage(value); } + } + public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalForeignMessage = true; + result.optionalForeignMessage_ = value; + return this; + } + public Builder SetOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalForeignMessage = true; + result.optionalForeignMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalForeignMessage && + result.optionalForeignMessage_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.optionalForeignMessage_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.optionalForeignMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalForeignMessage_ = value; + } + result.hasOptionalForeignMessage = true; + return this; + } + public Builder ClearOptionalForeignMessage() { + PrepareBuilder(); + result.hasOptionalForeignMessage = false; + result.optionalForeignMessage_ = null; + return this; + } + + public bool HasOptionalImportMessage { + get { return result.hasOptionalImportMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage OptionalImportMessage { + get { return result.OptionalImportMessage; } + set { SetOptionalImportMessage(value); } + } + public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalImportMessage = true; + result.optionalImportMessage_ = value; + return this; + } + public Builder SetOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalImportMessage = true; + result.optionalImportMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalImportMessage && + result.optionalImportMessage_ != global::Google.ProtocolBuffers.TestProtos.ImportMessage.DefaultInstance) { + result.optionalImportMessage_ = global::Google.ProtocolBuffers.TestProtos.ImportMessage.CreateBuilder(result.optionalImportMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalImportMessage_ = value; + } + result.hasOptionalImportMessage = true; + return this; + } + public Builder ClearOptionalImportMessage() { + PrepareBuilder(); + result.hasOptionalImportMessage = false; + result.optionalImportMessage_ = null; + return this; + } + + public bool HasOptionalNestedEnum { + get { return result.hasOptionalNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum OptionalNestedEnum { + get { return result.OptionalNestedEnum; } + set { SetOptionalNestedEnum(value); } + } + public Builder SetOptionalNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.hasOptionalNestedEnum = true; + result.optionalNestedEnum_ = value; + return this; + } + public Builder ClearOptionalNestedEnum() { + PrepareBuilder(); + result.hasOptionalNestedEnum = false; + result.optionalNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.FOO; + return this; + } + + public bool HasOptionalForeignEnum { + get { return result.hasOptionalForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum OptionalForeignEnum { + get { return result.OptionalForeignEnum; } + set { SetOptionalForeignEnum(value); } + } + public Builder SetOptionalForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasOptionalForeignEnum = true; + result.optionalForeignEnum_ = value; + return this; + } + public Builder ClearOptionalForeignEnum() { + PrepareBuilder(); + result.hasOptionalForeignEnum = false; + result.optionalForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + return this; + } + + public bool HasOptionalImportEnum { + get { return result.hasOptionalImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum OptionalImportEnum { + get { return result.OptionalImportEnum; } + set { SetOptionalImportEnum(value); } + } + public Builder SetOptionalImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.hasOptionalImportEnum = true; + result.optionalImportEnum_ = value; + return this; + } + public Builder ClearOptionalImportEnum() { + PrepareBuilder(); + result.hasOptionalImportEnum = false; + result.optionalImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_FOO; + return this; + } + + public bool HasOptionalStringPiece { + get { return result.hasOptionalStringPiece; } + } + public string OptionalStringPiece { + get { return result.OptionalStringPiece; } + set { SetOptionalStringPiece(value); } + } + public Builder SetOptionalStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalStringPiece = true; + result.optionalStringPiece_ = value; + return this; + } + public Builder ClearOptionalStringPiece() { + PrepareBuilder(); + result.hasOptionalStringPiece = false; + result.optionalStringPiece_ = ""; + return this; + } + + public bool HasOptionalCord { + get { return result.hasOptionalCord; } + } + public string OptionalCord { + get { return result.OptionalCord; } + set { SetOptionalCord(value); } + } + public Builder SetOptionalCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalCord = true; + result.optionalCord_ = value; + return this; + } + public Builder ClearOptionalCord() { + PrepareBuilder(); + result.hasOptionalCord = false; + result.optionalCord_ = ""; + return this; + } + + public pbc::IPopsicleList RepeatedInt32List { + get { return PrepareBuilder().repeatedInt32_; } + } + public int RepeatedInt32Count { + get { return result.RepeatedInt32Count; } + } + public int GetRepeatedInt32(int index) { + return result.GetRepeatedInt32(index); + } + public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.repeatedInt32_[index] = value; + return this; + } + public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); + result.repeatedInt32_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt32_.Add(values); + return this; + } + public Builder ClearRepeatedInt32() { + PrepareBuilder(); + result.repeatedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt64List { + get { return PrepareBuilder().repeatedInt64_; } + } + public int RepeatedInt64Count { + get { return result.RepeatedInt64Count; } + } + public long GetRepeatedInt64(int index) { + return result.GetRepeatedInt64(index); + } + public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); + result.repeatedInt64_[index] = value; + return this; + } + public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); + result.repeatedInt64_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt64_.Add(values); + return this; + } + public Builder ClearRepeatedInt64() { + PrepareBuilder(); + result.repeatedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint32List { + get { return PrepareBuilder().repeatedUint32_; } + } + public int RepeatedUint32Count { + get { return result.RepeatedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedUint32(int index) { + return result.GetRepeatedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint32(int index, uint value) { + PrepareBuilder(); + result.repeatedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint32(uint value) { + PrepareBuilder(); + result.repeatedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint32_.Add(values); + return this; + } + public Builder ClearRepeatedUint32() { + PrepareBuilder(); + result.repeatedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint64List { + get { return PrepareBuilder().repeatedUint64_; } + } + public int RepeatedUint64Count { + get { return result.RepeatedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return result.GetRepeatedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); + result.repeatedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); + result.repeatedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint64_.Add(values); + return this; + } + public Builder ClearRepeatedUint64() { + PrepareBuilder(); + result.repeatedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSint32List { + get { return PrepareBuilder().repeatedSint32_; } + } + public int RepeatedSint32Count { + get { return result.RepeatedSint32Count; } + } + public int GetRepeatedSint32(int index) { + return result.GetRepeatedSint32(index); + } + public Builder SetRepeatedSint32(int index, int value) { + PrepareBuilder(); + result.repeatedSint32_[index] = value; + return this; + } + public Builder AddRepeatedSint32(int value) { + PrepareBuilder(); + result.repeatedSint32_.Add(value); + return this; + } + public Builder AddRangeRepeatedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSint32_.Add(values); + return this; + } + public Builder ClearRepeatedSint32() { + PrepareBuilder(); + result.repeatedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSint64List { + get { return PrepareBuilder().repeatedSint64_; } + } + public int RepeatedSint64Count { + get { return result.RepeatedSint64Count; } + } + public long GetRepeatedSint64(int index) { + return result.GetRepeatedSint64(index); + } + public Builder SetRepeatedSint64(int index, long value) { + PrepareBuilder(); + result.repeatedSint64_[index] = value; + return this; + } + public Builder AddRepeatedSint64(long value) { + PrepareBuilder(); + result.repeatedSint64_.Add(value); + return this; + } + public Builder AddRangeRepeatedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSint64_.Add(values); + return this; + } + public Builder ClearRepeatedSint64() { + PrepareBuilder(); + result.repeatedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed32List { + get { return PrepareBuilder().repeatedFixed32_; } + } + public int RepeatedFixed32Count { + get { return result.RepeatedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return result.GetRepeatedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); + result.repeatedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); + result.repeatedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed32_.Add(values); + return this; + } + public Builder ClearRepeatedFixed32() { + PrepareBuilder(); + result.repeatedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed64List { + get { return PrepareBuilder().repeatedFixed64_; } + } + public int RepeatedFixed64Count { + get { return result.RepeatedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return result.GetRepeatedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); + result.repeatedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); + result.repeatedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed64_.Add(values); + return this; + } + public Builder ClearRepeatedFixed64() { + PrepareBuilder(); + result.repeatedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSfixed32List { + get { return PrepareBuilder().repeatedSfixed32_; } + } + public int RepeatedSfixed32Count { + get { return result.RepeatedSfixed32Count; } + } + public int GetRepeatedSfixed32(int index) { + return result.GetRepeatedSfixed32(index); + } + public Builder SetRepeatedSfixed32(int index, int value) { + PrepareBuilder(); + result.repeatedSfixed32_[index] = value; + return this; + } + public Builder AddRepeatedSfixed32(int value) { + PrepareBuilder(); + result.repeatedSfixed32_.Add(value); + return this; + } + public Builder AddRangeRepeatedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSfixed32_.Add(values); + return this; + } + public Builder ClearRepeatedSfixed32() { + PrepareBuilder(); + result.repeatedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedSfixed64List { + get { return PrepareBuilder().repeatedSfixed64_; } + } + public int RepeatedSfixed64Count { + get { return result.RepeatedSfixed64Count; } + } + public long GetRepeatedSfixed64(int index) { + return result.GetRepeatedSfixed64(index); + } + public Builder SetRepeatedSfixed64(int index, long value) { + PrepareBuilder(); + result.repeatedSfixed64_[index] = value; + return this; + } + public Builder AddRepeatedSfixed64(long value) { + PrepareBuilder(); + result.repeatedSfixed64_.Add(value); + return this; + } + public Builder AddRangeRepeatedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedSfixed64_.Add(values); + return this; + } + public Builder ClearRepeatedSfixed64() { + PrepareBuilder(); + result.repeatedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedFloatList { + get { return PrepareBuilder().repeatedFloat_; } + } + public int RepeatedFloatCount { + get { return result.RepeatedFloatCount; } + } + public float GetRepeatedFloat(int index) { + return result.GetRepeatedFloat(index); + } + public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); + result.repeatedFloat_[index] = value; + return this; + } + public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); + result.repeatedFloat_.Add(value); + return this; + } + public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFloat_.Add(values); + return this; + } + public Builder ClearRepeatedFloat() { + PrepareBuilder(); + result.repeatedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedDoubleList { + get { return PrepareBuilder().repeatedDouble_; } + } + public int RepeatedDoubleCount { + get { return result.RepeatedDoubleCount; } + } + public double GetRepeatedDouble(int index) { + return result.GetRepeatedDouble(index); + } + public Builder SetRepeatedDouble(int index, double value) { + PrepareBuilder(); + result.repeatedDouble_[index] = value; + return this; + } + public Builder AddRepeatedDouble(double value) { + PrepareBuilder(); + result.repeatedDouble_.Add(value); + return this; + } + public Builder AddRangeRepeatedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedDouble_.Add(values); + return this; + } + public Builder ClearRepeatedDouble() { + PrepareBuilder(); + result.repeatedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedBoolList { + get { return PrepareBuilder().repeatedBool_; } + } + public int RepeatedBoolCount { + get { return result.RepeatedBoolCount; } + } + public bool GetRepeatedBool(int index) { + return result.GetRepeatedBool(index); + } + public Builder SetRepeatedBool(int index, bool value) { + PrepareBuilder(); + result.repeatedBool_[index] = value; + return this; + } + public Builder AddRepeatedBool(bool value) { + PrepareBuilder(); + result.repeatedBool_.Add(value); + return this; + } + public Builder AddRangeRepeatedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedBool_.Add(values); + return this; + } + public Builder ClearRepeatedBool() { + PrepareBuilder(); + result.repeatedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringList { + get { return PrepareBuilder().repeatedString_; } + } + public int RepeatedStringCount { + get { return result.RepeatedStringCount; } + } + public string GetRepeatedString(int index) { + return result.GetRepeatedString(index); + } + public Builder SetRepeatedString(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedString_[index] = value; + return this; + } + public Builder AddRepeatedString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedString_.Add(value); + return this; + } + public Builder AddRangeRepeatedString(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedString_.Add(values); + return this; + } + public Builder ClearRepeatedString() { + PrepareBuilder(); + result.repeatedString_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedBytesList { + get { return PrepareBuilder().repeatedBytes_; } + } + public int RepeatedBytesCount { + get { return result.RepeatedBytesCount; } + } + public pb::ByteString GetRepeatedBytes(int index) { + return result.GetRepeatedBytes(index); + } + public Builder SetRepeatedBytes(int index, pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedBytes_[index] = value; + return this; + } + public Builder AddRepeatedBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedBytes_.Add(value); + return this; + } + public Builder AddRangeRepeatedBytes(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedBytes_.Add(values); + return this; + } + public Builder ClearRepeatedBytes() { + PrepareBuilder(); + result.repeatedBytes_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedGroupList { + get { return PrepareBuilder().repeatedGroup_; } + } + public int RepeatedGroupCount { + get { return result.RepeatedGroupCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup GetRepeatedGroup(int index) { + return result.GetRepeatedGroup(index); + } + public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedGroup_[index] = value; + return this; + } + public Builder SetRepeatedGroup(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedGroup_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedGroup_.Add(value); + return this; + } + public Builder AddRepeatedGroup(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.RepeatedGroup.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedGroup_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedGroup(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedGroup_.Add(values); + return this; + } + public Builder ClearRepeatedGroup() { + PrepareBuilder(); + result.repeatedGroup_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedNestedMessageList { + get { return PrepareBuilder().repeatedNestedMessage_; } + } + public int RepeatedNestedMessageCount { + get { return result.RepeatedNestedMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage GetRepeatedNestedMessage(int index) { + return result.GetRepeatedNestedMessage(index); + } + public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedNestedMessage_[index] = value; + return this; + } + public Builder SetRepeatedNestedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedNestedMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedNestedMessage_.Add(value); + return this; + } + public Builder AddRepeatedNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedNestedMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedNestedMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedNestedMessage_.Add(values); + return this; + } + public Builder ClearRepeatedNestedMessage() { + PrepareBuilder(); + result.repeatedNestedMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedForeignMessageList { + get { return PrepareBuilder().repeatedForeignMessage_; } + } + public int RepeatedForeignMessageCount { + get { return result.RepeatedForeignMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedForeignMessage(int index) { + return result.GetRepeatedForeignMessage(index); + } + public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedForeignMessage_[index] = value; + return this; + } + public Builder SetRepeatedForeignMessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedForeignMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedForeignMessage_.Add(value); + return this; + } + public Builder AddRepeatedForeignMessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedForeignMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedForeignMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedForeignMessage_.Add(values); + return this; + } + public Builder ClearRepeatedForeignMessage() { + PrepareBuilder(); + result.repeatedForeignMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedImportMessageList { + get { return PrepareBuilder().repeatedImportMessage_; } + } + public int RepeatedImportMessageCount { + get { return result.RepeatedImportMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportMessage GetRepeatedImportMessage(int index) { + return result.GetRepeatedImportMessage(index); + } + public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedImportMessage_[index] = value; + return this; + } + public Builder SetRepeatedImportMessage(int index, global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedImportMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedImportMessage_.Add(value); + return this; + } + public Builder AddRepeatedImportMessage(global::Google.ProtocolBuffers.TestProtos.ImportMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedImportMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedImportMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedImportMessage_.Add(values); + return this; + } + public Builder ClearRepeatedImportMessage() { + PrepareBuilder(); + result.repeatedImportMessage_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedNestedEnumList { + get { return PrepareBuilder().repeatedNestedEnum_; } + } + public int RepeatedNestedEnumCount { + get { return result.RepeatedNestedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum GetRepeatedNestedEnum(int index) { + return result.GetRepeatedNestedEnum(index); + } + public Builder SetRepeatedNestedEnum(int index, global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.repeatedNestedEnum_[index] = value; + return this; + } + public Builder AddRepeatedNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.repeatedNestedEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedNestedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedNestedEnum_.Add(values); + return this; + } + public Builder ClearRepeatedNestedEnum() { + PrepareBuilder(); + result.repeatedNestedEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedForeignEnumList { + get { return PrepareBuilder().repeatedForeignEnum_; } + } + public int RepeatedForeignEnumCount { + get { return result.RepeatedForeignEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedForeignEnum(int index) { + return result.GetRepeatedForeignEnum(index); + } + public Builder SetRepeatedForeignEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedForeignEnum_[index] = value; + return this; + } + public Builder AddRepeatedForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedForeignEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedForeignEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedForeignEnum_.Add(values); + return this; + } + public Builder ClearRepeatedForeignEnum() { + PrepareBuilder(); + result.repeatedForeignEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedImportEnumList { + get { return PrepareBuilder().repeatedImportEnum_; } + } + public int RepeatedImportEnumCount { + get { return result.RepeatedImportEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum GetRepeatedImportEnum(int index) { + return result.GetRepeatedImportEnum(index); + } + public Builder SetRepeatedImportEnum(int index, global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.repeatedImportEnum_[index] = value; + return this; + } + public Builder AddRepeatedImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.repeatedImportEnum_.Add(value); + return this; + } + public Builder AddRangeRepeatedImportEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedImportEnum_.Add(values); + return this; + } + public Builder ClearRepeatedImportEnum() { + PrepareBuilder(); + result.repeatedImportEnum_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringPieceList { + get { return PrepareBuilder().repeatedStringPiece_; } + } + public int RepeatedStringPieceCount { + get { return result.RepeatedStringPieceCount; } + } + public string GetRepeatedStringPiece(int index) { + return result.GetRepeatedStringPiece(index); + } + public Builder SetRepeatedStringPiece(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPiece_[index] = value; + return this; + } + public Builder AddRepeatedStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPiece_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringPiece(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringPiece_.Add(values); + return this; + } + public Builder ClearRepeatedStringPiece() { + PrepareBuilder(); + result.repeatedStringPiece_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedCordList { + get { return PrepareBuilder().repeatedCord_; } + } + public int RepeatedCordCount { + get { return result.RepeatedCordCount; } + } + public string GetRepeatedCord(int index) { + return result.GetRepeatedCord(index); + } + public Builder SetRepeatedCord(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCord_[index] = value; + return this; + } + public Builder AddRepeatedCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCord_.Add(value); + return this; + } + public Builder AddRangeRepeatedCord(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedCord_.Add(values); + return this; + } + public Builder ClearRepeatedCord() { + PrepareBuilder(); + result.repeatedCord_.Clear(); + return this; + } + + public bool HasDefaultInt32 { + get { return result.hasDefaultInt32; } + } + public int DefaultInt32 { + get { return result.DefaultInt32; } + set { SetDefaultInt32(value); } + } + public Builder SetDefaultInt32(int value) { + PrepareBuilder(); + result.hasDefaultInt32 = true; + result.defaultInt32_ = value; + return this; + } + public Builder ClearDefaultInt32() { + PrepareBuilder(); + result.hasDefaultInt32 = false; + result.defaultInt32_ = 41; + return this; + } + + public bool HasDefaultInt64 { + get { return result.hasDefaultInt64; } + } + public long DefaultInt64 { + get { return result.DefaultInt64; } + set { SetDefaultInt64(value); } + } + public Builder SetDefaultInt64(long value) { + PrepareBuilder(); + result.hasDefaultInt64 = true; + result.defaultInt64_ = value; + return this; + } + public Builder ClearDefaultInt64() { + PrepareBuilder(); + result.hasDefaultInt64 = false; + result.defaultInt64_ = 42L; + return this; + } + + public bool HasDefaultUint32 { + get { return result.hasDefaultUint32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultUint32 { + get { return result.DefaultUint32; } + set { SetDefaultUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultUint32(uint value) { + PrepareBuilder(); + result.hasDefaultUint32 = true; + result.defaultUint32_ = value; + return this; + } + public Builder ClearDefaultUint32() { + PrepareBuilder(); + result.hasDefaultUint32 = false; + result.defaultUint32_ = 43; + return this; + } + + public bool HasDefaultUint64 { + get { return result.hasDefaultUint64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultUint64 { + get { return result.DefaultUint64; } + set { SetDefaultUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultUint64(ulong value) { + PrepareBuilder(); + result.hasDefaultUint64 = true; + result.defaultUint64_ = value; + return this; + } + public Builder ClearDefaultUint64() { + PrepareBuilder(); + result.hasDefaultUint64 = false; + result.defaultUint64_ = 44UL; + return this; + } + + public bool HasDefaultSint32 { + get { return result.hasDefaultSint32; } + } + public int DefaultSint32 { + get { return result.DefaultSint32; } + set { SetDefaultSint32(value); } + } + public Builder SetDefaultSint32(int value) { + PrepareBuilder(); + result.hasDefaultSint32 = true; + result.defaultSint32_ = value; + return this; + } + public Builder ClearDefaultSint32() { + PrepareBuilder(); + result.hasDefaultSint32 = false; + result.defaultSint32_ = -45; + return this; + } + + public bool HasDefaultSint64 { + get { return result.hasDefaultSint64; } + } + public long DefaultSint64 { + get { return result.DefaultSint64; } + set { SetDefaultSint64(value); } + } + public Builder SetDefaultSint64(long value) { + PrepareBuilder(); + result.hasDefaultSint64 = true; + result.defaultSint64_ = value; + return this; + } + public Builder ClearDefaultSint64() { + PrepareBuilder(); + result.hasDefaultSint64 = false; + result.defaultSint64_ = 46; + return this; + } + + public bool HasDefaultFixed32 { + get { return result.hasDefaultFixed32; } + } + [global::System.CLSCompliant(false)] + public uint DefaultFixed32 { + get { return result.DefaultFixed32; } + set { SetDefaultFixed32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultFixed32(uint value) { + PrepareBuilder(); + result.hasDefaultFixed32 = true; + result.defaultFixed32_ = value; + return this; + } + public Builder ClearDefaultFixed32() { + PrepareBuilder(); + result.hasDefaultFixed32 = false; + result.defaultFixed32_ = 47; + return this; + } + + public bool HasDefaultFixed64 { + get { return result.hasDefaultFixed64; } + } + [global::System.CLSCompliant(false)] + public ulong DefaultFixed64 { + get { return result.DefaultFixed64; } + set { SetDefaultFixed64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetDefaultFixed64(ulong value) { + PrepareBuilder(); + result.hasDefaultFixed64 = true; + result.defaultFixed64_ = value; + return this; + } + public Builder ClearDefaultFixed64() { + PrepareBuilder(); + result.hasDefaultFixed64 = false; + result.defaultFixed64_ = 48; + return this; + } + + public bool HasDefaultSfixed32 { + get { return result.hasDefaultSfixed32; } + } + public int DefaultSfixed32 { + get { return result.DefaultSfixed32; } + set { SetDefaultSfixed32(value); } + } + public Builder SetDefaultSfixed32(int value) { + PrepareBuilder(); + result.hasDefaultSfixed32 = true; + result.defaultSfixed32_ = value; + return this; + } + public Builder ClearDefaultSfixed32() { + PrepareBuilder(); + result.hasDefaultSfixed32 = false; + result.defaultSfixed32_ = 49; + return this; + } + + public bool HasDefaultSfixed64 { + get { return result.hasDefaultSfixed64; } + } + public long DefaultSfixed64 { + get { return result.DefaultSfixed64; } + set { SetDefaultSfixed64(value); } + } + public Builder SetDefaultSfixed64(long value) { + PrepareBuilder(); + result.hasDefaultSfixed64 = true; + result.defaultSfixed64_ = value; + return this; + } + public Builder ClearDefaultSfixed64() { + PrepareBuilder(); + result.hasDefaultSfixed64 = false; + result.defaultSfixed64_ = -50; + return this; + } + + public bool HasDefaultFloat { + get { return result.hasDefaultFloat; } + } + public float DefaultFloat { + get { return result.DefaultFloat; } + set { SetDefaultFloat(value); } + } + public Builder SetDefaultFloat(float value) { + PrepareBuilder(); + result.hasDefaultFloat = true; + result.defaultFloat_ = value; + return this; + } + public Builder ClearDefaultFloat() { + PrepareBuilder(); + result.hasDefaultFloat = false; + result.defaultFloat_ = 51.5F; + return this; + } + + public bool HasDefaultDouble { + get { return result.hasDefaultDouble; } + } + public double DefaultDouble { + get { return result.DefaultDouble; } + set { SetDefaultDouble(value); } + } + public Builder SetDefaultDouble(double value) { + PrepareBuilder(); + result.hasDefaultDouble = true; + result.defaultDouble_ = value; + return this; + } + public Builder ClearDefaultDouble() { + PrepareBuilder(); + result.hasDefaultDouble = false; + result.defaultDouble_ = 52000D; + return this; + } + + public bool HasDefaultBool { + get { return result.hasDefaultBool; } + } + public bool DefaultBool { + get { return result.DefaultBool; } + set { SetDefaultBool(value); } + } + public Builder SetDefaultBool(bool value) { + PrepareBuilder(); + result.hasDefaultBool = true; + result.defaultBool_ = value; + return this; + } + public Builder ClearDefaultBool() { + PrepareBuilder(); + result.hasDefaultBool = false; + result.defaultBool_ = true; + return this; + } + + public bool HasDefaultString { + get { return result.hasDefaultString; } + } + public string DefaultString { + get { return result.DefaultString; } + set { SetDefaultString(value); } + } + public Builder SetDefaultString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultString = true; + result.defaultString_ = value; + return this; + } + public Builder ClearDefaultString() { + PrepareBuilder(); + result.hasDefaultString = false; + result.defaultString_ = "hello"; + return this; + } + + public bool HasDefaultBytes { + get { return result.hasDefaultBytes; } + } + public pb::ByteString DefaultBytes { + get { return result.DefaultBytes; } + set { SetDefaultBytes(value); } + } + public Builder SetDefaultBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultBytes = true; + result.defaultBytes_ = value; + return this; + } + public Builder ClearDefaultBytes() { + PrepareBuilder(); + result.hasDefaultBytes = false; + result.defaultBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Descriptor.Fields[62].DefaultValue; + return this; + } + + public bool HasDefaultNestedEnum { + get { return result.hasDefaultNestedEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum DefaultNestedEnum { + get { return result.DefaultNestedEnum; } + set { SetDefaultNestedEnum(value); } + } + public Builder SetDefaultNestedEnum(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum value) { + PrepareBuilder(); + result.hasDefaultNestedEnum = true; + result.defaultNestedEnum_ = value; + return this; + } + public Builder ClearDefaultNestedEnum() { + PrepareBuilder(); + result.hasDefaultNestedEnum = false; + result.defaultNestedEnum_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedEnum.BAR; + return this; + } + + public bool HasDefaultForeignEnum { + get { return result.hasDefaultForeignEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum DefaultForeignEnum { + get { return result.DefaultForeignEnum; } + set { SetDefaultForeignEnum(value); } + } + public Builder SetDefaultForeignEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasDefaultForeignEnum = true; + result.defaultForeignEnum_ = value; + return this; + } + public Builder ClearDefaultForeignEnum() { + PrepareBuilder(); + result.hasDefaultForeignEnum = false; + result.defaultForeignEnum_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_BAR; + return this; + } + + public bool HasDefaultImportEnum { + get { return result.hasDefaultImportEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.ImportEnum DefaultImportEnum { + get { return result.DefaultImportEnum; } + set { SetDefaultImportEnum(value); } + } + public Builder SetDefaultImportEnum(global::Google.ProtocolBuffers.TestProtos.ImportEnum value) { + PrepareBuilder(); + result.hasDefaultImportEnum = true; + result.defaultImportEnum_ = value; + return this; + } + public Builder ClearDefaultImportEnum() { + PrepareBuilder(); + result.hasDefaultImportEnum = false; + result.defaultImportEnum_ = global::Google.ProtocolBuffers.TestProtos.ImportEnum.IMPORT_BAR; + return this; + } + + public bool HasDefaultStringPiece { + get { return result.hasDefaultStringPiece; } + } + public string DefaultStringPiece { + get { return result.DefaultStringPiece; } + set { SetDefaultStringPiece(value); } + } + public Builder SetDefaultStringPiece(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultStringPiece = true; + result.defaultStringPiece_ = value; + return this; + } + public Builder ClearDefaultStringPiece() { + PrepareBuilder(); + result.hasDefaultStringPiece = false; + result.defaultStringPiece_ = "abc"; + return this; + } + + public bool HasDefaultCord { + get { return result.hasDefaultCord; } + } + public string DefaultCord { + get { return result.DefaultCord; } + set { SetDefaultCord(value); } + } + public Builder SetDefaultCord(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDefaultCord = true; + result.defaultCord_ = value; + return this; + } + public Builder ClearDefaultCord() { + PrepareBuilder(); + result.hasDefaultCord = false; + result.defaultCord_ = "123"; + return this; + } + } + static TestAllTypes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDeprecatedFields : pb::GeneratedMessage { + private TestDeprecatedFields() { } + private static readonly TestDeprecatedFields defaultInstance = new TestDeprecatedFields().MakeReadOnly(); + private static readonly string[] _testDeprecatedFieldsFieldNames = new string[] { "deprecated_int32" }; + private static readonly uint[] _testDeprecatedFieldsFieldTags = new uint[] { 8 }; + public static TestDeprecatedFields DefaultInstance { + get { return defaultInstance; } + } + + public override TestDeprecatedFields DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDeprecatedFields ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDeprecatedFields__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDeprecatedFields__FieldAccessorTable; } + } + + public const int DeprecatedInt32FieldNumber = 1; + private bool hasDeprecatedInt32; + private int deprecatedInt32_; + [global::System.ObsoleteAttribute()] + public bool HasDeprecatedInt32 { + get { return hasDeprecatedInt32; } + } + [global::System.ObsoleteAttribute()] + public int DeprecatedInt32 { + get { return deprecatedInt32_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDeprecatedFieldsFieldNames; + if (hasDeprecatedInt32) { + output.WriteInt32(1, field_names[0], DeprecatedInt32); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasDeprecatedInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(1, DeprecatedInt32); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestDeprecatedFields ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDeprecatedFields ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDeprecatedFields ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDeprecatedFields ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDeprecatedFields MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDeprecatedFields prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDeprecatedFields cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDeprecatedFields result; + + private TestDeprecatedFields PrepareBuilder() { + if (resultIsReadOnly) { + TestDeprecatedFields original = result; + result = new TestDeprecatedFields(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDeprecatedFields MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.Descriptor; } + } + + public override TestDeprecatedFields DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.DefaultInstance; } + } + + public override TestDeprecatedFields BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestDeprecatedFields) { + return MergeFrom((TestDeprecatedFields) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDeprecatedFields other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDeprecatedFields.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasDeprecatedInt32) { + DeprecatedInt32 = other.DeprecatedInt32; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDeprecatedFieldsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDeprecatedFieldsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasDeprecatedInt32 = input.ReadInt32(ref result.deprecatedInt32_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + [global::System.ObsoleteAttribute()] + public bool HasDeprecatedInt32 { + get { return result.hasDeprecatedInt32; } + } + [global::System.ObsoleteAttribute()] + public int DeprecatedInt32 { + get { return result.DeprecatedInt32; } + set { SetDeprecatedInt32(value); } + } + [global::System.ObsoleteAttribute()] + public Builder SetDeprecatedInt32(int value) { + PrepareBuilder(); + result.hasDeprecatedInt32 = true; + result.deprecatedInt32_ = value; + return this; + } + [global::System.ObsoleteAttribute()] + public Builder ClearDeprecatedInt32() { + PrepareBuilder(); + result.hasDeprecatedInt32 = false; + result.deprecatedInt32_ = 0; + return this; + } + } + static TestDeprecatedFields() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ForeignMessage : pb::GeneratedMessage { + private ForeignMessage() { } + private static readonly ForeignMessage defaultInstance = new ForeignMessage().MakeReadOnly(); + private static readonly string[] _foreignMessageFieldNames = new string[] { "c" }; + private static readonly uint[] _foreignMessageFieldTags = new uint[] { 8 }; + public static ForeignMessage DefaultInstance { + get { return defaultInstance; } + } + + public override ForeignMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ForeignMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_ForeignMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_ForeignMessage__FieldAccessorTable; } + } + + public const int CFieldNumber = 1; + private bool hasC; + private int c_; + public bool HasC { + get { return hasC; } + } + public int C { + get { return c_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _foreignMessageFieldNames; + if (hasC) { + output.WriteInt32(1, field_names[0], C); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasC) { + size += pb::CodedOutputStream.ComputeInt32Size(1, C); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static ForeignMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ForeignMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ForeignMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ForeignMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ForeignMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ForeignMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ForeignMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ForeignMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ForeignMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ForeignMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ForeignMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ForeignMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ForeignMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ForeignMessage result; + + private ForeignMessage PrepareBuilder() { + if (resultIsReadOnly) { + ForeignMessage original = result; + result = new ForeignMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ForeignMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Descriptor; } + } + + public override ForeignMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public override ForeignMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is ForeignMessage) { + return MergeFrom((ForeignMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ForeignMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasC) { + C = other.C; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_foreignMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _foreignMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasC = input.ReadInt32(ref result.c_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasC { + get { return result.hasC; } + } + public int C { + get { return result.C; } + set { SetC(value); } + } + public Builder SetC(int value) { + PrepareBuilder(); + result.hasC = true; + result.c_ = value; + return this; + } + public Builder ClearC() { + PrepareBuilder(); + result.hasC = false; + result.c_ = 0; + return this; + } + } + static ForeignMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestAllExtensions : pb::ExtendableMessage { + private TestAllExtensions() { } + private static readonly TestAllExtensions defaultInstance = new TestAllExtensions().MakeReadOnly(); + private static readonly string[] _testAllExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testAllExtensionsFieldTags = new uint[] { }; + public static TestAllExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestAllExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestAllExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestAllExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testAllExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestAllExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestAllExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestAllExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestAllExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestAllExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestAllExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestAllExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestAllExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestAllExtensions result; + + private TestAllExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestAllExtensions original = result; + result = new TestAllExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestAllExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.Descriptor; } + } + + public override TestAllExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.DefaultInstance; } + } + + public override TestAllExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestAllExtensions) { + return MergeFrom((TestAllExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestAllExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestAllExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testAllExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testAllExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestAllExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OptionalGroup_extension : pb::GeneratedMessage { + private OptionalGroup_extension() { } + private static readonly OptionalGroup_extension defaultInstance = new OptionalGroup_extension().MakeReadOnly(); + private static readonly string[] _optionalGroupExtensionFieldNames = new string[] { "a" }; + private static readonly uint[] _optionalGroupExtensionFieldTags = new uint[] { 136 }; + public static OptionalGroup_extension DefaultInstance { + get { return defaultInstance; } + } + + public override OptionalGroup_extension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OptionalGroup_extension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OptionalGroup_extension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OptionalGroup_extension__FieldAccessorTable; } + } + + public const int AFieldNumber = 17; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _optionalGroupExtensionFieldNames; + if (hasA) { + output.WriteInt32(17, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(17, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OptionalGroup_extension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OptionalGroup_extension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OptionalGroup_extension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OptionalGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OptionalGroup_extension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OptionalGroup_extension prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OptionalGroup_extension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OptionalGroup_extension result; + + private OptionalGroup_extension PrepareBuilder() { + if (resultIsReadOnly) { + OptionalGroup_extension original = result; + result = new OptionalGroup_extension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OptionalGroup_extension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.Descriptor; } + } + + public override OptionalGroup_extension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.DefaultInstance; } + } + + public override OptionalGroup_extension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OptionalGroup_extension) { + return MergeFrom((OptionalGroup_extension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OptionalGroup_extension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OptionalGroup_extension.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_optionalGroupExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _optionalGroupExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 136: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static OptionalGroup_extension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RepeatedGroup_extension : pb::GeneratedMessage { + private RepeatedGroup_extension() { } + private static readonly RepeatedGroup_extension defaultInstance = new RepeatedGroup_extension().MakeReadOnly(); + private static readonly string[] _repeatedGroupExtensionFieldNames = new string[] { "a" }; + private static readonly uint[] _repeatedGroupExtensionFieldTags = new uint[] { 376 }; + public static RepeatedGroup_extension DefaultInstance { + get { return defaultInstance; } + } + + public override RepeatedGroup_extension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RepeatedGroup_extension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_RepeatedGroup_extension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_RepeatedGroup_extension__FieldAccessorTable; } + } + + public const int AFieldNumber = 47; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _repeatedGroupExtensionFieldNames; + if (hasA) { + output.WriteInt32(47, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(47, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static RepeatedGroup_extension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RepeatedGroup_extension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RepeatedGroup_extension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RepeatedGroup_extension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RepeatedGroup_extension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RepeatedGroup_extension prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RepeatedGroup_extension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RepeatedGroup_extension result; + + private RepeatedGroup_extension PrepareBuilder() { + if (resultIsReadOnly) { + RepeatedGroup_extension original = result; + result = new RepeatedGroup_extension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RepeatedGroup_extension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.Descriptor; } + } + + public override RepeatedGroup_extension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.DefaultInstance; } + } + + public override RepeatedGroup_extension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is RepeatedGroup_extension) { + return MergeFrom((RepeatedGroup_extension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RepeatedGroup_extension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.RepeatedGroup_extension.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_repeatedGroupExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _repeatedGroupExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 376: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static RepeatedGroup_extension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestNestedExtension : pb::GeneratedMessage { + private TestNestedExtension() { } + private static readonly TestNestedExtension defaultInstance = new TestNestedExtension().MakeReadOnly(); + private static readonly string[] _testNestedExtensionFieldNames = new string[] { }; + private static readonly uint[] _testNestedExtensionFieldTags = new uint[] { }; + public static TestNestedExtension DefaultInstance { + get { return defaultInstance; } + } + + public override TestNestedExtension DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestNestedExtension ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedExtension__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedExtension__FieldAccessorTable; } + } + + public const int TestFieldNumber = 1002; + public static pb::GeneratedExtensionBase Test; + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testNestedExtensionFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestNestedExtension ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestNestedExtension ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestNestedExtension ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestNestedExtension ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedExtension ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestNestedExtension MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestNestedExtension prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestNestedExtension cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestNestedExtension result; + + private TestNestedExtension PrepareBuilder() { + if (resultIsReadOnly) { + TestNestedExtension original = result; + result = new TestNestedExtension(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestNestedExtension MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.Descriptor; } + } + + public override TestNestedExtension DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.DefaultInstance; } + } + + public override TestNestedExtension BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestNestedExtension) { + return MergeFrom((TestNestedExtension) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestNestedExtension other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedExtension.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testNestedExtensionFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testNestedExtensionFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestNestedExtension() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRequired : pb::GeneratedMessage { + private TestRequired() { } + private static readonly TestRequired defaultInstance = new TestRequired().MakeReadOnly(); + private static readonly string[] _testRequiredFieldNames = new string[] { "a", "b", "c", "dummy10", "dummy11", "dummy12", "dummy13", "dummy14", "dummy15", "dummy16", "dummy17", "dummy18", "dummy19", "dummy2", "dummy20", "dummy21", "dummy22", "dummy23", "dummy24", "dummy25", "dummy26", "dummy27", "dummy28", "dummy29", "dummy30", "dummy31", "dummy32", "dummy4", "dummy5", "dummy6", "dummy7", "dummy8", "dummy9" }; + private static readonly uint[] _testRequiredFieldTags = new uint[] { 8, 24, 264, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 16, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 32, 40, 48, 56, 64, 72 }; + public static TestRequired DefaultInstance { + get { return defaultInstance; } + } + + public override TestRequired DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRequired ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequired__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequired__FieldAccessorTable; } + } + + public const int SingleFieldNumber = 1000; + public static pb::GeneratedExtensionBase Single; + public const int MultiFieldNumber = 1001; + public static pb::GeneratedExtensionBase> Multi; + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public const int Dummy2FieldNumber = 2; + private bool hasDummy2; + private int dummy2_; + public bool HasDummy2 { + get { return hasDummy2; } + } + public int Dummy2 { + get { return dummy2_; } + } + + public const int BFieldNumber = 3; + private bool hasB; + private int b_; + public bool HasB { + get { return hasB; } + } + public int B { + get { return b_; } + } + + public const int Dummy4FieldNumber = 4; + private bool hasDummy4; + private int dummy4_; + public bool HasDummy4 { + get { return hasDummy4; } + } + public int Dummy4 { + get { return dummy4_; } + } + + public const int Dummy5FieldNumber = 5; + private bool hasDummy5; + private int dummy5_; + public bool HasDummy5 { + get { return hasDummy5; } + } + public int Dummy5 { + get { return dummy5_; } + } + + public const int Dummy6FieldNumber = 6; + private bool hasDummy6; + private int dummy6_; + public bool HasDummy6 { + get { return hasDummy6; } + } + public int Dummy6 { + get { return dummy6_; } + } + + public const int Dummy7FieldNumber = 7; + private bool hasDummy7; + private int dummy7_; + public bool HasDummy7 { + get { return hasDummy7; } + } + public int Dummy7 { + get { return dummy7_; } + } + + public const int Dummy8FieldNumber = 8; + private bool hasDummy8; + private int dummy8_; + public bool HasDummy8 { + get { return hasDummy8; } + } + public int Dummy8 { + get { return dummy8_; } + } + + public const int Dummy9FieldNumber = 9; + private bool hasDummy9; + private int dummy9_; + public bool HasDummy9 { + get { return hasDummy9; } + } + public int Dummy9 { + get { return dummy9_; } + } + + public const int Dummy10FieldNumber = 10; + private bool hasDummy10; + private int dummy10_; + public bool HasDummy10 { + get { return hasDummy10; } + } + public int Dummy10 { + get { return dummy10_; } + } + + public const int Dummy11FieldNumber = 11; + private bool hasDummy11; + private int dummy11_; + public bool HasDummy11 { + get { return hasDummy11; } + } + public int Dummy11 { + get { return dummy11_; } + } + + public const int Dummy12FieldNumber = 12; + private bool hasDummy12; + private int dummy12_; + public bool HasDummy12 { + get { return hasDummy12; } + } + public int Dummy12 { + get { return dummy12_; } + } + + public const int Dummy13FieldNumber = 13; + private bool hasDummy13; + private int dummy13_; + public bool HasDummy13 { + get { return hasDummy13; } + } + public int Dummy13 { + get { return dummy13_; } + } + + public const int Dummy14FieldNumber = 14; + private bool hasDummy14; + private int dummy14_; + public bool HasDummy14 { + get { return hasDummy14; } + } + public int Dummy14 { + get { return dummy14_; } + } + + public const int Dummy15FieldNumber = 15; + private bool hasDummy15; + private int dummy15_; + public bool HasDummy15 { + get { return hasDummy15; } + } + public int Dummy15 { + get { return dummy15_; } + } + + public const int Dummy16FieldNumber = 16; + private bool hasDummy16; + private int dummy16_; + public bool HasDummy16 { + get { return hasDummy16; } + } + public int Dummy16 { + get { return dummy16_; } + } + + public const int Dummy17FieldNumber = 17; + private bool hasDummy17; + private int dummy17_; + public bool HasDummy17 { + get { return hasDummy17; } + } + public int Dummy17 { + get { return dummy17_; } + } + + public const int Dummy18FieldNumber = 18; + private bool hasDummy18; + private int dummy18_; + public bool HasDummy18 { + get { return hasDummy18; } + } + public int Dummy18 { + get { return dummy18_; } + } + + public const int Dummy19FieldNumber = 19; + private bool hasDummy19; + private int dummy19_; + public bool HasDummy19 { + get { return hasDummy19; } + } + public int Dummy19 { + get { return dummy19_; } + } + + public const int Dummy20FieldNumber = 20; + private bool hasDummy20; + private int dummy20_; + public bool HasDummy20 { + get { return hasDummy20; } + } + public int Dummy20 { + get { return dummy20_; } + } + + public const int Dummy21FieldNumber = 21; + private bool hasDummy21; + private int dummy21_; + public bool HasDummy21 { + get { return hasDummy21; } + } + public int Dummy21 { + get { return dummy21_; } + } + + public const int Dummy22FieldNumber = 22; + private bool hasDummy22; + private int dummy22_; + public bool HasDummy22 { + get { return hasDummy22; } + } + public int Dummy22 { + get { return dummy22_; } + } + + public const int Dummy23FieldNumber = 23; + private bool hasDummy23; + private int dummy23_; + public bool HasDummy23 { + get { return hasDummy23; } + } + public int Dummy23 { + get { return dummy23_; } + } + + public const int Dummy24FieldNumber = 24; + private bool hasDummy24; + private int dummy24_; + public bool HasDummy24 { + get { return hasDummy24; } + } + public int Dummy24 { + get { return dummy24_; } + } + + public const int Dummy25FieldNumber = 25; + private bool hasDummy25; + private int dummy25_; + public bool HasDummy25 { + get { return hasDummy25; } + } + public int Dummy25 { + get { return dummy25_; } + } + + public const int Dummy26FieldNumber = 26; + private bool hasDummy26; + private int dummy26_; + public bool HasDummy26 { + get { return hasDummy26; } + } + public int Dummy26 { + get { return dummy26_; } + } + + public const int Dummy27FieldNumber = 27; + private bool hasDummy27; + private int dummy27_; + public bool HasDummy27 { + get { return hasDummy27; } + } + public int Dummy27 { + get { return dummy27_; } + } + + public const int Dummy28FieldNumber = 28; + private bool hasDummy28; + private int dummy28_; + public bool HasDummy28 { + get { return hasDummy28; } + } + public int Dummy28 { + get { return dummy28_; } + } + + public const int Dummy29FieldNumber = 29; + private bool hasDummy29; + private int dummy29_; + public bool HasDummy29 { + get { return hasDummy29; } + } + public int Dummy29 { + get { return dummy29_; } + } + + public const int Dummy30FieldNumber = 30; + private bool hasDummy30; + private int dummy30_; + public bool HasDummy30 { + get { return hasDummy30; } + } + public int Dummy30 { + get { return dummy30_; } + } + + public const int Dummy31FieldNumber = 31; + private bool hasDummy31; + private int dummy31_; + public bool HasDummy31 { + get { return hasDummy31; } + } + public int Dummy31 { + get { return dummy31_; } + } + + public const int Dummy32FieldNumber = 32; + private bool hasDummy32; + private int dummy32_; + public bool HasDummy32 { + get { return hasDummy32; } + } + public int Dummy32 { + get { return dummy32_; } + } + + public const int CFieldNumber = 33; + private bool hasC; + private int c_; + public bool HasC { + get { return hasC; } + } + public int C { + get { return c_; } + } + + public override bool IsInitialized { + get { + if (!hasA) return false; + if (!hasB) return false; + if (!hasC) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRequiredFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + if (hasDummy2) { + output.WriteInt32(2, field_names[13], Dummy2); + } + if (hasB) { + output.WriteInt32(3, field_names[1], B); + } + if (hasDummy4) { + output.WriteInt32(4, field_names[27], Dummy4); + } + if (hasDummy5) { + output.WriteInt32(5, field_names[28], Dummy5); + } + if (hasDummy6) { + output.WriteInt32(6, field_names[29], Dummy6); + } + if (hasDummy7) { + output.WriteInt32(7, field_names[30], Dummy7); + } + if (hasDummy8) { + output.WriteInt32(8, field_names[31], Dummy8); + } + if (hasDummy9) { + output.WriteInt32(9, field_names[32], Dummy9); + } + if (hasDummy10) { + output.WriteInt32(10, field_names[3], Dummy10); + } + if (hasDummy11) { + output.WriteInt32(11, field_names[4], Dummy11); + } + if (hasDummy12) { + output.WriteInt32(12, field_names[5], Dummy12); + } + if (hasDummy13) { + output.WriteInt32(13, field_names[6], Dummy13); + } + if (hasDummy14) { + output.WriteInt32(14, field_names[7], Dummy14); + } + if (hasDummy15) { + output.WriteInt32(15, field_names[8], Dummy15); + } + if (hasDummy16) { + output.WriteInt32(16, field_names[9], Dummy16); + } + if (hasDummy17) { + output.WriteInt32(17, field_names[10], Dummy17); + } + if (hasDummy18) { + output.WriteInt32(18, field_names[11], Dummy18); + } + if (hasDummy19) { + output.WriteInt32(19, field_names[12], Dummy19); + } + if (hasDummy20) { + output.WriteInt32(20, field_names[14], Dummy20); + } + if (hasDummy21) { + output.WriteInt32(21, field_names[15], Dummy21); + } + if (hasDummy22) { + output.WriteInt32(22, field_names[16], Dummy22); + } + if (hasDummy23) { + output.WriteInt32(23, field_names[17], Dummy23); + } + if (hasDummy24) { + output.WriteInt32(24, field_names[18], Dummy24); + } + if (hasDummy25) { + output.WriteInt32(25, field_names[19], Dummy25); + } + if (hasDummy26) { + output.WriteInt32(26, field_names[20], Dummy26); + } + if (hasDummy27) { + output.WriteInt32(27, field_names[21], Dummy27); + } + if (hasDummy28) { + output.WriteInt32(28, field_names[22], Dummy28); + } + if (hasDummy29) { + output.WriteInt32(29, field_names[23], Dummy29); + } + if (hasDummy30) { + output.WriteInt32(30, field_names[24], Dummy30); + } + if (hasDummy31) { + output.WriteInt32(31, field_names[25], Dummy31); + } + if (hasDummy32) { + output.WriteInt32(32, field_names[26], Dummy32); + } + if (hasC) { + output.WriteInt32(33, field_names[2], C); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + if (hasDummy2) { + size += pb::CodedOutputStream.ComputeInt32Size(2, Dummy2); + } + if (hasB) { + size += pb::CodedOutputStream.ComputeInt32Size(3, B); + } + if (hasDummy4) { + size += pb::CodedOutputStream.ComputeInt32Size(4, Dummy4); + } + if (hasDummy5) { + size += pb::CodedOutputStream.ComputeInt32Size(5, Dummy5); + } + if (hasDummy6) { + size += pb::CodedOutputStream.ComputeInt32Size(6, Dummy6); + } + if (hasDummy7) { + size += pb::CodedOutputStream.ComputeInt32Size(7, Dummy7); + } + if (hasDummy8) { + size += pb::CodedOutputStream.ComputeInt32Size(8, Dummy8); + } + if (hasDummy9) { + size += pb::CodedOutputStream.ComputeInt32Size(9, Dummy9); + } + if (hasDummy10) { + size += pb::CodedOutputStream.ComputeInt32Size(10, Dummy10); + } + if (hasDummy11) { + size += pb::CodedOutputStream.ComputeInt32Size(11, Dummy11); + } + if (hasDummy12) { + size += pb::CodedOutputStream.ComputeInt32Size(12, Dummy12); + } + if (hasDummy13) { + size += pb::CodedOutputStream.ComputeInt32Size(13, Dummy13); + } + if (hasDummy14) { + size += pb::CodedOutputStream.ComputeInt32Size(14, Dummy14); + } + if (hasDummy15) { + size += pb::CodedOutputStream.ComputeInt32Size(15, Dummy15); + } + if (hasDummy16) { + size += pb::CodedOutputStream.ComputeInt32Size(16, Dummy16); + } + if (hasDummy17) { + size += pb::CodedOutputStream.ComputeInt32Size(17, Dummy17); + } + if (hasDummy18) { + size += pb::CodedOutputStream.ComputeInt32Size(18, Dummy18); + } + if (hasDummy19) { + size += pb::CodedOutputStream.ComputeInt32Size(19, Dummy19); + } + if (hasDummy20) { + size += pb::CodedOutputStream.ComputeInt32Size(20, Dummy20); + } + if (hasDummy21) { + size += pb::CodedOutputStream.ComputeInt32Size(21, Dummy21); + } + if (hasDummy22) { + size += pb::CodedOutputStream.ComputeInt32Size(22, Dummy22); + } + if (hasDummy23) { + size += pb::CodedOutputStream.ComputeInt32Size(23, Dummy23); + } + if (hasDummy24) { + size += pb::CodedOutputStream.ComputeInt32Size(24, Dummy24); + } + if (hasDummy25) { + size += pb::CodedOutputStream.ComputeInt32Size(25, Dummy25); + } + if (hasDummy26) { + size += pb::CodedOutputStream.ComputeInt32Size(26, Dummy26); + } + if (hasDummy27) { + size += pb::CodedOutputStream.ComputeInt32Size(27, Dummy27); + } + if (hasDummy28) { + size += pb::CodedOutputStream.ComputeInt32Size(28, Dummy28); + } + if (hasDummy29) { + size += pb::CodedOutputStream.ComputeInt32Size(29, Dummy29); + } + if (hasDummy30) { + size += pb::CodedOutputStream.ComputeInt32Size(30, Dummy30); + } + if (hasDummy31) { + size += pb::CodedOutputStream.ComputeInt32Size(31, Dummy31); + } + if (hasDummy32) { + size += pb::CodedOutputStream.ComputeInt32Size(32, Dummy32); + } + if (hasC) { + size += pb::CodedOutputStream.ComputeInt32Size(33, C); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRequired ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequired ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequired ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequired ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequired ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequired ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRequired ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRequired ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRequired ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequired ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRequired MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRequired prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRequired cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRequired result; + + private TestRequired PrepareBuilder() { + if (resultIsReadOnly) { + TestRequired original = result; + result = new TestRequired(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRequired MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequired.Descriptor; } + } + + public override TestRequired DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; } + } + + public override TestRequired BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRequired) { + return MergeFrom((TestRequired) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRequired other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + if (other.HasDummy2) { + Dummy2 = other.Dummy2; + } + if (other.HasB) { + B = other.B; + } + if (other.HasDummy4) { + Dummy4 = other.Dummy4; + } + if (other.HasDummy5) { + Dummy5 = other.Dummy5; + } + if (other.HasDummy6) { + Dummy6 = other.Dummy6; + } + if (other.HasDummy7) { + Dummy7 = other.Dummy7; + } + if (other.HasDummy8) { + Dummy8 = other.Dummy8; + } + if (other.HasDummy9) { + Dummy9 = other.Dummy9; + } + if (other.HasDummy10) { + Dummy10 = other.Dummy10; + } + if (other.HasDummy11) { + Dummy11 = other.Dummy11; + } + if (other.HasDummy12) { + Dummy12 = other.Dummy12; + } + if (other.HasDummy13) { + Dummy13 = other.Dummy13; + } + if (other.HasDummy14) { + Dummy14 = other.Dummy14; + } + if (other.HasDummy15) { + Dummy15 = other.Dummy15; + } + if (other.HasDummy16) { + Dummy16 = other.Dummy16; + } + if (other.HasDummy17) { + Dummy17 = other.Dummy17; + } + if (other.HasDummy18) { + Dummy18 = other.Dummy18; + } + if (other.HasDummy19) { + Dummy19 = other.Dummy19; + } + if (other.HasDummy20) { + Dummy20 = other.Dummy20; + } + if (other.HasDummy21) { + Dummy21 = other.Dummy21; + } + if (other.HasDummy22) { + Dummy22 = other.Dummy22; + } + if (other.HasDummy23) { + Dummy23 = other.Dummy23; + } + if (other.HasDummy24) { + Dummy24 = other.Dummy24; + } + if (other.HasDummy25) { + Dummy25 = other.Dummy25; + } + if (other.HasDummy26) { + Dummy26 = other.Dummy26; + } + if (other.HasDummy27) { + Dummy27 = other.Dummy27; + } + if (other.HasDummy28) { + Dummy28 = other.Dummy28; + } + if (other.HasDummy29) { + Dummy29 = other.Dummy29; + } + if (other.HasDummy30) { + Dummy30 = other.Dummy30; + } + if (other.HasDummy31) { + Dummy31 = other.Dummy31; + } + if (other.HasDummy32) { + Dummy32 = other.Dummy32; + } + if (other.HasC) { + C = other.C; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRequiredFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRequiredFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + case 16: { + result.hasDummy2 = input.ReadInt32(ref result.dummy2_); + break; + } + case 24: { + result.hasB = input.ReadInt32(ref result.b_); + break; + } + case 32: { + result.hasDummy4 = input.ReadInt32(ref result.dummy4_); + break; + } + case 40: { + result.hasDummy5 = input.ReadInt32(ref result.dummy5_); + break; + } + case 48: { + result.hasDummy6 = input.ReadInt32(ref result.dummy6_); + break; + } + case 56: { + result.hasDummy7 = input.ReadInt32(ref result.dummy7_); + break; + } + case 64: { + result.hasDummy8 = input.ReadInt32(ref result.dummy8_); + break; + } + case 72: { + result.hasDummy9 = input.ReadInt32(ref result.dummy9_); + break; + } + case 80: { + result.hasDummy10 = input.ReadInt32(ref result.dummy10_); + break; + } + case 88: { + result.hasDummy11 = input.ReadInt32(ref result.dummy11_); + break; + } + case 96: { + result.hasDummy12 = input.ReadInt32(ref result.dummy12_); + break; + } + case 104: { + result.hasDummy13 = input.ReadInt32(ref result.dummy13_); + break; + } + case 112: { + result.hasDummy14 = input.ReadInt32(ref result.dummy14_); + break; + } + case 120: { + result.hasDummy15 = input.ReadInt32(ref result.dummy15_); + break; + } + case 128: { + result.hasDummy16 = input.ReadInt32(ref result.dummy16_); + break; + } + case 136: { + result.hasDummy17 = input.ReadInt32(ref result.dummy17_); + break; + } + case 144: { + result.hasDummy18 = input.ReadInt32(ref result.dummy18_); + break; + } + case 152: { + result.hasDummy19 = input.ReadInt32(ref result.dummy19_); + break; + } + case 160: { + result.hasDummy20 = input.ReadInt32(ref result.dummy20_); + break; + } + case 168: { + result.hasDummy21 = input.ReadInt32(ref result.dummy21_); + break; + } + case 176: { + result.hasDummy22 = input.ReadInt32(ref result.dummy22_); + break; + } + case 184: { + result.hasDummy23 = input.ReadInt32(ref result.dummy23_); + break; + } + case 192: { + result.hasDummy24 = input.ReadInt32(ref result.dummy24_); + break; + } + case 200: { + result.hasDummy25 = input.ReadInt32(ref result.dummy25_); + break; + } + case 208: { + result.hasDummy26 = input.ReadInt32(ref result.dummy26_); + break; + } + case 216: { + result.hasDummy27 = input.ReadInt32(ref result.dummy27_); + break; + } + case 224: { + result.hasDummy28 = input.ReadInt32(ref result.dummy28_); + break; + } + case 232: { + result.hasDummy29 = input.ReadInt32(ref result.dummy29_); + break; + } + case 240: { + result.hasDummy30 = input.ReadInt32(ref result.dummy30_); + break; + } + case 248: { + result.hasDummy31 = input.ReadInt32(ref result.dummy31_); + break; + } + case 256: { + result.hasDummy32 = input.ReadInt32(ref result.dummy32_); + break; + } + case 264: { + result.hasC = input.ReadInt32(ref result.c_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + + public bool HasDummy2 { + get { return result.hasDummy2; } + } + public int Dummy2 { + get { return result.Dummy2; } + set { SetDummy2(value); } + } + public Builder SetDummy2(int value) { + PrepareBuilder(); + result.hasDummy2 = true; + result.dummy2_ = value; + return this; + } + public Builder ClearDummy2() { + PrepareBuilder(); + result.hasDummy2 = false; + result.dummy2_ = 0; + return this; + } + + public bool HasB { + get { return result.hasB; } + } + public int B { + get { return result.B; } + set { SetB(value); } + } + public Builder SetB(int value) { + PrepareBuilder(); + result.hasB = true; + result.b_ = value; + return this; + } + public Builder ClearB() { + PrepareBuilder(); + result.hasB = false; + result.b_ = 0; + return this; + } + + public bool HasDummy4 { + get { return result.hasDummy4; } + } + public int Dummy4 { + get { return result.Dummy4; } + set { SetDummy4(value); } + } + public Builder SetDummy4(int value) { + PrepareBuilder(); + result.hasDummy4 = true; + result.dummy4_ = value; + return this; + } + public Builder ClearDummy4() { + PrepareBuilder(); + result.hasDummy4 = false; + result.dummy4_ = 0; + return this; + } + + public bool HasDummy5 { + get { return result.hasDummy5; } + } + public int Dummy5 { + get { return result.Dummy5; } + set { SetDummy5(value); } + } + public Builder SetDummy5(int value) { + PrepareBuilder(); + result.hasDummy5 = true; + result.dummy5_ = value; + return this; + } + public Builder ClearDummy5() { + PrepareBuilder(); + result.hasDummy5 = false; + result.dummy5_ = 0; + return this; + } + + public bool HasDummy6 { + get { return result.hasDummy6; } + } + public int Dummy6 { + get { return result.Dummy6; } + set { SetDummy6(value); } + } + public Builder SetDummy6(int value) { + PrepareBuilder(); + result.hasDummy6 = true; + result.dummy6_ = value; + return this; + } + public Builder ClearDummy6() { + PrepareBuilder(); + result.hasDummy6 = false; + result.dummy6_ = 0; + return this; + } + + public bool HasDummy7 { + get { return result.hasDummy7; } + } + public int Dummy7 { + get { return result.Dummy7; } + set { SetDummy7(value); } + } + public Builder SetDummy7(int value) { + PrepareBuilder(); + result.hasDummy7 = true; + result.dummy7_ = value; + return this; + } + public Builder ClearDummy7() { + PrepareBuilder(); + result.hasDummy7 = false; + result.dummy7_ = 0; + return this; + } + + public bool HasDummy8 { + get { return result.hasDummy8; } + } + public int Dummy8 { + get { return result.Dummy8; } + set { SetDummy8(value); } + } + public Builder SetDummy8(int value) { + PrepareBuilder(); + result.hasDummy8 = true; + result.dummy8_ = value; + return this; + } + public Builder ClearDummy8() { + PrepareBuilder(); + result.hasDummy8 = false; + result.dummy8_ = 0; + return this; + } + + public bool HasDummy9 { + get { return result.hasDummy9; } + } + public int Dummy9 { + get { return result.Dummy9; } + set { SetDummy9(value); } + } + public Builder SetDummy9(int value) { + PrepareBuilder(); + result.hasDummy9 = true; + result.dummy9_ = value; + return this; + } + public Builder ClearDummy9() { + PrepareBuilder(); + result.hasDummy9 = false; + result.dummy9_ = 0; + return this; + } + + public bool HasDummy10 { + get { return result.hasDummy10; } + } + public int Dummy10 { + get { return result.Dummy10; } + set { SetDummy10(value); } + } + public Builder SetDummy10(int value) { + PrepareBuilder(); + result.hasDummy10 = true; + result.dummy10_ = value; + return this; + } + public Builder ClearDummy10() { + PrepareBuilder(); + result.hasDummy10 = false; + result.dummy10_ = 0; + return this; + } + + public bool HasDummy11 { + get { return result.hasDummy11; } + } + public int Dummy11 { + get { return result.Dummy11; } + set { SetDummy11(value); } + } + public Builder SetDummy11(int value) { + PrepareBuilder(); + result.hasDummy11 = true; + result.dummy11_ = value; + return this; + } + public Builder ClearDummy11() { + PrepareBuilder(); + result.hasDummy11 = false; + result.dummy11_ = 0; + return this; + } + + public bool HasDummy12 { + get { return result.hasDummy12; } + } + public int Dummy12 { + get { return result.Dummy12; } + set { SetDummy12(value); } + } + public Builder SetDummy12(int value) { + PrepareBuilder(); + result.hasDummy12 = true; + result.dummy12_ = value; + return this; + } + public Builder ClearDummy12() { + PrepareBuilder(); + result.hasDummy12 = false; + result.dummy12_ = 0; + return this; + } + + public bool HasDummy13 { + get { return result.hasDummy13; } + } + public int Dummy13 { + get { return result.Dummy13; } + set { SetDummy13(value); } + } + public Builder SetDummy13(int value) { + PrepareBuilder(); + result.hasDummy13 = true; + result.dummy13_ = value; + return this; + } + public Builder ClearDummy13() { + PrepareBuilder(); + result.hasDummy13 = false; + result.dummy13_ = 0; + return this; + } + + public bool HasDummy14 { + get { return result.hasDummy14; } + } + public int Dummy14 { + get { return result.Dummy14; } + set { SetDummy14(value); } + } + public Builder SetDummy14(int value) { + PrepareBuilder(); + result.hasDummy14 = true; + result.dummy14_ = value; + return this; + } + public Builder ClearDummy14() { + PrepareBuilder(); + result.hasDummy14 = false; + result.dummy14_ = 0; + return this; + } + + public bool HasDummy15 { + get { return result.hasDummy15; } + } + public int Dummy15 { + get { return result.Dummy15; } + set { SetDummy15(value); } + } + public Builder SetDummy15(int value) { + PrepareBuilder(); + result.hasDummy15 = true; + result.dummy15_ = value; + return this; + } + public Builder ClearDummy15() { + PrepareBuilder(); + result.hasDummy15 = false; + result.dummy15_ = 0; + return this; + } + + public bool HasDummy16 { + get { return result.hasDummy16; } + } + public int Dummy16 { + get { return result.Dummy16; } + set { SetDummy16(value); } + } + public Builder SetDummy16(int value) { + PrepareBuilder(); + result.hasDummy16 = true; + result.dummy16_ = value; + return this; + } + public Builder ClearDummy16() { + PrepareBuilder(); + result.hasDummy16 = false; + result.dummy16_ = 0; + return this; + } + + public bool HasDummy17 { + get { return result.hasDummy17; } + } + public int Dummy17 { + get { return result.Dummy17; } + set { SetDummy17(value); } + } + public Builder SetDummy17(int value) { + PrepareBuilder(); + result.hasDummy17 = true; + result.dummy17_ = value; + return this; + } + public Builder ClearDummy17() { + PrepareBuilder(); + result.hasDummy17 = false; + result.dummy17_ = 0; + return this; + } + + public bool HasDummy18 { + get { return result.hasDummy18; } + } + public int Dummy18 { + get { return result.Dummy18; } + set { SetDummy18(value); } + } + public Builder SetDummy18(int value) { + PrepareBuilder(); + result.hasDummy18 = true; + result.dummy18_ = value; + return this; + } + public Builder ClearDummy18() { + PrepareBuilder(); + result.hasDummy18 = false; + result.dummy18_ = 0; + return this; + } + + public bool HasDummy19 { + get { return result.hasDummy19; } + } + public int Dummy19 { + get { return result.Dummy19; } + set { SetDummy19(value); } + } + public Builder SetDummy19(int value) { + PrepareBuilder(); + result.hasDummy19 = true; + result.dummy19_ = value; + return this; + } + public Builder ClearDummy19() { + PrepareBuilder(); + result.hasDummy19 = false; + result.dummy19_ = 0; + return this; + } + + public bool HasDummy20 { + get { return result.hasDummy20; } + } + public int Dummy20 { + get { return result.Dummy20; } + set { SetDummy20(value); } + } + public Builder SetDummy20(int value) { + PrepareBuilder(); + result.hasDummy20 = true; + result.dummy20_ = value; + return this; + } + public Builder ClearDummy20() { + PrepareBuilder(); + result.hasDummy20 = false; + result.dummy20_ = 0; + return this; + } + + public bool HasDummy21 { + get { return result.hasDummy21; } + } + public int Dummy21 { + get { return result.Dummy21; } + set { SetDummy21(value); } + } + public Builder SetDummy21(int value) { + PrepareBuilder(); + result.hasDummy21 = true; + result.dummy21_ = value; + return this; + } + public Builder ClearDummy21() { + PrepareBuilder(); + result.hasDummy21 = false; + result.dummy21_ = 0; + return this; + } + + public bool HasDummy22 { + get { return result.hasDummy22; } + } + public int Dummy22 { + get { return result.Dummy22; } + set { SetDummy22(value); } + } + public Builder SetDummy22(int value) { + PrepareBuilder(); + result.hasDummy22 = true; + result.dummy22_ = value; + return this; + } + public Builder ClearDummy22() { + PrepareBuilder(); + result.hasDummy22 = false; + result.dummy22_ = 0; + return this; + } + + public bool HasDummy23 { + get { return result.hasDummy23; } + } + public int Dummy23 { + get { return result.Dummy23; } + set { SetDummy23(value); } + } + public Builder SetDummy23(int value) { + PrepareBuilder(); + result.hasDummy23 = true; + result.dummy23_ = value; + return this; + } + public Builder ClearDummy23() { + PrepareBuilder(); + result.hasDummy23 = false; + result.dummy23_ = 0; + return this; + } + + public bool HasDummy24 { + get { return result.hasDummy24; } + } + public int Dummy24 { + get { return result.Dummy24; } + set { SetDummy24(value); } + } + public Builder SetDummy24(int value) { + PrepareBuilder(); + result.hasDummy24 = true; + result.dummy24_ = value; + return this; + } + public Builder ClearDummy24() { + PrepareBuilder(); + result.hasDummy24 = false; + result.dummy24_ = 0; + return this; + } + + public bool HasDummy25 { + get { return result.hasDummy25; } + } + public int Dummy25 { + get { return result.Dummy25; } + set { SetDummy25(value); } + } + public Builder SetDummy25(int value) { + PrepareBuilder(); + result.hasDummy25 = true; + result.dummy25_ = value; + return this; + } + public Builder ClearDummy25() { + PrepareBuilder(); + result.hasDummy25 = false; + result.dummy25_ = 0; + return this; + } + + public bool HasDummy26 { + get { return result.hasDummy26; } + } + public int Dummy26 { + get { return result.Dummy26; } + set { SetDummy26(value); } + } + public Builder SetDummy26(int value) { + PrepareBuilder(); + result.hasDummy26 = true; + result.dummy26_ = value; + return this; + } + public Builder ClearDummy26() { + PrepareBuilder(); + result.hasDummy26 = false; + result.dummy26_ = 0; + return this; + } + + public bool HasDummy27 { + get { return result.hasDummy27; } + } + public int Dummy27 { + get { return result.Dummy27; } + set { SetDummy27(value); } + } + public Builder SetDummy27(int value) { + PrepareBuilder(); + result.hasDummy27 = true; + result.dummy27_ = value; + return this; + } + public Builder ClearDummy27() { + PrepareBuilder(); + result.hasDummy27 = false; + result.dummy27_ = 0; + return this; + } + + public bool HasDummy28 { + get { return result.hasDummy28; } + } + public int Dummy28 { + get { return result.Dummy28; } + set { SetDummy28(value); } + } + public Builder SetDummy28(int value) { + PrepareBuilder(); + result.hasDummy28 = true; + result.dummy28_ = value; + return this; + } + public Builder ClearDummy28() { + PrepareBuilder(); + result.hasDummy28 = false; + result.dummy28_ = 0; + return this; + } + + public bool HasDummy29 { + get { return result.hasDummy29; } + } + public int Dummy29 { + get { return result.Dummy29; } + set { SetDummy29(value); } + } + public Builder SetDummy29(int value) { + PrepareBuilder(); + result.hasDummy29 = true; + result.dummy29_ = value; + return this; + } + public Builder ClearDummy29() { + PrepareBuilder(); + result.hasDummy29 = false; + result.dummy29_ = 0; + return this; + } + + public bool HasDummy30 { + get { return result.hasDummy30; } + } + public int Dummy30 { + get { return result.Dummy30; } + set { SetDummy30(value); } + } + public Builder SetDummy30(int value) { + PrepareBuilder(); + result.hasDummy30 = true; + result.dummy30_ = value; + return this; + } + public Builder ClearDummy30() { + PrepareBuilder(); + result.hasDummy30 = false; + result.dummy30_ = 0; + return this; + } + + public bool HasDummy31 { + get { return result.hasDummy31; } + } + public int Dummy31 { + get { return result.Dummy31; } + set { SetDummy31(value); } + } + public Builder SetDummy31(int value) { + PrepareBuilder(); + result.hasDummy31 = true; + result.dummy31_ = value; + return this; + } + public Builder ClearDummy31() { + PrepareBuilder(); + result.hasDummy31 = false; + result.dummy31_ = 0; + return this; + } + + public bool HasDummy32 { + get { return result.hasDummy32; } + } + public int Dummy32 { + get { return result.Dummy32; } + set { SetDummy32(value); } + } + public Builder SetDummy32(int value) { + PrepareBuilder(); + result.hasDummy32 = true; + result.dummy32_ = value; + return this; + } + public Builder ClearDummy32() { + PrepareBuilder(); + result.hasDummy32 = false; + result.dummy32_ = 0; + return this; + } + + public bool HasC { + get { return result.hasC; } + } + public int C { + get { return result.C; } + set { SetC(value); } + } + public Builder SetC(int value) { + PrepareBuilder(); + result.hasC = true; + result.c_ = value; + return this; + } + public Builder ClearC() { + PrepareBuilder(); + result.hasC = false; + result.c_ = 0; + return this; + } + } + static TestRequired() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRequiredForeign : pb::GeneratedMessage { + private TestRequiredForeign() { } + private static readonly TestRequiredForeign defaultInstance = new TestRequiredForeign().MakeReadOnly(); + private static readonly string[] _testRequiredForeignFieldNames = new string[] { "dummy", "optional_message", "repeated_message" }; + private static readonly uint[] _testRequiredForeignFieldTags = new uint[] { 24, 10, 18 }; + public static TestRequiredForeign DefaultInstance { + get { return defaultInstance; } + } + + public override TestRequiredForeign DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRequiredForeign ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequiredForeign__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRequiredForeign__FieldAccessorTable; } + } + + public const int OptionalMessageFieldNumber = 1; + private bool hasOptionalMessage; + private global::Google.ProtocolBuffers.TestProtos.TestRequired optionalMessage_; + public bool HasOptionalMessage { + get { return hasOptionalMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired OptionalMessage { + get { return optionalMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance; } + } + + public const int RepeatedMessageFieldNumber = 2; + private pbc::PopsicleList repeatedMessage_ = new pbc::PopsicleList(); + public scg::IList RepeatedMessageList { + get { return repeatedMessage_; } + } + public int RepeatedMessageCount { + get { return repeatedMessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired GetRepeatedMessage(int index) { + return repeatedMessage_[index]; + } + + public const int DummyFieldNumber = 3; + private bool hasDummy; + private int dummy_; + public bool HasDummy { + get { return hasDummy; } + } + public int Dummy { + get { return dummy_; } + } + + public override bool IsInitialized { + get { + if (HasOptionalMessage) { + if (!OptionalMessage.IsInitialized) return false; + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestRequired element in RepeatedMessageList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRequiredForeignFieldNames; + if (hasOptionalMessage) { + output.WriteMessage(1, field_names[1], OptionalMessage); + } + if (repeatedMessage_.Count > 0) { + output.WriteMessageArray(2, field_names[2], repeatedMessage_); + } + if (hasDummy) { + output.WriteInt32(3, field_names[0], Dummy); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalMessage); + } + foreach (global::Google.ProtocolBuffers.TestProtos.TestRequired element in RepeatedMessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + if (hasDummy) { + size += pb::CodedOutputStream.ComputeInt32Size(3, Dummy); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRequiredForeign ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRequiredForeign ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRequiredForeign ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRequiredForeign ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRequiredForeign MakeReadOnly() { + repeatedMessage_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRequiredForeign prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRequiredForeign cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRequiredForeign result; + + private TestRequiredForeign PrepareBuilder() { + if (resultIsReadOnly) { + TestRequiredForeign original = result; + result = new TestRequiredForeign(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRequiredForeign MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.Descriptor; } + } + + public override TestRequiredForeign DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.DefaultInstance; } + } + + public override TestRequiredForeign BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRequiredForeign) { + return MergeFrom((TestRequiredForeign) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRequiredForeign other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRequiredForeign.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalMessage) { + MergeOptionalMessage(other.OptionalMessage); + } + if (other.repeatedMessage_.Count != 0) { + result.repeatedMessage_.Add(other.repeatedMessage_); + } + if (other.HasDummy) { + Dummy = other.Dummy; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRequiredForeignFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRequiredForeignFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestRequired.CreateBuilder(); + if (result.hasOptionalMessage) { + subBuilder.MergeFrom(OptionalMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalMessage = subBuilder.BuildPartial(); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.repeatedMessage_, global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance, extensionRegistry); + break; + } + case 24: { + result.hasDummy = input.ReadInt32(ref result.dummy_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalMessage { + get { return result.hasOptionalMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired OptionalMessage { + get { return result.OptionalMessage; } + set { SetOptionalMessage(value); } + } + public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalMessage = true; + result.optionalMessage_ = value; + return this; + } + public Builder SetOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalMessage = true; + result.optionalMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalMessage && + result.optionalMessage_ != global::Google.ProtocolBuffers.TestProtos.TestRequired.DefaultInstance) { + result.optionalMessage_ = global::Google.ProtocolBuffers.TestProtos.TestRequired.CreateBuilder(result.optionalMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalMessage_ = value; + } + result.hasOptionalMessage = true; + return this; + } + public Builder ClearOptionalMessage() { + PrepareBuilder(); + result.hasOptionalMessage = false; + result.optionalMessage_ = null; + return this; + } + + public pbc::IPopsicleList RepeatedMessageList { + get { return PrepareBuilder().repeatedMessage_; } + } + public int RepeatedMessageCount { + get { return result.RepeatedMessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRequired GetRepeatedMessage(int index) { + return result.GetRepeatedMessage(index); + } + public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessage_[index] = value; + return this; + } + public Builder SetRepeatedMessage(int index, global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessage_.Add(value); + return this; + } + public Builder AddRepeatedMessage(global::Google.ProtocolBuffers.TestProtos.TestRequired.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedMessage(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedMessage_.Add(values); + return this; + } + public Builder ClearRepeatedMessage() { + PrepareBuilder(); + result.repeatedMessage_.Clear(); + return this; + } + + public bool HasDummy { + get { return result.hasDummy; } + } + public int Dummy { + get { return result.Dummy; } + set { SetDummy(value); } + } + public Builder SetDummy(int value) { + PrepareBuilder(); + result.hasDummy = true; + result.dummy_ = value; + return this; + } + public Builder ClearDummy() { + PrepareBuilder(); + result.hasDummy = false; + result.dummy_ = 0; + return this; + } + } + static TestRequiredForeign() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestForeignNested : pb::GeneratedMessage { + private TestForeignNested() { } + private static readonly TestForeignNested defaultInstance = new TestForeignNested().MakeReadOnly(); + private static readonly string[] _testForeignNestedFieldNames = new string[] { "foreign_nested" }; + private static readonly uint[] _testForeignNestedFieldTags = new uint[] { 10 }; + public static TestForeignNested DefaultInstance { + get { return defaultInstance; } + } + + public override TestForeignNested DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestForeignNested ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestForeignNested__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestForeignNested__FieldAccessorTable; } + } + + public const int ForeignNestedFieldNumber = 1; + private bool hasForeignNested; + private global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage foreignNested_; + public bool HasForeignNested { + get { return hasForeignNested; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { + get { return foreignNested_ ?? global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testForeignNestedFieldNames; + if (hasForeignNested) { + output.WriteMessage(1, field_names[0], ForeignNested); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasForeignNested) { + size += pb::CodedOutputStream.ComputeMessageSize(1, ForeignNested); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestForeignNested ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestForeignNested ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestForeignNested ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestForeignNested ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestForeignNested ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestForeignNested ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestForeignNested ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestForeignNested ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestForeignNested ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestForeignNested ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestForeignNested MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestForeignNested prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestForeignNested cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestForeignNested result; + + private TestForeignNested PrepareBuilder() { + if (resultIsReadOnly) { + TestForeignNested original = result; + result = new TestForeignNested(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestForeignNested MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestForeignNested.Descriptor; } + } + + public override TestForeignNested DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestForeignNested.DefaultInstance; } + } + + public override TestForeignNested BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestForeignNested) { + return MergeFrom((TestForeignNested) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestForeignNested other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestForeignNested.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasForeignNested) { + MergeForeignNested(other.ForeignNested); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testForeignNestedFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testForeignNestedFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(); + if (result.hasForeignNested) { + subBuilder.MergeFrom(ForeignNested); + } + input.ReadMessage(subBuilder, extensionRegistry); + ForeignNested = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasForeignNested { + get { return result.hasForeignNested; } + } + public global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage ForeignNested { + get { return result.ForeignNested; } + set { SetForeignNested(value); } + } + public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasForeignNested = true; + result.foreignNested_ = value; + return this; + } + public Builder SetForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasForeignNested = true; + result.foreignNested_ = builderForValue.Build(); + return this; + } + public Builder MergeForeignNested(global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasForeignNested && + result.foreignNested_ != global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.DefaultInstance) { + result.foreignNested_ = global::Google.ProtocolBuffers.TestProtos.TestAllTypes.Types.NestedMessage.CreateBuilder(result.foreignNested_).MergeFrom(value).BuildPartial(); + } else { + result.foreignNested_ = value; + } + result.hasForeignNested = true; + return this; + } + public Builder ClearForeignNested() { + PrepareBuilder(); + result.hasForeignNested = false; + result.foreignNested_ = null; + return this; + } + } + static TestForeignNested() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestEmptyMessage : pb::GeneratedMessage { + private TestEmptyMessage() { } + private static readonly TestEmptyMessage defaultInstance = new TestEmptyMessage().MakeReadOnly(); + private static readonly string[] _testEmptyMessageFieldNames = new string[] { }; + private static readonly uint[] _testEmptyMessageFieldTags = new uint[] { }; + public static TestEmptyMessage DefaultInstance { + get { return defaultInstance; } + } + + public override TestEmptyMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestEmptyMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessage__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testEmptyMessageFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestEmptyMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestEmptyMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestEmptyMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestEmptyMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestEmptyMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestEmptyMessage result; + + private TestEmptyMessage PrepareBuilder() { + if (resultIsReadOnly) { + TestEmptyMessage original = result; + result = new TestEmptyMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestEmptyMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.Descriptor; } + } + + public override TestEmptyMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.DefaultInstance; } + } + + public override TestEmptyMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestEmptyMessage) { + return MergeFrom((TestEmptyMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestEmptyMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessage.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testEmptyMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testEmptyMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestEmptyMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestEmptyMessageWithExtensions : pb::ExtendableMessage { + private TestEmptyMessageWithExtensions() { } + private static readonly TestEmptyMessageWithExtensions defaultInstance = new TestEmptyMessageWithExtensions().MakeReadOnly(); + private static readonly string[] _testEmptyMessageWithExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testEmptyMessageWithExtensionsFieldTags = new uint[] { }; + public static TestEmptyMessageWithExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestEmptyMessageWithExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestEmptyMessageWithExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestEmptyMessageWithExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testEmptyMessageWithExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestEmptyMessageWithExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestEmptyMessageWithExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestEmptyMessageWithExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestEmptyMessageWithExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestEmptyMessageWithExtensions result; + + private TestEmptyMessageWithExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestEmptyMessageWithExtensions original = result; + result = new TestEmptyMessageWithExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestEmptyMessageWithExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.Descriptor; } + } + + public override TestEmptyMessageWithExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.DefaultInstance; } + } + + public override TestEmptyMessageWithExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestEmptyMessageWithExtensions) { + return MergeFrom((TestEmptyMessageWithExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestEmptyMessageWithExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestEmptyMessageWithExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testEmptyMessageWithExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testEmptyMessageWithExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestEmptyMessageWithExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMultipleExtensionRanges : pb::ExtendableMessage { + private TestMultipleExtensionRanges() { } + private static readonly TestMultipleExtensionRanges defaultInstance = new TestMultipleExtensionRanges().MakeReadOnly(); + private static readonly string[] _testMultipleExtensionRangesFieldNames = new string[] { }; + private static readonly uint[] _testMultipleExtensionRangesFieldTags = new uint[] { }; + public static TestMultipleExtensionRanges DefaultInstance { + get { return defaultInstance; } + } + + public override TestMultipleExtensionRanges DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMultipleExtensionRanges ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMultipleExtensionRanges__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMultipleExtensionRanges__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMultipleExtensionRangesFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(43, output); + extensionWriter.WriteUntil(4244, output); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMultipleExtensionRanges ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMultipleExtensionRanges ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMultipleExtensionRanges MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMultipleExtensionRanges prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMultipleExtensionRanges cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMultipleExtensionRanges result; + + private TestMultipleExtensionRanges PrepareBuilder() { + if (resultIsReadOnly) { + TestMultipleExtensionRanges original = result; + result = new TestMultipleExtensionRanges(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMultipleExtensionRanges MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.Descriptor; } + } + + public override TestMultipleExtensionRanges DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.DefaultInstance; } + } + + public override TestMultipleExtensionRanges BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMultipleExtensionRanges) { + return MergeFrom((TestMultipleExtensionRanges) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMultipleExtensionRanges other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMultipleExtensionRanges.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMultipleExtensionRangesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMultipleExtensionRangesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestMultipleExtensionRanges() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestReallyLargeTagNumber : pb::GeneratedMessage { + private TestReallyLargeTagNumber() { } + private static readonly TestReallyLargeTagNumber defaultInstance = new TestReallyLargeTagNumber().MakeReadOnly(); + private static readonly string[] _testReallyLargeTagNumberFieldNames = new string[] { "a", "bb" }; + private static readonly uint[] _testReallyLargeTagNumberFieldTags = new uint[] { 8, 2147483640 }; + public static TestReallyLargeTagNumber DefaultInstance { + get { return defaultInstance; } + } + + public override TestReallyLargeTagNumber DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestReallyLargeTagNumber ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestReallyLargeTagNumber__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestReallyLargeTagNumber__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public const int BbFieldNumber = 268435455; + private bool hasBb; + private int bb_; + public bool HasBb { + get { return hasBb; } + } + public int Bb { + get { return bb_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testReallyLargeTagNumberFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + if (hasBb) { + output.WriteInt32(268435455, field_names[1], Bb); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + if (hasBb) { + size += pb::CodedOutputStream.ComputeInt32Size(268435455, Bb); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestReallyLargeTagNumber ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestReallyLargeTagNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestReallyLargeTagNumber MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestReallyLargeTagNumber prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestReallyLargeTagNumber cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestReallyLargeTagNumber result; + + private TestReallyLargeTagNumber PrepareBuilder() { + if (resultIsReadOnly) { + TestReallyLargeTagNumber original = result; + result = new TestReallyLargeTagNumber(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestReallyLargeTagNumber MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.Descriptor; } + } + + public override TestReallyLargeTagNumber DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.DefaultInstance; } + } + + public override TestReallyLargeTagNumber BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestReallyLargeTagNumber) { + return MergeFrom((TestReallyLargeTagNumber) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestReallyLargeTagNumber other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestReallyLargeTagNumber.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + if (other.HasBb) { + Bb = other.Bb; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testReallyLargeTagNumberFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testReallyLargeTagNumberFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + case 2147483640: { + result.hasBb = input.ReadInt32(ref result.bb_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + + public bool HasBb { + get { return result.hasBb; } + } + public int Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(int value) { + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = 0; + return this; + } + } + static TestReallyLargeTagNumber() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRecursiveMessage : pb::GeneratedMessage { + private TestRecursiveMessage() { } + private static readonly TestRecursiveMessage defaultInstance = new TestRecursiveMessage().MakeReadOnly(); + private static readonly string[] _testRecursiveMessageFieldNames = new string[] { "a", "i" }; + private static readonly uint[] _testRecursiveMessageFieldTags = new uint[] { 10, 16 }; + public static TestRecursiveMessage DefaultInstance { + get { return defaultInstance; } + } + + public override TestRecursiveMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRecursiveMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRecursiveMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRecursiveMessage__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage a_; + public bool HasA { + get { return hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage A { + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; } + } + + public const int IFieldNumber = 2; + private bool hasI; + private int i_; + public bool HasI { + get { return hasI; } + } + public int I { + get { return i_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRecursiveMessageFieldNames; + if (hasA) { + output.WriteMessage(1, field_names[0], A); + } + if (hasI) { + output.WriteInt32(2, field_names[1], I); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeMessageSize(1, A); + } + if (hasI) { + size += pb::CodedOutputStream.ComputeInt32Size(2, I); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRecursiveMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRecursiveMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRecursiveMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRecursiveMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRecursiveMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRecursiveMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRecursiveMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRecursiveMessage result; + + private TestRecursiveMessage PrepareBuilder() { + if (resultIsReadOnly) { + TestRecursiveMessage original = result; + result = new TestRecursiveMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRecursiveMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Descriptor; } + } + + public override TestRecursiveMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance; } + } + + public override TestRecursiveMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRecursiveMessage) { + return MergeFrom((TestRecursiveMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRecursiveMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + MergeA(other.A); + } + if (other.HasI) { + I = other.I; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRecursiveMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRecursiveMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.CreateBuilder(); + if (result.hasA) { + subBuilder.MergeFrom(A); + } + input.ReadMessage(subBuilder, extensionRegistry); + A = subBuilder.BuildPartial(); + break; + } + case 16: { + result.hasI = input.ReadInt32(ref result.i_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasA = true; + result.a_ = builderForValue.Build(); + return this; + } + public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasA && + result.a_ != global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.DefaultInstance) { + result.a_ = global::Google.ProtocolBuffers.TestProtos.TestRecursiveMessage.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); + } else { + result.a_ = value; + } + result.hasA = true; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = null; + return this; + } + + public bool HasI { + get { return result.hasI; } + } + public int I { + get { return result.I; } + set { SetI(value); } + } + public Builder SetI(int value) { + PrepareBuilder(); + result.hasI = true; + result.i_ = value; + return this; + } + public Builder ClearI() { + PrepareBuilder(); + result.hasI = false; + result.i_ = 0; + return this; + } + } + static TestRecursiveMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMutualRecursionA : pb::GeneratedMessage { + private TestMutualRecursionA() { } + private static readonly TestMutualRecursionA defaultInstance = new TestMutualRecursionA().MakeReadOnly(); + private static readonly string[] _testMutualRecursionAFieldNames = new string[] { "bb" }; + private static readonly uint[] _testMutualRecursionAFieldTags = new uint[] { 10 }; + public static TestMutualRecursionA DefaultInstance { + get { return defaultInstance; } + } + + public override TestMutualRecursionA DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMutualRecursionA ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionA__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionA__FieldAccessorTable; } + } + + public const int BbFieldNumber = 1; + private bool hasBb; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB bb_; + public bool HasBb { + get { return hasBb; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB Bb { + get { return bb_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMutualRecursionAFieldNames; + if (hasBb) { + output.WriteMessage(1, field_names[0], Bb); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasBb) { + size += pb::CodedOutputStream.ComputeMessageSize(1, Bb); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMutualRecursionA ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionA ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMutualRecursionA ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionA ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMutualRecursionA MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMutualRecursionA prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMutualRecursionA cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMutualRecursionA result; + + private TestMutualRecursionA PrepareBuilder() { + if (resultIsReadOnly) { + TestMutualRecursionA original = result; + result = new TestMutualRecursionA(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMutualRecursionA MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Descriptor; } + } + + public override TestMutualRecursionA DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; } + } + + public override TestMutualRecursionA BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMutualRecursionA) { + return MergeFrom((TestMutualRecursionA) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMutualRecursionA other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasBb) { + MergeBb(other.Bb); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMutualRecursionAFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMutualRecursionAFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.CreateBuilder(); + if (result.hasBb) { + subBuilder.MergeFrom(Bb); + } + input.ReadMessage(subBuilder, extensionRegistry); + Bb = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasBb { + get { return result.hasBb; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB Bb { + get { return result.Bb; } + set { SetBb(value); } + } + public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBb = true; + result.bb_ = value; + return this; + } + public Builder SetBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasBb = true; + result.bb_ = builderForValue.Build(); + return this; + } + public Builder MergeBb(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasBb && + result.bb_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) { + result.bb_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.CreateBuilder(result.bb_).MergeFrom(value).BuildPartial(); + } else { + result.bb_ = value; + } + result.hasBb = true; + return this; + } + public Builder ClearBb() { + PrepareBuilder(); + result.hasBb = false; + result.bb_ = null; + return this; + } + } + static TestMutualRecursionA() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestMutualRecursionB : pb::GeneratedMessage { + private TestMutualRecursionB() { } + private static readonly TestMutualRecursionB defaultInstance = new TestMutualRecursionB().MakeReadOnly(); + private static readonly string[] _testMutualRecursionBFieldNames = new string[] { "a", "optional_int32" }; + private static readonly uint[] _testMutualRecursionBFieldTags = new uint[] { 10, 16 }; + public static TestMutualRecursionB DefaultInstance { + get { return defaultInstance; } + } + + public override TestMutualRecursionB DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestMutualRecursionB ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionB__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestMutualRecursionB__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA a_; + public bool HasA { + get { return hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA A { + get { return a_ ?? global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance; } + } + + public const int OptionalInt32FieldNumber = 2; + private bool hasOptionalInt32; + private int optionalInt32_; + public bool HasOptionalInt32 { + get { return hasOptionalInt32; } + } + public int OptionalInt32 { + get { return optionalInt32_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testMutualRecursionBFieldNames; + if (hasA) { + output.WriteMessage(1, field_names[0], A); + } + if (hasOptionalInt32) { + output.WriteInt32(2, field_names[1], OptionalInt32); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeMessageSize(1, A); + } + if (hasOptionalInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(2, OptionalInt32); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestMutualRecursionB ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestMutualRecursionB ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestMutualRecursionB ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestMutualRecursionB ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestMutualRecursionB MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestMutualRecursionB prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestMutualRecursionB cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestMutualRecursionB result; + + private TestMutualRecursionB PrepareBuilder() { + if (resultIsReadOnly) { + TestMutualRecursionB original = result; + result = new TestMutualRecursionB(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestMutualRecursionB MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.Descriptor; } + } + + public override TestMutualRecursionB DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance; } + } + + public override TestMutualRecursionB BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestMutualRecursionB) { + return MergeFrom((TestMutualRecursionB) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestMutualRecursionB other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionB.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + MergeA(other.A); + } + if (other.HasOptionalInt32) { + OptionalInt32 = other.OptionalInt32; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testMutualRecursionBFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testMutualRecursionBFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.CreateBuilder(); + if (result.hasA) { + subBuilder.MergeFrom(A); + } + input.ReadMessage(subBuilder, extensionRegistry); + A = subBuilder.BuildPartial(); + break; + } + case 16: { + result.hasOptionalInt32 = input.ReadInt32(ref result.optionalInt32_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder SetA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasA = true; + result.a_ = builderForValue.Build(); + return this; + } + public Builder MergeA(global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasA && + result.a_ != global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.DefaultInstance) { + result.a_ = global::Google.ProtocolBuffers.TestProtos.TestMutualRecursionA.CreateBuilder(result.a_).MergeFrom(value).BuildPartial(); + } else { + result.a_ = value; + } + result.hasA = true; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = null; + return this; + } + + public bool HasOptionalInt32 { + get { return result.hasOptionalInt32; } + } + public int OptionalInt32 { + get { return result.OptionalInt32; } + set { SetOptionalInt32(value); } + } + public Builder SetOptionalInt32(int value) { + PrepareBuilder(); + result.hasOptionalInt32 = true; + result.optionalInt32_ = value; + return this; + } + public Builder ClearOptionalInt32() { + PrepareBuilder(); + result.hasOptionalInt32 = false; + result.optionalInt32_ = 0; + return this; + } + } + static TestMutualRecursionB() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDupFieldNumber : pb::GeneratedMessage { + private TestDupFieldNumber() { } + private static readonly TestDupFieldNumber defaultInstance = new TestDupFieldNumber().MakeReadOnly(); + private static readonly string[] _testDupFieldNumberFieldNames = new string[] { "a", "bar", "foo" }; + private static readonly uint[] _testDupFieldNumberFieldTags = new uint[] { 8, 27, 19 }; + public static TestDupFieldNumber DefaultInstance { + get { return defaultInstance; } + } + + public override TestDupFieldNumber DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDupFieldNumber ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Foo : pb::GeneratedMessage { + private Foo() { } + private static readonly Foo defaultInstance = new Foo().MakeReadOnly(); + private static readonly string[] _fooFieldNames = new string[] { "a" }; + private static readonly uint[] _fooFieldTags = new uint[] { 8 }; + public static Foo DefaultInstance { + get { return defaultInstance; } + } + + public override Foo DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Foo ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Foo__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Foo__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fooFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Foo ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Foo ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Foo ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Foo ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Foo ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Foo ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Foo ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Foo ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Foo ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Foo ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Foo MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Foo prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Foo cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Foo result; + + private Foo PrepareBuilder() { + if (resultIsReadOnly) { + Foo original = result; + result = new Foo(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Foo MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Descriptor; } + } + + public override Foo DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; } + } + + public override Foo BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Foo) { + return MergeFrom((Foo) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Foo other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fooFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fooFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static Foo() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Bar : pb::GeneratedMessage { + private Bar() { } + private static readonly Bar defaultInstance = new Bar().MakeReadOnly(); + private static readonly string[] _barFieldNames = new string[] { "a" }; + private static readonly uint[] _barFieldTags = new uint[] { 8 }; + public static Bar DefaultInstance { + get { return defaultInstance; } + } + + public override Bar DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override Bar ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Bar__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDupFieldNumber_Bar__FieldAccessorTable; } + } + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _barFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static Bar ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Bar ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Bar ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static Bar ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static Bar ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Bar ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static Bar ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static Bar ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static Bar ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static Bar ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private Bar MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(Bar prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(Bar cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private Bar result; + + private Bar PrepareBuilder() { + if (resultIsReadOnly) { + Bar original = result; + result = new Bar(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override Bar MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Descriptor; } + } + + public override Bar DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; } + } + + public override Bar BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is Bar) { + return MergeFrom((Bar) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(Bar other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_barFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _barFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + } + static Bar() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int AFieldNumber = 1; + private bool hasA; + private int a_; + public bool HasA { + get { return hasA; } + } + public int A { + get { return a_; } + } + + public const int FooFieldNumber = 2; + private bool hasFoo; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo foo_; + public bool HasFoo { + get { return hasFoo; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo Foo { + get { return foo_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance; } + } + + public const int BarFieldNumber = 3; + private bool hasBar; + private global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar bar_; + public bool HasBar { + get { return hasBar; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar Bar { + get { return bar_ ?? global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDupFieldNumberFieldNames; + if (hasA) { + output.WriteInt32(1, field_names[0], A); + } + if (hasFoo) { + output.WriteGroup(2, field_names[2], Foo); + } + if (hasBar) { + output.WriteGroup(3, field_names[1], Bar); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasA) { + size += pb::CodedOutputStream.ComputeInt32Size(1, A); + } + if (hasFoo) { + size += pb::CodedOutputStream.ComputeGroupSize(2, Foo); + } + if (hasBar) { + size += pb::CodedOutputStream.ComputeGroupSize(3, Bar); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestDupFieldNumber ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDupFieldNumber ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDupFieldNumber ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDupFieldNumber ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDupFieldNumber MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDupFieldNumber prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDupFieldNumber cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDupFieldNumber result; + + private TestDupFieldNumber PrepareBuilder() { + if (resultIsReadOnly) { + TestDupFieldNumber original = result; + result = new TestDupFieldNumber(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDupFieldNumber MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Descriptor; } + } + + public override TestDupFieldNumber DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.DefaultInstance; } + } + + public override TestDupFieldNumber BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestDupFieldNumber) { + return MergeFrom((TestDupFieldNumber) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDupFieldNumber other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasA) { + A = other.A; + } + if (other.HasFoo) { + MergeFoo(other.Foo); + } + if (other.HasBar) { + MergeBar(other.Bar); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDupFieldNumberFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDupFieldNumberFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasA = input.ReadInt32(ref result.a_); + break; + } + case 19: { + global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.CreateBuilder(); + if (result.hasFoo) { + subBuilder.MergeFrom(Foo); + } + input.ReadGroup(2, subBuilder, extensionRegistry); + Foo = subBuilder.BuildPartial(); + break; + } + case 27: { + global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.CreateBuilder(); + if (result.hasBar) { + subBuilder.MergeFrom(Bar); + } + input.ReadGroup(3, subBuilder, extensionRegistry); + Bar = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasA { + get { return result.hasA; } + } + public int A { + get { return result.A; } + set { SetA(value); } + } + public Builder SetA(int value) { + PrepareBuilder(); + result.hasA = true; + result.a_ = value; + return this; + } + public Builder ClearA() { + PrepareBuilder(); + result.hasA = false; + result.a_ = 0; + return this; + } + + public bool HasFoo { + get { return result.hasFoo; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo Foo { + get { return result.Foo; } + set { SetFoo(value); } + } + public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasFoo = true; + result.foo_ = value; + return this; + } + public Builder SetFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasFoo = true; + result.foo_ = builderForValue.Build(); + return this; + } + public Builder MergeFoo(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasFoo && + result.foo_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.DefaultInstance) { + result.foo_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Foo.CreateBuilder(result.foo_).MergeFrom(value).BuildPartial(); + } else { + result.foo_ = value; + } + result.hasFoo = true; + return this; + } + public Builder ClearFoo() { + PrepareBuilder(); + result.hasFoo = false; + result.foo_ = null; + return this; + } + + public bool HasBar { + get { return result.hasBar; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar Bar { + get { return result.Bar; } + set { SetBar(value); } + } + public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasBar = true; + result.bar_ = value; + return this; + } + public Builder SetBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasBar = true; + result.bar_ = builderForValue.Build(); + return this; + } + public Builder MergeBar(global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasBar && + result.bar_ != global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.DefaultInstance) { + result.bar_ = global::Google.ProtocolBuffers.TestProtos.TestDupFieldNumber.Types.Bar.CreateBuilder(result.bar_).MergeFrom(value).BuildPartial(); + } else { + result.bar_ = value; + } + result.hasBar = true; + return this; + } + public Builder ClearBar() { + PrepareBuilder(); + result.hasBar = false; + result.bar_ = null; + return this; + } + } + static TestDupFieldNumber() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestNestedMessageHasBits : pb::GeneratedMessage { + private TestNestedMessageHasBits() { } + private static readonly TestNestedMessageHasBits defaultInstance = new TestNestedMessageHasBits().MakeReadOnly(); + private static readonly string[] _testNestedMessageHasBitsFieldNames = new string[] { "optional_nested_message" }; + private static readonly uint[] _testNestedMessageHasBitsFieldTags = new uint[] { 10 }; + public static TestNestedMessageHasBits DefaultInstance { + get { return defaultInstance; } + } + + public override TestNestedMessageHasBits DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestNestedMessageHasBits ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class NestedMessage : pb::GeneratedMessage { + private NestedMessage() { } + private static readonly NestedMessage defaultInstance = new NestedMessage().MakeReadOnly(); + private static readonly string[] _nestedMessageFieldNames = new string[] { "nestedmessage_repeated_foreignmessage", "nestedmessage_repeated_int32" }; + private static readonly uint[] _nestedMessageFieldTags = new uint[] { 18, 8 }; + public static NestedMessage DefaultInstance { + get { return defaultInstance; } + } + + public override NestedMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override NestedMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestNestedMessageHasBits_NestedMessage__FieldAccessorTable; } + } + + public const int NestedmessageRepeatedInt32FieldNumber = 1; + private pbc::PopsicleList nestedmessageRepeatedInt32_ = new pbc::PopsicleList(); + public scg::IList NestedmessageRepeatedInt32List { + get { return pbc::Lists.AsReadOnly(nestedmessageRepeatedInt32_); } + } + public int NestedmessageRepeatedInt32Count { + get { return nestedmessageRepeatedInt32_.Count; } + } + public int GetNestedmessageRepeatedInt32(int index) { + return nestedmessageRepeatedInt32_[index]; + } + + public const int NestedmessageRepeatedForeignmessageFieldNumber = 2; + private pbc::PopsicleList nestedmessageRepeatedForeignmessage_ = new pbc::PopsicleList(); + public scg::IList NestedmessageRepeatedForeignmessageList { + get { return nestedmessageRepeatedForeignmessage_; } + } + public int NestedmessageRepeatedForeignmessageCount { + get { return nestedmessageRepeatedForeignmessage_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetNestedmessageRepeatedForeignmessage(int index) { + return nestedmessageRepeatedForeignmessage_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _nestedMessageFieldNames; + if (nestedmessageRepeatedInt32_.Count > 0) { + output.WriteInt32Array(1, field_names[1], nestedmessageRepeatedInt32_); + } + if (nestedmessageRepeatedForeignmessage_.Count > 0) { + output.WriteMessageArray(2, field_names[0], nestedmessageRepeatedForeignmessage_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in NestedmessageRepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * nestedmessageRepeatedInt32_.Count; + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessage element in NestedmessageRepeatedForeignmessageList) { + size += pb::CodedOutputStream.ComputeMessageSize(2, element); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static NestedMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static NestedMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static NestedMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static NestedMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private NestedMessage MakeReadOnly() { + nestedmessageRepeatedInt32_.MakeReadOnly(); + nestedmessageRepeatedForeignmessage_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(NestedMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(NestedMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private NestedMessage result; + + private NestedMessage PrepareBuilder() { + if (resultIsReadOnly) { + NestedMessage original = result; + result = new NestedMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override NestedMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Descriptor; } + } + + public override NestedMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; } + } + + public override NestedMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is NestedMessage) { + return MergeFrom((NestedMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(NestedMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.nestedmessageRepeatedInt32_.Count != 0) { + result.nestedmessageRepeatedInt32_.Add(other.nestedmessageRepeatedInt32_); + } + if (other.nestedmessageRepeatedForeignmessage_.Count != 0) { + result.nestedmessageRepeatedForeignmessage_.Add(other.nestedmessageRepeatedForeignmessage_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_nestedMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _nestedMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: + case 8: { + input.ReadInt32Array(tag, field_name, result.nestedmessageRepeatedInt32_); + break; + } + case 18: { + input.ReadMessageArray(tag, field_name, result.nestedmessageRepeatedForeignmessage_, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance, extensionRegistry); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList NestedmessageRepeatedInt32List { + get { return PrepareBuilder().nestedmessageRepeatedInt32_; } + } + public int NestedmessageRepeatedInt32Count { + get { return result.NestedmessageRepeatedInt32Count; } + } + public int GetNestedmessageRepeatedInt32(int index) { + return result.GetNestedmessageRepeatedInt32(index); + } + public Builder SetNestedmessageRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_[index] = value; + return this; + } + public Builder AddNestedmessageRepeatedInt32(int value) { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_.Add(value); + return this; + } + public Builder AddRangeNestedmessageRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_.Add(values); + return this; + } + public Builder ClearNestedmessageRepeatedInt32() { + PrepareBuilder(); + result.nestedmessageRepeatedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList NestedmessageRepeatedForeignmessageList { + get { return PrepareBuilder().nestedmessageRepeatedForeignmessage_; } + } + public int NestedmessageRepeatedForeignmessageCount { + get { return result.NestedmessageRepeatedForeignmessageCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetNestedmessageRepeatedForeignmessage(int index) { + return result.GetNestedmessageRepeatedForeignmessage(index); + } + public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_[index] = value; + return this; + } + public Builder SetNestedmessageRepeatedForeignmessage(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_[index] = builderForValue.Build(); + return this; + } + public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Add(value); + return this; + } + public Builder AddNestedmessageRepeatedForeignmessage(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeNestedmessageRepeatedForeignmessage(scg::IEnumerable values) { + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Add(values); + return this; + } + public Builder ClearNestedmessageRepeatedForeignmessage() { + PrepareBuilder(); + result.nestedmessageRepeatedForeignmessage_.Clear(); + return this; + } + } + static NestedMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int OptionalNestedMessageFieldNumber = 1; + private bool hasOptionalNestedMessage; + private global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage optionalNestedMessage_; + public bool HasOptionalNestedMessage { + get { return hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage OptionalNestedMessage { + get { return optionalNestedMessage_ ?? global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testNestedMessageHasBitsFieldNames; + if (hasOptionalNestedMessage) { + output.WriteMessage(1, field_names[0], OptionalNestedMessage); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasOptionalNestedMessage) { + size += pb::CodedOutputStream.ComputeMessageSize(1, OptionalNestedMessage); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestNestedMessageHasBits ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestNestedMessageHasBits ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestNestedMessageHasBits ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestNestedMessageHasBits MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestNestedMessageHasBits prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestNestedMessageHasBits cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestNestedMessageHasBits result; + + private TestNestedMessageHasBits PrepareBuilder() { + if (resultIsReadOnly) { + TestNestedMessageHasBits original = result; + result = new TestNestedMessageHasBits(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestNestedMessageHasBits MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Descriptor; } + } + + public override TestNestedMessageHasBits DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.DefaultInstance; } + } + + public override TestNestedMessageHasBits BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestNestedMessageHasBits) { + return MergeFrom((TestNestedMessageHasBits) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestNestedMessageHasBits other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasOptionalNestedMessage) { + MergeOptionalNestedMessage(other.OptionalNestedMessage); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testNestedMessageHasBitsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testNestedMessageHasBitsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.CreateBuilder(); + if (result.hasOptionalNestedMessage) { + subBuilder.MergeFrom(OptionalNestedMessage); + } + input.ReadMessage(subBuilder, extensionRegistry); + OptionalNestedMessage = subBuilder.BuildPartial(); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasOptionalNestedMessage { + get { return result.hasOptionalNestedMessage; } + } + public global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage OptionalNestedMessage { + get { return result.OptionalNestedMessage; } + set { SetOptionalNestedMessage(value); } + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = value; + return this; + } + public Builder SetOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasOptionalNestedMessage = true; + result.optionalNestedMessage_ = builderForValue.Build(); + return this; + } + public Builder MergeOptionalNestedMessage(global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasOptionalNestedMessage && + result.optionalNestedMessage_ != global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.DefaultInstance) { + result.optionalNestedMessage_ = global::Google.ProtocolBuffers.TestProtos.TestNestedMessageHasBits.Types.NestedMessage.CreateBuilder(result.optionalNestedMessage_).MergeFrom(value).BuildPartial(); + } else { + result.optionalNestedMessage_ = value; + } + result.hasOptionalNestedMessage = true; + return this; + } + public Builder ClearOptionalNestedMessage() { + PrepareBuilder(); + result.hasOptionalNestedMessage = false; + result.optionalNestedMessage_ = null; + return this; + } + } + static TestNestedMessageHasBits() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestCamelCaseFieldNames : pb::GeneratedMessage { + private TestCamelCaseFieldNames() { } + private static readonly TestCamelCaseFieldNames defaultInstance = new TestCamelCaseFieldNames().MakeReadOnly(); + private static readonly string[] _testCamelCaseFieldNamesFieldNames = new string[] { "CordField", "EnumField", "MessageField", "PrimitiveField", "RepeatedCordField", "RepeatedEnumField", "RepeatedMessageField", "RepeatedPrimitiveField", "RepeatedStringField", "RepeatedStringPieceField", "StringField", "StringPieceField" }; + private static readonly uint[] _testCamelCaseFieldNamesFieldTags = new uint[] { 50, 24, 34, 8, 98, 72, 82, 56, 66, 90, 18, 42 }; + public static TestCamelCaseFieldNames DefaultInstance { + get { return defaultInstance; } + } + + public override TestCamelCaseFieldNames DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestCamelCaseFieldNames ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestCamelCaseFieldNames__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestCamelCaseFieldNames__FieldAccessorTable; } + } + + public const int PrimitiveFieldFieldNumber = 1; + private bool hasPrimitiveField; + private int primitiveField_; + public bool HasPrimitiveField { + get { return hasPrimitiveField; } + } + public int PrimitiveField { + get { return primitiveField_; } + } + + public const int StringFieldFieldNumber = 2; + private bool hasStringField; + private string stringField_ = ""; + public bool HasStringField { + get { return hasStringField; } + } + public string StringField { + get { return stringField_; } + } + + public const int EnumFieldFieldNumber = 3; + private bool hasEnumField; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum enumField_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + public bool HasEnumField { + get { return hasEnumField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumField { + get { return enumField_; } + } + + public const int MessageFieldFieldNumber = 4; + private bool hasMessageField; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageField_; + public bool HasMessageField { + get { return hasMessageField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageField { + get { return messageField_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public const int StringPieceFieldFieldNumber = 5; + private bool hasStringPieceField; + private string stringPieceField_ = ""; + public bool HasStringPieceField { + get { return hasStringPieceField; } + } + public string StringPieceField { + get { return stringPieceField_; } + } + + public const int CordFieldFieldNumber = 6; + private bool hasCordField; + private string cordField_ = ""; + public bool HasCordField { + get { return hasCordField; } + } + public string CordField { + get { return cordField_; } + } + + public const int RepeatedPrimitiveFieldFieldNumber = 7; + private pbc::PopsicleList repeatedPrimitiveField_ = new pbc::PopsicleList(); + public scg::IList RepeatedPrimitiveFieldList { + get { return pbc::Lists.AsReadOnly(repeatedPrimitiveField_); } + } + public int RepeatedPrimitiveFieldCount { + get { return repeatedPrimitiveField_.Count; } + } + public int GetRepeatedPrimitiveField(int index) { + return repeatedPrimitiveField_[index]; + } + + public const int RepeatedStringFieldFieldNumber = 8; + private pbc::PopsicleList repeatedStringField_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringFieldList { + get { return pbc::Lists.AsReadOnly(repeatedStringField_); } + } + public int RepeatedStringFieldCount { + get { return repeatedStringField_.Count; } + } + public string GetRepeatedStringField(int index) { + return repeatedStringField_[index]; + } + + public const int RepeatedEnumFieldFieldNumber = 9; + private pbc::PopsicleList repeatedEnumField_ = new pbc::PopsicleList(); + public scg::IList RepeatedEnumFieldList { + get { return pbc::Lists.AsReadOnly(repeatedEnumField_); } + } + public int RepeatedEnumFieldCount { + get { return repeatedEnumField_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedEnumField(int index) { + return repeatedEnumField_[index]; + } + + public const int RepeatedMessageFieldFieldNumber = 10; + private pbc::PopsicleList repeatedMessageField_ = new pbc::PopsicleList(); + public scg::IList RepeatedMessageFieldList { + get { return repeatedMessageField_; } + } + public int RepeatedMessageFieldCount { + get { return repeatedMessageField_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedMessageField(int index) { + return repeatedMessageField_[index]; + } + + public const int RepeatedStringPieceFieldFieldNumber = 11; + private pbc::PopsicleList repeatedStringPieceField_ = new pbc::PopsicleList(); + public scg::IList RepeatedStringPieceFieldList { + get { return pbc::Lists.AsReadOnly(repeatedStringPieceField_); } + } + public int RepeatedStringPieceFieldCount { + get { return repeatedStringPieceField_.Count; } + } + public string GetRepeatedStringPieceField(int index) { + return repeatedStringPieceField_[index]; + } + + public const int RepeatedCordFieldFieldNumber = 12; + private pbc::PopsicleList repeatedCordField_ = new pbc::PopsicleList(); + public scg::IList RepeatedCordFieldList { + get { return pbc::Lists.AsReadOnly(repeatedCordField_); } + } + public int RepeatedCordFieldCount { + get { return repeatedCordField_.Count; } + } + public string GetRepeatedCordField(int index) { + return repeatedCordField_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testCamelCaseFieldNamesFieldNames; + if (hasPrimitiveField) { + output.WriteInt32(1, field_names[3], PrimitiveField); + } + if (hasStringField) { + output.WriteString(2, field_names[10], StringField); + } + if (hasEnumField) { + output.WriteEnum(3, field_names[1], (int) EnumField, EnumField); + } + if (hasMessageField) { + output.WriteMessage(4, field_names[2], MessageField); + } + if (hasStringPieceField) { + output.WriteString(5, field_names[11], StringPieceField); + } + if (hasCordField) { + output.WriteString(6, field_names[0], CordField); + } + if (repeatedPrimitiveField_.Count > 0) { + output.WriteInt32Array(7, field_names[7], repeatedPrimitiveField_); + } + if (repeatedStringField_.Count > 0) { + output.WriteStringArray(8, field_names[8], repeatedStringField_); + } + if (repeatedEnumField_.Count > 0) { + output.WriteEnumArray(9, field_names[5], repeatedEnumField_); + } + if (repeatedMessageField_.Count > 0) { + output.WriteMessageArray(10, field_names[6], repeatedMessageField_); + } + if (repeatedStringPieceField_.Count > 0) { + output.WriteStringArray(11, field_names[9], repeatedStringPieceField_); + } + if (repeatedCordField_.Count > 0) { + output.WriteStringArray(12, field_names[4], repeatedCordField_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasPrimitiveField) { + size += pb::CodedOutputStream.ComputeInt32Size(1, PrimitiveField); + } + if (hasStringField) { + size += pb::CodedOutputStream.ComputeStringSize(2, StringField); + } + if (hasEnumField) { + size += pb::CodedOutputStream.ComputeEnumSize(3, (int) EnumField); + } + if (hasMessageField) { + size += pb::CodedOutputStream.ComputeMessageSize(4, MessageField); + } + if (hasStringPieceField) { + size += pb::CodedOutputStream.ComputeStringSize(5, StringPieceField); + } + if (hasCordField) { + size += pb::CodedOutputStream.ComputeStringSize(6, CordField); + } + { + int dataSize = 0; + foreach (int element in RepeatedPrimitiveFieldList) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedPrimitiveField_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedStringFieldList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedStringField_.Count; + } + { + int dataSize = 0; + if (repeatedEnumField_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in repeatedEnumField_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 1 * repeatedEnumField_.Count; + } + } + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignMessage element in RepeatedMessageFieldList) { + size += pb::CodedOutputStream.ComputeMessageSize(10, element); + } + { + int dataSize = 0; + foreach (string element in RepeatedStringPieceFieldList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedStringPieceField_.Count; + } + { + int dataSize = 0; + foreach (string element in RepeatedCordFieldList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedCordField_.Count; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestCamelCaseFieldNames ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestCamelCaseFieldNames ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestCamelCaseFieldNames MakeReadOnly() { + repeatedPrimitiveField_.MakeReadOnly(); + repeatedStringField_.MakeReadOnly(); + repeatedEnumField_.MakeReadOnly(); + repeatedMessageField_.MakeReadOnly(); + repeatedStringPieceField_.MakeReadOnly(); + repeatedCordField_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestCamelCaseFieldNames prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestCamelCaseFieldNames cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestCamelCaseFieldNames result; + + private TestCamelCaseFieldNames PrepareBuilder() { + if (resultIsReadOnly) { + TestCamelCaseFieldNames original = result; + result = new TestCamelCaseFieldNames(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestCamelCaseFieldNames MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.Descriptor; } + } + + public override TestCamelCaseFieldNames DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.DefaultInstance; } + } + + public override TestCamelCaseFieldNames BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestCamelCaseFieldNames) { + return MergeFrom((TestCamelCaseFieldNames) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestCamelCaseFieldNames other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestCamelCaseFieldNames.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasPrimitiveField) { + PrimitiveField = other.PrimitiveField; + } + if (other.HasStringField) { + StringField = other.StringField; + } + if (other.HasEnumField) { + EnumField = other.EnumField; + } + if (other.HasMessageField) { + MergeMessageField(other.MessageField); + } + if (other.HasStringPieceField) { + StringPieceField = other.StringPieceField; + } + if (other.HasCordField) { + CordField = other.CordField; + } + if (other.repeatedPrimitiveField_.Count != 0) { + result.repeatedPrimitiveField_.Add(other.repeatedPrimitiveField_); + } + if (other.repeatedStringField_.Count != 0) { + result.repeatedStringField_.Add(other.repeatedStringField_); + } + if (other.repeatedEnumField_.Count != 0) { + result.repeatedEnumField_.Add(other.repeatedEnumField_); + } + if (other.repeatedMessageField_.Count != 0) { + result.repeatedMessageField_.Add(other.repeatedMessageField_); + } + if (other.repeatedStringPieceField_.Count != 0) { + result.repeatedStringPieceField_.Add(other.repeatedStringPieceField_); + } + if (other.repeatedCordField_.Count != 0) { + result.repeatedCordField_.Add(other.repeatedCordField_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testCamelCaseFieldNamesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testCamelCaseFieldNamesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasPrimitiveField = input.ReadInt32(ref result.primitiveField_); + break; + } + case 18: { + result.hasStringField = input.ReadString(ref result.stringField_); + break; + } + case 24: { + object unknown; + if(input.ReadEnum(ref result.enumField_, out unknown)) { + result.hasEnumField = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(3, (ulong)(int)unknown); + } + break; + } + case 34: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(); + if (result.hasMessageField) { + subBuilder.MergeFrom(MessageField); + } + input.ReadMessage(subBuilder, extensionRegistry); + MessageField = subBuilder.BuildPartial(); + break; + } + case 42: { + result.hasStringPieceField = input.ReadString(ref result.stringPieceField_); + break; + } + case 50: { + result.hasCordField = input.ReadString(ref result.cordField_); + break; + } + case 58: + case 56: { + input.ReadInt32Array(tag, field_name, result.repeatedPrimitiveField_); + break; + } + case 66: { + input.ReadStringArray(tag, field_name, result.repeatedStringField_); + break; + } + case 74: + case 72: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.repeatedEnumField_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(9, (ulong)(int)rawValue); + } + break; + } + case 82: { + input.ReadMessageArray(tag, field_name, result.repeatedMessageField_, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance, extensionRegistry); + break; + } + case 90: { + input.ReadStringArray(tag, field_name, result.repeatedStringPieceField_); + break; + } + case 98: { + input.ReadStringArray(tag, field_name, result.repeatedCordField_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasPrimitiveField { + get { return result.hasPrimitiveField; } + } + public int PrimitiveField { + get { return result.PrimitiveField; } + set { SetPrimitiveField(value); } + } + public Builder SetPrimitiveField(int value) { + PrepareBuilder(); + result.hasPrimitiveField = true; + result.primitiveField_ = value; + return this; + } + public Builder ClearPrimitiveField() { + PrepareBuilder(); + result.hasPrimitiveField = false; + result.primitiveField_ = 0; + return this; + } + + public bool HasStringField { + get { return result.hasStringField; } + } + public string StringField { + get { return result.StringField; } + set { SetStringField(value); } + } + public Builder SetStringField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasStringField = true; + result.stringField_ = value; + return this; + } + public Builder ClearStringField() { + PrepareBuilder(); + result.hasStringField = false; + result.stringField_ = ""; + return this; + } + + public bool HasEnumField { + get { return result.hasEnumField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumField { + get { return result.EnumField; } + set { SetEnumField(value); } + } + public Builder SetEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasEnumField = true; + result.enumField_ = value; + return this; + } + public Builder ClearEnumField() { + PrepareBuilder(); + result.hasEnumField = false; + result.enumField_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + return this; + } + + public bool HasMessageField { + get { return result.hasMessageField; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageField { + get { return result.MessageField; } + set { SetMessageField(value); } + } + public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessageField = true; + result.messageField_ = value; + return this; + } + public Builder SetMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMessageField = true; + result.messageField_ = builderForValue.Build(); + return this; + } + public Builder MergeMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMessageField && + result.messageField_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.messageField_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageField_).MergeFrom(value).BuildPartial(); + } else { + result.messageField_ = value; + } + result.hasMessageField = true; + return this; + } + public Builder ClearMessageField() { + PrepareBuilder(); + result.hasMessageField = false; + result.messageField_ = null; + return this; + } + + public bool HasStringPieceField { + get { return result.hasStringPieceField; } + } + public string StringPieceField { + get { return result.StringPieceField; } + set { SetStringPieceField(value); } + } + public Builder SetStringPieceField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasStringPieceField = true; + result.stringPieceField_ = value; + return this; + } + public Builder ClearStringPieceField() { + PrepareBuilder(); + result.hasStringPieceField = false; + result.stringPieceField_ = ""; + return this; + } + + public bool HasCordField { + get { return result.hasCordField; } + } + public string CordField { + get { return result.CordField; } + set { SetCordField(value); } + } + public Builder SetCordField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasCordField = true; + result.cordField_ = value; + return this; + } + public Builder ClearCordField() { + PrepareBuilder(); + result.hasCordField = false; + result.cordField_ = ""; + return this; + } + + public pbc::IPopsicleList RepeatedPrimitiveFieldList { + get { return PrepareBuilder().repeatedPrimitiveField_; } + } + public int RepeatedPrimitiveFieldCount { + get { return result.RepeatedPrimitiveFieldCount; } + } + public int GetRepeatedPrimitiveField(int index) { + return result.GetRepeatedPrimitiveField(index); + } + public Builder SetRepeatedPrimitiveField(int index, int value) { + PrepareBuilder(); + result.repeatedPrimitiveField_[index] = value; + return this; + } + public Builder AddRepeatedPrimitiveField(int value) { + PrepareBuilder(); + result.repeatedPrimitiveField_.Add(value); + return this; + } + public Builder AddRangeRepeatedPrimitiveField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedPrimitiveField_.Add(values); + return this; + } + public Builder ClearRepeatedPrimitiveField() { + PrepareBuilder(); + result.repeatedPrimitiveField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringFieldList { + get { return PrepareBuilder().repeatedStringField_; } + } + public int RepeatedStringFieldCount { + get { return result.RepeatedStringFieldCount; } + } + public string GetRepeatedStringField(int index) { + return result.GetRepeatedStringField(index); + } + public Builder SetRepeatedStringField(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringField_[index] = value; + return this; + } + public Builder AddRepeatedStringField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringField_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringField_.Add(values); + return this; + } + public Builder ClearRepeatedStringField() { + PrepareBuilder(); + result.repeatedStringField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedEnumFieldList { + get { return PrepareBuilder().repeatedEnumField_; } + } + public int RepeatedEnumFieldCount { + get { return result.RepeatedEnumFieldCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetRepeatedEnumField(int index) { + return result.GetRepeatedEnumField(index); + } + public Builder SetRepeatedEnumField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedEnumField_[index] = value; + return this; + } + public Builder AddRepeatedEnumField(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.repeatedEnumField_.Add(value); + return this; + } + public Builder AddRangeRepeatedEnumField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedEnumField_.Add(values); + return this; + } + public Builder ClearRepeatedEnumField() { + PrepareBuilder(); + result.repeatedEnumField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedMessageFieldList { + get { return PrepareBuilder().repeatedMessageField_; } + } + public int RepeatedMessageFieldCount { + get { return result.RepeatedMessageFieldCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage GetRepeatedMessageField(int index) { + return result.GetRepeatedMessageField(index); + } + public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessageField_[index] = value; + return this; + } + public Builder SetRepeatedMessageField(int index, global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessageField_[index] = builderForValue.Build(); + return this; + } + public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedMessageField_.Add(value); + return this; + } + public Builder AddRepeatedMessageField(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.repeatedMessageField_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeRepeatedMessageField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedMessageField_.Add(values); + return this; + } + public Builder ClearRepeatedMessageField() { + PrepareBuilder(); + result.repeatedMessageField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedStringPieceFieldList { + get { return PrepareBuilder().repeatedStringPieceField_; } + } + public int RepeatedStringPieceFieldCount { + get { return result.RepeatedStringPieceFieldCount; } + } + public string GetRepeatedStringPieceField(int index) { + return result.GetRepeatedStringPieceField(index); + } + public Builder SetRepeatedStringPieceField(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPieceField_[index] = value; + return this; + } + public Builder AddRepeatedStringPieceField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedStringPieceField_.Add(value); + return this; + } + public Builder AddRangeRepeatedStringPieceField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedStringPieceField_.Add(values); + return this; + } + public Builder ClearRepeatedStringPieceField() { + PrepareBuilder(); + result.repeatedStringPieceField_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedCordFieldList { + get { return PrepareBuilder().repeatedCordField_; } + } + public int RepeatedCordFieldCount { + get { return result.RepeatedCordFieldCount; } + } + public string GetRepeatedCordField(int index) { + return result.GetRepeatedCordField(index); + } + public Builder SetRepeatedCordField(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCordField_[index] = value; + return this; + } + public Builder AddRepeatedCordField(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedCordField_.Add(value); + return this; + } + public Builder AddRangeRepeatedCordField(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedCordField_.Add(values); + return this; + } + public Builder ClearRepeatedCordField() { + PrepareBuilder(); + result.repeatedCordField_.Clear(); + return this; + } + } + static TestCamelCaseFieldNames() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestFieldOrderings : pb::ExtendableMessage { + private TestFieldOrderings() { } + private static readonly TestFieldOrderings defaultInstance = new TestFieldOrderings().MakeReadOnly(); + private static readonly string[] _testFieldOrderingsFieldNames = new string[] { "my_float", "my_int", "my_string" }; + private static readonly uint[] _testFieldOrderingsFieldTags = new uint[] { 813, 8, 90 }; + public static TestFieldOrderings DefaultInstance { + get { return defaultInstance; } + } + + public override TestFieldOrderings DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestFieldOrderings ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestFieldOrderings__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestFieldOrderings__FieldAccessorTable; } + } + + public const int MyStringFieldNumber = 11; + private bool hasMyString; + private string myString_ = ""; + public bool HasMyString { + get { return hasMyString; } + } + public string MyString { + get { return myString_; } + } + + public const int MyIntFieldNumber = 1; + private bool hasMyInt; + private long myInt_; + public bool HasMyInt { + get { return hasMyInt; } + } + public long MyInt { + get { return myInt_; } + } + + public const int MyFloatFieldNumber = 101; + private bool hasMyFloat; + private float myFloat_; + public bool HasMyFloat { + get { return hasMyFloat; } + } + public float MyFloat { + get { return myFloat_; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testFieldOrderingsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + if (hasMyInt) { + output.WriteInt64(1, field_names[1], MyInt); + } + extensionWriter.WriteUntil(11, output); + if (hasMyString) { + output.WriteString(11, field_names[2], MyString); + } + extensionWriter.WriteUntil(101, output); + if (hasMyFloat) { + output.WriteFloat(101, field_names[0], MyFloat); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasMyString) { + size += pb::CodedOutputStream.ComputeStringSize(11, MyString); + } + if (hasMyInt) { + size += pb::CodedOutputStream.ComputeInt64Size(1, MyInt); + } + if (hasMyFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(101, MyFloat); + } + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestFieldOrderings ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestFieldOrderings ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestFieldOrderings ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestFieldOrderings ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestFieldOrderings MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestFieldOrderings prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestFieldOrderings cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestFieldOrderings result; + + private TestFieldOrderings PrepareBuilder() { + if (resultIsReadOnly) { + TestFieldOrderings original = result; + result = new TestFieldOrderings(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestFieldOrderings MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.Descriptor; } + } + + public override TestFieldOrderings DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.DefaultInstance; } + } + + public override TestFieldOrderings BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestFieldOrderings) { + return MergeFrom((TestFieldOrderings) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestFieldOrderings other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestFieldOrderings.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasMyString) { + MyString = other.MyString; + } + if (other.HasMyInt) { + MyInt = other.MyInt; + } + if (other.HasMyFloat) { + MyFloat = other.MyFloat; + } + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testFieldOrderingsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testFieldOrderingsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + result.hasMyInt = input.ReadInt64(ref result.myInt_); + break; + } + case 90: { + result.hasMyString = input.ReadString(ref result.myString_); + break; + } + case 813: { + result.hasMyFloat = input.ReadFloat(ref result.myFloat_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasMyString { + get { return result.hasMyString; } + } + public string MyString { + get { return result.MyString; } + set { SetMyString(value); } + } + public Builder SetMyString(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMyString = true; + result.myString_ = value; + return this; + } + public Builder ClearMyString() { + PrepareBuilder(); + result.hasMyString = false; + result.myString_ = ""; + return this; + } + + public bool HasMyInt { + get { return result.hasMyInt; } + } + public long MyInt { + get { return result.MyInt; } + set { SetMyInt(value); } + } + public Builder SetMyInt(long value) { + PrepareBuilder(); + result.hasMyInt = true; + result.myInt_ = value; + return this; + } + public Builder ClearMyInt() { + PrepareBuilder(); + result.hasMyInt = false; + result.myInt_ = 0L; + return this; + } + + public bool HasMyFloat { + get { return result.hasMyFloat; } + } + public float MyFloat { + get { return result.MyFloat; } + set { SetMyFloat(value); } + } + public Builder SetMyFloat(float value) { + PrepareBuilder(); + result.hasMyFloat = true; + result.myFloat_ = value; + return this; + } + public Builder ClearMyFloat() { + PrepareBuilder(); + result.hasMyFloat = false; + result.myFloat_ = 0F; + return this; + } + } + static TestFieldOrderings() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestExtremeDefaultValues : pb::GeneratedMessage { + private TestExtremeDefaultValues() { } + private static readonly TestExtremeDefaultValues defaultInstance = new TestExtremeDefaultValues().MakeReadOnly(); + private static readonly string[] _testExtremeDefaultValuesFieldNames = new string[] { "cpp_trigraph", "escaped_bytes", "inf_double", "inf_float", "large_float", "large_uint32", "large_uint64", "nan_double", "nan_float", "neg_inf_double", "neg_inf_float", "negative_float", "negative_one_float", "one_float", "small_float", "small_int32", "small_int64", "small_negative_float", "utf8_string", "zero_float" }; + private static readonly uint[] _testExtremeDefaultValuesFieldTags = new uint[] { 162, 10, 113, 141, 101, 16, 24, 129, 157, 121, 149, 93, 85, 69, 77, 32, 40, 109, 50, 61 }; + public static TestExtremeDefaultValues DefaultInstance { + get { return defaultInstance; } + } + + public override TestExtremeDefaultValues DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestExtremeDefaultValues ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestExtremeDefaultValues__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestExtremeDefaultValues__FieldAccessorTable; } + } + + public const int EscapedBytesFieldNumber = 1; + private bool hasEscapedBytes; + private pb::ByteString escapedBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[0].DefaultValue; + public bool HasEscapedBytes { + get { return hasEscapedBytes; } + } + public pb::ByteString EscapedBytes { + get { return escapedBytes_; } + } + + public const int LargeUint32FieldNumber = 2; + private bool hasLargeUint32; + private uint largeUint32_ = 4294967295; + public bool HasLargeUint32 { + get { return hasLargeUint32; } + } + [global::System.CLSCompliant(false)] + public uint LargeUint32 { + get { return largeUint32_; } + } + + public const int LargeUint64FieldNumber = 3; + private bool hasLargeUint64; + private ulong largeUint64_ = 18446744073709551615UL; + public bool HasLargeUint64 { + get { return hasLargeUint64; } + } + [global::System.CLSCompliant(false)] + public ulong LargeUint64 { + get { return largeUint64_; } + } + + public const int SmallInt32FieldNumber = 4; + private bool hasSmallInt32; + private int smallInt32_ = -2147483647; + public bool HasSmallInt32 { + get { return hasSmallInt32; } + } + public int SmallInt32 { + get { return smallInt32_; } + } + + public const int SmallInt64FieldNumber = 5; + private bool hasSmallInt64; + private long smallInt64_ = -9223372036854775807L; + public bool HasSmallInt64 { + get { return hasSmallInt64; } + } + public long SmallInt64 { + get { return smallInt64_; } + } + + public const int Utf8StringFieldNumber = 6; + private bool hasUtf8String; + private string utf8String_ = (string) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[5].DefaultValue; + public bool HasUtf8String { + get { return hasUtf8String; } + } + public string Utf8String { + get { return utf8String_; } + } + + public const int ZeroFloatFieldNumber = 7; + private bool hasZeroFloat; + private float zeroFloat_; + public bool HasZeroFloat { + get { return hasZeroFloat; } + } + public float ZeroFloat { + get { return zeroFloat_; } + } + + public const int OneFloatFieldNumber = 8; + private bool hasOneFloat; + private float oneFloat_ = 1F; + public bool HasOneFloat { + get { return hasOneFloat; } + } + public float OneFloat { + get { return oneFloat_; } + } + + public const int SmallFloatFieldNumber = 9; + private bool hasSmallFloat; + private float smallFloat_ = 1.5F; + public bool HasSmallFloat { + get { return hasSmallFloat; } + } + public float SmallFloat { + get { return smallFloat_; } + } + + public const int NegativeOneFloatFieldNumber = 10; + private bool hasNegativeOneFloat; + private float negativeOneFloat_ = -1F; + public bool HasNegativeOneFloat { + get { return hasNegativeOneFloat; } + } + public float NegativeOneFloat { + get { return negativeOneFloat_; } + } + + public const int NegativeFloatFieldNumber = 11; + private bool hasNegativeFloat; + private float negativeFloat_ = -1.5F; + public bool HasNegativeFloat { + get { return hasNegativeFloat; } + } + public float NegativeFloat { + get { return negativeFloat_; } + } + + public const int LargeFloatFieldNumber = 12; + private bool hasLargeFloat; + private float largeFloat_ = 2E+08F; + public bool HasLargeFloat { + get { return hasLargeFloat; } + } + public float LargeFloat { + get { return largeFloat_; } + } + + public const int SmallNegativeFloatFieldNumber = 13; + private bool hasSmallNegativeFloat; + private float smallNegativeFloat_ = -8E-28F; + public bool HasSmallNegativeFloat { + get { return hasSmallNegativeFloat; } + } + public float SmallNegativeFloat { + get { return smallNegativeFloat_; } + } + + public const int InfDoubleFieldNumber = 14; + private bool hasInfDouble; + private double infDouble_ = double.PositiveInfinity; + public bool HasInfDouble { + get { return hasInfDouble; } + } + public double InfDouble { + get { return infDouble_; } + } + + public const int NegInfDoubleFieldNumber = 15; + private bool hasNegInfDouble; + private double negInfDouble_ = double.NegativeInfinity; + public bool HasNegInfDouble { + get { return hasNegInfDouble; } + } + public double NegInfDouble { + get { return negInfDouble_; } + } + + public const int NanDoubleFieldNumber = 16; + private bool hasNanDouble; + private double nanDouble_ = double.NaN; + public bool HasNanDouble { + get { return hasNanDouble; } + } + public double NanDouble { + get { return nanDouble_; } + } + + public const int InfFloatFieldNumber = 17; + private bool hasInfFloat; + private float infFloat_ = float.PositiveInfinity; + public bool HasInfFloat { + get { return hasInfFloat; } + } + public float InfFloat { + get { return infFloat_; } + } + + public const int NegInfFloatFieldNumber = 18; + private bool hasNegInfFloat; + private float negInfFloat_ = float.NegativeInfinity; + public bool HasNegInfFloat { + get { return hasNegInfFloat; } + } + public float NegInfFloat { + get { return negInfFloat_; } + } + + public const int NanFloatFieldNumber = 19; + private bool hasNanFloat; + private float nanFloat_ = float.NaN; + public bool HasNanFloat { + get { return hasNanFloat; } + } + public float NanFloat { + get { return nanFloat_; } + } + + public const int CppTrigraphFieldNumber = 20; + private bool hasCppTrigraph; + private string cppTrigraph_ = "? ? ?? ?? ??? ??/ ??-"; + public bool HasCppTrigraph { + get { return hasCppTrigraph; } + } + public string CppTrigraph { + get { return cppTrigraph_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testExtremeDefaultValuesFieldNames; + if (hasEscapedBytes) { + output.WriteBytes(1, field_names[1], EscapedBytes); + } + if (hasLargeUint32) { + output.WriteUInt32(2, field_names[5], LargeUint32); + } + if (hasLargeUint64) { + output.WriteUInt64(3, field_names[6], LargeUint64); + } + if (hasSmallInt32) { + output.WriteInt32(4, field_names[15], SmallInt32); + } + if (hasSmallInt64) { + output.WriteInt64(5, field_names[16], SmallInt64); + } + if (hasUtf8String) { + output.WriteString(6, field_names[18], Utf8String); + } + if (hasZeroFloat) { + output.WriteFloat(7, field_names[19], ZeroFloat); + } + if (hasOneFloat) { + output.WriteFloat(8, field_names[13], OneFloat); + } + if (hasSmallFloat) { + output.WriteFloat(9, field_names[14], SmallFloat); + } + if (hasNegativeOneFloat) { + output.WriteFloat(10, field_names[12], NegativeOneFloat); + } + if (hasNegativeFloat) { + output.WriteFloat(11, field_names[11], NegativeFloat); + } + if (hasLargeFloat) { + output.WriteFloat(12, field_names[4], LargeFloat); + } + if (hasSmallNegativeFloat) { + output.WriteFloat(13, field_names[17], SmallNegativeFloat); + } + if (hasInfDouble) { + output.WriteDouble(14, field_names[2], InfDouble); + } + if (hasNegInfDouble) { + output.WriteDouble(15, field_names[9], NegInfDouble); + } + if (hasNanDouble) { + output.WriteDouble(16, field_names[7], NanDouble); + } + if (hasInfFloat) { + output.WriteFloat(17, field_names[3], InfFloat); + } + if (hasNegInfFloat) { + output.WriteFloat(18, field_names[10], NegInfFloat); + } + if (hasNanFloat) { + output.WriteFloat(19, field_names[8], NanFloat); + } + if (hasCppTrigraph) { + output.WriteString(20, field_names[0], CppTrigraph); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasEscapedBytes) { + size += pb::CodedOutputStream.ComputeBytesSize(1, EscapedBytes); + } + if (hasLargeUint32) { + size += pb::CodedOutputStream.ComputeUInt32Size(2, LargeUint32); + } + if (hasLargeUint64) { + size += pb::CodedOutputStream.ComputeUInt64Size(3, LargeUint64); + } + if (hasSmallInt32) { + size += pb::CodedOutputStream.ComputeInt32Size(4, SmallInt32); + } + if (hasSmallInt64) { + size += pb::CodedOutputStream.ComputeInt64Size(5, SmallInt64); + } + if (hasUtf8String) { + size += pb::CodedOutputStream.ComputeStringSize(6, Utf8String); + } + if (hasZeroFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(7, ZeroFloat); + } + if (hasOneFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(8, OneFloat); + } + if (hasSmallFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(9, SmallFloat); + } + if (hasNegativeOneFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(10, NegativeOneFloat); + } + if (hasNegativeFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(11, NegativeFloat); + } + if (hasLargeFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(12, LargeFloat); + } + if (hasSmallNegativeFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(13, SmallNegativeFloat); + } + if (hasInfDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(14, InfDouble); + } + if (hasNegInfDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(15, NegInfDouble); + } + if (hasNanDouble) { + size += pb::CodedOutputStream.ComputeDoubleSize(16, NanDouble); + } + if (hasInfFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(17, InfFloat); + } + if (hasNegInfFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(18, NegInfFloat); + } + if (hasNanFloat) { + size += pb::CodedOutputStream.ComputeFloatSize(19, NanFloat); + } + if (hasCppTrigraph) { + size += pb::CodedOutputStream.ComputeStringSize(20, CppTrigraph); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestExtremeDefaultValues ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestExtremeDefaultValues ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestExtremeDefaultValues ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestExtremeDefaultValues MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestExtremeDefaultValues prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestExtremeDefaultValues cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestExtremeDefaultValues result; + + private TestExtremeDefaultValues PrepareBuilder() { + if (resultIsReadOnly) { + TestExtremeDefaultValues original = result; + result = new TestExtremeDefaultValues(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestExtremeDefaultValues MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor; } + } + + public override TestExtremeDefaultValues DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.DefaultInstance; } + } + + public override TestExtremeDefaultValues BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestExtremeDefaultValues) { + return MergeFrom((TestExtremeDefaultValues) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestExtremeDefaultValues other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasEscapedBytes) { + EscapedBytes = other.EscapedBytes; + } + if (other.HasLargeUint32) { + LargeUint32 = other.LargeUint32; + } + if (other.HasLargeUint64) { + LargeUint64 = other.LargeUint64; + } + if (other.HasSmallInt32) { + SmallInt32 = other.SmallInt32; + } + if (other.HasSmallInt64) { + SmallInt64 = other.SmallInt64; + } + if (other.HasUtf8String) { + Utf8String = other.Utf8String; + } + if (other.HasZeroFloat) { + ZeroFloat = other.ZeroFloat; + } + if (other.HasOneFloat) { + OneFloat = other.OneFloat; + } + if (other.HasSmallFloat) { + SmallFloat = other.SmallFloat; + } + if (other.HasNegativeOneFloat) { + NegativeOneFloat = other.NegativeOneFloat; + } + if (other.HasNegativeFloat) { + NegativeFloat = other.NegativeFloat; + } + if (other.HasLargeFloat) { + LargeFloat = other.LargeFloat; + } + if (other.HasSmallNegativeFloat) { + SmallNegativeFloat = other.SmallNegativeFloat; + } + if (other.HasInfDouble) { + InfDouble = other.InfDouble; + } + if (other.HasNegInfDouble) { + NegInfDouble = other.NegInfDouble; + } + if (other.HasNanDouble) { + NanDouble = other.NanDouble; + } + if (other.HasInfFloat) { + InfFloat = other.InfFloat; + } + if (other.HasNegInfFloat) { + NegInfFloat = other.NegInfFloat; + } + if (other.HasNanFloat) { + NanFloat = other.NanFloat; + } + if (other.HasCppTrigraph) { + CppTrigraph = other.CppTrigraph; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testExtremeDefaultValuesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testExtremeDefaultValuesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasEscapedBytes = input.ReadBytes(ref result.escapedBytes_); + break; + } + case 16: { + result.hasLargeUint32 = input.ReadUInt32(ref result.largeUint32_); + break; + } + case 24: { + result.hasLargeUint64 = input.ReadUInt64(ref result.largeUint64_); + break; + } + case 32: { + result.hasSmallInt32 = input.ReadInt32(ref result.smallInt32_); + break; + } + case 40: { + result.hasSmallInt64 = input.ReadInt64(ref result.smallInt64_); + break; + } + case 50: { + result.hasUtf8String = input.ReadString(ref result.utf8String_); + break; + } + case 61: { + result.hasZeroFloat = input.ReadFloat(ref result.zeroFloat_); + break; + } + case 69: { + result.hasOneFloat = input.ReadFloat(ref result.oneFloat_); + break; + } + case 77: { + result.hasSmallFloat = input.ReadFloat(ref result.smallFloat_); + break; + } + case 85: { + result.hasNegativeOneFloat = input.ReadFloat(ref result.negativeOneFloat_); + break; + } + case 93: { + result.hasNegativeFloat = input.ReadFloat(ref result.negativeFloat_); + break; + } + case 101: { + result.hasLargeFloat = input.ReadFloat(ref result.largeFloat_); + break; + } + case 109: { + result.hasSmallNegativeFloat = input.ReadFloat(ref result.smallNegativeFloat_); + break; + } + case 113: { + result.hasInfDouble = input.ReadDouble(ref result.infDouble_); + break; + } + case 121: { + result.hasNegInfDouble = input.ReadDouble(ref result.negInfDouble_); + break; + } + case 129: { + result.hasNanDouble = input.ReadDouble(ref result.nanDouble_); + break; + } + case 141: { + result.hasInfFloat = input.ReadFloat(ref result.infFloat_); + break; + } + case 149: { + result.hasNegInfFloat = input.ReadFloat(ref result.negInfFloat_); + break; + } + case 157: { + result.hasNanFloat = input.ReadFloat(ref result.nanFloat_); + break; + } + case 162: { + result.hasCppTrigraph = input.ReadString(ref result.cppTrigraph_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasEscapedBytes { + get { return result.hasEscapedBytes; } + } + public pb::ByteString EscapedBytes { + get { return result.EscapedBytes; } + set { SetEscapedBytes(value); } + } + public Builder SetEscapedBytes(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasEscapedBytes = true; + result.escapedBytes_ = value; + return this; + } + public Builder ClearEscapedBytes() { + PrepareBuilder(); + result.hasEscapedBytes = false; + result.escapedBytes_ = (pb::ByteString) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[0].DefaultValue; + return this; + } + + public bool HasLargeUint32 { + get { return result.hasLargeUint32; } + } + [global::System.CLSCompliant(false)] + public uint LargeUint32 { + get { return result.LargeUint32; } + set { SetLargeUint32(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetLargeUint32(uint value) { + PrepareBuilder(); + result.hasLargeUint32 = true; + result.largeUint32_ = value; + return this; + } + public Builder ClearLargeUint32() { + PrepareBuilder(); + result.hasLargeUint32 = false; + result.largeUint32_ = 4294967295; + return this; + } + + public bool HasLargeUint64 { + get { return result.hasLargeUint64; } + } + [global::System.CLSCompliant(false)] + public ulong LargeUint64 { + get { return result.LargeUint64; } + set { SetLargeUint64(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetLargeUint64(ulong value) { + PrepareBuilder(); + result.hasLargeUint64 = true; + result.largeUint64_ = value; + return this; + } + public Builder ClearLargeUint64() { + PrepareBuilder(); + result.hasLargeUint64 = false; + result.largeUint64_ = 18446744073709551615UL; + return this; + } + + public bool HasSmallInt32 { + get { return result.hasSmallInt32; } + } + public int SmallInt32 { + get { return result.SmallInt32; } + set { SetSmallInt32(value); } + } + public Builder SetSmallInt32(int value) { + PrepareBuilder(); + result.hasSmallInt32 = true; + result.smallInt32_ = value; + return this; + } + public Builder ClearSmallInt32() { + PrepareBuilder(); + result.hasSmallInt32 = false; + result.smallInt32_ = -2147483647; + return this; + } + + public bool HasSmallInt64 { + get { return result.hasSmallInt64; } + } + public long SmallInt64 { + get { return result.SmallInt64; } + set { SetSmallInt64(value); } + } + public Builder SetSmallInt64(long value) { + PrepareBuilder(); + result.hasSmallInt64 = true; + result.smallInt64_ = value; + return this; + } + public Builder ClearSmallInt64() { + PrepareBuilder(); + result.hasSmallInt64 = false; + result.smallInt64_ = -9223372036854775807L; + return this; + } + + public bool HasUtf8String { + get { return result.hasUtf8String; } + } + public string Utf8String { + get { return result.Utf8String; } + set { SetUtf8String(value); } + } + public Builder SetUtf8String(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasUtf8String = true; + result.utf8String_ = value; + return this; + } + public Builder ClearUtf8String() { + PrepareBuilder(); + result.hasUtf8String = false; + result.utf8String_ = (string) global::Google.ProtocolBuffers.TestProtos.TestExtremeDefaultValues.Descriptor.Fields[5].DefaultValue; + return this; + } + + public bool HasZeroFloat { + get { return result.hasZeroFloat; } + } + public float ZeroFloat { + get { return result.ZeroFloat; } + set { SetZeroFloat(value); } + } + public Builder SetZeroFloat(float value) { + PrepareBuilder(); + result.hasZeroFloat = true; + result.zeroFloat_ = value; + return this; + } + public Builder ClearZeroFloat() { + PrepareBuilder(); + result.hasZeroFloat = false; + result.zeroFloat_ = 0F; + return this; + } + + public bool HasOneFloat { + get { return result.hasOneFloat; } + } + public float OneFloat { + get { return result.OneFloat; } + set { SetOneFloat(value); } + } + public Builder SetOneFloat(float value) { + PrepareBuilder(); + result.hasOneFloat = true; + result.oneFloat_ = value; + return this; + } + public Builder ClearOneFloat() { + PrepareBuilder(); + result.hasOneFloat = false; + result.oneFloat_ = 1F; + return this; + } + + public bool HasSmallFloat { + get { return result.hasSmallFloat; } + } + public float SmallFloat { + get { return result.SmallFloat; } + set { SetSmallFloat(value); } + } + public Builder SetSmallFloat(float value) { + PrepareBuilder(); + result.hasSmallFloat = true; + result.smallFloat_ = value; + return this; + } + public Builder ClearSmallFloat() { + PrepareBuilder(); + result.hasSmallFloat = false; + result.smallFloat_ = 1.5F; + return this; + } + + public bool HasNegativeOneFloat { + get { return result.hasNegativeOneFloat; } + } + public float NegativeOneFloat { + get { return result.NegativeOneFloat; } + set { SetNegativeOneFloat(value); } + } + public Builder SetNegativeOneFloat(float value) { + PrepareBuilder(); + result.hasNegativeOneFloat = true; + result.negativeOneFloat_ = value; + return this; + } + public Builder ClearNegativeOneFloat() { + PrepareBuilder(); + result.hasNegativeOneFloat = false; + result.negativeOneFloat_ = -1F; + return this; + } + + public bool HasNegativeFloat { + get { return result.hasNegativeFloat; } + } + public float NegativeFloat { + get { return result.NegativeFloat; } + set { SetNegativeFloat(value); } + } + public Builder SetNegativeFloat(float value) { + PrepareBuilder(); + result.hasNegativeFloat = true; + result.negativeFloat_ = value; + return this; + } + public Builder ClearNegativeFloat() { + PrepareBuilder(); + result.hasNegativeFloat = false; + result.negativeFloat_ = -1.5F; + return this; + } + + public bool HasLargeFloat { + get { return result.hasLargeFloat; } + } + public float LargeFloat { + get { return result.LargeFloat; } + set { SetLargeFloat(value); } + } + public Builder SetLargeFloat(float value) { + PrepareBuilder(); + result.hasLargeFloat = true; + result.largeFloat_ = value; + return this; + } + public Builder ClearLargeFloat() { + PrepareBuilder(); + result.hasLargeFloat = false; + result.largeFloat_ = 2E+08F; + return this; + } + + public bool HasSmallNegativeFloat { + get { return result.hasSmallNegativeFloat; } + } + public float SmallNegativeFloat { + get { return result.SmallNegativeFloat; } + set { SetSmallNegativeFloat(value); } + } + public Builder SetSmallNegativeFloat(float value) { + PrepareBuilder(); + result.hasSmallNegativeFloat = true; + result.smallNegativeFloat_ = value; + return this; + } + public Builder ClearSmallNegativeFloat() { + PrepareBuilder(); + result.hasSmallNegativeFloat = false; + result.smallNegativeFloat_ = -8E-28F; + return this; + } + + public bool HasInfDouble { + get { return result.hasInfDouble; } + } + public double InfDouble { + get { return result.InfDouble; } + set { SetInfDouble(value); } + } + public Builder SetInfDouble(double value) { + PrepareBuilder(); + result.hasInfDouble = true; + result.infDouble_ = value; + return this; + } + public Builder ClearInfDouble() { + PrepareBuilder(); + result.hasInfDouble = false; + result.infDouble_ = double.PositiveInfinity; + return this; + } + + public bool HasNegInfDouble { + get { return result.hasNegInfDouble; } + } + public double NegInfDouble { + get { return result.NegInfDouble; } + set { SetNegInfDouble(value); } + } + public Builder SetNegInfDouble(double value) { + PrepareBuilder(); + result.hasNegInfDouble = true; + result.negInfDouble_ = value; + return this; + } + public Builder ClearNegInfDouble() { + PrepareBuilder(); + result.hasNegInfDouble = false; + result.negInfDouble_ = double.NegativeInfinity; + return this; + } + + public bool HasNanDouble { + get { return result.hasNanDouble; } + } + public double NanDouble { + get { return result.NanDouble; } + set { SetNanDouble(value); } + } + public Builder SetNanDouble(double value) { + PrepareBuilder(); + result.hasNanDouble = true; + result.nanDouble_ = value; + return this; + } + public Builder ClearNanDouble() { + PrepareBuilder(); + result.hasNanDouble = false; + result.nanDouble_ = double.NaN; + return this; + } + + public bool HasInfFloat { + get { return result.hasInfFloat; } + } + public float InfFloat { + get { return result.InfFloat; } + set { SetInfFloat(value); } + } + public Builder SetInfFloat(float value) { + PrepareBuilder(); + result.hasInfFloat = true; + result.infFloat_ = value; + return this; + } + public Builder ClearInfFloat() { + PrepareBuilder(); + result.hasInfFloat = false; + result.infFloat_ = float.PositiveInfinity; + return this; + } + + public bool HasNegInfFloat { + get { return result.hasNegInfFloat; } + } + public float NegInfFloat { + get { return result.NegInfFloat; } + set { SetNegInfFloat(value); } + } + public Builder SetNegInfFloat(float value) { + PrepareBuilder(); + result.hasNegInfFloat = true; + result.negInfFloat_ = value; + return this; + } + public Builder ClearNegInfFloat() { + PrepareBuilder(); + result.hasNegInfFloat = false; + result.negInfFloat_ = float.NegativeInfinity; + return this; + } + + public bool HasNanFloat { + get { return result.hasNanFloat; } + } + public float NanFloat { + get { return result.NanFloat; } + set { SetNanFloat(value); } + } + public Builder SetNanFloat(float value) { + PrepareBuilder(); + result.hasNanFloat = true; + result.nanFloat_ = value; + return this; + } + public Builder ClearNanFloat() { + PrepareBuilder(); + result.hasNanFloat = false; + result.nanFloat_ = float.NaN; + return this; + } + + public bool HasCppTrigraph { + get { return result.hasCppTrigraph; } + } + public string CppTrigraph { + get { return result.CppTrigraph; } + set { SetCppTrigraph(value); } + } + public Builder SetCppTrigraph(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasCppTrigraph = true; + result.cppTrigraph_ = value; + return this; + } + public Builder ClearCppTrigraph() { + PrepareBuilder(); + result.hasCppTrigraph = false; + result.cppTrigraph_ = "? ? ?? ?? ??? ??/ ??-"; + return this; + } + } + static TestExtremeDefaultValues() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SparseEnumMessage : pb::GeneratedMessage { + private SparseEnumMessage() { } + private static readonly SparseEnumMessage defaultInstance = new SparseEnumMessage().MakeReadOnly(); + private static readonly string[] _sparseEnumMessageFieldNames = new string[] { "sparse_enum" }; + private static readonly uint[] _sparseEnumMessageFieldTags = new uint[] { 8 }; + public static SparseEnumMessage DefaultInstance { + get { return defaultInstance; } + } + + public override SparseEnumMessage DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SparseEnumMessage ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_SparseEnumMessage__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_SparseEnumMessage__FieldAccessorTable; } + } + + public const int SparseEnumFieldNumber = 1; + private bool hasSparseEnum; + private global::Google.ProtocolBuffers.TestProtos.TestSparseEnum sparseEnum_ = global::Google.ProtocolBuffers.TestProtos.TestSparseEnum.SPARSE_A; + public bool HasSparseEnum { + get { return hasSparseEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestSparseEnum SparseEnum { + get { return sparseEnum_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _sparseEnumMessageFieldNames; + if (hasSparseEnum) { + output.WriteEnum(1, field_names[0], (int) SparseEnum, SparseEnum); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasSparseEnum) { + size += pb::CodedOutputStream.ComputeEnumSize(1, (int) SparseEnum); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static SparseEnumMessage ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SparseEnumMessage ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SparseEnumMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SparseEnumMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SparseEnumMessage MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SparseEnumMessage prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SparseEnumMessage cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SparseEnumMessage result; + + private SparseEnumMessage PrepareBuilder() { + if (resultIsReadOnly) { + SparseEnumMessage original = result; + result = new SparseEnumMessage(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SparseEnumMessage MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.SparseEnumMessage.Descriptor; } + } + + public override SparseEnumMessage DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SparseEnumMessage.DefaultInstance; } + } + + public override SparseEnumMessage BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is SparseEnumMessage) { + return MergeFrom((SparseEnumMessage) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SparseEnumMessage other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SparseEnumMessage.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasSparseEnum) { + SparseEnum = other.SparseEnum; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_sparseEnumMessageFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _sparseEnumMessageFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 8: { + object unknown; + if(input.ReadEnum(ref result.sparseEnum_, out unknown)) { + result.hasSparseEnum = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(1, (ulong)(int)unknown); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasSparseEnum { + get { return result.hasSparseEnum; } + } + public global::Google.ProtocolBuffers.TestProtos.TestSparseEnum SparseEnum { + get { return result.SparseEnum; } + set { SetSparseEnum(value); } + } + public Builder SetSparseEnum(global::Google.ProtocolBuffers.TestProtos.TestSparseEnum value) { + PrepareBuilder(); + result.hasSparseEnum = true; + result.sparseEnum_ = value; + return this; + } + public Builder ClearSparseEnum() { + PrepareBuilder(); + result.hasSparseEnum = false; + result.sparseEnum_ = global::Google.ProtocolBuffers.TestProtos.TestSparseEnum.SPARSE_A; + return this; + } + } + static SparseEnumMessage() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OneString : pb::GeneratedMessage { + private OneString() { } + private static readonly OneString defaultInstance = new OneString().MakeReadOnly(); + private static readonly string[] _oneStringFieldNames = new string[] { "data" }; + private static readonly uint[] _oneStringFieldTags = new uint[] { 10 }; + public static OneString DefaultInstance { + get { return defaultInstance; } + } + + public override OneString DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OneString ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneString__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneString__FieldAccessorTable; } + } + + public const int DataFieldNumber = 1; + private bool hasData; + private string data_ = ""; + public bool HasData { + get { return hasData; } + } + public string Data { + get { return data_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _oneStringFieldNames; + if (hasData) { + output.WriteString(1, field_names[0], Data); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasData) { + size += pb::CodedOutputStream.ComputeStringSize(1, Data); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OneString ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneString ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneString ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneString ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneString ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneString ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OneString ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OneString ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OneString ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneString ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OneString MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OneString prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OneString cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OneString result; + + private OneString PrepareBuilder() { + if (resultIsReadOnly) { + OneString original = result; + result = new OneString(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OneString MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneString.Descriptor; } + } + + public override OneString DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneString.DefaultInstance; } + } + + public override OneString BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OneString) { + return MergeFrom((OneString) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OneString other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OneString.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasData) { + Data = other.Data; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_oneStringFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _oneStringFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasData = input.ReadString(ref result.data_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasData { + get { return result.hasData; } + } + public string Data { + get { return result.Data; } + set { SetData(value); } + } + public Builder SetData(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasData = true; + result.data_ = value; + return this; + } + public Builder ClearData() { + PrepareBuilder(); + result.hasData = false; + result.data_ = ""; + return this; + } + } + static OneString() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class OneBytes : pb::GeneratedMessage { + private OneBytes() { } + private static readonly OneBytes defaultInstance = new OneBytes().MakeReadOnly(); + private static readonly string[] _oneBytesFieldNames = new string[] { "data" }; + private static readonly uint[] _oneBytesFieldTags = new uint[] { 10 }; + public static OneBytes DefaultInstance { + get { return defaultInstance; } + } + + public override OneBytes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override OneBytes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneBytes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_OneBytes__FieldAccessorTable; } + } + + public const int DataFieldNumber = 1; + private bool hasData; + private pb::ByteString data_ = pb::ByteString.Empty; + public bool HasData { + get { return hasData; } + } + public pb::ByteString Data { + get { return data_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _oneBytesFieldNames; + if (hasData) { + output.WriteBytes(1, field_names[0], Data); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasData) { + size += pb::CodedOutputStream.ComputeBytesSize(1, Data); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static OneBytes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneBytes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneBytes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static OneBytes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static OneBytes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneBytes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static OneBytes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static OneBytes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static OneBytes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static OneBytes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private OneBytes MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(OneBytes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(OneBytes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private OneBytes result; + + private OneBytes PrepareBuilder() { + if (resultIsReadOnly) { + OneBytes original = result; + result = new OneBytes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override OneBytes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneBytes.Descriptor; } + } + + public override OneBytes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.OneBytes.DefaultInstance; } + } + + public override OneBytes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is OneBytes) { + return MergeFrom((OneBytes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(OneBytes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.OneBytes.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasData) { + Data = other.Data; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_oneBytesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _oneBytesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasData = input.ReadBytes(ref result.data_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasData { + get { return result.hasData; } + } + public pb::ByteString Data { + get { return result.Data; } + set { SetData(value); } + } + public Builder SetData(pb::ByteString value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasData = true; + result.data_ = value; + return this; + } + public Builder ClearData() { + PrepareBuilder(); + result.hasData = false; + result.data_ = pb::ByteString.Empty; + return this; + } + } + static OneBytes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestPackedTypes : pb::GeneratedMessage { + private TestPackedTypes() { } + private static readonly TestPackedTypes defaultInstance = new TestPackedTypes().MakeReadOnly(); + private static readonly string[] _testPackedTypesFieldNames = new string[] { "packed_bool", "packed_double", "packed_enum", "packed_fixed32", "packed_fixed64", "packed_float", "packed_int32", "packed_int64", "packed_sfixed32", "packed_sfixed64", "packed_sint32", "packed_sint64", "packed_uint32", "packed_uint64" }; + private static readonly uint[] _testPackedTypesFieldTags = new uint[] { 818, 810, 826, 770, 778, 802, 722, 730, 786, 794, 754, 762, 738, 746 }; + public static TestPackedTypes DefaultInstance { + get { return defaultInstance; } + } + + public override TestPackedTypes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestPackedTypes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedTypes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedTypes__FieldAccessorTable; } + } + + public const int PackedInt32FieldNumber = 90; + private int packedInt32MemoizedSerializedSize; + private pbc::PopsicleList packedInt32_ = new pbc::PopsicleList(); + public scg::IList PackedInt32List { + get { return pbc::Lists.AsReadOnly(packedInt32_); } + } + public int PackedInt32Count { + get { return packedInt32_.Count; } + } + public int GetPackedInt32(int index) { + return packedInt32_[index]; + } + + public const int PackedInt64FieldNumber = 91; + private int packedInt64MemoizedSerializedSize; + private pbc::PopsicleList packedInt64_ = new pbc::PopsicleList(); + public scg::IList PackedInt64List { + get { return pbc::Lists.AsReadOnly(packedInt64_); } + } + public int PackedInt64Count { + get { return packedInt64_.Count; } + } + public long GetPackedInt64(int index) { + return packedInt64_[index]; + } + + public const int PackedUint32FieldNumber = 92; + private int packedUint32MemoizedSerializedSize; + private pbc::PopsicleList packedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedUint32List { + get { return pbc::Lists.AsReadOnly(packedUint32_); } + } + public int PackedUint32Count { + get { return packedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedUint32(int index) { + return packedUint32_[index]; + } + + public const int PackedUint64FieldNumber = 93; + private int packedUint64MemoizedSerializedSize; + private pbc::PopsicleList packedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedUint64List { + get { return pbc::Lists.AsReadOnly(packedUint64_); } + } + public int PackedUint64Count { + get { return packedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedUint64(int index) { + return packedUint64_[index]; + } + + public const int PackedSint32FieldNumber = 94; + private int packedSint32MemoizedSerializedSize; + private pbc::PopsicleList packedSint32_ = new pbc::PopsicleList(); + public scg::IList PackedSint32List { + get { return pbc::Lists.AsReadOnly(packedSint32_); } + } + public int PackedSint32Count { + get { return packedSint32_.Count; } + } + public int GetPackedSint32(int index) { + return packedSint32_[index]; + } + + public const int PackedSint64FieldNumber = 95; + private int packedSint64MemoizedSerializedSize; + private pbc::PopsicleList packedSint64_ = new pbc::PopsicleList(); + public scg::IList PackedSint64List { + get { return pbc::Lists.AsReadOnly(packedSint64_); } + } + public int PackedSint64Count { + get { return packedSint64_.Count; } + } + public long GetPackedSint64(int index) { + return packedSint64_[index]; + } + + public const int PackedFixed32FieldNumber = 96; + private int packedFixed32MemoizedSerializedSize; + private pbc::PopsicleList packedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedFixed32List { + get { return pbc::Lists.AsReadOnly(packedFixed32_); } + } + public int PackedFixed32Count { + get { return packedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedFixed32(int index) { + return packedFixed32_[index]; + } + + public const int PackedFixed64FieldNumber = 97; + private int packedFixed64MemoizedSerializedSize; + private pbc::PopsicleList packedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList PackedFixed64List { + get { return pbc::Lists.AsReadOnly(packedFixed64_); } + } + public int PackedFixed64Count { + get { return packedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedFixed64(int index) { + return packedFixed64_[index]; + } + + public const int PackedSfixed32FieldNumber = 98; + private int packedSfixed32MemoizedSerializedSize; + private pbc::PopsicleList packedSfixed32_ = new pbc::PopsicleList(); + public scg::IList PackedSfixed32List { + get { return pbc::Lists.AsReadOnly(packedSfixed32_); } + } + public int PackedSfixed32Count { + get { return packedSfixed32_.Count; } + } + public int GetPackedSfixed32(int index) { + return packedSfixed32_[index]; + } + + public const int PackedSfixed64FieldNumber = 99; + private int packedSfixed64MemoizedSerializedSize; + private pbc::PopsicleList packedSfixed64_ = new pbc::PopsicleList(); + public scg::IList PackedSfixed64List { + get { return pbc::Lists.AsReadOnly(packedSfixed64_); } + } + public int PackedSfixed64Count { + get { return packedSfixed64_.Count; } + } + public long GetPackedSfixed64(int index) { + return packedSfixed64_[index]; + } + + public const int PackedFloatFieldNumber = 100; + private int packedFloatMemoizedSerializedSize; + private pbc::PopsicleList packedFloat_ = new pbc::PopsicleList(); + public scg::IList PackedFloatList { + get { return pbc::Lists.AsReadOnly(packedFloat_); } + } + public int PackedFloatCount { + get { return packedFloat_.Count; } + } + public float GetPackedFloat(int index) { + return packedFloat_[index]; + } + + public const int PackedDoubleFieldNumber = 101; + private int packedDoubleMemoizedSerializedSize; + private pbc::PopsicleList packedDouble_ = new pbc::PopsicleList(); + public scg::IList PackedDoubleList { + get { return pbc::Lists.AsReadOnly(packedDouble_); } + } + public int PackedDoubleCount { + get { return packedDouble_.Count; } + } + public double GetPackedDouble(int index) { + return packedDouble_[index]; + } + + public const int PackedBoolFieldNumber = 102; + private int packedBoolMemoizedSerializedSize; + private pbc::PopsicleList packedBool_ = new pbc::PopsicleList(); + public scg::IList PackedBoolList { + get { return pbc::Lists.AsReadOnly(packedBool_); } + } + public int PackedBoolCount { + get { return packedBool_.Count; } + } + public bool GetPackedBool(int index) { + return packedBool_[index]; + } + + public const int PackedEnumFieldNumber = 103; + private int packedEnumMemoizedSerializedSize; + private pbc::PopsicleList packedEnum_ = new pbc::PopsicleList(); + public scg::IList PackedEnumList { + get { return pbc::Lists.AsReadOnly(packedEnum_); } + } + public int PackedEnumCount { + get { return packedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetPackedEnum(int index) { + return packedEnum_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testPackedTypesFieldNames; + if (packedInt32_.Count > 0) { + output.WritePackedInt32Array(90, field_names[6], packedInt32MemoizedSerializedSize, packedInt32_); + } + if (packedInt64_.Count > 0) { + output.WritePackedInt64Array(91, field_names[7], packedInt64MemoizedSerializedSize, packedInt64_); + } + if (packedUint32_.Count > 0) { + output.WritePackedUInt32Array(92, field_names[12], packedUint32MemoizedSerializedSize, packedUint32_); + } + if (packedUint64_.Count > 0) { + output.WritePackedUInt64Array(93, field_names[13], packedUint64MemoizedSerializedSize, packedUint64_); + } + if (packedSint32_.Count > 0) { + output.WritePackedSInt32Array(94, field_names[10], packedSint32MemoizedSerializedSize, packedSint32_); + } + if (packedSint64_.Count > 0) { + output.WritePackedSInt64Array(95, field_names[11], packedSint64MemoizedSerializedSize, packedSint64_); + } + if (packedFixed32_.Count > 0) { + output.WritePackedFixed32Array(96, field_names[3], packedFixed32MemoizedSerializedSize, packedFixed32_); + } + if (packedFixed64_.Count > 0) { + output.WritePackedFixed64Array(97, field_names[4], packedFixed64MemoizedSerializedSize, packedFixed64_); + } + if (packedSfixed32_.Count > 0) { + output.WritePackedSFixed32Array(98, field_names[8], packedSfixed32MemoizedSerializedSize, packedSfixed32_); + } + if (packedSfixed64_.Count > 0) { + output.WritePackedSFixed64Array(99, field_names[9], packedSfixed64MemoizedSerializedSize, packedSfixed64_); + } + if (packedFloat_.Count > 0) { + output.WritePackedFloatArray(100, field_names[5], packedFloatMemoizedSerializedSize, packedFloat_); + } + if (packedDouble_.Count > 0) { + output.WritePackedDoubleArray(101, field_names[1], packedDoubleMemoizedSerializedSize, packedDouble_); + } + if (packedBool_.Count > 0) { + output.WritePackedBoolArray(102, field_names[0], packedBoolMemoizedSerializedSize, packedBool_); + } + if (packedEnum_.Count > 0) { + output.WritePackedEnumArray(103, field_names[2], packedEnumMemoizedSerializedSize, packedEnum_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in PackedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + if (packedInt32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedInt32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (long element in PackedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + if (packedInt64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedInt64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (uint element in PackedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + if (packedUint32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedUint32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (ulong element in PackedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + if (packedUint64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedUint64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (int element in PackedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + if (packedSint32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSint32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + foreach (long element in PackedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + if (packedSint64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSint64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedFixed32_.Count; + size += dataSize; + if (packedFixed32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFixed32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedFixed64_.Count; + size += dataSize; + if (packedFixed64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFixed64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedSfixed32_.Count; + size += dataSize; + if (packedSfixed32_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSfixed32MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedSfixed64_.Count; + size += dataSize; + if (packedSfixed64_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedSfixed64MemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 4 * packedFloat_.Count; + size += dataSize; + if (packedFloat_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedFloatMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 8 * packedDouble_.Count; + size += dataSize; + if (packedDouble_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedDoubleMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + dataSize = 1 * packedBool_.Count; + size += dataSize; + if (packedBool_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedBoolMemoizedSerializedSize = dataSize; + } + { + int dataSize = 0; + if (packedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in packedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2; + size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize); + } + packedEnumMemoizedSerializedSize = dataSize; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestPackedTypes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestPackedTypes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestPackedTypes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestPackedTypes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestPackedTypes MakeReadOnly() { + packedInt32_.MakeReadOnly(); + packedInt64_.MakeReadOnly(); + packedUint32_.MakeReadOnly(); + packedUint64_.MakeReadOnly(); + packedSint32_.MakeReadOnly(); + packedSint64_.MakeReadOnly(); + packedFixed32_.MakeReadOnly(); + packedFixed64_.MakeReadOnly(); + packedSfixed32_.MakeReadOnly(); + packedSfixed64_.MakeReadOnly(); + packedFloat_.MakeReadOnly(); + packedDouble_.MakeReadOnly(); + packedBool_.MakeReadOnly(); + packedEnum_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestPackedTypes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestPackedTypes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestPackedTypes result; + + private TestPackedTypes PrepareBuilder() { + if (resultIsReadOnly) { + TestPackedTypes original = result; + result = new TestPackedTypes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestPackedTypes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.Descriptor; } + } + + public override TestPackedTypes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance; } + } + + public override TestPackedTypes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestPackedTypes) { + return MergeFrom((TestPackedTypes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestPackedTypes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedTypes.DefaultInstance) return this; + PrepareBuilder(); + if (other.packedInt32_.Count != 0) { + result.packedInt32_.Add(other.packedInt32_); + } + if (other.packedInt64_.Count != 0) { + result.packedInt64_.Add(other.packedInt64_); + } + if (other.packedUint32_.Count != 0) { + result.packedUint32_.Add(other.packedUint32_); + } + if (other.packedUint64_.Count != 0) { + result.packedUint64_.Add(other.packedUint64_); + } + if (other.packedSint32_.Count != 0) { + result.packedSint32_.Add(other.packedSint32_); + } + if (other.packedSint64_.Count != 0) { + result.packedSint64_.Add(other.packedSint64_); + } + if (other.packedFixed32_.Count != 0) { + result.packedFixed32_.Add(other.packedFixed32_); + } + if (other.packedFixed64_.Count != 0) { + result.packedFixed64_.Add(other.packedFixed64_); + } + if (other.packedSfixed32_.Count != 0) { + result.packedSfixed32_.Add(other.packedSfixed32_); + } + if (other.packedSfixed64_.Count != 0) { + result.packedSfixed64_.Add(other.packedSfixed64_); + } + if (other.packedFloat_.Count != 0) { + result.packedFloat_.Add(other.packedFloat_); + } + if (other.packedDouble_.Count != 0) { + result.packedDouble_.Add(other.packedDouble_); + } + if (other.packedBool_.Count != 0) { + result.packedBool_.Add(other.packedBool_); + } + if (other.packedEnum_.Count != 0) { + result.packedEnum_.Add(other.packedEnum_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testPackedTypesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testPackedTypesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 722: + case 720: { + input.ReadInt32Array(tag, field_name, result.packedInt32_); + break; + } + case 730: + case 728: { + input.ReadInt64Array(tag, field_name, result.packedInt64_); + break; + } + case 738: + case 736: { + input.ReadUInt32Array(tag, field_name, result.packedUint32_); + break; + } + case 746: + case 744: { + input.ReadUInt64Array(tag, field_name, result.packedUint64_); + break; + } + case 754: + case 752: { + input.ReadSInt32Array(tag, field_name, result.packedSint32_); + break; + } + case 762: + case 760: { + input.ReadSInt64Array(tag, field_name, result.packedSint64_); + break; + } + case 770: + case 773: { + input.ReadFixed32Array(tag, field_name, result.packedFixed32_); + break; + } + case 778: + case 777: { + input.ReadFixed64Array(tag, field_name, result.packedFixed64_); + break; + } + case 786: + case 789: { + input.ReadSFixed32Array(tag, field_name, result.packedSfixed32_); + break; + } + case 794: + case 793: { + input.ReadSFixed64Array(tag, field_name, result.packedSfixed64_); + break; + } + case 802: + case 805: { + input.ReadFloatArray(tag, field_name, result.packedFloat_); + break; + } + case 810: + case 809: { + input.ReadDoubleArray(tag, field_name, result.packedDouble_); + break; + } + case 818: + case 816: { + input.ReadBoolArray(tag, field_name, result.packedBool_); + break; + } + case 826: + case 824: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.packedEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(103, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList PackedInt32List { + get { return PrepareBuilder().packedInt32_; } + } + public int PackedInt32Count { + get { return result.PackedInt32Count; } + } + public int GetPackedInt32(int index) { + return result.GetPackedInt32(index); + } + public Builder SetPackedInt32(int index, int value) { + PrepareBuilder(); + result.packedInt32_[index] = value; + return this; + } + public Builder AddPackedInt32(int value) { + PrepareBuilder(); + result.packedInt32_.Add(value); + return this; + } + public Builder AddRangePackedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedInt32_.Add(values); + return this; + } + public Builder ClearPackedInt32() { + PrepareBuilder(); + result.packedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedInt64List { + get { return PrepareBuilder().packedInt64_; } + } + public int PackedInt64Count { + get { return result.PackedInt64Count; } + } + public long GetPackedInt64(int index) { + return result.GetPackedInt64(index); + } + public Builder SetPackedInt64(int index, long value) { + PrepareBuilder(); + result.packedInt64_[index] = value; + return this; + } + public Builder AddPackedInt64(long value) { + PrepareBuilder(); + result.packedInt64_.Add(value); + return this; + } + public Builder AddRangePackedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedInt64_.Add(values); + return this; + } + public Builder ClearPackedInt64() { + PrepareBuilder(); + result.packedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedUint32List { + get { return PrepareBuilder().packedUint32_; } + } + public int PackedUint32Count { + get { return result.PackedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedUint32(int index) { + return result.GetPackedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedUint32(int index, uint value) { + PrepareBuilder(); + result.packedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedUint32(uint value) { + PrepareBuilder(); + result.packedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedUint32_.Add(values); + return this; + } + public Builder ClearPackedUint32() { + PrepareBuilder(); + result.packedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedUint64List { + get { return PrepareBuilder().packedUint64_; } + } + public int PackedUint64Count { + get { return result.PackedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedUint64(int index) { + return result.GetPackedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedUint64(int index, ulong value) { + PrepareBuilder(); + result.packedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedUint64(ulong value) { + PrepareBuilder(); + result.packedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedUint64_.Add(values); + return this; + } + public Builder ClearPackedUint64() { + PrepareBuilder(); + result.packedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSint32List { + get { return PrepareBuilder().packedSint32_; } + } + public int PackedSint32Count { + get { return result.PackedSint32Count; } + } + public int GetPackedSint32(int index) { + return result.GetPackedSint32(index); + } + public Builder SetPackedSint32(int index, int value) { + PrepareBuilder(); + result.packedSint32_[index] = value; + return this; + } + public Builder AddPackedSint32(int value) { + PrepareBuilder(); + result.packedSint32_.Add(value); + return this; + } + public Builder AddRangePackedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSint32_.Add(values); + return this; + } + public Builder ClearPackedSint32() { + PrepareBuilder(); + result.packedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSint64List { + get { return PrepareBuilder().packedSint64_; } + } + public int PackedSint64Count { + get { return result.PackedSint64Count; } + } + public long GetPackedSint64(int index) { + return result.GetPackedSint64(index); + } + public Builder SetPackedSint64(int index, long value) { + PrepareBuilder(); + result.packedSint64_[index] = value; + return this; + } + public Builder AddPackedSint64(long value) { + PrepareBuilder(); + result.packedSint64_.Add(value); + return this; + } + public Builder AddRangePackedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSint64_.Add(values); + return this; + } + public Builder ClearPackedSint64() { + PrepareBuilder(); + result.packedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedFixed32List { + get { return PrepareBuilder().packedFixed32_; } + } + public int PackedFixed32Count { + get { return result.PackedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetPackedFixed32(int index) { + return result.GetPackedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedFixed32(int index, uint value) { + PrepareBuilder(); + result.packedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedFixed32(uint value) { + PrepareBuilder(); + result.packedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFixed32_.Add(values); + return this; + } + public Builder ClearPackedFixed32() { + PrepareBuilder(); + result.packedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList PackedFixed64List { + get { return PrepareBuilder().packedFixed64_; } + } + public int PackedFixed64Count { + get { return result.PackedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetPackedFixed64(int index) { + return result.GetPackedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetPackedFixed64(int index, ulong value) { + PrepareBuilder(); + result.packedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddPackedFixed64(ulong value) { + PrepareBuilder(); + result.packedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangePackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFixed64_.Add(values); + return this; + } + public Builder ClearPackedFixed64() { + PrepareBuilder(); + result.packedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSfixed32List { + get { return PrepareBuilder().packedSfixed32_; } + } + public int PackedSfixed32Count { + get { return result.PackedSfixed32Count; } + } + public int GetPackedSfixed32(int index) { + return result.GetPackedSfixed32(index); + } + public Builder SetPackedSfixed32(int index, int value) { + PrepareBuilder(); + result.packedSfixed32_[index] = value; + return this; + } + public Builder AddPackedSfixed32(int value) { + PrepareBuilder(); + result.packedSfixed32_.Add(value); + return this; + } + public Builder AddRangePackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSfixed32_.Add(values); + return this; + } + public Builder ClearPackedSfixed32() { + PrepareBuilder(); + result.packedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedSfixed64List { + get { return PrepareBuilder().packedSfixed64_; } + } + public int PackedSfixed64Count { + get { return result.PackedSfixed64Count; } + } + public long GetPackedSfixed64(int index) { + return result.GetPackedSfixed64(index); + } + public Builder SetPackedSfixed64(int index, long value) { + PrepareBuilder(); + result.packedSfixed64_[index] = value; + return this; + } + public Builder AddPackedSfixed64(long value) { + PrepareBuilder(); + result.packedSfixed64_.Add(value); + return this; + } + public Builder AddRangePackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.packedSfixed64_.Add(values); + return this; + } + public Builder ClearPackedSfixed64() { + PrepareBuilder(); + result.packedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedFloatList { + get { return PrepareBuilder().packedFloat_; } + } + public int PackedFloatCount { + get { return result.PackedFloatCount; } + } + public float GetPackedFloat(int index) { + return result.GetPackedFloat(index); + } + public Builder SetPackedFloat(int index, float value) { + PrepareBuilder(); + result.packedFloat_[index] = value; + return this; + } + public Builder AddPackedFloat(float value) { + PrepareBuilder(); + result.packedFloat_.Add(value); + return this; + } + public Builder AddRangePackedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.packedFloat_.Add(values); + return this; + } + public Builder ClearPackedFloat() { + PrepareBuilder(); + result.packedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedDoubleList { + get { return PrepareBuilder().packedDouble_; } + } + public int PackedDoubleCount { + get { return result.PackedDoubleCount; } + } + public double GetPackedDouble(int index) { + return result.GetPackedDouble(index); + } + public Builder SetPackedDouble(int index, double value) { + PrepareBuilder(); + result.packedDouble_[index] = value; + return this; + } + public Builder AddPackedDouble(double value) { + PrepareBuilder(); + result.packedDouble_.Add(value); + return this; + } + public Builder AddRangePackedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.packedDouble_.Add(values); + return this; + } + public Builder ClearPackedDouble() { + PrepareBuilder(); + result.packedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedBoolList { + get { return PrepareBuilder().packedBool_; } + } + public int PackedBoolCount { + get { return result.PackedBoolCount; } + } + public bool GetPackedBool(int index) { + return result.GetPackedBool(index); + } + public Builder SetPackedBool(int index, bool value) { + PrepareBuilder(); + result.packedBool_[index] = value; + return this; + } + public Builder AddPackedBool(bool value) { + PrepareBuilder(); + result.packedBool_.Add(value); + return this; + } + public Builder AddRangePackedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.packedBool_.Add(values); + return this; + } + public Builder ClearPackedBool() { + PrepareBuilder(); + result.packedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedEnumList { + get { return PrepareBuilder().packedEnum_; } + } + public int PackedEnumCount { + get { return result.PackedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetPackedEnum(int index) { + return result.GetPackedEnum(index); + } + public Builder SetPackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.packedEnum_[index] = value; + return this; + } + public Builder AddPackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.packedEnum_.Add(value); + return this; + } + public Builder AddRangePackedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.packedEnum_.Add(values); + return this; + } + public Builder ClearPackedEnum() { + PrepareBuilder(); + result.packedEnum_.Clear(); + return this; + } + } + static TestPackedTypes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestUnpackedTypes : pb::GeneratedMessage { + private TestUnpackedTypes() { } + private static readonly TestUnpackedTypes defaultInstance = new TestUnpackedTypes().MakeReadOnly(); + private static readonly string[] _testUnpackedTypesFieldNames = new string[] { "unpacked_bool", "unpacked_double", "unpacked_enum", "unpacked_fixed32", "unpacked_fixed64", "unpacked_float", "unpacked_int32", "unpacked_int64", "unpacked_sfixed32", "unpacked_sfixed64", "unpacked_sint32", "unpacked_sint64", "unpacked_uint32", "unpacked_uint64" }; + private static readonly uint[] _testUnpackedTypesFieldTags = new uint[] { 816, 809, 824, 773, 777, 805, 720, 728, 789, 793, 752, 760, 736, 744 }; + public static TestUnpackedTypes DefaultInstance { + get { return defaultInstance; } + } + + public override TestUnpackedTypes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestUnpackedTypes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestUnpackedTypes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestUnpackedTypes__FieldAccessorTable; } + } + + public const int UnpackedInt32FieldNumber = 90; + private pbc::PopsicleList unpackedInt32_ = new pbc::PopsicleList(); + public scg::IList UnpackedInt32List { + get { return pbc::Lists.AsReadOnly(unpackedInt32_); } + } + public int UnpackedInt32Count { + get { return unpackedInt32_.Count; } + } + public int GetUnpackedInt32(int index) { + return unpackedInt32_[index]; + } + + public const int UnpackedInt64FieldNumber = 91; + private pbc::PopsicleList unpackedInt64_ = new pbc::PopsicleList(); + public scg::IList UnpackedInt64List { + get { return pbc::Lists.AsReadOnly(unpackedInt64_); } + } + public int UnpackedInt64Count { + get { return unpackedInt64_.Count; } + } + public long GetUnpackedInt64(int index) { + return unpackedInt64_[index]; + } + + public const int UnpackedUint32FieldNumber = 92; + private pbc::PopsicleList unpackedUint32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedUint32List { + get { return pbc::Lists.AsReadOnly(unpackedUint32_); } + } + public int UnpackedUint32Count { + get { return unpackedUint32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedUint32(int index) { + return unpackedUint32_[index]; + } + + public const int UnpackedUint64FieldNumber = 93; + private pbc::PopsicleList unpackedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedUint64List { + get { return pbc::Lists.AsReadOnly(unpackedUint64_); } + } + public int UnpackedUint64Count { + get { return unpackedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedUint64(int index) { + return unpackedUint64_[index]; + } + + public const int UnpackedSint32FieldNumber = 94; + private pbc::PopsicleList unpackedSint32_ = new pbc::PopsicleList(); + public scg::IList UnpackedSint32List { + get { return pbc::Lists.AsReadOnly(unpackedSint32_); } + } + public int UnpackedSint32Count { + get { return unpackedSint32_.Count; } + } + public int GetUnpackedSint32(int index) { + return unpackedSint32_[index]; + } + + public const int UnpackedSint64FieldNumber = 95; + private pbc::PopsicleList unpackedSint64_ = new pbc::PopsicleList(); + public scg::IList UnpackedSint64List { + get { return pbc::Lists.AsReadOnly(unpackedSint64_); } + } + public int UnpackedSint64Count { + get { return unpackedSint64_.Count; } + } + public long GetUnpackedSint64(int index) { + return unpackedSint64_[index]; + } + + public const int UnpackedFixed32FieldNumber = 96; + private pbc::PopsicleList unpackedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedFixed32List { + get { return pbc::Lists.AsReadOnly(unpackedFixed32_); } + } + public int UnpackedFixed32Count { + get { return unpackedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedFixed32(int index) { + return unpackedFixed32_[index]; + } + + public const int UnpackedFixed64FieldNumber = 97; + private pbc::PopsicleList unpackedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList UnpackedFixed64List { + get { return pbc::Lists.AsReadOnly(unpackedFixed64_); } + } + public int UnpackedFixed64Count { + get { return unpackedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedFixed64(int index) { + return unpackedFixed64_[index]; + } + + public const int UnpackedSfixed32FieldNumber = 98; + private pbc::PopsicleList unpackedSfixed32_ = new pbc::PopsicleList(); + public scg::IList UnpackedSfixed32List { + get { return pbc::Lists.AsReadOnly(unpackedSfixed32_); } + } + public int UnpackedSfixed32Count { + get { return unpackedSfixed32_.Count; } + } + public int GetUnpackedSfixed32(int index) { + return unpackedSfixed32_[index]; + } + + public const int UnpackedSfixed64FieldNumber = 99; + private pbc::PopsicleList unpackedSfixed64_ = new pbc::PopsicleList(); + public scg::IList UnpackedSfixed64List { + get { return pbc::Lists.AsReadOnly(unpackedSfixed64_); } + } + public int UnpackedSfixed64Count { + get { return unpackedSfixed64_.Count; } + } + public long GetUnpackedSfixed64(int index) { + return unpackedSfixed64_[index]; + } + + public const int UnpackedFloatFieldNumber = 100; + private pbc::PopsicleList unpackedFloat_ = new pbc::PopsicleList(); + public scg::IList UnpackedFloatList { + get { return pbc::Lists.AsReadOnly(unpackedFloat_); } + } + public int UnpackedFloatCount { + get { return unpackedFloat_.Count; } + } + public float GetUnpackedFloat(int index) { + return unpackedFloat_[index]; + } + + public const int UnpackedDoubleFieldNumber = 101; + private pbc::PopsicleList unpackedDouble_ = new pbc::PopsicleList(); + public scg::IList UnpackedDoubleList { + get { return pbc::Lists.AsReadOnly(unpackedDouble_); } + } + public int UnpackedDoubleCount { + get { return unpackedDouble_.Count; } + } + public double GetUnpackedDouble(int index) { + return unpackedDouble_[index]; + } + + public const int UnpackedBoolFieldNumber = 102; + private pbc::PopsicleList unpackedBool_ = new pbc::PopsicleList(); + public scg::IList UnpackedBoolList { + get { return pbc::Lists.AsReadOnly(unpackedBool_); } + } + public int UnpackedBoolCount { + get { return unpackedBool_.Count; } + } + public bool GetUnpackedBool(int index) { + return unpackedBool_[index]; + } + + public const int UnpackedEnumFieldNumber = 103; + private pbc::PopsicleList unpackedEnum_ = new pbc::PopsicleList(); + public scg::IList UnpackedEnumList { + get { return pbc::Lists.AsReadOnly(unpackedEnum_); } + } + public int UnpackedEnumCount { + get { return unpackedEnum_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetUnpackedEnum(int index) { + return unpackedEnum_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testUnpackedTypesFieldNames; + if (unpackedInt32_.Count > 0) { + output.WriteInt32Array(90, field_names[6], unpackedInt32_); + } + if (unpackedInt64_.Count > 0) { + output.WriteInt64Array(91, field_names[7], unpackedInt64_); + } + if (unpackedUint32_.Count > 0) { + output.WriteUInt32Array(92, field_names[12], unpackedUint32_); + } + if (unpackedUint64_.Count > 0) { + output.WriteUInt64Array(93, field_names[13], unpackedUint64_); + } + if (unpackedSint32_.Count > 0) { + output.WriteSInt32Array(94, field_names[10], unpackedSint32_); + } + if (unpackedSint64_.Count > 0) { + output.WriteSInt64Array(95, field_names[11], unpackedSint64_); + } + if (unpackedFixed32_.Count > 0) { + output.WriteFixed32Array(96, field_names[3], unpackedFixed32_); + } + if (unpackedFixed64_.Count > 0) { + output.WriteFixed64Array(97, field_names[4], unpackedFixed64_); + } + if (unpackedSfixed32_.Count > 0) { + output.WriteSFixed32Array(98, field_names[8], unpackedSfixed32_); + } + if (unpackedSfixed64_.Count > 0) { + output.WriteSFixed64Array(99, field_names[9], unpackedSfixed64_); + } + if (unpackedFloat_.Count > 0) { + output.WriteFloatArray(100, field_names[5], unpackedFloat_); + } + if (unpackedDouble_.Count > 0) { + output.WriteDoubleArray(101, field_names[1], unpackedDouble_); + } + if (unpackedBool_.Count > 0) { + output.WriteBoolArray(102, field_names[0], unpackedBool_); + } + if (unpackedEnum_.Count > 0) { + output.WriteEnumArray(103, field_names[2], unpackedEnum_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (int element in UnpackedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedInt32_.Count; + } + { + int dataSize = 0; + foreach (long element in UnpackedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedInt64_.Count; + } + { + int dataSize = 0; + foreach (uint element in UnpackedUint32List) { + dataSize += pb::CodedOutputStream.ComputeUInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedUint32_.Count; + } + { + int dataSize = 0; + foreach (ulong element in UnpackedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedUint64_.Count; + } + { + int dataSize = 0; + foreach (int element in UnpackedSint32List) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedSint32_.Count; + } + { + int dataSize = 0; + foreach (long element in UnpackedSint64List) { + dataSize += pb::CodedOutputStream.ComputeSInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * unpackedSint64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedFixed32_.Count; + size += dataSize; + size += 2 * unpackedFixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedFixed64_.Count; + size += dataSize; + size += 2 * unpackedFixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedSfixed32_.Count; + size += dataSize; + size += 2 * unpackedSfixed32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedSfixed64_.Count; + size += dataSize; + size += 2 * unpackedSfixed64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * unpackedFloat_.Count; + size += dataSize; + size += 2 * unpackedFloat_.Count; + } + { + int dataSize = 0; + dataSize = 8 * unpackedDouble_.Count; + size += dataSize; + size += 2 * unpackedDouble_.Count; + } + { + int dataSize = 0; + dataSize = 1 * unpackedBool_.Count; + size += dataSize; + size += 2 * unpackedBool_.Count; + } + { + int dataSize = 0; + if (unpackedEnum_.Count > 0) { + foreach (global::Google.ProtocolBuffers.TestProtos.ForeignEnum element in unpackedEnum_) { + dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element); + } + size += dataSize; + size += 2 * unpackedEnum_.Count; + } + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestUnpackedTypes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestUnpackedTypes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestUnpackedTypes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestUnpackedTypes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestUnpackedTypes MakeReadOnly() { + unpackedInt32_.MakeReadOnly(); + unpackedInt64_.MakeReadOnly(); + unpackedUint32_.MakeReadOnly(); + unpackedUint64_.MakeReadOnly(); + unpackedSint32_.MakeReadOnly(); + unpackedSint64_.MakeReadOnly(); + unpackedFixed32_.MakeReadOnly(); + unpackedFixed64_.MakeReadOnly(); + unpackedSfixed32_.MakeReadOnly(); + unpackedSfixed64_.MakeReadOnly(); + unpackedFloat_.MakeReadOnly(); + unpackedDouble_.MakeReadOnly(); + unpackedBool_.MakeReadOnly(); + unpackedEnum_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestUnpackedTypes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestUnpackedTypes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestUnpackedTypes result; + + private TestUnpackedTypes PrepareBuilder() { + if (resultIsReadOnly) { + TestUnpackedTypes original = result; + result = new TestUnpackedTypes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestUnpackedTypes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.Descriptor; } + } + + public override TestUnpackedTypes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance; } + } + + public override TestUnpackedTypes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestUnpackedTypes) { + return MergeFrom((TestUnpackedTypes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestUnpackedTypes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestUnpackedTypes.DefaultInstance) return this; + PrepareBuilder(); + if (other.unpackedInt32_.Count != 0) { + result.unpackedInt32_.Add(other.unpackedInt32_); + } + if (other.unpackedInt64_.Count != 0) { + result.unpackedInt64_.Add(other.unpackedInt64_); + } + if (other.unpackedUint32_.Count != 0) { + result.unpackedUint32_.Add(other.unpackedUint32_); + } + if (other.unpackedUint64_.Count != 0) { + result.unpackedUint64_.Add(other.unpackedUint64_); + } + if (other.unpackedSint32_.Count != 0) { + result.unpackedSint32_.Add(other.unpackedSint32_); + } + if (other.unpackedSint64_.Count != 0) { + result.unpackedSint64_.Add(other.unpackedSint64_); + } + if (other.unpackedFixed32_.Count != 0) { + result.unpackedFixed32_.Add(other.unpackedFixed32_); + } + if (other.unpackedFixed64_.Count != 0) { + result.unpackedFixed64_.Add(other.unpackedFixed64_); + } + if (other.unpackedSfixed32_.Count != 0) { + result.unpackedSfixed32_.Add(other.unpackedSfixed32_); + } + if (other.unpackedSfixed64_.Count != 0) { + result.unpackedSfixed64_.Add(other.unpackedSfixed64_); + } + if (other.unpackedFloat_.Count != 0) { + result.unpackedFloat_.Add(other.unpackedFloat_); + } + if (other.unpackedDouble_.Count != 0) { + result.unpackedDouble_.Add(other.unpackedDouble_); + } + if (other.unpackedBool_.Count != 0) { + result.unpackedBool_.Add(other.unpackedBool_); + } + if (other.unpackedEnum_.Count != 0) { + result.unpackedEnum_.Add(other.unpackedEnum_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testUnpackedTypesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testUnpackedTypesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 722: + case 720: { + input.ReadInt32Array(tag, field_name, result.unpackedInt32_); + break; + } + case 730: + case 728: { + input.ReadInt64Array(tag, field_name, result.unpackedInt64_); + break; + } + case 738: + case 736: { + input.ReadUInt32Array(tag, field_name, result.unpackedUint32_); + break; + } + case 746: + case 744: { + input.ReadUInt64Array(tag, field_name, result.unpackedUint64_); + break; + } + case 754: + case 752: { + input.ReadSInt32Array(tag, field_name, result.unpackedSint32_); + break; + } + case 762: + case 760: { + input.ReadSInt64Array(tag, field_name, result.unpackedSint64_); + break; + } + case 770: + case 773: { + input.ReadFixed32Array(tag, field_name, result.unpackedFixed32_); + break; + } + case 778: + case 777: { + input.ReadFixed64Array(tag, field_name, result.unpackedFixed64_); + break; + } + case 786: + case 789: { + input.ReadSFixed32Array(tag, field_name, result.unpackedSfixed32_); + break; + } + case 794: + case 793: { + input.ReadSFixed64Array(tag, field_name, result.unpackedSfixed64_); + break; + } + case 802: + case 805: { + input.ReadFloatArray(tag, field_name, result.unpackedFloat_); + break; + } + case 810: + case 809: { + input.ReadDoubleArray(tag, field_name, result.unpackedDouble_); + break; + } + case 818: + case 816: { + input.ReadBoolArray(tag, field_name, result.unpackedBool_); + break; + } + case 826: + case 824: { + scg::ICollection unknownItems; + input.ReadEnumArray(tag, field_name, result.unpackedEnum_, out unknownItems); + if (unknownItems != null) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + foreach (object rawValue in unknownItems) + if (rawValue is int) + unknownFields.MergeVarintField(103, (ulong)(int)rawValue); + } + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public pbc::IPopsicleList UnpackedInt32List { + get { return PrepareBuilder().unpackedInt32_; } + } + public int UnpackedInt32Count { + get { return result.UnpackedInt32Count; } + } + public int GetUnpackedInt32(int index) { + return result.GetUnpackedInt32(index); + } + public Builder SetUnpackedInt32(int index, int value) { + PrepareBuilder(); + result.unpackedInt32_[index] = value; + return this; + } + public Builder AddUnpackedInt32(int value) { + PrepareBuilder(); + result.unpackedInt32_.Add(value); + return this; + } + public Builder AddRangeUnpackedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedInt32_.Add(values); + return this; + } + public Builder ClearUnpackedInt32() { + PrepareBuilder(); + result.unpackedInt32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedInt64List { + get { return PrepareBuilder().unpackedInt64_; } + } + public int UnpackedInt64Count { + get { return result.UnpackedInt64Count; } + } + public long GetUnpackedInt64(int index) { + return result.GetUnpackedInt64(index); + } + public Builder SetUnpackedInt64(int index, long value) { + PrepareBuilder(); + result.unpackedInt64_[index] = value; + return this; + } + public Builder AddUnpackedInt64(long value) { + PrepareBuilder(); + result.unpackedInt64_.Add(value); + return this; + } + public Builder AddRangeUnpackedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedInt64_.Add(values); + return this; + } + public Builder ClearUnpackedInt64() { + PrepareBuilder(); + result.unpackedInt64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedUint32List { + get { return PrepareBuilder().unpackedUint32_; } + } + public int UnpackedUint32Count { + get { return result.UnpackedUint32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedUint32(int index) { + return result.GetUnpackedUint32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedUint32(int index, uint value) { + PrepareBuilder(); + result.unpackedUint32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedUint32(uint value) { + PrepareBuilder(); + result.unpackedUint32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedUint32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedUint32_.Add(values); + return this; + } + public Builder ClearUnpackedUint32() { + PrepareBuilder(); + result.unpackedUint32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedUint64List { + get { return PrepareBuilder().unpackedUint64_; } + } + public int UnpackedUint64Count { + get { return result.UnpackedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedUint64(int index) { + return result.GetUnpackedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedUint64(int index, ulong value) { + PrepareBuilder(); + result.unpackedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedUint64(ulong value) { + PrepareBuilder(); + result.unpackedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedUint64_.Add(values); + return this; + } + public Builder ClearUnpackedUint64() { + PrepareBuilder(); + result.unpackedUint64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSint32List { + get { return PrepareBuilder().unpackedSint32_; } + } + public int UnpackedSint32Count { + get { return result.UnpackedSint32Count; } + } + public int GetUnpackedSint32(int index) { + return result.GetUnpackedSint32(index); + } + public Builder SetUnpackedSint32(int index, int value) { + PrepareBuilder(); + result.unpackedSint32_[index] = value; + return this; + } + public Builder AddUnpackedSint32(int value) { + PrepareBuilder(); + result.unpackedSint32_.Add(value); + return this; + } + public Builder AddRangeUnpackedSint32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSint32_.Add(values); + return this; + } + public Builder ClearUnpackedSint32() { + PrepareBuilder(); + result.unpackedSint32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSint64List { + get { return PrepareBuilder().unpackedSint64_; } + } + public int UnpackedSint64Count { + get { return result.UnpackedSint64Count; } + } + public long GetUnpackedSint64(int index) { + return result.GetUnpackedSint64(index); + } + public Builder SetUnpackedSint64(int index, long value) { + PrepareBuilder(); + result.unpackedSint64_[index] = value; + return this; + } + public Builder AddUnpackedSint64(long value) { + PrepareBuilder(); + result.unpackedSint64_.Add(value); + return this; + } + public Builder AddRangeUnpackedSint64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSint64_.Add(values); + return this; + } + public Builder ClearUnpackedSint64() { + PrepareBuilder(); + result.unpackedSint64_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedFixed32List { + get { return PrepareBuilder().unpackedFixed32_; } + } + public int UnpackedFixed32Count { + get { return result.UnpackedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetUnpackedFixed32(int index) { + return result.GetUnpackedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedFixed32(int index, uint value) { + PrepareBuilder(); + result.unpackedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedFixed32(uint value) { + PrepareBuilder(); + result.unpackedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFixed32_.Add(values); + return this; + } + public Builder ClearUnpackedFixed32() { + PrepareBuilder(); + result.unpackedFixed32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList UnpackedFixed64List { + get { return PrepareBuilder().unpackedFixed64_; } + } + public int UnpackedFixed64Count { + get { return result.UnpackedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetUnpackedFixed64(int index) { + return result.GetUnpackedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetUnpackedFixed64(int index, ulong value) { + PrepareBuilder(); + result.unpackedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddUnpackedFixed64(ulong value) { + PrepareBuilder(); + result.unpackedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeUnpackedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFixed64_.Add(values); + return this; + } + public Builder ClearUnpackedFixed64() { + PrepareBuilder(); + result.unpackedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSfixed32List { + get { return PrepareBuilder().unpackedSfixed32_; } + } + public int UnpackedSfixed32Count { + get { return result.UnpackedSfixed32Count; } + } + public int GetUnpackedSfixed32(int index) { + return result.GetUnpackedSfixed32(index); + } + public Builder SetUnpackedSfixed32(int index, int value) { + PrepareBuilder(); + result.unpackedSfixed32_[index] = value; + return this; + } + public Builder AddUnpackedSfixed32(int value) { + PrepareBuilder(); + result.unpackedSfixed32_.Add(value); + return this; + } + public Builder AddRangeUnpackedSfixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSfixed32_.Add(values); + return this; + } + public Builder ClearUnpackedSfixed32() { + PrepareBuilder(); + result.unpackedSfixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedSfixed64List { + get { return PrepareBuilder().unpackedSfixed64_; } + } + public int UnpackedSfixed64Count { + get { return result.UnpackedSfixed64Count; } + } + public long GetUnpackedSfixed64(int index) { + return result.GetUnpackedSfixed64(index); + } + public Builder SetUnpackedSfixed64(int index, long value) { + PrepareBuilder(); + result.unpackedSfixed64_[index] = value; + return this; + } + public Builder AddUnpackedSfixed64(long value) { + PrepareBuilder(); + result.unpackedSfixed64_.Add(value); + return this; + } + public Builder AddRangeUnpackedSfixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedSfixed64_.Add(values); + return this; + } + public Builder ClearUnpackedSfixed64() { + PrepareBuilder(); + result.unpackedSfixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedFloatList { + get { return PrepareBuilder().unpackedFloat_; } + } + public int UnpackedFloatCount { + get { return result.UnpackedFloatCount; } + } + public float GetUnpackedFloat(int index) { + return result.GetUnpackedFloat(index); + } + public Builder SetUnpackedFloat(int index, float value) { + PrepareBuilder(); + result.unpackedFloat_[index] = value; + return this; + } + public Builder AddUnpackedFloat(float value) { + PrepareBuilder(); + result.unpackedFloat_.Add(value); + return this; + } + public Builder AddRangeUnpackedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedFloat_.Add(values); + return this; + } + public Builder ClearUnpackedFloat() { + PrepareBuilder(); + result.unpackedFloat_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedDoubleList { + get { return PrepareBuilder().unpackedDouble_; } + } + public int UnpackedDoubleCount { + get { return result.UnpackedDoubleCount; } + } + public double GetUnpackedDouble(int index) { + return result.GetUnpackedDouble(index); + } + public Builder SetUnpackedDouble(int index, double value) { + PrepareBuilder(); + result.unpackedDouble_[index] = value; + return this; + } + public Builder AddUnpackedDouble(double value) { + PrepareBuilder(); + result.unpackedDouble_.Add(value); + return this; + } + public Builder AddRangeUnpackedDouble(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedDouble_.Add(values); + return this; + } + public Builder ClearUnpackedDouble() { + PrepareBuilder(); + result.unpackedDouble_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedBoolList { + get { return PrepareBuilder().unpackedBool_; } + } + public int UnpackedBoolCount { + get { return result.UnpackedBoolCount; } + } + public bool GetUnpackedBool(int index) { + return result.GetUnpackedBool(index); + } + public Builder SetUnpackedBool(int index, bool value) { + PrepareBuilder(); + result.unpackedBool_[index] = value; + return this; + } + public Builder AddUnpackedBool(bool value) { + PrepareBuilder(); + result.unpackedBool_.Add(value); + return this; + } + public Builder AddRangeUnpackedBool(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedBool_.Add(values); + return this; + } + public Builder ClearUnpackedBool() { + PrepareBuilder(); + result.unpackedBool_.Clear(); + return this; + } + + public pbc::IPopsicleList UnpackedEnumList { + get { return PrepareBuilder().unpackedEnum_; } + } + public int UnpackedEnumCount { + get { return result.UnpackedEnumCount; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum GetUnpackedEnum(int index) { + return result.GetUnpackedEnum(index); + } + public Builder SetUnpackedEnum(int index, global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.unpackedEnum_[index] = value; + return this; + } + public Builder AddUnpackedEnum(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.unpackedEnum_.Add(value); + return this; + } + public Builder AddRangeUnpackedEnum(scg::IEnumerable values) { + PrepareBuilder(); + result.unpackedEnum_.Add(values); + return this; + } + public Builder ClearUnpackedEnum() { + PrepareBuilder(); + result.unpackedEnum_.Clear(); + return this; + } + } + static TestUnpackedTypes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestPackedExtensions : pb::ExtendableMessage { + private TestPackedExtensions() { } + private static readonly TestPackedExtensions defaultInstance = new TestPackedExtensions().MakeReadOnly(); + private static readonly string[] _testPackedExtensionsFieldNames = new string[] { }; + private static readonly uint[] _testPackedExtensionsFieldTags = new uint[] { }; + public static TestPackedExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestPackedExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestPackedExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestPackedExtensions__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + if (!ExtensionsAreInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testPackedExtensionsFieldNames; + pb::ExtendableMessage.ExtensionWriter extensionWriter = CreateExtensionWriter(this); + extensionWriter.WriteUntil(536870912, output); + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += ExtensionsSerializedSize; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestPackedExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestPackedExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestPackedExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestPackedExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestPackedExtensions MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestPackedExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::ExtendableBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestPackedExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestPackedExtensions result; + + private TestPackedExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestPackedExtensions original = result; + result = new TestPackedExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestPackedExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.Descriptor; } + } + + public override TestPackedExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.DefaultInstance; } + } + + public override TestPackedExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestPackedExtensions) { + return MergeFrom((TestPackedExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestPackedExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestPackedExtensions.DefaultInstance) return this; + PrepareBuilder(); + this.MergeExtensionFields(other); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testPackedExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testPackedExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static TestPackedExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestDynamicExtensions : pb::GeneratedMessage { + private TestDynamicExtensions() { } + private static readonly TestDynamicExtensions defaultInstance = new TestDynamicExtensions().MakeReadOnly(); + private static readonly string[] _testDynamicExtensionsFieldNames = new string[] { "dynamic_enum_extension", "dynamic_message_extension", "enum_extension", "message_extension", "packed_extension", "repeated_extension", "scalar_extension" }; + private static readonly uint[] _testDynamicExtensionsFieldTags = new uint[] { 16016, 16034, 16008, 16026, 16050, 16042, 16005 }; + public static TestDynamicExtensions DefaultInstance { + get { return defaultInstance; } + } + + public override TestDynamicExtensions DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestDynamicExtensions ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions__FieldAccessorTable; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + public enum DynamicEnumType { + DYNAMIC_FOO = 2200, + DYNAMIC_BAR = 2201, + DYNAMIC_BAZ = 2202, + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class DynamicMessageType : pb::GeneratedMessage { + private DynamicMessageType() { } + private static readonly DynamicMessageType defaultInstance = new DynamicMessageType().MakeReadOnly(); + private static readonly string[] _dynamicMessageTypeFieldNames = new string[] { "dynamic_field" }; + private static readonly uint[] _dynamicMessageTypeFieldTags = new uint[] { 16800 }; + public static DynamicMessageType DefaultInstance { + get { return defaultInstance; } + } + + public override DynamicMessageType DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override DynamicMessageType ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestDynamicExtensions_DynamicMessageType__FieldAccessorTable; } + } + + public const int DynamicFieldFieldNumber = 2100; + private bool hasDynamicField; + private int dynamicField_; + public bool HasDynamicField { + get { return hasDynamicField; } + } + public int DynamicField { + get { return dynamicField_; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _dynamicMessageTypeFieldNames; + if (hasDynamicField) { + output.WriteInt32(2100, field_names[0], DynamicField); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasDynamicField) { + size += pb::CodedOutputStream.ComputeInt32Size(2100, DynamicField); + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static DynamicMessageType ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static DynamicMessageType ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static DynamicMessageType ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static DynamicMessageType ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static DynamicMessageType ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private DynamicMessageType MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(DynamicMessageType prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(DynamicMessageType cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private DynamicMessageType result; + + private DynamicMessageType PrepareBuilder() { + if (resultIsReadOnly) { + DynamicMessageType original = result; + result = new DynamicMessageType(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override DynamicMessageType MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Descriptor; } + } + + public override DynamicMessageType DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; } + } + + public override DynamicMessageType BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is DynamicMessageType) { + return MergeFrom((DynamicMessageType) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(DynamicMessageType other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasDynamicField) { + DynamicField = other.DynamicField; + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_dynamicMessageTypeFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _dynamicMessageTypeFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 16800: { + result.hasDynamicField = input.ReadInt32(ref result.dynamicField_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasDynamicField { + get { return result.hasDynamicField; } + } + public int DynamicField { + get { return result.DynamicField; } + set { SetDynamicField(value); } + } + public Builder SetDynamicField(int value) { + PrepareBuilder(); + result.hasDynamicField = true; + result.dynamicField_ = value; + return this; + } + public Builder ClearDynamicField() { + PrepareBuilder(); + result.hasDynamicField = false; + result.dynamicField_ = 0; + return this; + } + } + static DynamicMessageType() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + } + #endregion + + public const int ScalarExtensionFieldNumber = 2000; + private bool hasScalarExtension; + private uint scalarExtension_; + public bool HasScalarExtension { + get { return hasScalarExtension; } + } + [global::System.CLSCompliant(false)] + public uint ScalarExtension { + get { return scalarExtension_; } + } + + public const int EnumExtensionFieldNumber = 2001; + private bool hasEnumExtension; + private global::Google.ProtocolBuffers.TestProtos.ForeignEnum enumExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + public bool HasEnumExtension { + get { return hasEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumExtension { + get { return enumExtension_; } + } + + public const int DynamicEnumExtensionFieldNumber = 2002; + private bool hasDynamicEnumExtension; + private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType dynamicEnumExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType.DYNAMIC_FOO; + public bool HasDynamicEnumExtension { + get { return hasDynamicEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType DynamicEnumExtension { + get { return dynamicEnumExtension_; } + } + + public const int MessageExtensionFieldNumber = 2003; + private bool hasMessageExtension; + private global::Google.ProtocolBuffers.TestProtos.ForeignMessage messageExtension_; + public bool HasMessageExtension { + get { return hasMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageExtension { + get { return messageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance; } + } + + public const int DynamicMessageExtensionFieldNumber = 2004; + private bool hasDynamicMessageExtension; + private global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType dynamicMessageExtension_; + public bool HasDynamicMessageExtension { + get { return hasDynamicMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType DynamicMessageExtension { + get { return dynamicMessageExtension_ ?? global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance; } + } + + public const int RepeatedExtensionFieldNumber = 2005; + private pbc::PopsicleList repeatedExtension_ = new pbc::PopsicleList(); + public scg::IList RepeatedExtensionList { + get { return pbc::Lists.AsReadOnly(repeatedExtension_); } + } + public int RepeatedExtensionCount { + get { return repeatedExtension_.Count; } + } + public string GetRepeatedExtension(int index) { + return repeatedExtension_[index]; + } + + public const int PackedExtensionFieldNumber = 2006; + private int packedExtensionMemoizedSerializedSize; + private pbc::PopsicleList packedExtension_ = new pbc::PopsicleList(); + public scg::IList PackedExtensionList { + get { return pbc::Lists.AsReadOnly(packedExtension_); } + } + public int PackedExtensionCount { + get { return packedExtension_.Count; } + } + public int GetPackedExtension(int index) { + return packedExtension_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testDynamicExtensionsFieldNames; + if (hasScalarExtension) { + output.WriteFixed32(2000, field_names[6], ScalarExtension); + } + if (hasEnumExtension) { + output.WriteEnum(2001, field_names[2], (int) EnumExtension, EnumExtension); + } + if (hasDynamicEnumExtension) { + output.WriteEnum(2002, field_names[0], (int) DynamicEnumExtension, DynamicEnumExtension); + } + if (hasMessageExtension) { + output.WriteMessage(2003, field_names[3], MessageExtension); + } + if (hasDynamicMessageExtension) { + output.WriteMessage(2004, field_names[1], DynamicMessageExtension); + } + if (repeatedExtension_.Count > 0) { + output.WriteStringArray(2005, field_names[5], repeatedExtension_); + } + if (packedExtension_.Count > 0) { + output.WritePackedSInt32Array(2006, field_names[4], packedExtensionMemoizedSerializedSize, packedExtension_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasScalarExtension) { + size += pb::CodedOutputStream.ComputeFixed32Size(2000, ScalarExtension); + } + if (hasEnumExtension) { + size += pb::CodedOutputStream.ComputeEnumSize(2001, (int) EnumExtension); + } + if (hasDynamicEnumExtension) { + size += pb::CodedOutputStream.ComputeEnumSize(2002, (int) DynamicEnumExtension); + } + if (hasMessageExtension) { + size += pb::CodedOutputStream.ComputeMessageSize(2003, MessageExtension); + } + if (hasDynamicMessageExtension) { + size += pb::CodedOutputStream.ComputeMessageSize(2004, DynamicMessageExtension); + } + { + int dataSize = 0; + foreach (string element in RepeatedExtensionList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedExtension_.Count; + } + { + int dataSize = 0; + foreach (int element in PackedExtensionList) { + dataSize += pb::CodedOutputStream.ComputeSInt32SizeNoTag(element); + } + size += dataSize; + if (packedExtension_.Count != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize); + } + packedExtensionMemoizedSerializedSize = dataSize; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestDynamicExtensions ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestDynamicExtensions ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestDynamicExtensions ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestDynamicExtensions ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestDynamicExtensions MakeReadOnly() { + repeatedExtension_.MakeReadOnly(); + packedExtension_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestDynamicExtensions prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestDynamicExtensions cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestDynamicExtensions result; + + private TestDynamicExtensions PrepareBuilder() { + if (resultIsReadOnly) { + TestDynamicExtensions original = result; + result = new TestDynamicExtensions(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestDynamicExtensions MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Descriptor; } + } + + public override TestDynamicExtensions DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.DefaultInstance; } + } + + public override TestDynamicExtensions BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestDynamicExtensions) { + return MergeFrom((TestDynamicExtensions) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestDynamicExtensions other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasScalarExtension) { + ScalarExtension = other.ScalarExtension; + } + if (other.HasEnumExtension) { + EnumExtension = other.EnumExtension; + } + if (other.HasDynamicEnumExtension) { + DynamicEnumExtension = other.DynamicEnumExtension; + } + if (other.HasMessageExtension) { + MergeMessageExtension(other.MessageExtension); + } + if (other.HasDynamicMessageExtension) { + MergeDynamicMessageExtension(other.DynamicMessageExtension); + } + if (other.repeatedExtension_.Count != 0) { + result.repeatedExtension_.Add(other.repeatedExtension_); + } + if (other.packedExtension_.Count != 0) { + result.packedExtension_.Add(other.packedExtension_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testDynamicExtensionsFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testDynamicExtensionsFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 16005: { + result.hasScalarExtension = input.ReadFixed32(ref result.scalarExtension_); + break; + } + case 16008: { + object unknown; + if(input.ReadEnum(ref result.enumExtension_, out unknown)) { + result.hasEnumExtension = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(2001, (ulong)(int)unknown); + } + break; + } + case 16016: { + object unknown; + if(input.ReadEnum(ref result.dynamicEnumExtension_, out unknown)) { + result.hasDynamicEnumExtension = true; + } else if(unknown is int) { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + unknownFields.MergeVarintField(2002, (ulong)(int)unknown); + } + break; + } + case 16026: { + global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(); + if (result.hasMessageExtension) { + subBuilder.MergeFrom(MessageExtension); + } + input.ReadMessage(subBuilder, extensionRegistry); + MessageExtension = subBuilder.BuildPartial(); + break; + } + case 16034: { + global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.CreateBuilder(); + if (result.hasDynamicMessageExtension) { + subBuilder.MergeFrom(DynamicMessageExtension); + } + input.ReadMessage(subBuilder, extensionRegistry); + DynamicMessageExtension = subBuilder.BuildPartial(); + break; + } + case 16042: { + input.ReadStringArray(tag, field_name, result.repeatedExtension_); + break; + } + case 16050: + case 16048: { + input.ReadSInt32Array(tag, field_name, result.packedExtension_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + public bool HasScalarExtension { + get { return result.hasScalarExtension; } + } + [global::System.CLSCompliant(false)] + public uint ScalarExtension { + get { return result.ScalarExtension; } + set { SetScalarExtension(value); } + } + [global::System.CLSCompliant(false)] + public Builder SetScalarExtension(uint value) { + PrepareBuilder(); + result.hasScalarExtension = true; + result.scalarExtension_ = value; + return this; + } + public Builder ClearScalarExtension() { + PrepareBuilder(); + result.hasScalarExtension = false; + result.scalarExtension_ = 0; + return this; + } + + public bool HasEnumExtension { + get { return result.hasEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignEnum EnumExtension { + get { return result.EnumExtension; } + set { SetEnumExtension(value); } + } + public Builder SetEnumExtension(global::Google.ProtocolBuffers.TestProtos.ForeignEnum value) { + PrepareBuilder(); + result.hasEnumExtension = true; + result.enumExtension_ = value; + return this; + } + public Builder ClearEnumExtension() { + PrepareBuilder(); + result.hasEnumExtension = false; + result.enumExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignEnum.FOREIGN_FOO; + return this; + } + + public bool HasDynamicEnumExtension { + get { return result.hasDynamicEnumExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType DynamicEnumExtension { + get { return result.DynamicEnumExtension; } + set { SetDynamicEnumExtension(value); } + } + public Builder SetDynamicEnumExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType value) { + PrepareBuilder(); + result.hasDynamicEnumExtension = true; + result.dynamicEnumExtension_ = value; + return this; + } + public Builder ClearDynamicEnumExtension() { + PrepareBuilder(); + result.hasDynamicEnumExtension = false; + result.dynamicEnumExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicEnumType.DYNAMIC_FOO; + return this; + } + + public bool HasMessageExtension { + get { return result.hasMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.ForeignMessage MessageExtension { + get { return result.MessageExtension; } + set { SetMessageExtension(value); } + } + public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasMessageExtension = true; + result.messageExtension_ = value; + return this; + } + public Builder SetMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasMessageExtension = true; + result.messageExtension_ = builderForValue.Build(); + return this; + } + public Builder MergeMessageExtension(global::Google.ProtocolBuffers.TestProtos.ForeignMessage value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasMessageExtension && + result.messageExtension_ != global::Google.ProtocolBuffers.TestProtos.ForeignMessage.DefaultInstance) { + result.messageExtension_ = global::Google.ProtocolBuffers.TestProtos.ForeignMessage.CreateBuilder(result.messageExtension_).MergeFrom(value).BuildPartial(); + } else { + result.messageExtension_ = value; + } + result.hasMessageExtension = true; + return this; + } + public Builder ClearMessageExtension() { + PrepareBuilder(); + result.hasMessageExtension = false; + result.messageExtension_ = null; + return this; + } + + public bool HasDynamicMessageExtension { + get { return result.hasDynamicMessageExtension; } + } + public global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType DynamicMessageExtension { + get { return result.DynamicMessageExtension; } + set { SetDynamicMessageExtension(value); } + } + public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasDynamicMessageExtension = true; + result.dynamicMessageExtension_ = value; + return this; + } + public Builder SetDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasDynamicMessageExtension = true; + result.dynamicMessageExtension_ = builderForValue.Build(); + return this; + } + public Builder MergeDynamicMessageExtension(global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasDynamicMessageExtension && + result.dynamicMessageExtension_ != global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.DefaultInstance) { + result.dynamicMessageExtension_ = global::Google.ProtocolBuffers.TestProtos.TestDynamicExtensions.Types.DynamicMessageType.CreateBuilder(result.dynamicMessageExtension_).MergeFrom(value).BuildPartial(); + } else { + result.dynamicMessageExtension_ = value; + } + result.hasDynamicMessageExtension = true; + return this; + } + public Builder ClearDynamicMessageExtension() { + PrepareBuilder(); + result.hasDynamicMessageExtension = false; + result.dynamicMessageExtension_ = null; + return this; + } + + public pbc::IPopsicleList RepeatedExtensionList { + get { return PrepareBuilder().repeatedExtension_; } + } + public int RepeatedExtensionCount { + get { return result.RepeatedExtensionCount; } + } + public string GetRepeatedExtension(int index) { + return result.GetRepeatedExtension(index); + } + public Builder SetRepeatedExtension(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedExtension_[index] = value; + return this; + } + public Builder AddRepeatedExtension(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.repeatedExtension_.Add(value); + return this; + } + public Builder AddRangeRepeatedExtension(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedExtension_.Add(values); + return this; + } + public Builder ClearRepeatedExtension() { + PrepareBuilder(); + result.repeatedExtension_.Clear(); + return this; + } + + public pbc::IPopsicleList PackedExtensionList { + get { return PrepareBuilder().packedExtension_; } + } + public int PackedExtensionCount { + get { return result.PackedExtensionCount; } + } + public int GetPackedExtension(int index) { + return result.GetPackedExtension(index); + } + public Builder SetPackedExtension(int index, int value) { + PrepareBuilder(); + result.packedExtension_[index] = value; + return this; + } + public Builder AddPackedExtension(int value) { + PrepareBuilder(); + result.packedExtension_.Add(value); + return this; + } + public Builder AddRangePackedExtension(scg::IEnumerable values) { + PrepareBuilder(); + result.packedExtension_.Add(values); + return this; + } + public Builder ClearPackedExtension() { + PrepareBuilder(); + result.packedExtension_.Clear(); + return this; + } + } + static TestDynamicExtensions() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class TestRepeatedScalarDifferentTagSizes : pb::GeneratedMessage { + private TestRepeatedScalarDifferentTagSizes() { } + private static readonly TestRepeatedScalarDifferentTagSizes defaultInstance = new TestRepeatedScalarDifferentTagSizes().MakeReadOnly(); + private static readonly string[] _testRepeatedScalarDifferentTagSizesFieldNames = new string[] { "repeated_fixed32", "repeated_fixed64", "repeated_float", "repeated_int32", "repeated_int64", "repeated_uint64" }; + private static readonly uint[] _testRepeatedScalarDifferentTagSizesFieldTags = new uint[] { 101, 16369, 2097141, 104, 16376, 2097144 }; + public static TestRepeatedScalarDifferentTagSizes DefaultInstance { + get { return defaultInstance; } + } + + public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override TestRepeatedScalarDifferentTagSizes ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_TestRepeatedScalarDifferentTagSizes__FieldAccessorTable; } + } + + public const int RepeatedFixed32FieldNumber = 12; + private pbc::PopsicleList repeatedFixed32_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed32List { + get { return pbc::Lists.AsReadOnly(repeatedFixed32_); } + } + public int RepeatedFixed32Count { + get { return repeatedFixed32_.Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return repeatedFixed32_[index]; + } + + public const int RepeatedInt32FieldNumber = 13; + private pbc::PopsicleList repeatedInt32_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt32List { + get { return pbc::Lists.AsReadOnly(repeatedInt32_); } + } + public int RepeatedInt32Count { + get { return repeatedInt32_.Count; } + } + public int GetRepeatedInt32(int index) { + return repeatedInt32_[index]; + } + + public const int RepeatedFixed64FieldNumber = 2046; + private pbc::PopsicleList repeatedFixed64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedFixed64List { + get { return pbc::Lists.AsReadOnly(repeatedFixed64_); } + } + public int RepeatedFixed64Count { + get { return repeatedFixed64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return repeatedFixed64_[index]; + } + + public const int RepeatedInt64FieldNumber = 2047; + private pbc::PopsicleList repeatedInt64_ = new pbc::PopsicleList(); + public scg::IList RepeatedInt64List { + get { return pbc::Lists.AsReadOnly(repeatedInt64_); } + } + public int RepeatedInt64Count { + get { return repeatedInt64_.Count; } + } + public long GetRepeatedInt64(int index) { + return repeatedInt64_[index]; + } + + public const int RepeatedFloatFieldNumber = 262142; + private pbc::PopsicleList repeatedFloat_ = new pbc::PopsicleList(); + public scg::IList RepeatedFloatList { + get { return pbc::Lists.AsReadOnly(repeatedFloat_); } + } + public int RepeatedFloatCount { + get { return repeatedFloat_.Count; } + } + public float GetRepeatedFloat(int index) { + return repeatedFloat_[index]; + } + + public const int RepeatedUint64FieldNumber = 262143; + private pbc::PopsicleList repeatedUint64_ = new pbc::PopsicleList(); + [global::System.CLSCompliant(false)] + public scg::IList RepeatedUint64List { + get { return pbc::Lists.AsReadOnly(repeatedUint64_); } + } + public int RepeatedUint64Count { + get { return repeatedUint64_.Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return repeatedUint64_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _testRepeatedScalarDifferentTagSizesFieldNames; + if (repeatedFixed32_.Count > 0) { + output.WriteFixed32Array(12, field_names[0], repeatedFixed32_); + } + if (repeatedInt32_.Count > 0) { + output.WriteInt32Array(13, field_names[3], repeatedInt32_); + } + if (repeatedFixed64_.Count > 0) { + output.WriteFixed64Array(2046, field_names[1], repeatedFixed64_); + } + if (repeatedInt64_.Count > 0) { + output.WriteInt64Array(2047, field_names[4], repeatedInt64_); + } + if (repeatedFloat_.Count > 0) { + output.WriteFloatArray(262142, field_names[2], repeatedFloat_); + } + if (repeatedUint64_.Count > 0) { + output.WriteUInt64Array(262143, field_names[5], repeatedUint64_); + } + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + dataSize = 4 * repeatedFixed32_.Count; + size += dataSize; + size += 1 * repeatedFixed32_.Count; + } + { + int dataSize = 0; + foreach (int element in RepeatedInt32List) { + dataSize += pb::CodedOutputStream.ComputeInt32SizeNoTag(element); + } + size += dataSize; + size += 1 * repeatedInt32_.Count; + } + { + int dataSize = 0; + dataSize = 8 * repeatedFixed64_.Count; + size += dataSize; + size += 2 * repeatedFixed64_.Count; + } + { + int dataSize = 0; + foreach (long element in RepeatedInt64List) { + dataSize += pb::CodedOutputStream.ComputeInt64SizeNoTag(element); + } + size += dataSize; + size += 2 * repeatedInt64_.Count; + } + { + int dataSize = 0; + dataSize = 4 * repeatedFloat_.Count; + size += dataSize; + size += 3 * repeatedFloat_.Count; + } + { + int dataSize = 0; + foreach (ulong element in RepeatedUint64List) { + dataSize += pb::CodedOutputStream.ComputeUInt64SizeNoTag(element); + } + size += dataSize; + size += 3 * repeatedUint64_.Count; + } + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static TestRepeatedScalarDifferentTagSizes ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private TestRepeatedScalarDifferentTagSizes MakeReadOnly() { + repeatedFixed32_.MakeReadOnly(); + repeatedInt32_.MakeReadOnly(); + repeatedFixed64_.MakeReadOnly(); + repeatedInt64_.MakeReadOnly(); + repeatedFloat_.MakeReadOnly(); + repeatedUint64_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(TestRepeatedScalarDifferentTagSizes prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(TestRepeatedScalarDifferentTagSizes cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private TestRepeatedScalarDifferentTagSizes result; + + private TestRepeatedScalarDifferentTagSizes PrepareBuilder() { + if (resultIsReadOnly) { + TestRepeatedScalarDifferentTagSizes original = result; + result = new TestRepeatedScalarDifferentTagSizes(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override TestRepeatedScalarDifferentTagSizes MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.Descriptor; } + } + + public override TestRepeatedScalarDifferentTagSizes DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance; } + } + + public override TestRepeatedScalarDifferentTagSizes BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is TestRepeatedScalarDifferentTagSizes) { + return MergeFrom((TestRepeatedScalarDifferentTagSizes) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(TestRepeatedScalarDifferentTagSizes other) { + if (other == global::Google.ProtocolBuffers.TestProtos.TestRepeatedScalarDifferentTagSizes.DefaultInstance) return this; + PrepareBuilder(); + if (other.repeatedFixed32_.Count != 0) { + result.repeatedFixed32_.Add(other.repeatedFixed32_); + } + if (other.repeatedInt32_.Count != 0) { + result.repeatedInt32_.Add(other.repeatedInt32_); + } + if (other.repeatedFixed64_.Count != 0) { + result.repeatedFixed64_.Add(other.repeatedFixed64_); + } + if (other.repeatedInt64_.Count != 0) { + result.repeatedInt64_.Add(other.repeatedInt64_); + } + if (other.repeatedFloat_.Count != 0) { + result.repeatedFloat_.Add(other.repeatedFloat_); + } + if (other.repeatedUint64_.Count != 0) { + result.repeatedUint64_.Add(other.repeatedUint64_); + } + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_testRepeatedScalarDifferentTagSizesFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _testRepeatedScalarDifferentTagSizesFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + case 98: + case 101: { + input.ReadFixed32Array(tag, field_name, result.repeatedFixed32_); + break; + } + case 106: + case 104: { + input.ReadInt32Array(tag, field_name, result.repeatedInt32_); + break; + } + case 16370: + case 16369: { + input.ReadFixed64Array(tag, field_name, result.repeatedFixed64_); + break; + } + case 16378: + case 16376: { + input.ReadInt64Array(tag, field_name, result.repeatedInt64_); + break; + } + case 2097138: + case 2097141: { + input.ReadFloatArray(tag, field_name, result.repeatedFloat_); + break; + } + case 2097146: + case 2097144: { + input.ReadUInt64Array(tag, field_name, result.repeatedUint64_); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed32List { + get { return PrepareBuilder().repeatedFixed32_; } + } + public int RepeatedFixed32Count { + get { return result.RepeatedFixed32Count; } + } + [global::System.CLSCompliant(false)] + public uint GetRepeatedFixed32(int index) { + return result.GetRepeatedFixed32(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed32(int index, uint value) { + PrepareBuilder(); + result.repeatedFixed32_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed32(uint value) { + PrepareBuilder(); + result.repeatedFixed32_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed32_.Add(values); + return this; + } + public Builder ClearRepeatedFixed32() { + PrepareBuilder(); + result.repeatedFixed32_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt32List { + get { return PrepareBuilder().repeatedInt32_; } + } + public int RepeatedInt32Count { + get { return result.RepeatedInt32Count; } + } + public int GetRepeatedInt32(int index) { + return result.GetRepeatedInt32(index); + } + public Builder SetRepeatedInt32(int index, int value) { + PrepareBuilder(); + result.repeatedInt32_[index] = value; + return this; + } + public Builder AddRepeatedInt32(int value) { + PrepareBuilder(); + result.repeatedInt32_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt32(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt32_.Add(values); + return this; + } + public Builder ClearRepeatedInt32() { + PrepareBuilder(); + result.repeatedInt32_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedFixed64List { + get { return PrepareBuilder().repeatedFixed64_; } + } + public int RepeatedFixed64Count { + get { return result.RepeatedFixed64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedFixed64(int index) { + return result.GetRepeatedFixed64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedFixed64(int index, ulong value) { + PrepareBuilder(); + result.repeatedFixed64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedFixed64(ulong value) { + PrepareBuilder(); + result.repeatedFixed64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedFixed64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFixed64_.Add(values); + return this; + } + public Builder ClearRepeatedFixed64() { + PrepareBuilder(); + result.repeatedFixed64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedInt64List { + get { return PrepareBuilder().repeatedInt64_; } + } + public int RepeatedInt64Count { + get { return result.RepeatedInt64Count; } + } + public long GetRepeatedInt64(int index) { + return result.GetRepeatedInt64(index); + } + public Builder SetRepeatedInt64(int index, long value) { + PrepareBuilder(); + result.repeatedInt64_[index] = value; + return this; + } + public Builder AddRepeatedInt64(long value) { + PrepareBuilder(); + result.repeatedInt64_.Add(value); + return this; + } + public Builder AddRangeRepeatedInt64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedInt64_.Add(values); + return this; + } + public Builder ClearRepeatedInt64() { + PrepareBuilder(); + result.repeatedInt64_.Clear(); + return this; + } + + public pbc::IPopsicleList RepeatedFloatList { + get { return PrepareBuilder().repeatedFloat_; } + } + public int RepeatedFloatCount { + get { return result.RepeatedFloatCount; } + } + public float GetRepeatedFloat(int index) { + return result.GetRepeatedFloat(index); + } + public Builder SetRepeatedFloat(int index, float value) { + PrepareBuilder(); + result.repeatedFloat_[index] = value; + return this; + } + public Builder AddRepeatedFloat(float value) { + PrepareBuilder(); + result.repeatedFloat_.Add(value); + return this; + } + public Builder AddRangeRepeatedFloat(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedFloat_.Add(values); + return this; + } + public Builder ClearRepeatedFloat() { + PrepareBuilder(); + result.repeatedFloat_.Clear(); + return this; + } + + [global::System.CLSCompliant(false)] + public pbc::IPopsicleList RepeatedUint64List { + get { return PrepareBuilder().repeatedUint64_; } + } + public int RepeatedUint64Count { + get { return result.RepeatedUint64Count; } + } + [global::System.CLSCompliant(false)] + public ulong GetRepeatedUint64(int index) { + return result.GetRepeatedUint64(index); + } + [global::System.CLSCompliant(false)] + public Builder SetRepeatedUint64(int index, ulong value) { + PrepareBuilder(); + result.repeatedUint64_[index] = value; + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRepeatedUint64(ulong value) { + PrepareBuilder(); + result.repeatedUint64_.Add(value); + return this; + } + [global::System.CLSCompliant(false)] + public Builder AddRangeRepeatedUint64(scg::IEnumerable values) { + PrepareBuilder(); + result.repeatedUint64_.Add(values); + return this; + } + public Builder ClearRepeatedUint64() { + PrepareBuilder(); + result.repeatedUint64_.Clear(); + return this; + } + } + static TestRepeatedScalarDifferentTagSizes() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FooRequest : pb::GeneratedMessage { + private FooRequest() { } + private static readonly FooRequest defaultInstance = new FooRequest().MakeReadOnly(); + private static readonly string[] _fooRequestFieldNames = new string[] { }; + private static readonly uint[] _fooRequestFieldTags = new uint[] { }; + public static FooRequest DefaultInstance { + get { return defaultInstance; } + } + + public override FooRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FooRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooRequest__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fooRequestFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FooRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FooRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FooRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FooRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FooRequest MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FooRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FooRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FooRequest result; + + private FooRequest PrepareBuilder() { + if (resultIsReadOnly) { + FooRequest original = result; + result = new FooRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FooRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooRequest.Descriptor; } + } + + public override FooRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance; } + } + + public override FooRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FooRequest) { + return MergeFrom((FooRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FooRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.FooRequest.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fooRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fooRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static FooRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class FooResponse : pb::GeneratedMessage { + private FooResponse() { } + private static readonly FooResponse defaultInstance = new FooResponse().MakeReadOnly(); + private static readonly string[] _fooResponseFieldNames = new string[] { }; + private static readonly uint[] _fooResponseFieldTags = new uint[] { }; + public static FooResponse DefaultInstance { + get { return defaultInstance; } + } + + public override FooResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override FooResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_FooResponse__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _fooResponseFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static FooResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static FooResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static FooResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static FooResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static FooResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static FooResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static FooResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private FooResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(FooResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(FooResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private FooResponse result; + + private FooResponse PrepareBuilder() { + if (resultIsReadOnly) { + FooResponse original = result; + result = new FooResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override FooResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooResponse.Descriptor; } + } + + public override FooResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance; } + } + + public override FooResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is FooResponse) { + return MergeFrom((FooResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(FooResponse other) { + if (other == global::Google.ProtocolBuffers.TestProtos.FooResponse.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_fooResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _fooResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static FooResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class BarRequest : pb::GeneratedMessage { + private BarRequest() { } + private static readonly BarRequest defaultInstance = new BarRequest().MakeReadOnly(); + private static readonly string[] _barRequestFieldNames = new string[] { }; + private static readonly uint[] _barRequestFieldTags = new uint[] { }; + public static BarRequest DefaultInstance { + get { return defaultInstance; } + } + + public override BarRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override BarRequest ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarRequest__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarRequest__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _barRequestFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static BarRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static BarRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static BarRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static BarRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private BarRequest MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(BarRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(BarRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private BarRequest result; + + private BarRequest PrepareBuilder() { + if (resultIsReadOnly) { + BarRequest original = result; + result = new BarRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override BarRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarRequest.Descriptor; } + } + + public override BarRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance; } + } + + public override BarRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is BarRequest) { + return MergeFrom((BarRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(BarRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.BarRequest.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_barRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _barRequestFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static BarRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class BarResponse : pb::GeneratedMessage { + private BarResponse() { } + private static readonly BarResponse defaultInstance = new BarResponse().MakeReadOnly(); + private static readonly string[] _barResponseFieldNames = new string[] { }; + private static readonly uint[] _barResponseFieldTags = new uint[] { }; + public static BarResponse DefaultInstance { + get { return defaultInstance; } + } + + public override BarResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override BarResponse ThisMessage { + get { return this; } + } + + public static pbd::MessageDescriptor Descriptor { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarResponse__Descriptor; } + } + + protected override pb::FieldAccess.FieldAccessorTable InternalFieldAccessors { + get { return global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.internal__static_protobuf_unittest_BarResponse__FieldAccessorTable; } + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _barResponseFieldNames; + UnknownFields.WriteTo(output); + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + size += UnknownFields.SerializedSize; + memoizedSerializedSize = size; + return size; + } + public static BarResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static BarResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static BarResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static BarResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static BarResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static BarResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static BarResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private BarResponse MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(BarResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilder { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(BarResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private BarResponse result; + + private BarResponse PrepareBuilder() { + if (resultIsReadOnly) { + BarResponse original = result; + result = new BarResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override BarResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override pbd::MessageDescriptor DescriptorForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarResponse.Descriptor; } + } + + public override BarResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance; } + } + + public override BarResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessage other) { + if (other is BarResponse) { + return MergeFrom((BarResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(BarResponse other) { + if (other == global::Google.ProtocolBuffers.TestProtos.BarResponse.DefaultInstance) return this; + PrepareBuilder(); + this.MergeUnknownFields(other.UnknownFields); + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + pb::UnknownFieldSet.Builder unknownFields = null; + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_barResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _barResponseFieldTags[field_ordinal]; + else { + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + if (unknownFields == null) { + unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); + } + ParseUnknownField(input, unknownFields, extensionRegistry, tag, field_name); + break; + } + } + } + + if (unknownFields != null) { + this.UnknownFields = unknownFields.Build(); + } + return this; + } + + } + static BarResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestProtoFile.Descriptor, null); + } + } + + #endregion + + #region Services + /* + * Service generation is now disabled by default, use the following option to enable: + * option (google.protobuf.csharp_file_options).service_generator_type = GENERIC; + */ + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestRpcInteropLite.cs b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestRpcInteropLite.cs new file mode 100644 index 00000000..189ff0db --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestProtos/UnitTestRpcInteropLite.cs @@ -0,0 +1,1395 @@ +// Generated by ProtoGen, Version=2.4.1.555, Culture=neutral, PublicKeyToken=55f7125234beb589. DO NOT EDIT! +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.ProtocolBuffers; +using pbc = global::Google.ProtocolBuffers.Collections; +using pbd = global::Google.ProtocolBuffers.Descriptors; +using scg = global::System.Collections.Generic; +namespace Google.ProtocolBuffers.TestProtos { + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class UnitTestRpcInteropLite { + + #region Extension registration + public static void RegisterAllExtensions(pb::ExtensionRegistry registry) { + } + #endregion + #region Static variables + #endregion + #region Extensions + internal static readonly object Descriptor; + static UnitTestRpcInteropLite() { + Descriptor = null; + } + #endregion + + } + #region Messages + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SearchRequest : pb::GeneratedMessageLite { + private SearchRequest() { } + private static readonly SearchRequest defaultInstance = new SearchRequest().MakeReadOnly(); + private static readonly string[] _searchRequestFieldNames = new string[] { "Criteria" }; + private static readonly uint[] _searchRequestFieldTags = new uint[] { 10 }; + public static SearchRequest DefaultInstance { + get { return defaultInstance; } + } + + public override SearchRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SearchRequest ThisMessage { + get { return this; } + } + + public const int CriteriaFieldNumber = 1; + private pbc::PopsicleList criteria_ = new pbc::PopsicleList(); + public scg::IList CriteriaList { + get { return pbc::Lists.AsReadOnly(criteria_); } + } + public int CriteriaCount { + get { return criteria_.Count; } + } + public string GetCriteria(int index) { + return criteria_[index]; + } + + public override bool IsInitialized { + get { + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _searchRequestFieldNames; + if (criteria_.Count > 0) { + output.WriteStringArray(1, field_names[0], criteria_); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (string element in CriteriaList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * criteria_.Count; + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + foreach(string i in criteria_) + hash ^= i.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + SearchRequest other = obj as SearchRequest; + if (other == null) return false; + if(criteria_.Count != other.criteria_.Count) return false; + for(int ix=0; ix < criteria_.Count; ix++) + if(!criteria_[ix].Equals(other.criteria_[ix])) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("Criteria", criteria_, writer); + } + #endregion + + public static SearchRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SearchRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SearchRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SearchRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SearchRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SearchRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SearchRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SearchRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SearchRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SearchRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SearchRequest MakeReadOnly() { + criteria_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SearchRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SearchRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SearchRequest result; + + private SearchRequest PrepareBuilder() { + if (resultIsReadOnly) { + SearchRequest original = result; + result = new SearchRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SearchRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override SearchRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SearchRequest.DefaultInstance; } + } + + public override SearchRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is SearchRequest) { + return MergeFrom((SearchRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SearchRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SearchRequest.DefaultInstance) return this; + PrepareBuilder(); + if (other.criteria_.Count != 0) { + result.criteria_.Add(other.criteria_); + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_searchRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _searchRequestFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadStringArray(tag, field_name, result.criteria_); + break; + } + } + } + + return this; + } + + + public pbc::IPopsicleList CriteriaList { + get { return PrepareBuilder().criteria_; } + } + public int CriteriaCount { + get { return result.CriteriaCount; } + } + public string GetCriteria(int index) { + return result.GetCriteria(index); + } + public Builder SetCriteria(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.criteria_[index] = value; + return this; + } + public Builder AddCriteria(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.criteria_.Add(value); + return this; + } + public Builder AddRangeCriteria(scg::IEnumerable values) { + PrepareBuilder(); + result.criteria_.Add(values); + return this; + } + public Builder ClearCriteria() { + PrepareBuilder(); + result.criteria_.Clear(); + return this; + } + } + static SearchRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInteropLite.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class SearchResponse : pb::GeneratedMessageLite { + private SearchResponse() { } + private static readonly SearchResponse defaultInstance = new SearchResponse().MakeReadOnly(); + private static readonly string[] _searchResponseFieldNames = new string[] { "results" }; + private static readonly uint[] _searchResponseFieldTags = new uint[] { 10 }; + public static SearchResponse DefaultInstance { + get { return defaultInstance; } + } + + public override SearchResponse DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override SearchResponse ThisMessage { + get { return this; } + } + + #region Nested types + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public static partial class Types { + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class ResultItem : pb::GeneratedMessageLite { + private ResultItem() { } + private static readonly ResultItem defaultInstance = new ResultItem().MakeReadOnly(); + private static readonly string[] _resultItemFieldNames = new string[] { "name", "url" }; + private static readonly uint[] _resultItemFieldTags = new uint[] { 18, 10 }; + public static ResultItem DefaultInstance { + get { return defaultInstance; } + } + + public override ResultItem DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override ResultItem ThisMessage { + get { return this; } + } + + public const int UrlFieldNumber = 1; + private bool hasUrl; + private string url_ = ""; + public bool HasUrl { + get { return hasUrl; } + } + public string Url { + get { return url_; } + } + + public const int NameFieldNumber = 2; + private bool hasName; + private string name_ = ""; + public bool HasName { + get { return hasName; } + } + public string Name { + get { return name_; } + } + + public override bool IsInitialized { + get { + if (!hasUrl) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _resultItemFieldNames; + if (hasUrl) { + output.WriteString(1, field_names[1], Url); + } + if (hasName) { + output.WriteString(2, field_names[0], Name); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasUrl) { + size += pb::CodedOutputStream.ComputeStringSize(1, Url); + } + if (hasName) { + size += pb::CodedOutputStream.ComputeStringSize(2, Name); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + if (hasUrl) hash ^= url_.GetHashCode(); + if (hasName) hash ^= name_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + ResultItem other = obj as ResultItem; + if (other == null) return false; + if (hasUrl != other.hasUrl || (hasUrl && !url_.Equals(other.url_))) return false; + if (hasName != other.hasName || (hasName && !name_.Equals(other.name_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("url", hasUrl, url_, writer); + PrintField("name", hasName, name_, writer); + } + #endregion + + public static ResultItem ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ResultItem ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ResultItem ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static ResultItem ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static ResultItem ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ResultItem ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static ResultItem ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static ResultItem ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static ResultItem ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static ResultItem ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private ResultItem MakeReadOnly() { + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(ResultItem prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(ResultItem cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private ResultItem result; + + private ResultItem PrepareBuilder() { + if (resultIsReadOnly) { + ResultItem original = result; + result = new ResultItem(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override ResultItem MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override ResultItem DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.DefaultInstance; } + } + + public override ResultItem BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is ResultItem) { + return MergeFrom((ResultItem) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(ResultItem other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.DefaultInstance) return this; + PrepareBuilder(); + if (other.HasUrl) { + Url = other.Url; + } + if (other.HasName) { + Name = other.Name; + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_resultItemFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _resultItemFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + result.hasUrl = input.ReadString(ref result.url_); + break; + } + case 18: { + result.hasName = input.ReadString(ref result.name_); + break; + } + } + } + + return this; + } + + + public bool HasUrl { + get { return result.hasUrl; } + } + public string Url { + get { return result.Url; } + set { SetUrl(value); } + } + public Builder SetUrl(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasUrl = true; + result.url_ = value; + return this; + } + public Builder ClearUrl() { + PrepareBuilder(); + result.hasUrl = false; + result.url_ = ""; + return this; + } + + public bool HasName { + get { return result.hasName; } + } + public string Name { + get { return result.Name; } + set { SetName(value); } + } + public Builder SetName(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasName = true; + result.name_ = value; + return this; + } + public Builder ClearName() { + PrepareBuilder(); + result.hasName = false; + result.name_ = ""; + return this; + } + } + static ResultItem() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInteropLite.Descriptor, null); + } + } + + } + #endregion + + public const int ResultsFieldNumber = 1; + private pbc::PopsicleList results_ = new pbc::PopsicleList(); + public scg::IList ResultsList { + get { return results_; } + } + public int ResultsCount { + get { return results_.Count; } + } + public global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem GetResults(int index) { + return results_[index]; + } + + public override bool IsInitialized { + get { + foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) { + if (!element.IsInitialized) return false; + } + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _searchResponseFieldNames; + if (results_.Count > 0) { + output.WriteMessageArray(1, field_names[0], results_); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + foreach (global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem element in ResultsList) { + size += pb::CodedOutputStream.ComputeMessageSize(1, element); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + foreach(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem i in results_) + hash ^= i.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + SearchResponse other = obj as SearchResponse; + if (other == null) return false; + if(results_.Count != other.results_.Count) return false; + for(int ix=0; ix < results_.Count; ix++) + if(!results_[ix].Equals(other.results_[ix])) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("results", results_, writer); + } + #endregion + + public static SearchResponse ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SearchResponse ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SearchResponse ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static SearchResponse ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static SearchResponse ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SearchResponse ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static SearchResponse ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static SearchResponse ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static SearchResponse ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static SearchResponse ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private SearchResponse MakeReadOnly() { + results_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(SearchResponse prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(SearchResponse cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private SearchResponse result; + + private SearchResponse PrepareBuilder() { + if (resultIsReadOnly) { + SearchResponse original = result; + result = new SearchResponse(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override SearchResponse MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override SearchResponse DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance; } + } + + public override SearchResponse BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is SearchResponse) { + return MergeFrom((SearchResponse) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(SearchResponse other) { + if (other == global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance) return this; + PrepareBuilder(); + if (other.results_.Count != 0) { + result.results_.Add(other.results_); + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_searchResponseFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _searchResponseFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadMessageArray(tag, field_name, result.results_, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.DefaultInstance, extensionRegistry); + break; + } + } + } + + return this; + } + + + public pbc::IPopsicleList ResultsList { + get { return PrepareBuilder().results_; } + } + public int ResultsCount { + get { return result.ResultsCount; } + } + public global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem GetResults(int index) { + return result.GetResults(index); + } + public Builder SetResults(int index, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.results_[index] = value; + return this; + } + public Builder SetResults(int index, global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.results_[index] = builderForValue.Build(); + return this; + } + public Builder AddResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.results_.Add(value); + return this; + } + public Builder AddResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Types.ResultItem.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.results_.Add(builderForValue.Build()); + return this; + } + public Builder AddRangeResults(scg::IEnumerable values) { + PrepareBuilder(); + result.results_.Add(values); + return this; + } + public Builder ClearResults() { + PrepareBuilder(); + result.results_.Clear(); + return this; + } + } + static SearchResponse() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInteropLite.Descriptor, null); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class RefineSearchRequest : pb::GeneratedMessageLite { + private RefineSearchRequest() { } + private static readonly RefineSearchRequest defaultInstance = new RefineSearchRequest().MakeReadOnly(); + private static readonly string[] _refineSearchRequestFieldNames = new string[] { "Criteria", "previous_results" }; + private static readonly uint[] _refineSearchRequestFieldTags = new uint[] { 10, 18 }; + public static RefineSearchRequest DefaultInstance { + get { return defaultInstance; } + } + + public override RefineSearchRequest DefaultInstanceForType { + get { return DefaultInstance; } + } + + protected override RefineSearchRequest ThisMessage { + get { return this; } + } + + public const int CriteriaFieldNumber = 1; + private pbc::PopsicleList criteria_ = new pbc::PopsicleList(); + public scg::IList CriteriaList { + get { return pbc::Lists.AsReadOnly(criteria_); } + } + public int CriteriaCount { + get { return criteria_.Count; } + } + public string GetCriteria(int index) { + return criteria_[index]; + } + + public const int PreviousResultsFieldNumber = 2; + private bool hasPreviousResults; + private global::Google.ProtocolBuffers.TestProtos.SearchResponse previousResults_; + public bool HasPreviousResults { + get { return hasPreviousResults; } + } + public global::Google.ProtocolBuffers.TestProtos.SearchResponse PreviousResults { + get { return previousResults_ ?? global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance; } + } + + public override bool IsInitialized { + get { + if (!hasPreviousResults) return false; + if (!PreviousResults.IsInitialized) return false; + return true; + } + } + + public override void WriteTo(pb::ICodedOutputStream output) { + CalcSerializedSize(); + string[] field_names = _refineSearchRequestFieldNames; + if (criteria_.Count > 0) { + output.WriteStringArray(1, field_names[0], criteria_); + } + if (hasPreviousResults) { + output.WriteMessage(2, field_names[1], PreviousResults); + } + } + + private int memoizedSerializedSize = -1; + public override int SerializedSize { + get { + int size = memoizedSerializedSize; + if (size != -1) return size; + return CalcSerializedSize(); + } + } + + private int CalcSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + foreach (string element in CriteriaList) { + dataSize += pb::CodedOutputStream.ComputeStringSizeNoTag(element); + } + size += dataSize; + size += 1 * criteria_.Count; + } + if (hasPreviousResults) { + size += pb::CodedOutputStream.ComputeMessageSize(2, PreviousResults); + } + memoizedSerializedSize = size; + return size; + } + #region Lite runtime methods + public override int GetHashCode() { + int hash = GetType().GetHashCode(); + foreach(string i in criteria_) + hash ^= i.GetHashCode(); + if (hasPreviousResults) hash ^= previousResults_.GetHashCode(); + return hash; + } + + public override bool Equals(object obj) { + RefineSearchRequest other = obj as RefineSearchRequest; + if (other == null) return false; + if(criteria_.Count != other.criteria_.Count) return false; + for(int ix=0; ix < criteria_.Count; ix++) + if(!criteria_[ix].Equals(other.criteria_[ix])) return false; + if (hasPreviousResults != other.hasPreviousResults || (hasPreviousResults && !previousResults_.Equals(other.previousResults_))) return false; + return true; + } + + public override void PrintTo(global::System.IO.TextWriter writer) { + PrintField("Criteria", criteria_, writer); + PrintField("previous_results", hasPreviousResults, previousResults_, writer); + } + #endregion + + public static RefineSearchRequest ParseFrom(pb::ByteString data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(byte[] data) { + return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(global::System.IO.Stream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + public static RefineSearchRequest ParseDelimitedFrom(global::System.IO.Stream input) { + return CreateBuilder().MergeDelimitedFrom(input).BuildParsed(); + } + public static RefineSearchRequest ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) { + return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(pb::ICodedInputStream input) { + return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed(); + } + public static RefineSearchRequest ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed(); + } + private RefineSearchRequest MakeReadOnly() { + criteria_.MakeReadOnly(); + return this; + } + + public static Builder CreateBuilder() { return new Builder(); } + public override Builder ToBuilder() { return CreateBuilder(this); } + public override Builder CreateBuilderForType() { return new Builder(); } + public static Builder CreateBuilder(RefineSearchRequest prototype) { + return new Builder(prototype); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public sealed partial class Builder : pb::GeneratedBuilderLite { + protected override Builder ThisBuilder { + get { return this; } + } + public Builder() { + result = DefaultInstance; + resultIsReadOnly = true; + } + internal Builder(RefineSearchRequest cloneFrom) { + result = cloneFrom; + resultIsReadOnly = true; + } + + private bool resultIsReadOnly; + private RefineSearchRequest result; + + private RefineSearchRequest PrepareBuilder() { + if (resultIsReadOnly) { + RefineSearchRequest original = result; + result = new RefineSearchRequest(); + resultIsReadOnly = false; + MergeFrom(original); + } + return result; + } + + public override bool IsInitialized { + get { return result.IsInitialized; } + } + + protected override RefineSearchRequest MessageBeingBuilt { + get { return PrepareBuilder(); } + } + + public override Builder Clear() { + result = DefaultInstance; + resultIsReadOnly = true; + return this; + } + + public override Builder Clone() { + if (resultIsReadOnly) { + return new Builder(result); + } else { + return new Builder().MergeFrom(result); + } + } + + public override RefineSearchRequest DefaultInstanceForType { + get { return global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.DefaultInstance; } + } + + public override RefineSearchRequest BuildPartial() { + if (resultIsReadOnly) { + return result; + } + resultIsReadOnly = true; + return result.MakeReadOnly(); + } + + public override Builder MergeFrom(pb::IMessageLite other) { + if (other is RefineSearchRequest) { + return MergeFrom((RefineSearchRequest) other); + } else { + base.MergeFrom(other); + return this; + } + } + + public override Builder MergeFrom(RefineSearchRequest other) { + if (other == global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.DefaultInstance) return this; + PrepareBuilder(); + if (other.criteria_.Count != 0) { + result.criteria_.Add(other.criteria_); + } + if (other.HasPreviousResults) { + MergePreviousResults(other.PreviousResults); + } + return this; + } + + public override Builder MergeFrom(pb::ICodedInputStream input) { + return MergeFrom(input, pb::ExtensionRegistry.Empty); + } + + public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) { + PrepareBuilder(); + uint tag; + string field_name; + while (input.ReadTag(out tag, out field_name)) { + if(tag == 0 && field_name != null) { + int field_ordinal = global::System.Array.BinarySearch(_refineSearchRequestFieldNames, field_name, global::System.StringComparer.Ordinal); + if(field_ordinal >= 0) + tag = _refineSearchRequestFieldTags[field_ordinal]; + else { + ParseUnknownField(input, extensionRegistry, tag, field_name); + continue; + } + } + switch (tag) { + case 0: { + throw pb::InvalidProtocolBufferException.InvalidTag(); + } + default: { + if (pb::WireFormat.IsEndGroupTag(tag)) { + return this; + } + ParseUnknownField(input, extensionRegistry, tag, field_name); + break; + } + case 10: { + input.ReadStringArray(tag, field_name, result.criteria_); + break; + } + case 18: { + global::Google.ProtocolBuffers.TestProtos.SearchResponse.Builder subBuilder = global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder(); + if (result.hasPreviousResults) { + subBuilder.MergeFrom(PreviousResults); + } + input.ReadMessage(subBuilder, extensionRegistry); + PreviousResults = subBuilder.BuildPartial(); + break; + } + } + } + + return this; + } + + + public pbc::IPopsicleList CriteriaList { + get { return PrepareBuilder().criteria_; } + } + public int CriteriaCount { + get { return result.CriteriaCount; } + } + public string GetCriteria(int index) { + return result.GetCriteria(index); + } + public Builder SetCriteria(int index, string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.criteria_[index] = value; + return this; + } + public Builder AddCriteria(string value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.criteria_.Add(value); + return this; + } + public Builder AddRangeCriteria(scg::IEnumerable values) { + PrepareBuilder(); + result.criteria_.Add(values); + return this; + } + public Builder ClearCriteria() { + PrepareBuilder(); + result.criteria_.Clear(); + return this; + } + + public bool HasPreviousResults { + get { return result.hasPreviousResults; } + } + public global::Google.ProtocolBuffers.TestProtos.SearchResponse PreviousResults { + get { return result.PreviousResults; } + set { SetPreviousResults(value); } + } + public Builder SetPreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + result.hasPreviousResults = true; + result.previousResults_ = value; + return this; + } + public Builder SetPreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse.Builder builderForValue) { + pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); + PrepareBuilder(); + result.hasPreviousResults = true; + result.previousResults_ = builderForValue.Build(); + return this; + } + public Builder MergePreviousResults(global::Google.ProtocolBuffers.TestProtos.SearchResponse value) { + pb::ThrowHelper.ThrowIfNull(value, "value"); + PrepareBuilder(); + if (result.hasPreviousResults && + result.previousResults_ != global::Google.ProtocolBuffers.TestProtos.SearchResponse.DefaultInstance) { + result.previousResults_ = global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder(result.previousResults_).MergeFrom(value).BuildPartial(); + } else { + result.previousResults_ = value; + } + result.hasPreviousResults = true; + return this; + } + public Builder ClearPreviousResults() { + PrepareBuilder(); + result.hasPreviousResults = false; + result.previousResults_ = null; + return this; + } + } + static RefineSearchRequest() { + object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnitTestRpcInteropLite.Descriptor, null); + } + } + + #endregion + + #region Services + public partial interface ISearchService { + global::Google.ProtocolBuffers.TestProtos.SearchResponse Search(global::Google.ProtocolBuffers.TestProtos.SearchRequest searchRequest); + global::Google.ProtocolBuffers.TestProtos.SearchResponse RefineSearch(global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest refineSearchRequest); + } + + [global::System.CLSCompliant(false)] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public partial class SearchService : ISearchService, pb::IRpcDispatch, global::System.IDisposable { + private readonly bool dispose; + private readonly pb::IRpcDispatch dispatch; + public SearchService(pb::IRpcDispatch dispatch) : this(dispatch, true) { + } + public SearchService(pb::IRpcDispatch dispatch, bool dispose) { + pb::ThrowHelper.ThrowIfNull(this.dispatch = dispatch, "dispatch"); + this.dispose = dispose && dispatch is global::System.IDisposable; + } + + public void Dispose() { + if (dispose) ((global::System.IDisposable)dispatch).Dispose(); + } + + TMessage pb::IRpcDispatch.CallMethod(string method, pb::IMessageLite request, pb::IBuilderLite response) { + return dispatch.CallMethod(method, request, response); + } + + public global::Google.ProtocolBuffers.TestProtos.SearchResponse Search(global::Google.ProtocolBuffers.TestProtos.SearchRequest searchRequest) { + return dispatch.CallMethod("Search", searchRequest, global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder()); + } + + public global::Google.ProtocolBuffers.TestProtos.SearchResponse RefineSearch(global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest refineSearchRequest) { + return dispatch.CallMethod("RefineSearch", refineSearchRequest, global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder()); + } + + [global::System.CLSCompliant(false)] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public partial class Dispatch : pb::IRpcDispatch, global::System.IDisposable { + private readonly bool dispose; + private readonly ISearchService implementation; + public Dispatch(ISearchService implementation) : this(implementation, true) { + } + public Dispatch(ISearchService implementation, bool dispose) { + pb::ThrowHelper.ThrowIfNull(this.implementation = implementation, "implementation"); + this.dispose = dispose && implementation is global::System.IDisposable; + } + + public void Dispose() { + if (dispose) ((global::System.IDisposable)implementation).Dispose(); + } + + public TMessage CallMethod(string methodName, pb::IMessageLite request, pb::IBuilderLite response) + where TMessage : pb::IMessageLite + where TBuilder : pb::IBuilderLite { + switch(methodName) { + case "Search": return response.MergeFrom(implementation.Search((global::Google.ProtocolBuffers.TestProtos.SearchRequest)request)).Build(); + case "RefineSearch": return response.MergeFrom(implementation.RefineSearch((global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest)request)).Build(); + default: throw pb::ThrowHelper.CreateMissingMethod(typeof(ISearchService), methodName); + } + } + } + [global::System.CLSCompliant(false)] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public partial class ServerStub : pb::IRpcServerStub, global::System.IDisposable { + private readonly bool dispose; + private readonly pb::IRpcDispatch implementation; + public ServerStub(ISearchService implementation) : this(implementation, true) { + } + public ServerStub(ISearchService implementation, bool dispose) : this(new Dispatch(implementation, dispose), dispose) { + } + public ServerStub(pb::IRpcDispatch implementation) : this(implementation, true) { + } + public ServerStub(pb::IRpcDispatch implementation, bool dispose) { + pb::ThrowHelper.ThrowIfNull(this.implementation = implementation, "implementation"); + this.dispose = dispose && implementation is global::System.IDisposable; + } + + public void Dispose() { + if (dispose) ((global::System.IDisposable)implementation).Dispose(); + } + + public pb::IMessageLite CallMethod(string methodName, pb::ICodedInputStream input, pb::ExtensionRegistry registry) { + switch(methodName) { + case "Search": return implementation.CallMethod(methodName, global::Google.ProtocolBuffers.TestProtos.SearchRequest.ParseFrom(input, registry), global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder()); + case "RefineSearch": return implementation.CallMethod(methodName, global::Google.ProtocolBuffers.TestProtos.RefineSearchRequest.ParseFrom(input, registry), global::Google.ProtocolBuffers.TestProtos.SearchResponse.CreateBuilder()); + default: throw pb::ThrowHelper.CreateMissingMethod(typeof(ISearchService), methodName); + } + } + } + } + #endregion + +} + +#endregion Designer generated code diff --git a/csharp/src/ProtocolBuffersLite.Test/TestUtil.cs b/csharp/src/ProtocolBuffersLite.Test/TestUtil.cs new file mode 100644 index 00000000..44c09b9c --- /dev/null +++ b/csharp/src/ProtocolBuffersLite.Test/TestUtil.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Google.ProtocolBuffers +{ + class TestUtil + { + internal static void AssertBytesEqual(byte[] a, byte[] b) + { + if (a == null || b == null) + { + Assert.AreEqual(a, b); + } + else + { + Assert.AreEqual(a.Length, b.Length, "The byte[] is not of the expected length."); + + for (int i = 0; i < a.Length; i++) + { + if (a[i] != b[i]) + { + Assert.AreEqual(a[i], b[i], "Byte[] differs at index " + i); + } + } + } + } + + } +} diff --git a/csharp/src/UseVS2008.bat b/csharp/src/UseVS2008.bat new file mode 100644 index 00000000..4cf97381 --- /dev/null +++ b/csharp/src/UseVS2008.bat @@ -0,0 +1,8 @@ +@ECHO OFF +REM ---- Converts the solution to Visual Studio 2008 ---- +PUSHD %~dp0 +ECHO Microsoft Visual Studio Solution File, Format Version 10.00> Temp.sln +ECHO # Visual Studio 2008>> Temp.sln +type ProtocolBuffers.sln | FIND /V " Visual Studio " >> Temp.sln +move /Y Temp.sln ProtocolBuffers.sln +POPD diff --git a/csharp/src/UseVS2010.bat b/csharp/src/UseVS2010.bat new file mode 100644 index 00000000..376a08f7 --- /dev/null +++ b/csharp/src/UseVS2010.bat @@ -0,0 +1,8 @@ +@ECHO OFF +REM ---- Converts the solution to Visual Studio 2010 ---- +PUSHD %~dp0 +ECHO Microsoft Visual Studio Solution File, Format Version 11.00> Temp.sln +ECHO # Visual Studio 2010>> Temp.sln +type ProtocolBuffers.sln | FIND /V " Visual Studio " >> Temp.sln +move /Y Temp.sln ProtocolBuffers.sln +POPD diff --git a/csharp/testdata/golden_message b/csharp/testdata/golden_message new file mode 100644 index 00000000..94898e49 Binary files /dev/null and b/csharp/testdata/golden_message differ diff --git a/csharp/testdata/golden_packed_fields_message b/csharp/testdata/golden_packed_fields_message new file mode 100644 index 00000000..ee28d388 Binary files /dev/null and b/csharp/testdata/golden_packed_fields_message differ diff --git a/csharp/testdata/text_format_unittest_data.txt b/csharp/testdata/text_format_unittest_data.txt new file mode 100644 index 00000000..d3e27b71 --- /dev/null +++ b/csharp/testdata/text_format_unittest_data.txt @@ -0,0 +1,116 @@ +optional_int32: 101 +optional_int64: 102 +optional_uint32: 103 +optional_uint64: 104 +optional_sint32: 105 +optional_sint64: 106 +optional_fixed32: 107 +optional_fixed64: 108 +optional_sfixed32: 109 +optional_sfixed64: 110 +optional_float: 111 +optional_double: 112 +optional_bool: true +optional_string: "115" +optional_bytes: "116" +OptionalGroup { + a: 117 +} +optional_nested_message { + bb: 118 +} +optional_foreign_message { + c: 119 +} +optional_import_message { + d: 120 +} +optional_nested_enum: BAZ +optional_foreign_enum: FOREIGN_BAZ +optional_import_enum: IMPORT_BAZ +optional_string_piece: "124" +optional_cord: "125" +repeated_int32: 201 +repeated_int32: 301 +repeated_int64: 202 +repeated_int64: 302 +repeated_uint32: 203 +repeated_uint32: 303 +repeated_uint64: 204 +repeated_uint64: 304 +repeated_sint32: 205 +repeated_sint32: 305 +repeated_sint64: 206 +repeated_sint64: 306 +repeated_fixed32: 207 +repeated_fixed32: 307 +repeated_fixed64: 208 +repeated_fixed64: 308 +repeated_sfixed32: 209 +repeated_sfixed32: 309 +repeated_sfixed64: 210 +repeated_sfixed64: 310 +repeated_float: 211 +repeated_float: 311 +repeated_double: 212 +repeated_double: 312 +repeated_bool: true +repeated_bool: false +repeated_string: "215" +repeated_string: "315" +repeated_bytes: "216" +repeated_bytes: "316" +RepeatedGroup { + a: 217 +} +RepeatedGroup { + a: 317 +} +repeated_nested_message { + bb: 218 +} +repeated_nested_message { + bb: 318 +} +repeated_foreign_message { + c: 219 +} +repeated_foreign_message { + c: 319 +} +repeated_import_message { + d: 220 +} +repeated_import_message { + d: 320 +} +repeated_nested_enum: BAR +repeated_nested_enum: BAZ +repeated_foreign_enum: FOREIGN_BAR +repeated_foreign_enum: FOREIGN_BAZ +repeated_import_enum: IMPORT_BAR +repeated_import_enum: IMPORT_BAZ +repeated_string_piece: "224" +repeated_string_piece: "324" +repeated_cord: "225" +repeated_cord: "325" +default_int32: 401 +default_int64: 402 +default_uint32: 403 +default_uint64: 404 +default_sint32: 405 +default_sint64: 406 +default_fixed32: 407 +default_fixed64: 408 +default_sfixed32: 409 +default_sfixed64: 410 +default_float: 411 +default_double: 412 +default_bool: false +default_string: "415" +default_bytes: "416" +default_nested_enum: FOO +default_foreign_enum: FOREIGN_FOO +default_import_enum: IMPORT_FOO +default_string_piece: "424" +default_cord: "425" diff --git a/csharp/testdata/text_format_unittest_extensions_data.txt b/csharp/testdata/text_format_unittest_extensions_data.txt new file mode 100644 index 00000000..4fc282c1 --- /dev/null +++ b/csharp/testdata/text_format_unittest_extensions_data.txt @@ -0,0 +1,116 @@ +[protobuf_unittest.optional_int32_extension]: 101 +[protobuf_unittest.optional_int64_extension]: 102 +[protobuf_unittest.optional_uint32_extension]: 103 +[protobuf_unittest.optional_uint64_extension]: 104 +[protobuf_unittest.optional_sint32_extension]: 105 +[protobuf_unittest.optional_sint64_extension]: 106 +[protobuf_unittest.optional_fixed32_extension]: 107 +[protobuf_unittest.optional_fixed64_extension]: 108 +[protobuf_unittest.optional_sfixed32_extension]: 109 +[protobuf_unittest.optional_sfixed64_extension]: 110 +[protobuf_unittest.optional_float_extension]: 111 +[protobuf_unittest.optional_double_extension]: 112 +[protobuf_unittest.optional_bool_extension]: true +[protobuf_unittest.optional_string_extension]: "115" +[protobuf_unittest.optional_bytes_extension]: "116" +[protobuf_unittest.optionalgroup_extension] { + a: 117 +} +[protobuf_unittest.optional_nested_message_extension] { + bb: 118 +} +[protobuf_unittest.optional_foreign_message_extension] { + c: 119 +} +[protobuf_unittest.optional_import_message_extension] { + d: 120 +} +[protobuf_unittest.optional_nested_enum_extension]: BAZ +[protobuf_unittest.optional_foreign_enum_extension]: FOREIGN_BAZ +[protobuf_unittest.optional_import_enum_extension]: IMPORT_BAZ +[protobuf_unittest.optional_string_piece_extension]: "124" +[protobuf_unittest.optional_cord_extension]: "125" +[protobuf_unittest.repeated_int32_extension]: 201 +[protobuf_unittest.repeated_int32_extension]: 301 +[protobuf_unittest.repeated_int64_extension]: 202 +[protobuf_unittest.repeated_int64_extension]: 302 +[protobuf_unittest.repeated_uint32_extension]: 203 +[protobuf_unittest.repeated_uint32_extension]: 303 +[protobuf_unittest.repeated_uint64_extension]: 204 +[protobuf_unittest.repeated_uint64_extension]: 304 +[protobuf_unittest.repeated_sint32_extension]: 205 +[protobuf_unittest.repeated_sint32_extension]: 305 +[protobuf_unittest.repeated_sint64_extension]: 206 +[protobuf_unittest.repeated_sint64_extension]: 306 +[protobuf_unittest.repeated_fixed32_extension]: 207 +[protobuf_unittest.repeated_fixed32_extension]: 307 +[protobuf_unittest.repeated_fixed64_extension]: 208 +[protobuf_unittest.repeated_fixed64_extension]: 308 +[protobuf_unittest.repeated_sfixed32_extension]: 209 +[protobuf_unittest.repeated_sfixed32_extension]: 309 +[protobuf_unittest.repeated_sfixed64_extension]: 210 +[protobuf_unittest.repeated_sfixed64_extension]: 310 +[protobuf_unittest.repeated_float_extension]: 211 +[protobuf_unittest.repeated_float_extension]: 311 +[protobuf_unittest.repeated_double_extension]: 212 +[protobuf_unittest.repeated_double_extension]: 312 +[protobuf_unittest.repeated_bool_extension]: true +[protobuf_unittest.repeated_bool_extension]: false +[protobuf_unittest.repeated_string_extension]: "215" +[protobuf_unittest.repeated_string_extension]: "315" +[protobuf_unittest.repeated_bytes_extension]: "216" +[protobuf_unittest.repeated_bytes_extension]: "316" +[protobuf_unittest.repeatedgroup_extension] { + a: 217 +} +[protobuf_unittest.repeatedgroup_extension] { + a: 317 +} +[protobuf_unittest.repeated_nested_message_extension] { + bb: 218 +} +[protobuf_unittest.repeated_nested_message_extension] { + bb: 318 +} +[protobuf_unittest.repeated_foreign_message_extension] { + c: 219 +} +[protobuf_unittest.repeated_foreign_message_extension] { + c: 319 +} +[protobuf_unittest.repeated_import_message_extension] { + d: 220 +} +[protobuf_unittest.repeated_import_message_extension] { + d: 320 +} +[protobuf_unittest.repeated_nested_enum_extension]: BAR +[protobuf_unittest.repeated_nested_enum_extension]: BAZ +[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAR +[protobuf_unittest.repeated_foreign_enum_extension]: FOREIGN_BAZ +[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAR +[protobuf_unittest.repeated_import_enum_extension]: IMPORT_BAZ +[protobuf_unittest.repeated_string_piece_extension]: "224" +[protobuf_unittest.repeated_string_piece_extension]: "324" +[protobuf_unittest.repeated_cord_extension]: "225" +[protobuf_unittest.repeated_cord_extension]: "325" +[protobuf_unittest.default_int32_extension]: 401 +[protobuf_unittest.default_int64_extension]: 402 +[protobuf_unittest.default_uint32_extension]: 403 +[protobuf_unittest.default_uint64_extension]: 404 +[protobuf_unittest.default_sint32_extension]: 405 +[protobuf_unittest.default_sint64_extension]: 406 +[protobuf_unittest.default_fixed32_extension]: 407 +[protobuf_unittest.default_fixed64_extension]: 408 +[protobuf_unittest.default_sfixed32_extension]: 409 +[protobuf_unittest.default_sfixed64_extension]: 410 +[protobuf_unittest.default_float_extension]: 411 +[protobuf_unittest.default_double_extension]: 412 +[protobuf_unittest.default_bool_extension]: false +[protobuf_unittest.default_string_extension]: "415" +[protobuf_unittest.default_bytes_extension]: "416" +[protobuf_unittest.default_nested_enum_extension]: FOO +[protobuf_unittest.default_foreign_enum_extension]: FOREIGN_FOO +[protobuf_unittest.default_import_enum_extension]: IMPORT_FOO +[protobuf_unittest.default_string_piece_extension]: "424" +[protobuf_unittest.default_cord_extension]: "425" diff --git a/src/Makefile.am b/src/Makefile.am index 7811b0ae..049583f5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -126,7 +126,8 @@ nobase_include_HEADERS = \ google/protobuf/compiler/java/java_names.h \ google/protobuf/compiler/javanano/javanano_generator.h \ google/protobuf/compiler/python/python_generator.h \ - google/protobuf/compiler/ruby/ruby_generator.h + google/protobuf/compiler/ruby/ruby_generator.h \ + google/protobuf/compiler/csharp/csharp_generator.h nobase_nodist_include_HEADERS = \ $(public_config) @@ -288,7 +289,36 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/javanano/javanano_primitive_field.cc \ google/protobuf/compiler/javanano/javanano_primitive_field.h \ google/protobuf/compiler/python/python_generator.cc \ - google/protobuf/compiler/ruby/ruby_generator.cc + google/protobuf/compiler/ruby/ruby_generator.cc \ + google/protobuf/compiler/csharp/csharp_enum.cc \ + google/protobuf/compiler/csharp/csharp_enum.h \ + google/protobuf/compiler/csharp/csharp_enum_field.cc \ + google/protobuf/compiler/csharp/csharp_enum_field.h \ + google/protobuf/compiler/csharp/csharp_extension.cc \ + google/protobuf/compiler/csharp/csharp_extension.h \ + google/protobuf/compiler/csharp/csharp_field_base.cc \ + google/protobuf/compiler/csharp/csharp_field_base.h \ + google/protobuf/compiler/csharp/csharp_generator.cc \ + google/protobuf/compiler/csharp/csharp_helpers.cc \ + google/protobuf/compiler/csharp/csharp_helpers.h \ + google/protobuf/compiler/csharp/csharp_message.cc \ + google/protobuf/compiler/csharp/csharp_message.h \ + google/protobuf/compiler/csharp/csharp_message_field.cc \ + google/protobuf/compiler/csharp/csharp_message_field.h \ + google/protobuf/compiler/csharp/csharp_primitive_field.cc \ + google/protobuf/compiler/csharp/csharp_primitive_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_message_field.h \ + google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc \ + google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h \ + google/protobuf/compiler/csharp/csharp_source_generator_base.cc \ + google/protobuf/compiler/csharp/csharp_source_generator_base.h \ + google/protobuf/compiler/csharp/csharp_umbrella_class.cc \ + google/protobuf/compiler/csharp/csharp_umbrella_class.h \ + google/protobuf/compiler/csharp/csharp_writer.cc \ + google/protobuf/compiler/csharp/csharp_writer.h bin_PROGRAMS = protoc protoc_LDADD = $(PTHREAD_LIBS) libprotobuf.la libprotoc.la @@ -493,6 +523,7 @@ protobuf_test_SOURCES = \ google/protobuf/compiler/java/java_doc_comment_unittest.cc \ google/protobuf/compiler/python/python_plugin_unittest.cc \ google/protobuf/compiler/ruby/ruby_generator_unittest.cc \ + google/protobuf/compiler/csharp/csharp_generator_unittest.cc \ $(COMMON_TEST_SOURCES) nodist_protobuf_test_SOURCES = $(protoc_outputs) diff --git a/src/google/protobuf/compiler/csharp/csharp_enum.cc b/src/google/protobuf/compiler/csharp/csharp_enum.cc new file mode 100644 index 00000000..27643e61 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_enum.cc @@ -0,0 +1,79 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +EnumGenerator::EnumGenerator(const EnumDescriptor* descriptor) : + SourceGeneratorBase(descriptor->file()), + descriptor_(descriptor) { +} + +EnumGenerator::~EnumGenerator() { +} + +void EnumGenerator::Generate(Writer* writer) { + WriteGeneratedCodeAttributes(writer); + writer->WriteLine("$0$ enum $1$ {", + class_access_level(), + descriptor_->name()); + writer->Indent(); + for (int i = 0; i < descriptor_->value_count(); i++) { + writer->WriteLine("$0$ = $1$,", + descriptor_->value(i)->name(), + SimpleItoa(descriptor_->value(i)->number())); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_enum.h b/src/google/protobuf/compiler/csharp/csharp_enum.h new file mode 100644 index 00000000..eaa7a9c5 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_enum.h @@ -0,0 +1,65 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class EnumGenerator : public SourceGeneratorBase { + public: + EnumGenerator(const EnumDescriptor* descriptor); + ~EnumGenerator(); + + void Generate(Writer* writer); + + private: + const EnumDescriptor* descriptor_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_enum_field.cc new file mode 100644 index 00000000..d5b1b477 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_enum_field.cc @@ -0,0 +1,160 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +EnumFieldGenerator::EnumFieldGenerator(const FieldDescriptor* descriptor, + int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +EnumFieldGenerator::~EnumFieldGenerator() { + +} + +void EnumFieldGenerator::GenerateMembers(Writer* writer) { + writer->WriteLine("private bool has$0$;", property_name()); + writer->WriteLine("private $0$ $1$_ = $2$;", type_name(), name(), + default_value()); + AddDeprecatedFlag(writer); + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return has$0$; }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return $0$_; }", name()); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateBuilderMembers(Writer* writer) { + AddDeprecatedFlag(writer); + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return result.has$0$; }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return result.$0$; }", property_name()); + writer->WriteLine(" set { Set$0$(value); }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public Builder Set$0$($1$ value) {", property_name(), + type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = true;", property_name()); + writer->WriteLine(" result.$0$_ = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = false;", property_name()); + writer->WriteLine(" result.$0$_ = $1$;", name(), default_value()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.Has$0$) {", property_name()); + writer->WriteLine(" $0$ = other.$0$;", property_name()); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateBuildingCode(Writer* writer) { + // Nothing to do here for enum types +} + +void EnumFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine("object unknown;"); + writer->WriteLine("if(input.ReadEnum(ref result.$0$_, out unknown)) {", + name()); + writer->WriteLine(" result.has$0$ = true;", property_name()); + writer->WriteLine("} else if(unknown is int) {"); + if (!use_lite_runtime()) { + writer->WriteLine(" if (unknownFields == null) {"); // First unknown field - create builder now + writer->WriteLine( + " unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer->WriteLine(" }"); + writer->WriteLine( + " unknownFields.MergeVarintField($0$, (ulong)(int)unknown);", + number()); + } + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateSerializationCode(Writer* writer) { + writer->WriteLine("if (has$0$) {", property_name()); + writer->WriteLine( + " output.WriteEnum($0$, field_names[$2$], (int) $1$, $1$);", number(), + property_name(), field_ordinal()); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + writer->WriteLine("if (has$0$) {", property_name()); + writer->WriteLine( + " size += pb::CodedOutputStream.ComputeEnumSize($0$, (int) $1$);", + number(), property_name()); + writer->WriteLine("}"); +} + +void EnumFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("if (has$0$) hash ^= $1$_.GetHashCode();", property_name(), + name()); +} +void EnumFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine( + "if (has$0$ != other.has$0$ || (has$0$ && !$1$_.Equals(other.$1$_))) return false;", + property_name(), name()); +} +void EnumFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$0$\", has$1$, $2$_, writer);", + descriptor_->name(), property_name(), name()); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_enum_field.h b/src/google/protobuf/compiler/csharp/csharp_enum_field.h new file mode 100644 index 00000000..b21fa9dc --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_enum_field.h @@ -0,0 +1,73 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class EnumFieldGenerator : public FieldGeneratorBase { + public: + EnumFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~EnumFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(EnumFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_ENUM_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_extension.cc b/src/google/protobuf/compiler/csharp/csharp_extension.cc new file mode 100644 index 00000000..5d38f52e --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_extension.cc @@ -0,0 +1,174 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor) + : FieldGeneratorBase(descriptor, 0) { + if (descriptor_->extension_scope()) { + scope_ = GetClassName(descriptor_->extension_scope()); + } else { + scope_ = GetFullUmbrellaClassName(descriptor_->file()); + } + extends_ = GetClassName(descriptor_->containing_type()); +} + +ExtensionGenerator::~ExtensionGenerator() { +} + +void ExtensionGenerator::Generate(Writer* writer) { + if (cls_compliance() + && (GetFieldConstantName(descriptor_).substr(0, 1) == "_")) { + writer->WriteLine("[global::System.CLSCompliant(false)]"); + } + + writer->WriteLine("public const int $0$ = $1$;", + GetFieldConstantName(descriptor_), + SimpleItoa(descriptor_->number())); + + if (use_lite_runtime()) { + // TODO(jtattermusch): include the following check + //if (Descriptor.MappedType == MappedType.Message && Descriptor.MessageType.Options.MessageSetWireFormat) + //{ + // throw new ArgumentException( + // "option message_set_wire_format = true; is not supported in Lite runtime extensions."); + //} + + AddClsComplianceCheck(writer); + writer->Write("$0$ ", class_access_level()); + writer->WriteLine( + "static pb::$3$<$0$, $1$> $2$;", + extends_, + type_name(), + property_name(), + descriptor_->is_repeated() ? + "GeneratedRepeatExtensionLite" : "GeneratedExtensionLite"); + } else if (descriptor_->is_repeated()) { + AddClsComplianceCheck(writer); + writer->WriteLine( + "$0$ static pb::GeneratedExtensionBase> $2$;", + class_access_level(), type_name(), property_name()); + } else { + AddClsComplianceCheck(writer); + writer->WriteLine("$0$ static pb::GeneratedExtensionBase<$1$> $2$;", + class_access_level(), type_name(), property_name()); + } +} + +void ExtensionGenerator::GenerateStaticVariableInitializers(Writer* writer) { + if (use_lite_runtime()) { + writer->WriteLine("$0$.$1$ = ", scope_, property_name()); + writer->Indent(); + writer->WriteLine( + "new pb::$0$<$1$, $2$>(", + descriptor_->is_repeated() ? + "GeneratedRepeatExtensionLite" : "GeneratedExtensionLite", + extends_, type_name()); + writer->Indent(); + writer->WriteLine("\"$0$\",", descriptor_->full_name()); + writer->WriteLine("$0$.DefaultInstance,", extends_); + if (!descriptor_->is_repeated()) { + std::string default_val; + if (descriptor_->has_default_value()) { + default_val = default_value(); + } else { + default_val = is_nullable_type() ? "null" : ("default(" + type_name() + ")"); + } + writer->WriteLine("$0$,", default_val); + } + writer->WriteLine( + "$0$,", + (GetCSharpType(descriptor_->type()) == CSHARPTYPE_MESSAGE) ? + type_name() + ".DefaultInstance" : "null"); + writer->WriteLine( + "$0$,", + (GetCSharpType(descriptor_->type()) == CSHARPTYPE_ENUM) ? + "new EnumLiteMap<" + type_name() + ">()" : "null"); + writer->WriteLine("$0$.$1$FieldNumber,", scope_, + GetPropertyName(descriptor_)); + writer->Write("pbd::FieldType.$0$", capitalized_type_name()); + if (descriptor_->is_repeated()) { + writer->WriteLine(","); + writer->Write(descriptor_->is_packed() ? "true" : "false"); + } + writer->Outdent(); + writer->WriteLine(");"); + writer->Outdent(); + } + else if (descriptor_->is_repeated()) + { + writer->WriteLine( + "$0$.$1$ = pb::GeneratedRepeatExtension<$2$>.CreateInstance($0$.Descriptor.Extensions[$3$]);", + scope_, property_name(), type_name(), SimpleItoa(descriptor_->index())); + } + else + { + writer->WriteLine( + "$0$.$1$ = pb::GeneratedSingleExtension<$2$>.CreateInstance($0$.Descriptor.Extensions[$3$]);", + scope_, property_name(), type_name(), SimpleItoa(descriptor_->index())); + } +} + +void ExtensionGenerator::GenerateExtensionRegistrationCode(Writer* writer) { + writer->WriteLine("registry.Add($0$.$1$);", scope_, property_name()); +} + +void ExtensionGenerator::WriteHash(Writer* writer) { +} + +void ExtensionGenerator::WriteEquals(Writer* writer) { +} + +void ExtensionGenerator::WriteToString(Writer* writer) { +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_extension.h b/src/google/protobuf/compiler/csharp/csharp_extension.h new file mode 100644 index 00000000..203f6e5e --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_extension.h @@ -0,0 +1,80 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_EXTENSION_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_EXTENSION_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class ExtensionGenerator : public FieldGeneratorBase { + public: + ExtensionGenerator(const FieldDescriptor* descriptor); + ~ExtensionGenerator(); + + void GenerateStaticVariableInitializers(Writer* writer); + void GenerateExtensionRegistrationCode(Writer* writer); + void Generate(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + virtual void GenerateMembers(Writer* writer) {}; + virtual void GenerateBuilderMembers(Writer* writer) {}; + virtual void GenerateMergingCode(Writer* writer) {}; + virtual void GenerateBuildingCode(Writer* writer) {}; + virtual void GenerateParsingCode(Writer* writer) {}; + virtual void GenerateSerializationCode(Writer* writer) {}; + virtual void GenerateSerializedSizeCode(Writer* writer) {}; + + private: + std::string scope_; + std::string extends_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ExtensionGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_EXTENSION_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.cc b/src/google/protobuf/compiler/csharp/csharp_field_base.cc new file mode 100644 index 00000000..ed4d55c4 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.cc @@ -0,0 +1,393 @@ +// 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. + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +FieldGeneratorBase::FieldGeneratorBase(const FieldDescriptor* descriptor, + int fieldOrdinal) + : SourceGeneratorBase(descriptor->file()), + descriptor_(descriptor), + fieldOrdinal_(fieldOrdinal) { +} + +FieldGeneratorBase::~FieldGeneratorBase() { +} + +void FieldGeneratorBase::AddDeprecatedFlag(Writer* writer) { + if (descriptor_->options().deprecated()) + { + writer->WriteLine("[global::System.ObsoleteAttribute()]"); + } +} + +void FieldGeneratorBase::AddNullCheck(Writer* writer) { + AddNullCheck(writer, "value"); +} + +void FieldGeneratorBase::AddNullCheck(Writer* writer, const std::string& name) { + if (is_nullable_type()) { + writer->WriteLine(" pb::ThrowHelper.ThrowIfNull($0$, \"$0$\");", name); + } +} + +void FieldGeneratorBase::AddPublicMemberAttributes(Writer* writer) { + AddDeprecatedFlag(writer); + AddClsComplianceCheck(writer); +} + +void FieldGeneratorBase::AddClsComplianceCheck(Writer* writer) { + if (cls_compliance() && !is_cls_compliant()) { + writer->WriteLine("[global::System.CLSCompliant(false)]"); + } +} + +std::string FieldGeneratorBase::property_name() { + return GetPropertyName(descriptor_); +} + +std::string FieldGeneratorBase::name() { + return UnderscoresToCamelCase(GetFieldName(descriptor_), false); +} + +std::string FieldGeneratorBase::type_name() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + return GetClassName(descriptor_->enum_type()); + case FieldDescriptor::TYPE_MESSAGE: + case FieldDescriptor::TYPE_GROUP: + return GetClassName(descriptor_->message_type()); + case FieldDescriptor::TYPE_DOUBLE: + return "double"; + case FieldDescriptor::TYPE_FLOAT: + return "float"; + case FieldDescriptor::TYPE_INT64: + return "long"; + case FieldDescriptor::TYPE_UINT64: + return "ulong"; + case FieldDescriptor::TYPE_INT32: + return "int"; + case FieldDescriptor::TYPE_FIXED64: + return "ulong"; + case FieldDescriptor::TYPE_FIXED32: + return "uint"; + case FieldDescriptor::TYPE_BOOL: + return "bool"; + case FieldDescriptor::TYPE_STRING: + return "string"; + case FieldDescriptor::TYPE_BYTES: + return "pb::ByteString"; + case FieldDescriptor::TYPE_UINT32: + return "uint"; + case FieldDescriptor::TYPE_SFIXED32: + return "int"; + case FieldDescriptor::TYPE_SFIXED64: + return "long"; + case FieldDescriptor::TYPE_SINT32: + return "int"; + case FieldDescriptor::TYPE_SINT64: + return "long"; + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return ""; + } +} + +bool FieldGeneratorBase::has_default_value() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + case FieldDescriptor::TYPE_MESSAGE: + case FieldDescriptor::TYPE_GROUP: + return true; + case FieldDescriptor::TYPE_DOUBLE: + return descriptor_->default_value_double() != 0.0; + case FieldDescriptor::TYPE_FLOAT: + return descriptor_->default_value_float() != 0.0; + case FieldDescriptor::TYPE_INT64: + return descriptor_->default_value_int64() != 0L; + case FieldDescriptor::TYPE_UINT64: + return descriptor_->default_value_uint64() != 0L; + case FieldDescriptor::TYPE_INT32: + return descriptor_->default_value_int32() != 0; + case FieldDescriptor::TYPE_FIXED64: + return descriptor_->default_value_uint64() != 0L; + case FieldDescriptor::TYPE_FIXED32: + return descriptor_->default_value_uint32() != 0; + case FieldDescriptor::TYPE_BOOL: + return descriptor_->default_value_bool(); + case FieldDescriptor::TYPE_STRING: + return true; + case FieldDescriptor::TYPE_BYTES: + return true; + case FieldDescriptor::TYPE_UINT32: + return descriptor_->default_value_uint32() != 0; + case FieldDescriptor::TYPE_SFIXED32: + return descriptor_->default_value_int32() != 0; + case FieldDescriptor::TYPE_SFIXED64: + return descriptor_->default_value_int64() != 0L; + case FieldDescriptor::TYPE_SINT32: + return descriptor_->default_value_int32() != 0; + case FieldDescriptor::TYPE_SINT64: + return descriptor_->default_value_int64() != 0L; + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return true; + } +} + +bool FieldGeneratorBase::is_nullable_type() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + case FieldDescriptor::TYPE_DOUBLE: + case FieldDescriptor::TYPE_FLOAT: + case FieldDescriptor::TYPE_INT64: + case FieldDescriptor::TYPE_UINT64: + case FieldDescriptor::TYPE_INT32: + case FieldDescriptor::TYPE_FIXED64: + case FieldDescriptor::TYPE_FIXED32: + case FieldDescriptor::TYPE_BOOL: + case FieldDescriptor::TYPE_UINT32: + case FieldDescriptor::TYPE_SFIXED32: + case FieldDescriptor::TYPE_SFIXED64: + case FieldDescriptor::TYPE_SINT32: + case FieldDescriptor::TYPE_SINT64: + return false; + + case FieldDescriptor::TYPE_MESSAGE: + case FieldDescriptor::TYPE_GROUP: + case FieldDescriptor::TYPE_STRING: + case FieldDescriptor::TYPE_BYTES: + return true; + + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return true; + } +} + +bool FieldGeneratorBase::is_cls_compliant() { + CSharpType type = GetCSharpType(descriptor_->type()); + return (type != CSHARPTYPE_UINT32) && (type != CSHARPTYPE_UINT64) + && (UnderscoresToPascalCase(name()).substr(0, 1) != "_"); +} + +inline bool IsNaN(double value) { + // NaN is never equal to anything, even itself. + return value != value; +} + +bool AllPrintableAscii(const std::string& text) { + for(int i = 0; i < text.size(); i++) { + if (text[i] < 0x20 || text[i] > 0x7e) { + return false; + } + } + return true; +} + +std::string FieldGeneratorBase::GetStringDefaultValueInternal() { + if (!descriptor_->has_default_value()) { + return "\"\""; + } + if (AllPrintableAscii(descriptor_->default_value_string())) { + // All chars are ASCII and printable. In this case we only + // need to escape quotes and backslashes. + std::string temp = descriptor_->default_value_string(); + temp = StringReplace(temp, "\\", "\\\\", true); + temp = StringReplace(temp, "'", "\\'", true); + temp = StringReplace(temp, "\"", "\\\"", true); + return "\"" + temp + "\""; + } + if (use_lite_runtime()) { + return "pb::ByteString.FromBase64(\"" + + StringToBase64(descriptor_->default_value_string()) + + "\").ToStringUtf8()"; + } + return "(string) " + GetClassName(descriptor_->containing_type()) + + ".Descriptor.Fields[" + SimpleItoa(descriptor_->index()) + + "].DefaultValue"; +} + +std::string FieldGeneratorBase::GetBytesDefaultValueInternal() { + if (!descriptor_->has_default_value()) { + return "pb::ByteString.Empty"; + } + if (use_lite_runtime()) { + return "pb::ByteString.FromBase64(\"" + StringToBase64(descriptor_->default_value_string()) + "\")"; + } + return "(pb::ByteString) "+ GetClassName(descriptor_->containing_type()) + + ".Descriptor.Fields[" + SimpleItoa(descriptor_->index()) + "].DefaultValue"; +} + +std::string FieldGeneratorBase::default_value() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + return type_name() + "." + descriptor_->default_value_enum()->name(); + case FieldDescriptor::TYPE_MESSAGE: + case FieldDescriptor::TYPE_GROUP: + return type_name() + ".DefaultInstance"; + case FieldDescriptor::TYPE_DOUBLE: { + double value = descriptor_->default_value_double(); + if (value == numeric_limits::infinity()) { + return "double.PositiveInfinity"; + } else if (value == -numeric_limits::infinity()) { + return "double.NegativeInfinity"; + } else if (IsNaN(value)) { + return "double.NaN"; + } + return SimpleDtoa(value) + "D"; + } + case FieldDescriptor::TYPE_FLOAT: { + float value = descriptor_->default_value_float(); + if (value == numeric_limits::infinity()) { + return "float.PositiveInfinity"; + } else if (value == -numeric_limits::infinity()) { + return "float.NegativeInfinity"; + } else if (IsNaN(value)) { + return "float.NaN"; + } + return SimpleFtoa(value) + "F"; + } + case FieldDescriptor::TYPE_INT64: + return SimpleItoa(descriptor_->default_value_int64()) + "L"; + case FieldDescriptor::TYPE_UINT64: + return SimpleItoa(descriptor_->default_value_uint64()) + "UL"; + case FieldDescriptor::TYPE_INT32: + return SimpleItoa(descriptor_->default_value_int32()); + case FieldDescriptor::TYPE_FIXED64: + return SimpleItoa(descriptor_->default_value_uint64()) + "UL"; + case FieldDescriptor::TYPE_FIXED32: + return SimpleItoa(descriptor_->default_value_uint32()); + case FieldDescriptor::TYPE_BOOL: + if (descriptor_->default_value_bool()) { + return "true"; + } else { + return "false"; + } + case FieldDescriptor::TYPE_STRING: + return GetStringDefaultValueInternal(); + case FieldDescriptor::TYPE_BYTES: + return GetBytesDefaultValueInternal(); + case FieldDescriptor::TYPE_UINT32: + return SimpleItoa(descriptor_->default_value_uint32()); + case FieldDescriptor::TYPE_SFIXED32: + return SimpleItoa(descriptor_->default_value_int32()); + case FieldDescriptor::TYPE_SFIXED64: + return SimpleItoa(descriptor_->default_value_int64()) + "L"; + case FieldDescriptor::TYPE_SINT32: + return SimpleItoa(descriptor_->default_value_int32()); + case FieldDescriptor::TYPE_SINT64: + return SimpleItoa(descriptor_->default_value_int64()) + "L"; + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return ""; + } +} + +std::string FieldGeneratorBase::number() { + return SimpleItoa(descriptor_->number()); +} + +std::string FieldGeneratorBase::message_or_group() { + return + (descriptor_->type() == FieldDescriptor::TYPE_GROUP) ? "Group" : "Message"; +} + +std::string FieldGeneratorBase::capitalized_type_name() { + switch (descriptor_->type()) { + case FieldDescriptor::TYPE_ENUM: + return "Enum"; + case FieldDescriptor::TYPE_MESSAGE: + return "Message"; + case FieldDescriptor::TYPE_GROUP: + return "Group"; + case FieldDescriptor::TYPE_DOUBLE: + return "Double"; + case FieldDescriptor::TYPE_FLOAT: + return "Float"; + case FieldDescriptor::TYPE_INT64: + return "Int64"; + case FieldDescriptor::TYPE_UINT64: + return "UInt64"; + case FieldDescriptor::TYPE_INT32: + return "Int32"; + case FieldDescriptor::TYPE_FIXED64: + return "Fixed64"; + case FieldDescriptor::TYPE_FIXED32: + return "Fixed32"; + case FieldDescriptor::TYPE_BOOL: + return "Bool"; + case FieldDescriptor::TYPE_STRING: + return "String"; + case FieldDescriptor::TYPE_BYTES: + return "Bytes"; + case FieldDescriptor::TYPE_UINT32: + return "UInt32"; + case FieldDescriptor::TYPE_SFIXED32: + return "SFixed32"; + case FieldDescriptor::TYPE_SFIXED64: + return "SFixed64"; + case FieldDescriptor::TYPE_SINT32: + return "SInt32"; + case FieldDescriptor::TYPE_SINT64: + return "SInt64"; + default: + GOOGLE_LOG(FATAL)<< "Unknown field type."; + return ""; + } +} + +std::string FieldGeneratorBase::field_ordinal() { + return SimpleItoa(fieldOrdinal_); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_field_base.h b/src/google/protobuf/compiler/csharp/csharp_field_base.h new file mode 100644 index 00000000..4f3a7658 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_field_base.h @@ -0,0 +1,100 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_FIELD_BASE_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_FIELD_BASE_H__ + +#include +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class FieldGeneratorBase : public SourceGeneratorBase { + public: + FieldGeneratorBase(const FieldDescriptor* descriptor, int fieldOrdinal); + ~FieldGeneratorBase(); + + virtual void GenerateMembers(Writer* writer) = 0; + virtual void GenerateBuilderMembers(Writer* writer) = 0; + virtual void GenerateMergingCode(Writer* writer) = 0; + virtual void GenerateBuildingCode(Writer* writer) = 0; + virtual void GenerateParsingCode(Writer* writer) = 0; + virtual void GenerateSerializationCode(Writer* writer) = 0; + virtual void GenerateSerializedSizeCode(Writer* writer) = 0; + + virtual void WriteHash(Writer* writer) = 0; + virtual void WriteEquals(Writer* writer) = 0; + virtual void WriteToString(Writer* writer) = 0; + + protected: + const FieldDescriptor* descriptor_; + const int fieldOrdinal_; + + void AddDeprecatedFlag(Writer* writer); + void AddNullCheck(Writer* writer); + void AddNullCheck(Writer* writer, const std::string& name); + + void AddPublicMemberAttributes(Writer* writer); + void AddClsComplianceCheck(Writer* writer); + + std::string property_name(); + std::string name(); + std::string type_name(); + bool has_default_value(); + bool is_nullable_type(); + bool is_cls_compliant(); + std::string default_value(); + std::string number(); + std::string message_or_group(); + std::string capitalized_type_name(); + std::string field_ordinal(); + + private: + std::string GetStringDefaultValueInternal(); + std::string GetBytesDefaultValueInternal(); + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FieldGeneratorBase); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_FIELD_BASE_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.cc b/src/google/protobuf/compiler/csharp/csharp_generator.cc new file mode 100644 index 00000000..61ed37ad --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_generator.cc @@ -0,0 +1,99 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +std::string GetOutputFile(const google::protobuf::FileDescriptor* file, const std::string file_extension) +{ + return GetFileUmbrellaClassname(file) + file_extension; +} + +void GenerateFile(const google::protobuf::FileDescriptor* file, + Writer* writer) { + UmbrellaClassGenerator umbrellaGenerator(file); + umbrellaGenerator.Generate(writer); +} + +bool Generator::Generate( + const FileDescriptor* file, + const string& parameter, + GeneratorContext* generator_context, + string* error) const { + + vector > options; + ParseGeneratorParameter(parameter, &options); + + std::string file_extension = ".cs"; + for (int i = 0; i < options.size(); i++) { + if (options[i].first == "no_cls_compliance") { + *error = "Turning off CLS compliance is not implemented yet."; + return false; + } else if (options[i].first == "file_extension") { + file_extension = options[i].second; + } else { + *error = "Unknown generator option: " + options[i].first; + return false; + } + } + + std::string filename = GetOutputFile(file, file_extension); + scoped_ptr output( + generator_context->Open(filename)); + io::Printer printer(output.get(), '$'); + Writer writer(&printer); + + GenerateFile(file, &writer); + + return true; +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_generator.h b/src/google/protobuf/compiler/csharp/csharp_generator.h new file mode 100644 index 00000000..9b54e914 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_generator.h @@ -0,0 +1,58 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__ + +#include + +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class LIBPROTOC_EXPORT Generator + : public google::protobuf::compiler::CodeGenerator { + virtual bool Generate( + const FileDescriptor* file, + const string& parameter, + GeneratorContext* generator_context, + string* error) const; +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_GENERATOR_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc b/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc new file mode 100644 index 00000000..7ef7df42 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc @@ -0,0 +1,54 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2014 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. + +#include + +#include +#include +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { +namespace { + +// TODO(jtattermusch): add some tests. + +} // namespace +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc new file mode 100644 index 00000000..4580b7be --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc @@ -0,0 +1,409 @@ +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +CSharpType GetCSharpType(FieldDescriptor::Type type) { + switch (type) { + case FieldDescriptor::TYPE_INT32: + return CSHARPTYPE_INT32; + case FieldDescriptor::TYPE_INT64: + return CSHARPTYPE_INT64; + case FieldDescriptor::TYPE_UINT32: + return CSHARPTYPE_UINT32; + case FieldDescriptor::TYPE_UINT64: + return CSHARPTYPE_UINT32; + case FieldDescriptor::TYPE_SINT32: + return CSHARPTYPE_INT32; + case FieldDescriptor::TYPE_SINT64: + return CSHARPTYPE_INT64; + case FieldDescriptor::TYPE_FIXED32: + return CSHARPTYPE_UINT32; + case FieldDescriptor::TYPE_FIXED64: + return CSHARPTYPE_UINT64; + case FieldDescriptor::TYPE_SFIXED32: + return CSHARPTYPE_INT32; + case FieldDescriptor::TYPE_SFIXED64: + return CSHARPTYPE_INT64; + case FieldDescriptor::TYPE_FLOAT: + return CSHARPTYPE_FLOAT; + case FieldDescriptor::TYPE_DOUBLE: + return CSHARPTYPE_DOUBLE; + case FieldDescriptor::TYPE_BOOL: + return CSHARPTYPE_BOOL; + case FieldDescriptor::TYPE_ENUM: + return CSHARPTYPE_ENUM; + case FieldDescriptor::TYPE_STRING: + return CSHARPTYPE_STRING; + case FieldDescriptor::TYPE_BYTES: + return CSHARPTYPE_BYTESTRING; + case FieldDescriptor::TYPE_GROUP: + return CSHARPTYPE_MESSAGE; + case FieldDescriptor::TYPE_MESSAGE: + return CSHARPTYPE_MESSAGE; + + // No default because we want the compiler to complain if any new + // types are added. + } + GOOGLE_LOG(FATAL)<< "Can't get here."; + return (CSharpType) -1; +} + +std::string StripDotProto(const std::string& proto_file) { + int lastindex = proto_file.find_last_of("."); + return proto_file.substr(0, lastindex); +} + +std::string GetFileNamespace(const FileDescriptor* descriptor) { + if (descriptor->options().has_csharp_namespace()) { + return descriptor->options().csharp_namespace(); + } + return descriptor->package(); +} + +std::string GetUmbrellaClassNameInternal(const std::string& proto_file) { + int lastslash = proto_file.find_last_of("/"); + std::string base = proto_file.substr(lastslash + 1); + return UnderscoresToPascalCase(StripDotProto(base)); +} + +std::string GetFileUmbrellaClassname(const FileDescriptor* descriptor) { + // umbrella_classname can no longer be set using message option. + return GetUmbrellaClassNameInternal(descriptor->name()); +} + +std::string GetFileUmbrellaNamespace(const FileDescriptor* descriptor) { + // TODO(jtattermusch): reintroduce csharp_umbrella_namespace option + bool collision = false; + std::string umbrella_classname = GetFileUmbrellaClassname(descriptor); + for(int i = 0; i < descriptor->message_type_count(); i++) { + if (descriptor->message_type(i)->name() == umbrella_classname) { + collision = true; + break; + } + } + for (int i = 0; i < descriptor->service_count(); i++) { + if (descriptor->service(i)->name() == umbrella_classname) { + collision = true; + break; + } + } + for (int i = 0; i < descriptor->enum_type_count(); i++) { + if (descriptor->enum_type(i)->name() == umbrella_classname) { + collision = true; + break; + } + } + return collision ? "Proto" : ""; +} + +// TODO(jtattermusch): can we reuse a utility function? +std::string UnderscoresToCamelCase(const std::string& input, + bool cap_next_letter) { + string result; + // Note: I distrust ctype.h due to locales. + for (int i = 0; i < input.size(); i++) { + if ('a' <= input[i] && input[i] <= 'z') { + if (cap_next_letter) { + result += input[i] + ('A' - 'a'); + } else { + result += input[i]; + } + cap_next_letter = false; + } else if ('A' <= input[i] && input[i] <= 'Z') { + if (i == 0 && !cap_next_letter) { + // Force first letter to lower-case unless explicitly told to + // capitalize it. + result += input[i] + ('a' - 'A'); + } else { + // Capital letters after the first are left as-is. + result += input[i]; + } + cap_next_letter = false; + } else if ('0' <= input[i] && input[i] <= '9') { + result += input[i]; + cap_next_letter = true; + } else { + cap_next_letter = true; + } + } + // Add a trailing "_" if the name should be altered. + if (input[input.size() - 1] == '#') { + result += '_'; + } + return result; +} + +std::string UnderscoresToPascalCase(const std::string& input) { + return UnderscoresToCamelCase(input, true); +} + +std::string ToCSharpName(const std::string& name, const FileDescriptor* file) { + std::string result = GetFileNamespace(file); + if (result != "") { + result += '.'; + } + string classname; + if (file->package().empty()) { + classname = name; + } else { + // Strip the proto package from full_name since we've replaced it with + // the C# namespace. + classname = name.substr(file->package().size() + 1); + } + result += StringReplace(classname, ".", ".Types.", false); + return "global::" + result; +} + + + +std::string GetFullUmbrellaClassName(const FileDescriptor* descriptor) { + std::string result = GetFileNamespace(descriptor); + if (!result.empty()) { + result += '.'; + } + result += GetQualifiedUmbrellaClassName(descriptor); + return "global::" + result; +} + +std::string GetQualifiedUmbrellaClassName(const FileDescriptor* descriptor) { + std::string umbrellaNamespace = GetFileUmbrellaNamespace(descriptor); + std::string umbrellaClassname = GetFileUmbrellaClassname(descriptor); + + std::string fullName = umbrellaClassname; + if (!umbrellaNamespace.empty()) { + fullName = umbrellaNamespace + "." + umbrellaClassname; + } + return fullName; +} + +std::string GetClassName(const Descriptor* descriptor) { + return ToCSharpName(descriptor->full_name(), descriptor->file()); +} + +std::string GetClassName(const EnumDescriptor* descriptor) { + return ToCSharpName(descriptor->full_name(), descriptor->file()); +} + +// Groups are hacky: The name of the field is just the lower-cased name +// of the group type. In C#, though, we would like to retain the original +// capitalization of the type name. +std::string GetFieldName(const FieldDescriptor* descriptor) { + if (descriptor->type() == FieldDescriptor::TYPE_GROUP) { + return descriptor->message_type()->name(); + } else { + return descriptor->name(); + } +} + +std::string GetFieldConstantName(const FieldDescriptor* field) { + return GetPropertyName(field) + "FieldNumber"; +} + +std::string GetPropertyName(const FieldDescriptor* descriptor) { + // TODO(jtattermusch): consider introducing csharp_property_name field option + std::string property_name = UnderscoresToPascalCase(GetFieldName(descriptor)); + if (property_name == descriptor->containing_type()->name()) { + property_name += "_"; + } + return property_name; +} + +// TODO: c&p from Java protoc plugin +// For encodings with fixed sizes, returns that size in bytes. Otherwise +// returns -1. +int GetFixedSize(FieldDescriptor::Type type) { + switch (type) { + case FieldDescriptor::TYPE_INT32 : return -1; + case FieldDescriptor::TYPE_INT64 : return -1; + case FieldDescriptor::TYPE_UINT32 : return -1; + case FieldDescriptor::TYPE_UINT64 : return -1; + case FieldDescriptor::TYPE_SINT32 : return -1; + case FieldDescriptor::TYPE_SINT64 : return -1; + case FieldDescriptor::TYPE_FIXED32 : return internal::WireFormatLite::kFixed32Size; + case FieldDescriptor::TYPE_FIXED64 : return internal::WireFormatLite::kFixed64Size; + case FieldDescriptor::TYPE_SFIXED32: return internal::WireFormatLite::kSFixed32Size; + case FieldDescriptor::TYPE_SFIXED64: return internal::WireFormatLite::kSFixed64Size; + case FieldDescriptor::TYPE_FLOAT : return internal::WireFormatLite::kFloatSize; + case FieldDescriptor::TYPE_DOUBLE : return internal::WireFormatLite::kDoubleSize; + + case FieldDescriptor::TYPE_BOOL : return internal::WireFormatLite::kBoolSize; + case FieldDescriptor::TYPE_ENUM : return -1; + + case FieldDescriptor::TYPE_STRING : return -1; + case FieldDescriptor::TYPE_BYTES : return -1; + case FieldDescriptor::TYPE_GROUP : return -1; + case FieldDescriptor::TYPE_MESSAGE : return -1; + + // No default because we want the compiler to complain if any new + // types are added. + } + GOOGLE_LOG(FATAL) << "Can't get here."; + return -1; +} + +static const char base64_chars[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + +std::string StringToBase64(const std::string& input) { + std::string result; + size_t remaining = input.size(); + const unsigned char *src = (const unsigned char*) input.c_str(); + while (remaining > 2) { + result += base64_chars[src[0] >> 2]; + result += base64_chars[((src[0] & 0x3) << 4) | (src[1] >> 4)]; + result += base64_chars[((src[1] & 0xf) << 2) | (src[2] >> 6)]; + result += base64_chars[src[2] & 0x3f]; + remaining -= 3; + src += 3; + } + switch (remaining) { + case 2: + result += base64_chars[src[0] >> 2]; + result += base64_chars[((src[0] & 0x3) << 4) | (src[1] >> 4)]; + result += base64_chars[(src[1] & 0xf) << 2]; + result += '='; + src += 2; + break; + case 1: + result += base64_chars[src[0] >> 2]; + result += base64_chars[((src[0] & 0x3) << 4)]; + result += '='; + result += '='; + src += 1; + break; + } + return result; +} + +std::string FileDescriptorToBase64(const FileDescriptor* descriptor) { + std::string fdp_bytes; + FileDescriptorProto fdp; + descriptor->CopyTo(&fdp); + fdp.SerializeToString(&fdp_bytes); + return StringToBase64(fdp_bytes); +} + +FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, + int fieldOrdinal) { + switch (descriptor->type()) { + case FieldDescriptor::TYPE_GROUP: + case FieldDescriptor::TYPE_MESSAGE: + if (descriptor->is_repeated()) { + return new RepeatedMessageFieldGenerator(descriptor, fieldOrdinal); + } else { + return new MessageFieldGenerator(descriptor, fieldOrdinal); + } + case FieldDescriptor::TYPE_ENUM: + if (descriptor->is_repeated()) { + return new RepeatedEnumFieldGenerator(descriptor, fieldOrdinal); + } else { + return new EnumFieldGenerator(descriptor, fieldOrdinal); + } + default: + if (descriptor->is_repeated()) { + return new RepeatedPrimitiveFieldGenerator(descriptor, fieldOrdinal); + } else { + return new PrimitiveFieldGenerator(descriptor, fieldOrdinal); + } + } +} + +bool HasRequiredFields(const Descriptor* descriptor, std::set* already_seen) { + if (already_seen->find(descriptor) != already_seen->end()) { + // The type is already in cache. This means that either: + // a. The type has no required fields. + // b. We are in the midst of checking if the type has required fields, + // somewhere up the stack. In this case, we know that if the type + // has any required fields, they'll be found when we return to it, + // and the whole call to HasRequiredFields() will return true. + // Therefore, we don't have to check if this type has required fields + // here. + return false; + } + already_seen->insert(descriptor); + + // If the type has extensions, an extension with message type could contain + // required fields, so we have to be conservative and assume such an + // extension exists. + if (descriptor->extension_count() > 0) { + return true; + } + + for (int i = 0; i < descriptor->field_count(); i++) { + const FieldDescriptor* field = descriptor->field(i); + if (field->is_required()) { + return true; + } + if (GetCSharpType(field->type()) == CSHARPTYPE_MESSAGE) { + if (HasRequiredFields(field->message_type(), already_seen)) { + return true; + } + } + } + return false; +} + +bool HasRequiredFields(const Descriptor* descriptor) { + std::set already_seen; + return HasRequiredFields(descriptor, &already_seen); +} + +} // namespace java +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.h b/src/google/protobuf/compiler/csharp/csharp_helpers.h new file mode 100644 index 00000000..8fdd214e --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.h @@ -0,0 +1,108 @@ +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__ + +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class FieldGeneratorBase; + +// TODO: start using this enum. +enum CSharpType { + CSHARPTYPE_INT32 = 1, + CSHARPTYPE_INT64 = 2, + CSHARPTYPE_UINT32 = 3, + CSHARPTYPE_UINT64 = 4, + CSHARPTYPE_FLOAT = 5, + CSHARPTYPE_DOUBLE = 6, + CSHARPTYPE_BOOL = 7, + CSHARPTYPE_STRING = 8, + CSHARPTYPE_BYTESTRING = 9, + CSHARPTYPE_MESSAGE = 10, + CSHARPTYPE_ENUM = 11, + MAX_CSHARPTYPE = 11 +}; + +// Converts field type to corresponding C# type. +CSharpType GetCSharpType(FieldDescriptor::Type type); + +std::string StripDotProto(const std::string& proto_file); + +std::string GetFileNamespace(const FileDescriptor* descriptor); +std::string GetFileUmbrellaClassname(const FileDescriptor* descriptor); +std::string GetFileUmbrellaNamespace(const FileDescriptor* descriptor); + +std::string GetFullUmbrellaClassName(const FileDescriptor* descriptor); + +std::string GetQualifiedUmbrellaClassName(const FileDescriptor* descriptor); + +std::string GetClassName(const Descriptor* descriptor); +std::string GetClassName(const EnumDescriptor* descriptor); + +std::string GetFieldName(const FieldDescriptor* descriptor); + +std::string GetFieldConstantName(const FieldDescriptor* field); + +std::string GetPropertyName(const FieldDescriptor* descriptor); + +int GetFixedSize(FieldDescriptor::Type type); + +std::string UnderscoresToCamelCase(const std::string& input, bool cap_next_letter); + +std::string UnderscoresToPascalCase(const std::string& input); + +// TODO(jtattermusch): perhaps we could move this to strutil +std::string StringToBase64(const std::string& input); + +std::string FileDescriptorToBase64(const FileDescriptor* descriptor); + +FieldGeneratorBase* CreateFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + +bool HasRequiredFields(const Descriptor* descriptor); + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_HELPERS_H__ diff --git a/src/google/protobuf/compiler/csharp/csharp_message.cc b/src/google/protobuf/compiler/csharp/csharp_message.cc new file mode 100644 index 00000000..f7c8ddfb --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_message.cc @@ -0,0 +1,897 @@ +// 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. + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +using google::protobuf::internal::scoped_ptr; + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +bool CompareFieldNumbers(const FieldDescriptor* d1, const FieldDescriptor* d2) { + return d1->number() < d2->number(); +} + +MessageGenerator::MessageGenerator(const Descriptor* descriptor) + : SourceGeneratorBase(descriptor->file()), + descriptor_(descriptor) { + + // sorted field names + for (int i = 0; i < descriptor_->field_count(); i++) { + field_names_.push_back(descriptor_->field(i)->name()); + } + std::sort(field_names_.begin(), field_names_.end()); + + // fields by number + for (int i = 0; i < descriptor_->field_count(); i++) { + fields_by_number_.push_back(descriptor_->field(i)); + } + std::sort(fields_by_number_.begin(), fields_by_number_.end(), + CompareFieldNumbers); +} + +MessageGenerator::~MessageGenerator() { +} + +std::string MessageGenerator::class_name() { + return descriptor_->name(); +} + +std::string MessageGenerator::full_class_name() { + return GetClassName(descriptor_); +} + +const std::vector& MessageGenerator::field_names() { + return field_names_; +} + +const std::vector& MessageGenerator::fields_by_number() { + return fields_by_number_; +} + +/// Get an identifier that uniquely identifies this type within the file. +/// This is used to declare static variables related to this type at the +/// outermost file scope. +std::string GetUniqueFileScopeIdentifier(const Descriptor* descriptor) { + std::string result = descriptor->full_name(); + std::replace(result.begin(), result.end(), '.', '_'); + return "static_" + result; +} + +void MessageGenerator::GenerateStaticVariables(Writer* writer) { + // Because descriptor.proto (Google.ProtocolBuffers.DescriptorProtos) is + // used in the construction of descriptors, we have a tricky bootstrapping + // problem. To help control static initialization order, we make sure all + // descriptors and other static data that depends on them are members of + // the proto-descriptor class. This way, they will be initialized in + // a deterministic order. + + std::string identifier = GetUniqueFileScopeIdentifier(descriptor_); + + if (!use_lite_runtime()) { + // The descriptor for this type. + std::string access = "internal"; + writer->WriteLine( + "$0$ static pbd::MessageDescriptor internal__$1$__Descriptor;", access, + identifier); + writer->WriteLine( + "$0$ static pb::FieldAccess.FieldAccessorTable<$1$, $1$.Builder> internal__$2$__FieldAccessorTable;", + access, full_class_name(), identifier); + } + + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + MessageGenerator messageGenerator(descriptor_->nested_type(i)); + messageGenerator.GenerateStaticVariables(writer); + } +} + +void MessageGenerator::GenerateStaticVariableInitializers(Writer* writer) { + std::string identifier = GetUniqueFileScopeIdentifier(descriptor_); + + if (!use_lite_runtime()) { + writer->Write("internal__$0$__Descriptor = ", identifier); + + if (!descriptor_->containing_type()) { + writer->WriteLine("Descriptor.MessageTypes[$0$];", + SimpleItoa(descriptor_->index())); + } else { + writer->WriteLine( + "internal__$0$__Descriptor.NestedTypes[$1$];", + GetUniqueFileScopeIdentifier(descriptor_->containing_type()), + SimpleItoa(descriptor_->index())); + } + + writer->WriteLine("internal__$0$__FieldAccessorTable = ", identifier); + writer->WriteLine( + " new pb::FieldAccess.FieldAccessorTable<$1$, $1$.Builder>(internal__$0$__Descriptor,", + identifier, full_class_name()); + writer->Write(" new string[] { "); + for (int i = 0; i < descriptor_->field_count(); i++) { + writer->Write("\"$0$\", ", GetPropertyName(descriptor_->field(i))); + } + writer->WriteLine("});"); + } + + // Generate static member initializers for all nested types. + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + MessageGenerator messageGenerator(descriptor_->nested_type(i)); + messageGenerator.GenerateStaticVariableInitializers(writer); + } + + for (int i = 0; i < descriptor_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(descriptor_->extension(i)); + extensionGenerator.GenerateStaticVariableInitializers(writer); + } +} + +void MessageGenerator::Generate(Writer* writer) { + writer->WriteLine( + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer->WriteLine( + "$0$ sealed partial class $1$ : pb::$2$Message$3$<$1$, $1$.Builder> {", + class_access_level(), class_name(), + descriptor_->extension_range_count() > 0 ? "Extendable" : "Generated", + runtime_suffix()); + writer->Indent(); + writer->WriteLine("private $0$() { }", class_name()); // Private ctor. + // Must call MakeReadOnly() to make sure all lists are made read-only + writer->WriteLine( + "private static readonly $0$ defaultInstance = new $0$().MakeReadOnly();", + class_name()); + + if (optimize_speed()) { + writer->WriteLine( + "private static readonly string[] _$0$FieldNames = new string[] { $2$$1$$2$ };", + UnderscoresToCamelCase(class_name(), false), + JoinStrings(field_names(), "\", \""), + field_names().size() > 0 ? "\"" : ""); + std::vector tags; + for (int i = 0; i < field_names().size(); i++) { + uint32 tag = internal::WireFormat::MakeTag( + descriptor_->FindFieldByName(field_names()[i])); + tags.push_back(SimpleItoa(tag)); + } + writer->WriteLine( + "private static readonly uint[] _$0$FieldTags = new uint[] { $1$ };", + UnderscoresToCamelCase(class_name(), false), JoinStrings(tags, ", ")); + } + writer->WriteLine("public static $0$ DefaultInstance {", class_name()); + writer->WriteLine(" get { return defaultInstance; }"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("public override $0$ DefaultInstanceForType {", + class_name()); + writer->WriteLine(" get { return DefaultInstance; }"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("protected override $0$ ThisMessage {", class_name()); + writer->WriteLine(" get { return this; }"); + writer->WriteLine("}"); + writer->WriteLine(); + if (!use_lite_runtime()) { + writer->WriteLine("public static pbd::MessageDescriptor Descriptor {"); + writer->WriteLine(" get { return $0$.internal__$1$__Descriptor; }", + GetFullUmbrellaClassName(descriptor_->file()), + GetUniqueFileScopeIdentifier(descriptor_)); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine( + "protected override pb::FieldAccess.FieldAccessorTable<$0$, $0$.Builder> InternalFieldAccessors {", + class_name()); + writer->WriteLine(" get { return $0$.internal__$1$__FieldAccessorTable; }", + GetFullUmbrellaClassName(descriptor_->file()), + GetUniqueFileScopeIdentifier(descriptor_)); + writer->WriteLine("}"); + writer->WriteLine(); + } + + // Extensions don't need to go in an extra nested type + for (int i = 0; i < descriptor_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(descriptor_->extension(i)); + extensionGenerator.Generate(writer); + } + + if (descriptor_->enum_type_count() + descriptor_->nested_type_count() > 0) { + writer->WriteLine("#region Nested types"); + writer->WriteLine( + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer->WriteLine("public static partial class Types {"); + writer->Indent(); + for (int i = 0; i < descriptor_->enum_type_count(); i++) { + EnumGenerator enumGenerator(descriptor_->enum_type(i)); + enumGenerator.Generate(writer); + } + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + MessageGenerator messageGenerator(descriptor_->nested_type(i)); + messageGenerator.Generate(writer); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); + writer->WriteLine(); + } + + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* fieldDescriptor = descriptor_->field(i); + // TODO(jtattermusch): same code for cls compliance is in csharp_extension + if (cls_compliance() + && GetFieldConstantName(fieldDescriptor)[0] == '_') { + writer->WriteLine("[global::System.CLSCompliant(false)]"); + } + + // Rats: we lose the debug comment here :( + writer->WriteLine("public const int $0$ = $1$;", + GetFieldConstantName(fieldDescriptor), + SimpleItoa(fieldDescriptor->number())); + scoped_ptr generator( + CreateFieldGeneratorInternal(fieldDescriptor)); + generator->GenerateMembers(writer); + writer->WriteLine(); + } + + if (optimize_speed()) { + GenerateIsInitialized(writer); + GenerateMessageSerializationMethods(writer); + } + if (use_lite_runtime()) { + GenerateLiteRuntimeMethods(writer); + } + + GenerateParseFromMethods(writer); + GenerateBuilder(writer); + + // Force the static initialization code for the file to run, since it may + // initialize static variables declared in this class. + writer->WriteLine("static $0$() {", class_name()); + // We call object.ReferenceEquals() just to make it a valid statement on its own. + // Another option would be GetType(), but that causes problems in DescriptorProtoFile, + // where the bootstrapping is somewhat recursive - type initializers call + // each other, effectively. We temporarily see Descriptor as null. + writer->WriteLine(" object.ReferenceEquals($0$.Descriptor, null);", + GetFullUmbrellaClassName(descriptor_->file())); + writer->WriteLine("}"); + + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + +} + +void MessageGenerator::GenerateLiteRuntimeMethods(Writer* writer) { + bool callbase = descriptor_->extension_range_count() > 0; + writer->WriteLine("#region Lite runtime methods"); + writer->WriteLine("public override int GetHashCode() {"); + writer->Indent(); + writer->WriteLine("int hash = GetType().GetHashCode();"); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->WriteHash(writer); + } + if (callbase) { + writer->WriteLine("hash ^= base.GetHashCode();"); + } + writer->WriteLine("return hash;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine("public override bool Equals(object obj) {"); + writer->Indent(); + writer->WriteLine("$0$ other = obj as $0$;", class_name()); + writer->WriteLine("if (other == null) return false;"); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->WriteEquals(writer); + } + if (callbase) { + writer->WriteLine("if (!base.Equals(other)) return false;"); + } + writer->WriteLine("return true;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine( + "public override void PrintTo(global::System.IO.TextWriter writer) {"); + writer->Indent(); + + for (int i = 0; i < fields_by_number().size(); i++) { + scoped_ptr generator( + CreateFieldGeneratorInternal(fields_by_number()[i])); + generator->WriteToString(writer); + } + + if (callbase) { + writer->WriteLine("base.PrintTo(writer);"); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); + writer->WriteLine(); +} + +bool CompareExtensionRangesStart(const Descriptor::ExtensionRange* r1, + const Descriptor::ExtensionRange* r2) { + return r1->start < r2->start; +} + +void MessageGenerator::GenerateMessageSerializationMethods(Writer* writer) { + std::vector extension_ranges_sorted; + for (int i = 0; i < descriptor_->extension_range_count(); i++) { + extension_ranges_sorted.push_back(descriptor_->extension_range(i)); + } + std::sort(extension_ranges_sorted.begin(), extension_ranges_sorted.end(), + CompareExtensionRangesStart); + + writer->WriteLine( + "public override void WriteTo(pb::ICodedOutputStream output) {"); + writer->Indent(); + // Make sure we've computed the serialized length, so that packed fields are generated correctly. + writer->WriteLine("CalcSerializedSize();"); + writer->WriteLine("string[] field_names = _$0$FieldNames;", + UnderscoresToCamelCase(class_name(), false)); + if (descriptor_->extension_range_count()) { + writer->WriteLine( + "pb::ExtendableMessage$1$<$0$, $0$.Builder>.ExtensionWriter extensionWriter = CreateExtensionWriter(this);", + class_name(), runtime_suffix()); + } + + // Merge the fields and the extension ranges, both sorted by field number. + for (int i = 0, j = 0; + i < fields_by_number().size() || j < extension_ranges_sorted.size();) { + if (i == fields_by_number().size()) { + GenerateSerializeOneExtensionRange(writer, extension_ranges_sorted[j++]); + } else if (j == extension_ranges_sorted.size()) { + GenerateSerializeOneField(writer, fields_by_number()[i++]); + } else if (fields_by_number()[i]->number() + < extension_ranges_sorted[j]->start) { + GenerateSerializeOneField(writer, fields_by_number()[i++]); + } else { + GenerateSerializeOneExtensionRange(writer, extension_ranges_sorted[j++]); + } + } + + if (!use_lite_runtime()) { + if (descriptor_->options().message_set_wire_format()) + { + writer->WriteLine("UnknownFields.WriteAsMessageSetTo(output);"); + } else { + writer->WriteLine("UnknownFields.WriteTo(output);"); + } + } + + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("private int memoizedSerializedSize = -1;"); + writer->WriteLine("public override int SerializedSize {"); + writer->Indent(); + writer->WriteLine("get {"); + writer->Indent(); + writer->WriteLine("int size = memoizedSerializedSize;"); + writer->WriteLine("if (size != -1) return size;"); + writer->WriteLine("return CalcSerializedSize();"); + writer->Outdent(); + writer->WriteLine("}"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine("private int CalcSerializedSize() {"); + writer->Indent(); + writer->WriteLine("int size = memoizedSerializedSize;"); + writer->WriteLine("if (size != -1) return size;"); + writer->WriteLine(); + writer->WriteLine("size = 0;"); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->GenerateSerializedSizeCode(writer); + } + if (descriptor_->extension_range_count() > 0) { + writer->WriteLine("size += ExtensionsSerializedSize;"); + } + + if (!use_lite_runtime()) { + if (descriptor_->options().message_set_wire_format()) { + writer->WriteLine("size += UnknownFields.SerializedSizeAsMessageSet;"); + } else { + writer->WriteLine("size += UnknownFields.SerializedSize;"); + } + } + writer->WriteLine("memoizedSerializedSize = size;"); + writer->WriteLine("return size;"); + writer->Outdent(); + writer->WriteLine("}"); +} + +void MessageGenerator::GenerateSerializeOneField( + Writer* writer, const FieldDescriptor* fieldDescriptor) { + scoped_ptr generator( + CreateFieldGeneratorInternal(fieldDescriptor)); + generator->GenerateSerializationCode(writer); +} + +void MessageGenerator::GenerateSerializeOneExtensionRange( + Writer* writer, const Descriptor::ExtensionRange* extensionRange) { + writer->WriteLine("extensionWriter.WriteUntil($0$, output);", + SimpleItoa(extensionRange->end)); +} + +void MessageGenerator::GenerateParseFromMethods(Writer* writer) { + // Note: These are separate from GenerateMessageSerializationMethods() + // because they need to be generated even for messages that are optimized + // for code size. + + writer->WriteLine("public static $0$ ParseFrom(pb::ByteString data) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine("public static $0$ ParseFrom(byte[] data) {", class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(global::System.IO.Stream input) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseDelimitedFrom(global::System.IO.Stream input) {", + class_name()); + writer->WriteLine( + " return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(pb::ICodedInputStream input) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();"); + writer->WriteLine("}"); + writer->WriteLine( + "public static $0$ ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {", + class_name()); + writer->WriteLine( + " return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();"); + writer->WriteLine("}"); +} + +void MessageGenerator::GenerateBuilder(Writer* writer) { + writer->WriteLine("private $0$ MakeReadOnly() {", class_name()); + writer->Indent(); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->GenerateBuildingCode(writer); + } + writer->WriteLine("return this;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine( + "public static Builder CreateBuilder() { return new Builder(); }"); + writer->WriteLine( + "public override Builder ToBuilder() { return CreateBuilder(this); }"); + writer->WriteLine( + "public override Builder CreateBuilderForType() { return new Builder(); }"); + writer->WriteLine("public static Builder CreateBuilder($0$ prototype) {", + class_name()); + writer->WriteLine(" return new Builder(prototype);"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine( + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer->WriteLine( + "$0$ sealed partial class Builder : pb::$2$Builder$3$<$1$, Builder> {", + class_access_level(), class_name(), + descriptor_->extension_range_count() > 0 ? "Extendable" : "Generated", + runtime_suffix()); + writer->Indent(); + writer->WriteLine("protected override Builder ThisBuilder {"); + writer->WriteLine(" get { return this; }"); + writer->WriteLine("}"); + GenerateCommonBuilderMethods(writer); + if (optimize_speed()) { + GenerateBuilderParsingMethods(writer); + } + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + writer->WriteLine(); + // No field comment :( + generator->GenerateBuilderMembers(writer); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void MessageGenerator::GenerateCommonBuilderMethods(Writer* writer) { + //default constructor + writer->WriteLine("public Builder() {"); + //Durring static initialization of message, DefaultInstance is expected to return null. + writer->WriteLine(" result = DefaultInstance;"); + writer->WriteLine(" resultIsReadOnly = true;"); + writer->WriteLine("}"); + //clone constructor + writer->WriteLine("internal Builder($0$ cloneFrom) {", class_name()); + writer->WriteLine(" result = cloneFrom;"); + writer->WriteLine(" resultIsReadOnly = true;"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("private bool resultIsReadOnly;"); + writer->WriteLine("private $0$ result;", class_name()); + writer->WriteLine(); + writer->WriteLine("private $0$ PrepareBuilder() {", class_name()); + writer->WriteLine(" if (resultIsReadOnly) {"); + writer->WriteLine(" $0$ original = result;", class_name()); + writer->WriteLine(" result = new $0$();", class_name()); + writer->WriteLine(" resultIsReadOnly = false;"); + writer->WriteLine(" MergeFrom(original);"); + writer->WriteLine(" }"); + writer->WriteLine(" return result;"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("public override bool IsInitialized {"); + writer->WriteLine(" get { return result.IsInitialized; }"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("protected override $0$ MessageBeingBuilt {", class_name()); + writer->WriteLine(" get { return PrepareBuilder(); }"); + writer->WriteLine("}"); + writer->WriteLine(); + //Not actually expecting that DefaultInstance would ever be null here; however, we will ensure it does not break + writer->WriteLine("public override Builder Clear() {"); + writer->WriteLine(" result = DefaultInstance;"); + writer->WriteLine(" resultIsReadOnly = true;"); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("public override Builder Clone() {"); + writer->WriteLine(" if (resultIsReadOnly) {"); + writer->WriteLine(" return new Builder(result);"); + writer->WriteLine(" } else {"); + writer->WriteLine(" return new Builder().MergeFrom(result);"); + writer->WriteLine(" }"); + writer->WriteLine("}"); + writer->WriteLine(); + if (!use_lite_runtime()) { + writer->WriteLine( + "public override pbd::MessageDescriptor DescriptorForType {"); + writer->WriteLine(" get { return $0$.Descriptor; }", full_class_name()); + writer->WriteLine("}"); + writer->WriteLine(); + } + writer->WriteLine("public override $0$ DefaultInstanceForType {", + class_name()); + writer->WriteLine(" get { return $0$.DefaultInstance; }", full_class_name()); + writer->WriteLine("}"); + writer->WriteLine(); + + writer->WriteLine("public override $0$ BuildPartial() {", class_name()); + writer->Indent(); + writer->WriteLine("if (resultIsReadOnly) {"); + writer->WriteLine(" return result;"); + writer->WriteLine("}"); + writer->WriteLine("resultIsReadOnly = true;"); + writer->WriteLine("return result.MakeReadOnly();"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + + if (optimize_speed()) { + writer->WriteLine( + "public override Builder MergeFrom(pb::IMessage$0$ other) {", + runtime_suffix()); + writer->WriteLine(" if (other is $0$) {", class_name()); + writer->WriteLine(" return MergeFrom(($0$) other);", class_name()); + writer->WriteLine(" } else {"); + writer->WriteLine(" base.MergeFrom(other);"); + writer->WriteLine(" return this;"); + writer->WriteLine(" }"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine("public override Builder MergeFrom($0$ other) {", + class_name()); + // Optimization: If other is the default instance, we know none of its + // fields are set so we can skip the merge. + writer->Indent(); + writer->WriteLine("if (other == $0$.DefaultInstance) return this;", + full_class_name()); + writer->WriteLine("PrepareBuilder();"); + for (int i = 0; i < descriptor_->field_count(); i++) { + scoped_ptr generator( + CreateFieldGeneratorInternal(descriptor_->field(i))); + generator->GenerateMergingCode(writer); + } + // if message type has extensions + if (descriptor_->extension_range_count() > 0) { + writer->WriteLine(" this.MergeExtensionFields(other);"); + } + if (!use_lite_runtime()) { + writer->WriteLine("this.MergeUnknownFields(other.UnknownFields);"); + } + writer->WriteLine("return this;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + } + +} + +void MessageGenerator::GenerateBuilderParsingMethods(Writer* writer) { + writer->WriteLine( + "public override Builder MergeFrom(pb::ICodedInputStream input) {"); + writer->WriteLine(" return MergeFrom(input, pb::ExtensionRegistry.Empty);"); + writer->WriteLine("}"); + writer->WriteLine(); + writer->WriteLine( + "public override Builder MergeFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {"); + writer->Indent(); + writer->WriteLine("PrepareBuilder();"); + if (!use_lite_runtime()) { + writer->WriteLine("pb::UnknownFieldSet.Builder unknownFields = null;"); + } + writer->WriteLine("uint tag;"); + writer->WriteLine("string field_name;"); + writer->WriteLine("while (input.ReadTag(out tag, out field_name)) {"); + writer->Indent(); + writer->WriteLine("if(tag == 0 && field_name != null) {"); + writer->Indent(); + //if you change from StringComparer.Ordinal, the array sort in FieldNames { get; } must also change + writer->WriteLine( + "int field_ordinal = global::System.Array.BinarySearch(_$0$FieldNames, field_name, global::System.StringComparer.Ordinal);", + UnderscoresToCamelCase(class_name(), false)); + writer->WriteLine("if(field_ordinal >= 0)"); + writer->WriteLine(" tag = _$0$FieldTags[field_ordinal];", + UnderscoresToCamelCase(class_name(), false)); + writer->WriteLine("else {"); + if (!use_lite_runtime()) { + writer->WriteLine(" if (unknownFields == null) {"); // First unknown field - create builder now + writer->WriteLine( + " unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer->WriteLine(" }"); + } + writer->WriteLine( + " ParseUnknownField(input, $0$extensionRegistry, tag, field_name);", + use_lite_runtime() ? "" : "unknownFields, "); + writer->WriteLine(" continue;"); + writer->WriteLine("}"); + writer->Outdent(); + writer->WriteLine("}"); + + writer->WriteLine("switch (tag) {"); + writer->Indent(); + writer->WriteLine("case 0: {"); // 0 signals EOF / limit reached + writer->WriteLine(" throw pb::InvalidProtocolBufferException.InvalidTag();"); + writer->WriteLine("}"); + writer->WriteLine("default: {"); + writer->WriteLine(" if (pb::WireFormat.IsEndGroupTag(tag)) {"); + if (!use_lite_runtime()) { + writer->WriteLine(" if (unknownFields != null) {"); + writer->WriteLine(" this.UnknownFields = unknownFields.Build();"); + writer->WriteLine(" }"); + } + writer->WriteLine(" return this;"); // it's an endgroup tag + writer->WriteLine(" }"); + if (!use_lite_runtime()) { + writer->WriteLine(" if (unknownFields == null) {"); // First unknown field - create builder now + writer->WriteLine( + " unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer->WriteLine(" }"); + } + writer->WriteLine( + " ParseUnknownField(input, $0$extensionRegistry, tag, field_name);", + use_lite_runtime() ? "" : "unknownFields, "); + writer->WriteLine(" break;"); + writer->WriteLine("}"); + + for (int i = 0; i < fields_by_number().size(); i++) { + const FieldDescriptor* field = fields_by_number()[i]; + internal::WireFormatLite::WireType wt = + internal::WireFormat::WireTypeForFieldType(field->type()); + uint32 tag = internal::WireFormatLite::MakeTag(field->number(), wt); + if (field->is_repeated() + && (wt == internal::WireFormatLite::WIRETYPE_VARINT + || wt == internal::WireFormatLite::WIRETYPE_FIXED32 + || wt == internal::WireFormatLite::WIRETYPE_FIXED64)) { + writer->WriteLine( + "case $0$:", + SimpleItoa( + internal::WireFormatLite::MakeTag( + field->number(), + internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED))); + } + + writer->WriteLine("case $0$: {", SimpleItoa(tag)); + writer->Indent(); + scoped_ptr generator( + CreateFieldGeneratorInternal(field)); + generator->GenerateParsingCode(writer); + writer->WriteLine("break;"); + writer->Outdent(); + writer->WriteLine("}"); + } + + writer->Outdent(); + writer->WriteLine("}"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); + if (!use_lite_runtime()) { + writer->WriteLine("if (unknownFields != null) {"); + writer->WriteLine(" this.UnknownFields = unknownFields.Build();"); + writer->WriteLine("}"); + } + writer->WriteLine("return this;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); +} + +void MessageGenerator::GenerateIsInitialized(Writer* writer) { + writer->WriteLine("public override bool IsInitialized {"); + writer->Indent(); + writer->WriteLine("get {"); + writer->Indent(); + + // Check that all required fields in this message are set. + // TODO(kenton): We can optimize this when we switch to putting all the + // "has" fields into a single bitfield. + for (int i = 0; i < descriptor_->field_count(); i++) { + if (descriptor_->field(i)->is_required()) { + writer->WriteLine("if (!has$0$) return false;", + GetPropertyName(descriptor_->field(i))); + } + } + + // Now check that all embedded messages are initialized. + for (int i = 0; i < descriptor_->field_count(); i++) { + const FieldDescriptor* field = descriptor_->field(i); + + if (field->type() != FieldDescriptor::TYPE_MESSAGE || + !HasRequiredFields(field->message_type())) + { + continue; + } + // TODO(jtattermusch): shouldn't we use GetPropertyName here? + string propertyName = UnderscoresToPascalCase(GetFieldName(field)); + if (field->is_repeated()) + { + writer->WriteLine("foreach ($0$ element in $1$List) {", + GetClassName(field->message_type()), + propertyName); + writer->WriteLine(" if (!element.IsInitialized) return false;"); + writer->WriteLine("}"); + } + else if (field->is_optional()) + { + writer->WriteLine("if (Has$0$) {", propertyName); + writer->WriteLine(" if (!$0$.IsInitialized) return false;", propertyName); + writer->WriteLine("}"); + } + else + { + writer->WriteLine("if (!$0$.IsInitialized) return false;", propertyName); + } + } + + if (descriptor_->extension_range_count() > 0) { + writer->WriteLine("if (!ExtensionsAreInitialized) return false;"); + } + writer->WriteLine("return true;"); + writer->Outdent(); + writer->WriteLine("}"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine(); +} + +void MessageGenerator::GenerateExtensionRegistrationCode(Writer* writer) { + for (int i = 0; i < descriptor_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(descriptor_->extension(i)); + extensionGenerator.GenerateExtensionRegistrationCode(writer); + } + for (int i = 0; i < descriptor_->nested_type_count(); i++) { + MessageGenerator messageGenerator(descriptor_->nested_type(i)); + messageGenerator.GenerateExtensionRegistrationCode(writer); + } +} + +int MessageGenerator::GetFieldOrdinal(const FieldDescriptor* descriptor) { + for (int i = 0; i < field_names().size(); i++) { + if (field_names()[i] == descriptor->name()) { + return i; + } + } + GOOGLE_LOG(DFATAL)<< "Could not find ordinal for field " << descriptor->name(); + return -1; +} + +FieldGeneratorBase* MessageGenerator::CreateFieldGeneratorInternal( + const FieldDescriptor* descriptor) { + return CreateFieldGenerator(descriptor, GetFieldOrdinal(descriptor)); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_message.h b/src/google/protobuf/compiler/csharp/csharp_message.h new file mode 100644 index 00000000..b8d15df0 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_message.h @@ -0,0 +1,98 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ + +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; +class FieldGeneratorBase; + +class MessageGenerator : public SourceGeneratorBase { + public: + MessageGenerator(const Descriptor* descriptor); + ~MessageGenerator(); + + void GenerateStaticVariables(Writer* printer); + void GenerateStaticVariableInitializers(Writer* printer); + void GenerateExtensionRegistrationCode(Writer* printer); + void Generate(Writer* printer); + + private: + const Descriptor* descriptor_; + std::vector field_names_; + std::vector fields_by_number_; + + void GenerateLiteRuntimeMethods(Writer* writer); + void GenerateMessageSerializationMethods(Writer* writer); + void GenerateSerializeOneField(Writer* writer, + const FieldDescriptor* fieldDescriptor); + void GenerateSerializeOneExtensionRange( + Writer* writer, const Descriptor::ExtensionRange* extendsionRange); + void GenerateParseFromMethods(Writer* writer); + void GenerateBuilder(Writer* writer); + void GenerateCommonBuilderMethods(Writer* writer); + void GenerateBuilderParsingMethods(Writer* writer); + void GenerateIsInitialized(Writer* writer); + + int GetFieldOrdinal(const FieldDescriptor* descriptor); + FieldGeneratorBase* CreateFieldGeneratorInternal( + const FieldDescriptor* descriptor); + + std::string class_name(); + std::string full_class_name(); + + // field names sorted alphabetically + const std::vector& field_names(); + + // field descriptors sorted by number + const std::vector& fields_by_number(); + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_message_field.cc new file mode 100644 index 00000000..10464c4b --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_message_field.cc @@ -0,0 +1,183 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +MessageFieldGenerator::MessageFieldGenerator(const FieldDescriptor* descriptor, + int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +MessageFieldGenerator::~MessageFieldGenerator() { + +} + +void MessageFieldGenerator::GenerateMembers(Writer* writer) { + writer->WriteLine("private bool has$0$;", property_name()); + writer->WriteLine("private $0$ $1$_;", type_name(), name()); + AddDeprecatedFlag(writer); + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return has$0$; }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return $0$_ ?? $1$; }", name(), default_value()); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::GenerateBuilderMembers(Writer* writer) { + AddDeprecatedFlag(writer); + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return result.has$0$; }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return result.$0$; }", property_name()); + writer->WriteLine(" set { Set$0$(value); }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Set$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = true;", property_name()); + writer->WriteLine(" result.$0$_ = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Set$0$($1$.Builder builderForValue) {", + property_name(), type_name()); + AddNullCheck(writer, "builderForValue"); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = true;", property_name()); + writer->WriteLine(" result.$0$_ = builderForValue.Build();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Merge$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" if (result.has$0$ &&", property_name()); + writer->WriteLine(" result.$0$_ != $1$) {", name(), default_value()); + writer->WriteLine( + " result.$0$_ = $1$.CreateBuilder(result.$0$_).MergeFrom(value).BuildPartial();", + name(), type_name()); + writer->WriteLine(" } else {"); + writer->WriteLine(" result.$0$_ = value;", name()); + writer->WriteLine(" }"); + writer->WriteLine(" result.has$0$ = true;", property_name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = false;", property_name()); + writer->WriteLine(" result.$0$_ = null;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.Has$0$) {", property_name()); + writer->WriteLine(" Merge$0$(other.$0$);", property_name()); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::GenerateBuildingCode(Writer* writer) { + // Nothing to do for singular fields +} + +void MessageFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine("$0$.Builder subBuilder = $0$.CreateBuilder();", + type_name()); + writer->WriteLine("if (result.has$0$) {", property_name()); + writer->WriteLine(" subBuilder.MergeFrom($0$);", property_name()); + writer->WriteLine("}"); + + if (descriptor_->type() == FieldDescriptor::TYPE_GROUP) { + writer->WriteLine("input.ReadGroup($0$, subBuilder, extensionRegistry);", + number()); + } else { + writer->WriteLine("input.ReadMessage(subBuilder, extensionRegistry);"); + } + writer->WriteLine("$0$ = subBuilder.BuildPartial();", property_name()); +} + +void MessageFieldGenerator::GenerateSerializationCode(Writer* writer) { + writer->WriteLine("if (has$0$) {", property_name()); + writer->WriteLine(" output.Write$0$($1$, field_names[$3$], $2$);", + message_or_group(), number(), property_name(), + field_ordinal()); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + writer->WriteLine("if (has$0$) {", property_name()); + writer->WriteLine(" size += pb::CodedOutputStream.Compute$0$Size($1$, $2$);", + message_or_group(), number(), property_name()); + writer->WriteLine("}"); +} + +void MessageFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("if (has$0$) hash ^= $1$_.GetHashCode();", property_name(), + name()); +} +void MessageFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine( + "if (has$0$ != other.has$0$ || (has$0$ && !$1$_.Equals(other.$1$_))) return false;", + property_name(), name()); +} +void MessageFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$2$\", has$0$, $1$_, writer);", + property_name(), name(), GetFieldName(descriptor_)); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_message_field.h b/src/google/protobuf/compiler/csharp/csharp_message_field.h new file mode 100644 index 00000000..48bf8be5 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_message_field.h @@ -0,0 +1,73 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class MessageFieldGenerator : public FieldGeneratorBase { + public: + MessageFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~MessageFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_MESSAGE_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc new file mode 100644 index 00000000..54287b41 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc @@ -0,0 +1,148 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +PrimitiveFieldGenerator::PrimitiveFieldGenerator( + const FieldDescriptor* descriptor, int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +PrimitiveFieldGenerator::~PrimitiveFieldGenerator() { + +} + +void PrimitiveFieldGenerator::GenerateMembers(Writer* writer) { + writer->WriteLine("private bool has$0$;", property_name()); + writer->WriteLine("private $0$ $1$_$2$;", type_name(), name(), + has_default_value() ? " = " + default_value() : ""); + AddDeprecatedFlag(writer); + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return has$0$; }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return $0$_; }", name()); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::GenerateBuilderMembers(Writer* writer) { + AddDeprecatedFlag(writer); + writer->WriteLine("public bool Has$0$ {", property_name()); + writer->WriteLine(" get { return result.has$0$; }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ $1$ {", type_name(), property_name()); + writer->WriteLine(" get { return result.$0$; }", property_name()); + writer->WriteLine(" set { Set$0$(value); }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public Builder Set$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = true;", property_name()); + writer->WriteLine(" result.$0$_ = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.has$0$ = false;", property_name()); + writer->WriteLine(" result.$0$_ = $1$;", name(), default_value()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.Has$0$) {", property_name()); + writer->WriteLine(" $0$ = other.$0$;", property_name()); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::GenerateBuildingCode(Writer* writer) { + // Nothing to do here for primitive types +} + +void PrimitiveFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine("result.has$0$ = input.Read$1$(ref result.$2$_);", + property_name(), capitalized_type_name(), name()); +} + +void PrimitiveFieldGenerator::GenerateSerializationCode(Writer* writer) { + writer->WriteLine("if (has$0$) {", property_name()); + writer->WriteLine(" output.Write$0$($1$, field_names[$3$], $2$);", + capitalized_type_name(), number(), property_name(), + field_ordinal()); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + writer->WriteLine("if (has$0$) {", property_name()); + writer->WriteLine(" size += pb::CodedOutputStream.Compute$0$Size($1$, $2$);", + capitalized_type_name(), number(), property_name()); + writer->WriteLine("}"); +} + +void PrimitiveFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("if (has$0$) hash ^= $1$_.GetHashCode();", property_name(), + name()); +} +void PrimitiveFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine( + "if (has$0$ != other.has$0$ || (has$0$ && !$1$_.Equals(other.$1$_))) return false;", + property_name(), name()); +} +void PrimitiveFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$0$\", has$1$, $2$_, writer);", + descriptor_->name(), property_name(), name()); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_primitive_field.h b/src/google/protobuf/compiler/csharp/csharp_primitive_field.h new file mode 100644 index 00000000..fb27ab43 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_primitive_field.h @@ -0,0 +1,73 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class PrimitiveFieldGenerator : public FieldGeneratorBase { + public: + PrimitiveFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~PrimitiveFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(PrimitiveFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_PRIMITIVE_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc new file mode 100644 index 00000000..cc8745ae --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc @@ -0,0 +1,226 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +RepeatedEnumFieldGenerator::RepeatedEnumFieldGenerator( + const FieldDescriptor* descriptor, int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +RepeatedEnumFieldGenerator::~RepeatedEnumFieldGenerator() { + +} + +void RepeatedEnumFieldGenerator::GenerateMembers(Writer* writer) { + if (descriptor_->is_packed() && optimize_speed()) { + writer->WriteLine("private int $0$MemoizedSerializedSize;", name()); + } + writer->WriteLine( + "private pbc::PopsicleList<$0$> $1$_ = new pbc::PopsicleList<$0$>();", + type_name(), name()); + AddDeprecatedFlag(writer); + writer->WriteLine("public scg::IList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return pbc::Lists.AsReadOnly($0$_); }", name()); + writer->WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return $0$_.Count; }", name()); + writer->WriteLine("}"); + + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return $0$_[index];", name()); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::GenerateBuilderMembers(Writer* writer) { + // Note: We can return the original list here, because we make it unmodifiable when we build + // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddDeprecatedFlag(writer); + writer->WriteLine("public pbc::IPopsicleList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return PrepareBuilder().$0$_; }", name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return result.$0$Count; }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return result.Get$0$(index);", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Set$0$(int index, $1$ value) {", + property_name(), type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_[index] = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Add$0$($1$ value) {", property_name(), + type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(value);", name(), type_name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine( + "public Builder AddRange$0$(scg::IEnumerable<$1$> values) {", + property_name(), type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(values);", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Clear();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.$0$_.Count != 0) {", name()); + writer->WriteLine(" result.$0$_.Add(other.$0$_);", name()); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::GenerateBuildingCode(Writer* writer) { + writer->WriteLine("$0$_.MakeReadOnly();", name()); +} + +void RepeatedEnumFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine("scg::ICollection unknownItems;"); + writer->WriteLine( + "input.ReadEnumArray<$0$>(tag, field_name, result.$1$_, out unknownItems);", + type_name(), name()); + if (!use_lite_runtime()) { + writer->WriteLine("if (unknownItems != null) {"); + writer->WriteLine(" if (unknownFields == null) {"); + writer->WriteLine( + " unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);"); + writer->WriteLine(" }"); + writer->WriteLine(" foreach (object rawValue in unknownItems)"); + writer->WriteLine(" if (rawValue is int)"); + writer->WriteLine( + " unknownFields.MergeVarintField($0$, (ulong)(int)rawValue);", + number()); + writer->WriteLine("}"); + } +} + +void RepeatedEnumFieldGenerator::GenerateSerializationCode(Writer* writer) { + writer->WriteLine("if ($0$_.Count > 0) {", name()); + writer->Indent(); + if (descriptor_->is_packed()) { + writer->WriteLine( + "output.WritePackedEnumArray($0$, field_names[$2$], $1$MemoizedSerializedSize, $1$_);", + number(), name(), field_ordinal()); + } else { + writer->WriteLine("output.WriteEnumArray($0$, field_names[$2$], $1$_);", + number(), name(), field_ordinal()); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + writer->WriteLine("{"); + writer->Indent(); + writer->WriteLine("int dataSize = 0;"); + writer->WriteLine("if ($0$_.Count > 0) {", name()); + writer->Indent(); + writer->WriteLine("foreach ($0$ element in $1$_) {", type_name(), name()); + writer->WriteLine( + " dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);"); + writer->WriteLine("}"); + writer->WriteLine("size += dataSize;"); + int tagSize = internal::WireFormat::TagSize(descriptor_->number(), descriptor_->type()); + if (descriptor_->is_packed()) { + writer->WriteLine("size += $0$;", SimpleItoa(tagSize)); + writer->WriteLine( + "size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize);"); + } else { + writer->WriteLine("size += $0$ * $1$_.Count;", SimpleItoa(tagSize), name()); + } + writer->Outdent(); + writer->WriteLine("}"); + // cache the data size for packed fields. + if (descriptor_->is_packed()) { + writer->WriteLine("$0$MemoizedSerializedSize = dataSize;", name()); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedEnumFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("foreach($0$ i in $1$_)", type_name(), name()); + writer->WriteLine(" hash ^= i.GetHashCode();"); +} + +void RepeatedEnumFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine("if($0$_.Count != other.$0$_.Count) return false;", name()); + writer->WriteLine("for(int ix=0; ix < $0$_.Count; ix++)", name()); + writer->WriteLine(" if(!$0$_[ix].Equals(other.$0$_[ix])) return false;", + name()); +} + +void RepeatedEnumFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$0$\", $1$_, writer);", descriptor_->name(), + name()); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h new file mode 100644 index 00000000..c872131c --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h @@ -0,0 +1,73 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class RepeatedEnumFieldGenerator : public FieldGeneratorBase { + public: + RepeatedEnumFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~RepeatedEnumFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedEnumFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_ENUM_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc new file mode 100644 index 00000000..2dfcd402 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc @@ -0,0 +1,201 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator( + const FieldDescriptor* descriptor, int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +RepeatedMessageFieldGenerator::~RepeatedMessageFieldGenerator() { + +} + +void RepeatedMessageFieldGenerator::GenerateMembers(Writer* writer) { + writer->WriteLine( + "private pbc::PopsicleList<$0$> $1$_ = new pbc::PopsicleList<$0$>();", + type_name(), name()); + AddDeprecatedFlag(writer); + writer->WriteLine("public scg::IList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return $0$_; }", name()); + writer->WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return $0$_.Count; }", name()); + writer->WriteLine("}"); + + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return $0$_[index];", name()); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::GenerateBuilderMembers(Writer* writer) { + // Note: We can return the original list here, because we make it unmodifiable when we build + // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddDeprecatedFlag(writer); + writer->WriteLine("public pbc::IPopsicleList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return PrepareBuilder().$0$_; }", name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return result.$0$Count; }", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return result.Get$0$(index);", property_name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Set$0$(int index, $1$ value) {", + property_name(), type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_[index] = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + // Extra overload for builder (just on messages) + AddDeprecatedFlag(writer); + writer->WriteLine( + "public Builder Set$0$(int index, $1$.Builder builderForValue) {", + property_name(), type_name()); + AddNullCheck(writer, "builderForValue"); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_[index] = builderForValue.Build();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Add$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(value);", name(), type_name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + // Extra overload for builder (just on messages) + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Add$0$($1$.Builder builderForValue) {", + property_name(), type_name()); + AddNullCheck(writer, "builderForValue"); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(builderForValue.Build());", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine( + "public Builder AddRange$0$(scg::IEnumerable<$1$> values) {", + property_name(), type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(values);", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Clear();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.$0$_.Count != 0) {", name()); + writer->WriteLine(" result.$0$_.Add(other.$0$_);", name()); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::GenerateBuildingCode(Writer* writer) { + writer->WriteLine("$0$_.MakeReadOnly();", name()); +} + +void RepeatedMessageFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine( + "input.Read$0$Array(tag, field_name, result.$1$_, $2$.DefaultInstance, extensionRegistry);", + message_or_group(), name(), type_name()); +} + +void RepeatedMessageFieldGenerator::GenerateSerializationCode(Writer* writer) { + writer->WriteLine("if ($0$_.Count > 0) {", name()); + writer->Indent(); + writer->WriteLine("output.Write$0$Array($1$, field_names[$3$], $2$_);", + message_or_group(), number(), name(), field_ordinal()); + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::GenerateSerializedSizeCode(Writer* writer) { + writer->WriteLine("foreach ($0$ element in $1$List) {", type_name(), + property_name()); + writer->WriteLine( + " size += pb::CodedOutputStream.Compute$0$Size($1$, element);", + message_or_group(), number()); + writer->WriteLine("}"); +} + +void RepeatedMessageFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("foreach($0$ i in $1$_)", type_name(), name()); + writer->WriteLine(" hash ^= i.GetHashCode();"); +} +void RepeatedMessageFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine("if($0$_.Count != other.$0$_.Count) return false;", name()); + writer->WriteLine("for(int ix=0; ix < $0$_.Count; ix++)", name()); + writer->WriteLine(" if(!$0$_[ix].Equals(other.$0$_[ix])) return false;", + name()); +} +void RepeatedMessageFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$0$\", $1$_, writer);", + GetFieldName(descriptor_), name()); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h new file mode 100644 index 00000000..104274cb --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h @@ -0,0 +1,73 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class RepeatedMessageFieldGenerator : public FieldGeneratorBase { + public: + RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~RepeatedMessageFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_MESSAGE_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc new file mode 100644 index 00000000..8b285468 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc @@ -0,0 +1,219 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +RepeatedPrimitiveFieldGenerator::RepeatedPrimitiveFieldGenerator( + const FieldDescriptor* descriptor, int fieldOrdinal) + : FieldGeneratorBase(descriptor, fieldOrdinal) { +} + +RepeatedPrimitiveFieldGenerator::~RepeatedPrimitiveFieldGenerator() { + +} + +void RepeatedPrimitiveFieldGenerator::GenerateMembers(Writer* writer) { + if (descriptor_->is_packed() && optimize_speed()) { + writer->WriteLine("private int $0$MemoizedSerializedSize;", name()); + } + writer->WriteLine( + "private pbc::PopsicleList<$0$> $1$_ = new pbc::PopsicleList<$0$>();", + type_name(), name()); + AddPublicMemberAttributes(writer); + writer->WriteLine("public scg::IList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return pbc::Lists.AsReadOnly($0$_); }", name()); + writer->WriteLine("}"); + + // TODO(jonskeet): Redundant API calls? Possibly - include for portability though. Maybe create an option. + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return $0$_.Count; }", name()); + writer->WriteLine("}"); + + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return $0$_[index];", name()); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::GenerateBuilderMembers(Writer* writer) { + // Note: We can return the original list here, because we make it unmodifiable when we build + // We return it via IPopsicleList so that collection initializers work more pleasantly. + AddPublicMemberAttributes(writer); + writer->WriteLine("public pbc::IPopsicleList<$0$> $1$List {", type_name(), + property_name()); + writer->WriteLine(" get { return PrepareBuilder().$0$_; }", name()); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public int $0$Count {", property_name()); + writer->WriteLine(" get { return result.$0$Count; }", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public $0$ Get$1$(int index) {", type_name(), + property_name()); + writer->WriteLine(" return result.Get$0$(index);", property_name()); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public Builder Set$0$(int index, $1$ value) {", + property_name(), type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_[index] = value;", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine("public Builder Add$0$($1$ value) {", property_name(), + type_name()); + AddNullCheck(writer); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(value);", name(), type_name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddPublicMemberAttributes(writer); + writer->WriteLine( + "public Builder AddRange$0$(scg::IEnumerable<$1$> values) {", + property_name(), type_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Add(values);", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); + AddDeprecatedFlag(writer); + writer->WriteLine("public Builder Clear$0$() {", property_name()); + writer->WriteLine(" PrepareBuilder();"); + writer->WriteLine(" result.$0$_.Clear();", name()); + writer->WriteLine(" return this;"); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::GenerateMergingCode(Writer* writer) { + writer->WriteLine("if (other.$0$_.Count != 0) {", name()); + writer->WriteLine(" result.$0$_.Add(other.$0$_);", name()); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::GenerateBuildingCode(Writer* writer) { + writer->WriteLine("$0$_.MakeReadOnly();", name()); +} + +void RepeatedPrimitiveFieldGenerator::GenerateParsingCode(Writer* writer) { + writer->WriteLine("input.Read$0$Array(tag, field_name, result.$1$_);", + capitalized_type_name(), name()); +} + +void RepeatedPrimitiveFieldGenerator::GenerateSerializationCode( + Writer* writer) { + writer->WriteLine("if ($0$_.Count > 0) {", name()); + writer->Indent(); + if (descriptor_->is_packed()) { + writer->WriteLine( + "output.WritePacked$0$Array($1$, field_names[$3$], $2$MemoizedSerializedSize, $2$_);", + capitalized_type_name(), number(), name(), field_ordinal()); + } else { + writer->WriteLine("output.Write$0$Array($1$, field_names[$3$], $2$_);", + capitalized_type_name(), number(), name(), + field_ordinal()); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::GenerateSerializedSizeCode( + Writer* writer) { + writer->WriteLine("{"); + writer->Indent(); + writer->WriteLine("int dataSize = 0;"); + int fixedSize = GetFixedSize(descriptor_->type()); + if (fixedSize == -1) { + writer->WriteLine("foreach ($0$ element in $1$List) {", type_name(), + property_name()); + writer->WriteLine( + " dataSize += pb::CodedOutputStream.Compute$0$SizeNoTag(element);", + capitalized_type_name(), number()); + writer->WriteLine("}"); + } else { + writer->WriteLine("dataSize = $0$ * $1$_.Count;", SimpleItoa(fixedSize), name()); + } + writer->WriteLine("size += dataSize;"); + int tagSize = internal::WireFormat::TagSize(descriptor_->number(), descriptor_->type()); + if (descriptor_->is_packed()) { + writer->WriteLine("if ($0$_.Count != 0) {", name()); + writer->WriteLine( + " size += $0$ + pb::CodedOutputStream.ComputeInt32SizeNoTag(dataSize);", + SimpleItoa(tagSize)); + writer->WriteLine("}"); + } else { + writer->WriteLine("size += $0$ * $1$_.Count;", SimpleItoa(tagSize), name()); + } + // cache the data size for packed fields. + if (descriptor_->is_packed()) { + writer->WriteLine("$0$MemoizedSerializedSize = dataSize;", name()); + } + writer->Outdent(); + writer->WriteLine("}"); +} + +void RepeatedPrimitiveFieldGenerator::WriteHash(Writer* writer) { + writer->WriteLine("foreach($0$ i in $1$_)", type_name(), name()); + writer->WriteLine(" hash ^= i.GetHashCode();"); +} +void RepeatedPrimitiveFieldGenerator::WriteEquals(Writer* writer) { + writer->WriteLine("if($0$_.Count != other.$0$_.Count) return false;", name()); + writer->WriteLine("for(int ix=0; ix < $0$_.Count; ix++)", name()); + writer->WriteLine(" if(!$0$_[ix].Equals(other.$0$_[ix])) return false;", + name()); +} +void RepeatedPrimitiveFieldGenerator::WriteToString(Writer* writer) { + writer->WriteLine("PrintField(\"$0$\", $1$_, writer);", descriptor_->name(), + name()); +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h new file mode 100644 index 00000000..07b12015 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h @@ -0,0 +1,73 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class RepeatedPrimitiveFieldGenerator : public FieldGeneratorBase { + public: + RepeatedPrimitiveFieldGenerator(const FieldDescriptor* descriptor, int fieldOrdinal); + ~RepeatedPrimitiveFieldGenerator(); + + virtual void GenerateMembers(Writer* writer); + virtual void GenerateBuilderMembers(Writer* writer); + virtual void GenerateMergingCode(Writer* writer); + virtual void GenerateBuildingCode(Writer* writer); + virtual void GenerateParsingCode(Writer* writer); + virtual void GenerateSerializationCode(Writer* writer); + virtual void GenerateSerializedSizeCode(Writer* writer); + + virtual void WriteHash(Writer* writer); + virtual void WriteEquals(Writer* writer); + virtual void WriteToString(Writer* writer); + + private: + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPrimitiveFieldGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_REPEATED_PRIMITIVE_FIELD_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc b/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc new file mode 100644 index 00000000..e39911ee --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc @@ -0,0 +1,80 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +SourceGeneratorBase::SourceGeneratorBase(const FileDescriptor* descriptor) + : descriptor_(descriptor) { + optimizeSize_ = (descriptor->options().optimize_for() + == FileOptions::CODE_SIZE); + optimizeSpeed_ = (descriptor->options().optimize_for() == FileOptions::SPEED); + useLiteRuntime_ = (descriptor->options().optimize_for() + == FileOptions::LITE_RUNTIME); + + optimizeSpeed_ |= useLiteRuntime_; + runtimeSuffix_ = useLiteRuntime_ ? "Lite" : ""; +} + +SourceGeneratorBase::~SourceGeneratorBase() { +} + +void SourceGeneratorBase::WriteGeneratedCodeAttributes(Writer* writer) { + // This hook can be used to reintroduce generated code attributes in the future. +} + +std::string SourceGeneratorBase::class_access_level() { + return "public"; // public_classes is always on. +} + +bool SourceGeneratorBase::cls_compliance() { + // TODO(jtattermusch): implement this based on "cls_compliance" cmdline param. + return true; +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h b/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h new file mode 100644 index 00000000..dbc65d04 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h @@ -0,0 +1,84 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_SOURCE_GENERATOR_BASE_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_SOURCE_GENERATOR_BASE_H__ + +#include + +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class SourceGeneratorBase { + protected: + SourceGeneratorBase(const FileDescriptor* descriptor); + virtual ~SourceGeneratorBase(); + + std::string class_access_level(); + bool cls_compliance(); + + bool optimize_size() { + return optimizeSize_; + } + bool optimize_speed() { + return optimizeSpeed_; + } + bool use_lite_runtime() { + return useLiteRuntime_; + } + std::string runtime_suffix() { + return runtimeSuffix_; + } + + void WriteGeneratedCodeAttributes(Writer* writer); + + private: + const FileDescriptor* descriptor_; + bool optimizeSize_; + bool optimizeSpeed_; + bool useLiteRuntime_; + std::string runtimeSuffix_; + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(SourceGeneratorBase); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_SOURCE_GENERATOR_BASE_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc new file mode 100644 index 00000000..358cfa4f --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.cc @@ -0,0 +1,286 @@ +// 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. + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +UmbrellaClassGenerator::UmbrellaClassGenerator(const FileDescriptor* file) + : SourceGeneratorBase(file), + file_(file) { + namespace_ = GetFileNamespace(file); + umbrellaClassname_ = GetFileUmbrellaClassname(file); + umbrellaNamespace_ = GetFileUmbrellaNamespace(file); +} + +UmbrellaClassGenerator::~UmbrellaClassGenerator() { +} + +void UmbrellaClassGenerator::Generate(Writer* writer) { + WriteIntroduction(writer); + WriteExtensionRegistration(writer); + + // write children: Extensions + if (file_->extension_count() > 0) { + writer->WriteLine("#region Extensions"); + for (int i = 0; i < file_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(file_->extension(i)); + extensionGenerator.Generate(writer); + } + writer->WriteLine("#endregion"); + writer->WriteLine(); + } + + writer->WriteLine("#region Static variables"); + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.GenerateStaticVariables(writer); + } + writer->WriteLine("#endregion"); + if (!use_lite_runtime()) { + WriteDescriptor(writer); + } else { + WriteLiteExtensions(writer); + } + // Close the class declaration. + writer->Outdent(); + writer->WriteLine("}"); + + // Close the namespace around the umbrella class if defined + if (!umbrellaNamespace_.empty()) { + writer->Outdent(); + writer->WriteLine("}"); + } + + // write children: Enums + if (file_->enum_type_count() > 0) { + writer->WriteLine("#region Enums"); + for (int i = 0; i < file_->enum_type_count(); i++) { + EnumGenerator enumGenerator(file_->enum_type(i)); + enumGenerator.Generate(writer); + } + writer->WriteLine("#endregion"); + writer->WriteLine(); + } + + // write children: Messages + if (file_->message_type_count() > 0) { + writer->WriteLine("#region Messages"); + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.Generate(writer); + } + writer->WriteLine("#endregion"); + writer->WriteLine(); + } + + // TODO(jtattermusch): add insertion point for services. + + if (!namespace_.empty()) { + writer->Outdent(); + writer->WriteLine("}"); + } + writer->WriteLine(); + writer->WriteLine("#endregion Designer generated code"); +} + +void UmbrellaClassGenerator::WriteIntroduction(Writer* writer) { + writer->WriteLine( + "// Generated by the protocol buffer compiler. DO NOT EDIT!"); + writer->WriteLine("// source: $0$", file_->name()); + writer->WriteLine("#pragma warning disable 1591, 0612, 3021"); + writer->WriteLine("#region Designer generated code"); + + writer->WriteLine(); + writer->WriteLine("using pb = global::Google.ProtocolBuffers;"); + writer->WriteLine("using pbc = global::Google.ProtocolBuffers.Collections;"); + writer->WriteLine("using pbd = global::Google.ProtocolBuffers.Descriptors;"); + writer->WriteLine("using scg = global::System.Collections.Generic;"); + + if (!namespace_.empty()) { + writer->WriteLine("namespace $0$ {", namespace_); + writer->Indent(); + writer->WriteLine(); + } + + // Add the namespace around the umbrella class if defined + if (!umbrellaNamespace_.empty()) { + writer->WriteLine("namespace $0$ {", umbrellaNamespace_); + writer->Indent(); + writer->WriteLine(); + } + + writer->WriteLine( + "[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]"); + WriteGeneratedCodeAttributes(writer); + writer->WriteLine("$0$ static partial class $1$ {", class_access_level(), + umbrellaClassname_); + writer->WriteLine(); + writer->Indent(); +} + +void UmbrellaClassGenerator::WriteExtensionRegistration(Writer* writer) { + writer->WriteLine("#region Extension registration"); + writer->WriteLine( + "public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {"); + writer->Indent(); + for (int i = 0; i < file_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(file_->extension(i)); + extensionGenerator.GenerateExtensionRegistrationCode(writer); + } + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.GenerateExtensionRegistrationCode(writer); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); +} + +void UmbrellaClassGenerator::WriteDescriptor(Writer* writer) { + writer->WriteLine("#region Descriptor"); + + writer->WriteLine("public static pbd::FileDescriptor Descriptor {"); + writer->WriteLine(" get { return descriptor; }"); + writer->WriteLine("}"); + writer->WriteLine("private static pbd::FileDescriptor descriptor;"); + writer->WriteLine(); + writer->WriteLine("static $0$() {", umbrellaClassname_); + writer->Indent(); + writer->WriteLine( + "byte[] descriptorData = global::System.Convert.FromBase64String("); + writer->Indent(); + writer->Indent(); + writer->WriteLine("string.Concat("); + writer->Indent(); + + // TODO(jonskeet): Consider a C#-escaping format here instead of just Base64. + std::string base64 = FileDescriptorToBase64(file_); + while (base64.size() > 60) { + writer->WriteLine("\"$0$\", ", base64.substr(0, 60)); + base64 = base64.substr(60); + } + writer->Outdent(); + writer->WriteLine("\"$0$\"));", base64); + writer->Outdent(); + writer->Outdent(); + writer->WriteLine( + "pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {"); + writer->Indent(); + writer->WriteLine("descriptor = root;"); + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.GenerateStaticVariableInitializers(writer); + } + for (int i = 0; i < file_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(file_->extension(i)); + extensionGenerator.GenerateStaticVariableInitializers(writer); + } + + if (uses_extensions()) { + // Must construct an ExtensionRegistry containing all possible extensions + // and return it. + writer->WriteLine( + "pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance();"); + writer->WriteLine("RegisterAllExtensions(registry);"); + for (int i = 0; i < file_->dependency_count(); i++) { + writer->WriteLine("$0$.RegisterAllExtensions(registry);", + GetFullUmbrellaClassName(file_->dependency(i))); + } + writer->WriteLine("return registry;"); + } else { + writer->WriteLine("return null;"); + } + writer->Outdent(); + writer->WriteLine("};"); + + // ----------------------------------------------------------------- + // Invoke internalBuildGeneratedFileFrom() to build the file. + writer->WriteLine( + "pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,"); + writer->WriteLine(" new pbd::FileDescriptor[] {"); + for (int i = 0; i < file_->dependency_count(); i++) { + writer->WriteLine(" $0$.Descriptor, ", + GetFullUmbrellaClassName(file_->dependency(i))); + } + writer->WriteLine(" }, assigner);"); + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); + writer->WriteLine(); +} + +void UmbrellaClassGenerator::WriteLiteExtensions(Writer* writer) { + writer->WriteLine("#region Extensions"); + writer->WriteLine("internal static readonly object Descriptor;"); + writer->WriteLine("static $0$() {", umbrellaClassname_); + writer->Indent(); + writer->WriteLine("Descriptor = null;"); + for (int i = 0; i < file_->message_type_count(); i++) { + MessageGenerator messageGenerator(file_->message_type(i)); + messageGenerator.GenerateStaticVariableInitializers(writer); + } + for (int i = 0; i < file_->extension_count(); i++) { + ExtensionGenerator extensionGenerator(file_->extension(i)); + extensionGenerator.GenerateStaticVariableInitializers(writer); + } + writer->Outdent(); + writer->WriteLine("}"); + writer->WriteLine("#endregion"); + writer->WriteLine(); +} + +bool UmbrellaClassGenerator::uses_extensions() { + // TODO(jtattermusch): implement recursive descent that looks for extensions. + // For now, we conservatively assume that extensions are used. + return true; +} + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_umbrella_class.h b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.h new file mode 100644 index 00000000..757f8f91 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_umbrella_class.h @@ -0,0 +1,76 @@ +// 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. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_UMBRELLA_CLASS_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_UMBRELLA_CLASS_H__ + +#include + +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +class Writer; + +class UmbrellaClassGenerator : public SourceGeneratorBase { + public: + UmbrellaClassGenerator(const FileDescriptor* file); + ~UmbrellaClassGenerator(); + + void Generate(Writer* write); + + private: + const FileDescriptor* file_; + + std::string namespace_; + std::string umbrellaClassname_; + std::string umbrellaNamespace_; + + void WriteIntroduction(Writer* writer); + void WriteExtensionRegistration(Writer* writer); + void WriteDescriptor(Writer* writer); + void WriteLiteExtensions(Writer* write); + + bool uses_extensions(); + + GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(UmbrellaClassGenerator); +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google + +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_UMBRELLA_CLASS_H__ + diff --git a/src/google/protobuf/compiler/csharp/csharp_writer.cc b/src/google/protobuf/compiler/csharp/csharp_writer.cc new file mode 100644 index 00000000..2bcafde5 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_writer.cc @@ -0,0 +1,136 @@ +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +Writer::Writer(google::protobuf::io::Printer* printer) + : printer_(printer), + newline_("\n") { + // TODO(jtattermusch): make newline customizable. +} + +Writer::~Writer() { +} + +void Writer::Indent() { + printer_->Indent(); +} + +void Writer::Outdent() { + printer_->Outdent(); +} + +void Writer::Write(const char* text) { + printer_->Print(text); +} + +void Writer::Write(const char* text, const string& value0) { + printer_->Print(text, "0", value0); +} + +void Writer::Write(const char* text, const string& value0, + const string& value1) { + printer_->Print(text, "0", value0, "1", value1); +} + +void Writer::Write(const char* text, const string& value0, const string& value1, + const string& value2) { + printer_->Print(text, "0", value0, "1", value1, "2", value2); +} + +void Writer::Write(const char* text, const string& value0, const string& value1, + const string& value2, const string& value3) { + printer_->Print(text, "0", value0, "1", value1, "2", value2, "3", value3); +} + +void Writer::WriteLine() { + printer_->Print(newline_); +} + +void Writer::WriteLine(const char* text) { + Write(text); + WriteLine(); +} + +void Writer::WriteLine(const char* text, const string& value0) { + Write(text, value0); + WriteLine(); +} + +void Writer::WriteLine(const char* text, const string& value0, + const string& value1) { + Write(text, value0, value1); + WriteLine(); +} + +void Writer::WriteLine(const char* text, const string& value0, + const string& value1, const string& value2) { + Write(text, value0, value1, value2); + WriteLine(); +} + +void Writer::WriteLine(const char* text, const string& value0, + const string& value1, const string& value2, + const string& value3) { + Write(text, value0, value1, value2, value3); + WriteLine(); +} + +} // namespace java +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/csharp/csharp_writer.h b/src/google/protobuf/compiler/csharp/csharp_writer.h new file mode 100644 index 00000000..26c59b31 --- /dev/null +++ b/src/google/protobuf/compiler/csharp/csharp_writer.h @@ -0,0 +1,93 @@ +// 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. + +// Author: kenton@google.com (Kenton Varda) +// Based on original Protocol Buffers design by +// Sanjay Ghemawat, Jeff Dean, and others. + +#ifndef GOOGLE_PROTOBUF_COMPILER_CSHARP_WRITER_H__ +#define GOOGLE_PROTOBUF_COMPILER_CSHARP_WRITER_H__ + +#include +#include +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace csharp { + +// Simple wrapper around Printer that supports customizable line endings +// and number-based variables (e.g. $0$). +class Writer { + public: + Writer(io::Printer* printer); + ~Writer(); + + void Indent(); + void Outdent(); + + void Write(const char* text); + + void Write(const char* text, const string& value0); + + void Write(const char* text, const string& value0, const string& value1); + + void Write(const char* text, const string& value0, const string& value1, + const string& value2); + + void Write(const char* text, const string& value0, const string& value1, + const string& value2, const string& value3); + + void WriteLine(); + + void WriteLine(const char* text); + + void WriteLine(const char* text, const string& value0); + + void WriteLine(const char* text, const string& value0, const string& value1); + + void WriteLine(const char* text, const string& value0, const string& value1, + const string& value2); + + void WriteLine(const char* text, const string& value0, const string& value1, + const string& value2, const string& value3); + private: + io::Printer* printer_; + const char* newline_; +}; + +} // namespace csharp +} // namespace compiler +} // namespace protobuf +} // namespace google +#endif // GOOGLE_PROTOBUF_COMPILER_CSHARP_WRITER_H__ diff --git a/src/google/protobuf/compiler/main.cc b/src/google/protobuf/compiler/main.cc index 931b8fa3..bc2da38e 100644 --- a/src/google/protobuf/compiler/main.cc +++ b/src/google/protobuf/compiler/main.cc @@ -36,6 +36,7 @@ #include #include #include +#include int main(int argc, char* argv[]) { @@ -68,5 +69,10 @@ int main(int argc, char* argv[]) { cli.RegisterGenerator("--ruby_out", &rb_generator, "Generate Ruby source file."); + // CSharp + google::protobuf::compiler::csharp::Generator csharp_generator; + cli.RegisterGenerator("--csharp_out", &csharp_generator, + "Generate C# source file."); + return cli.Run(argc, argv); } diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index 9556206c..9e703d96 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -289,7 +289,7 @@ void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto() { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(MethodDescriptorProto, _internal_metadata_), -1); FileOptions_descriptor_ = file->message_type(9); - static const int FileOptions_offsets_[14] = { + static const int FileOptions_offsets_[15] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_package_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_outer_classname_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, java_multiple_files_), @@ -303,6 +303,7 @@ void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto() { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, deprecated_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, cc_enable_arenas_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, objc_class_prefix_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, csharp_namespace_), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FileOptions, uninterpreted_option_), }; FileOptions_reflection_ = @@ -663,7 +664,7 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { "t_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.google.p" "rotobuf.MethodOptions\022\037\n\020client_streamin" "g\030\005 \001(\010:\005false\022\037\n\020server_streaming\030\006 \001(\010" - ":\005false\"\347\004\n\013FileOptions\022\024\n\014java_package\030" + ":\005false\"\201\005\n\013FileOptions\022\024\n\014java_package\030" "\001 \001(\t\022\034\n\024java_outer_classname\030\010 \001(\t\022\"\n\023j" "ava_multiple_files\030\n \001(\010:\005false\022,\n\035java_" "generate_equals_and_hash\030\024 \001(\010:\005false\022%\n" @@ -675,50 +676,51 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { "se\022\"\n\023py_generic_services\030\022 \001(\010:\005false\022\031" "\n\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enable_a" "renas\030\037 \001(\010:\005false\022\031\n\021objc_class_prefix\030" - "$ \001(\t\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.g" - "oogle.protobuf.UninterpretedOption\":\n\014Op" - "timizeMode\022\t\n\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014" - "LITE_RUNTIME\020\003*\t\010\350\007\020\200\200\200\200\002\"\346\001\n\016MessageOpt" - "ions\022&\n\027message_set_wire_format\030\001 \001(\010:\005f" - "alse\022.\n\037no_standard_descriptor_accessor\030" - "\002 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005false\022" - "\021\n\tmap_entry\030\007 \001(\010\022C\n\024uninterpreted_opti" - "on\030\347\007 \003(\0132$.google.protobuf.Uninterprete" - "dOption*\t\010\350\007\020\200\200\200\200\002\"\240\002\n\014FieldOptions\022:\n\005c" - "type\030\001 \001(\0162#.google.protobuf.FieldOption" - "s.CType:\006STRING\022\016\n\006packed\030\002 \001(\010\022\023\n\004lazy\030" - "\005 \001(\010:\005false\022\031\n\ndeprecated\030\003 \001(\010:\005false\022" - "\023\n\004weak\030\n \001(\010:\005false\022C\n\024uninterpreted_op" - "tion\030\347\007 \003(\0132$.google.protobuf.Uninterpre" - "tedOption\"/\n\005CType\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001" - "\022\020\n\014STRING_PIECE\020\002*\t\010\350\007\020\200\200\200\200\002\"\215\001\n\013EnumOp" - "tions\022\023\n\013allow_alias\030\002 \001(\010\022\031\n\ndeprecated" - "\030\003 \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007" - " \003(\0132$.google.protobuf.UninterpretedOpti" - "on*\t\010\350\007\020\200\200\200\200\002\"}\n\020EnumValueOptions\022\031\n\ndep" - "recated\030\001 \001(\010:\005false\022C\n\024uninterpreted_op" - "tion\030\347\007 \003(\0132$.google.protobuf.Uninterpre" - "tedOption*\t\010\350\007\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031" - "\n\ndeprecated\030! \001(\010:\005false\022C\n\024uninterpret" - "ed_option\030\347\007 \003(\0132$.google.protobuf.Unint" - "erpretedOption*\t\010\350\007\020\200\200\200\200\002\"z\n\rMethodOptio" - "ns\022\031\n\ndeprecated\030! \001(\010:\005false\022C\n\024uninter" - "preted_option\030\347\007 \003(\0132$.google.protobuf.U" - "ninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023Uninte" - "rpretedOption\022;\n\004name\030\002 \003(\0132-.google.pro" - "tobuf.UninterpretedOption.NamePart\022\030\n\020id" - "entifier_value\030\003 \001(\t\022\032\n\022positive_int_val" - "ue\030\004 \001(\004\022\032\n\022negative_int_value\030\005 \001(\003\022\024\n\014" - "double_value\030\006 \001(\001\022\024\n\014string_value\030\007 \001(\014" - "\022\027\n\017aggregate_value\030\010 \001(\t\0323\n\010NamePart\022\021\n" - "\tname_part\030\001 \002(\t\022\024\n\014is_extension\030\002 \002(\010\"\325" - "\001\n\016SourceCodeInfo\022:\n\010location\030\001 \003(\0132(.go" - "ogle.protobuf.SourceCodeInfo.Location\032\206\001" - "\n\010Location\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003" - "(\005B\002\020\001\022\030\n\020leading_comments\030\003 \001(\t\022\031\n\021trai" - "ling_comments\030\004 \001(\t\022!\n\031leading_detached_" - "comments\030\006 \003(\tB)\n\023com.google.protobufB\020D" - "escriptorProtosH\001", 4617); + "$ \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022C\n\024unint" + "erpreted_option\030\347\007 \003(\0132$.google.protobuf" + ".UninterpretedOption\":\n\014OptimizeMode\022\t\n\005" + "SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003" + "*\t\010\350\007\020\200\200\200\200\002\"\346\001\n\016MessageOptions\022&\n\027messag" + "e_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_sta" + "ndard_descriptor_accessor\030\002 \001(\010:\005false\022\031" + "\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030\007" + " \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go" + "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200" + "\200\200\200\002\"\240\002\n\014FieldOptions\022:\n\005ctype\030\001 \001(\0162#.g" + "oogle.protobuf.FieldOptions.CType:\006STRIN" + "G\022\016\n\006packed\030\002 \001(\010\022\023\n\004lazy\030\005 \001(\010:\005false\022\031" + "\n\ndeprecated\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:" + "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$." + "google.protobuf.UninterpretedOption\"/\n\005C" + "Type\022\n\n\006STRING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIE" + "CE\020\002*\t\010\350\007\020\200\200\200\200\002\"\215\001\n\013EnumOptions\022\023\n\013allow" + "_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022" + "C\n\024uninterpreted_option\030\347\007 \003(\0132$.google." + "protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"" + "}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010:" + "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$." + "google.protobuf.UninterpretedOption*\t\010\350\007" + "\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030!" + " \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003" + "(\0132$.google.protobuf.UninterpretedOption" + "*\t\010\350\007\020\200\200\200\200\002\"z\n\rMethodOptions\022\031\n\ndeprecat" + "ed\030! \001(\010:\005false\022C\n\024uninterpreted_option\030" + "\347\007 \003(\0132$.google.protobuf.UninterpretedOp" + "tion*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022" + ";\n\004name\030\002 \003(\0132-.google.protobuf.Uninterp" + "retedOption.NamePart\022\030\n\020identifier_value" + "\030\003 \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022ne" + "gative_int_value\030\005 \001(\003\022\024\n\014double_value\030\006" + " \001(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggregate_" + "value\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part\030\001 \002" + "(\t\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceCodeI" + "nfo\022:\n\010location\030\001 \003(\0132(.google.protobuf." + "SourceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004" + "path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020lead" + "ing_comments\030\003 \001(\t\022\031\n\021trailing_comments\030" + "\004 \001(\t\022!\n\031leading_detached_comments\030\006 \003(\t" + "B)\n\023com.google.protobufB\020DescriptorProto" + "sH\001", 4643); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/descriptor.proto", &protobuf_RegisterTypes); FileDescriptorSet::default_instance_ = new FileDescriptorSet(); @@ -7016,6 +7018,7 @@ const int FileOptions::kPyGenericServicesFieldNumber; const int FileOptions::kDeprecatedFieldNumber; const int FileOptions::kCcEnableArenasFieldNumber; const int FileOptions::kObjcClassPrefixFieldNumber; +const int FileOptions::kCsharpNamespaceFieldNumber; const int FileOptions::kUninterpretedOptionFieldNumber; #endif // !_MSC_VER @@ -7052,6 +7055,7 @@ void FileOptions::SharedCtor() { deprecated_ = false; cc_enable_arenas_ = false; objc_class_prefix_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + csharp_namespace_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -7065,6 +7069,7 @@ void FileOptions::SharedDtor() { java_outer_classname_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); go_package_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); objc_class_prefix_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + csharp_namespace_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != default_instance_) { } } @@ -7117,11 +7122,14 @@ void FileOptions::Clear() { go_package_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } } - if (_has_bits_[8 / 32] & 7936) { + if (_has_bits_[8 / 32] & 16128) { ZR_(java_generic_services_, cc_enable_arenas_); if (has_objc_class_prefix()) { objc_class_prefix_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } + if (has_csharp_namespace()) { + csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } } #undef ZR_HELPER_ @@ -7347,6 +7355,23 @@ bool FileOptions::MergePartialFromCodedStream( } else { goto handle_unusual; } + if (input->ExpectTag(298)) goto parse_csharp_namespace; + break; + } + + // optional string csharp_namespace = 37; + case 37: { + if (tag == 298) { + parse_csharp_namespace: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_csharp_namespace())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->csharp_namespace().data(), this->csharp_namespace().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.FileOptions.csharp_namespace"); + } else { + goto handle_unusual; + } if (input->ExpectTag(7994)) goto parse_uninterpreted_option; break; } @@ -7481,6 +7506,16 @@ void FileOptions::SerializeWithCachedSizes( 36, this->objc_class_prefix(), output); } + // optional string csharp_namespace = 37; + if (has_csharp_namespace()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->csharp_namespace().data(), this->csharp_namespace().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.csharp_namespace"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 37, this->csharp_namespace(), output); + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( @@ -7591,6 +7626,17 @@ void FileOptions::SerializeWithCachedSizes( 36, this->objc_class_prefix(), target); } + // optional string csharp_namespace = 37; + if (has_csharp_namespace()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->csharp_namespace().data(), this->csharp_namespace().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.FileOptions.csharp_namespace"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 37, this->csharp_namespace(), target); + } + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; for (unsigned int i = 0, n = this->uninterpreted_option_size(); i < n; i++) { target = ::google::protobuf::internal::WireFormatLite:: @@ -7662,7 +7708,7 @@ int FileOptions::ByteSize() const { } } - if (_has_bits_[8 / 32] & 7936) { + if (_has_bits_[8 / 32] & 16128) { // optional bool java_generic_services = 17 [default = false]; if (has_java_generic_services()) { total_size += 2 + 1; @@ -7690,6 +7736,13 @@ int FileOptions::ByteSize() const { this->objc_class_prefix()); } + // optional string csharp_namespace = 37; + if (has_csharp_namespace()) { + total_size += 2 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->csharp_namespace()); + } + } // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; total_size += 2 * this->uninterpreted_option_size(); @@ -7773,6 +7826,10 @@ void FileOptions::MergeFrom(const FileOptions& from) { set_has_objc_class_prefix(); objc_class_prefix_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.objc_class_prefix_); } + if (from.has_csharp_namespace()) { + set_has_csharp_namespace(); + csharp_namespace_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.csharp_namespace_); + } } _extensions_.MergeFrom(from._extensions_); if (from._internal_metadata_.have_unknown_fields()) { @@ -7817,6 +7874,7 @@ void FileOptions::InternalSwap(FileOptions* other) { std::swap(deprecated_, other->deprecated_); std::swap(cc_enable_arenas_, other->cc_enable_arenas_); objc_class_prefix_.Swap(&other->objc_class_prefix_); + csharp_namespace_.Swap(&other->csharp_namespace_); uninterpreted_option_.UnsafeArenaSwap(&other->uninterpreted_option_); std::swap(_has_bits_[0], other->_has_bits_[0]); _internal_metadata_.Swap(&other->_internal_metadata_); @@ -8264,6 +8322,59 @@ void FileOptions::InternalSwap(FileOptions* other) { // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix) } +// optional string csharp_namespace = 37; + bool FileOptions::has_csharp_namespace() const { + return (_has_bits_[0] & 0x00002000u) != 0; +} + void FileOptions::set_has_csharp_namespace() { + _has_bits_[0] |= 0x00002000u; +} + void FileOptions::clear_has_csharp_namespace() { + _has_bits_[0] &= ~0x00002000u; +} + void FileOptions::clear_csharp_namespace() { + csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_csharp_namespace(); +} + const ::std::string& FileOptions::csharp_namespace() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace) + return csharp_namespace_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void FileOptions::set_csharp_namespace(const ::std::string& value) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace) +} + void FileOptions::set_csharp_namespace(const char* value) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.csharp_namespace) +} + void FileOptions::set_csharp_namespace(const char* value, size_t size) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace) +} + ::std::string* FileOptions::mutable_csharp_namespace() { + set_has_csharp_namespace(); + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace) + return csharp_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* FileOptions::release_csharp_namespace() { + clear_has_csharp_namespace(); + return csharp_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_namespace) { + if (csharp_namespace != NULL) { + set_has_csharp_namespace(); + } else { + clear_has_csharp_namespace(); + } + csharp_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int FileOptions::uninterpreted_option_size() const { return uninterpreted_option_.size(); diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index d8cba659..5bebf4fd 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -1837,6 +1837,18 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { ::std::string* release_objc_class_prefix(); void set_allocated_objc_class_prefix(::std::string* objc_class_prefix); + // optional string csharp_namespace = 37; + bool has_csharp_namespace() const; + void clear_csharp_namespace(); + static const int kCsharpNamespaceFieldNumber = 37; + const ::std::string& csharp_namespace() const; + void set_csharp_namespace(const ::std::string& value); + void set_csharp_namespace(const char* value); + void set_csharp_namespace(const char* value, size_t size); + ::std::string* mutable_csharp_namespace(); + ::std::string* release_csharp_namespace(); + void set_allocated_csharp_namespace(::std::string* csharp_namespace); + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; void clear_uninterpreted_option(); @@ -1878,6 +1890,8 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { inline void clear_has_cc_enable_arenas(); inline void set_has_objc_class_prefix(); inline void clear_has_objc_class_prefix(); + inline void set_has_csharp_namespace(); + inline void clear_has_csharp_namespace(); ::google::protobuf::internal::ExtensionSet _extensions_; @@ -1893,6 +1907,7 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { int optimize_for_; ::google::protobuf::internal::ArenaStringPtr go_package_; ::google::protobuf::internal::ArenaStringPtr objc_class_prefix_; + ::google::protobuf::internal::ArenaStringPtr csharp_namespace_; ::google::protobuf::RepeatedPtrField< ::google::protobuf::UninterpretedOption > uninterpreted_option_; bool java_generic_services_; bool py_generic_services_; @@ -5502,6 +5517,59 @@ inline void FileOptions::set_allocated_objc_class_prefix(::std::string* objc_cla // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix) } +// optional string csharp_namespace = 37; +inline bool FileOptions::has_csharp_namespace() const { + return (_has_bits_[0] & 0x00002000u) != 0; +} +inline void FileOptions::set_has_csharp_namespace() { + _has_bits_[0] |= 0x00002000u; +} +inline void FileOptions::clear_has_csharp_namespace() { + _has_bits_[0] &= ~0x00002000u; +} +inline void FileOptions::clear_csharp_namespace() { + csharp_namespace_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_csharp_namespace(); +} +inline const ::std::string& FileOptions::csharp_namespace() const { + // @@protoc_insertion_point(field_get:google.protobuf.FileOptions.csharp_namespace) + return csharp_namespace_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void FileOptions::set_csharp_namespace(const ::std::string& value) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.FileOptions.csharp_namespace) +} +inline void FileOptions::set_csharp_namespace(const char* value) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.FileOptions.csharp_namespace) +} +inline void FileOptions::set_csharp_namespace(const char* value, size_t size) { + set_has_csharp_namespace(); + csharp_namespace_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.FileOptions.csharp_namespace) +} +inline ::std::string* FileOptions::mutable_csharp_namespace() { + set_has_csharp_namespace(); + // @@protoc_insertion_point(field_mutable:google.protobuf.FileOptions.csharp_namespace) + return csharp_namespace_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* FileOptions::release_csharp_namespace() { + clear_has_csharp_namespace(); + return csharp_namespace_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_namespace) { + if (csharp_namespace != NULL) { + set_has_csharp_namespace(); + } else { + clear_has_csharp_namespace(); + } + csharp_namespace_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), csharp_namespace); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) +} + // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; inline int FileOptions::uninterpreted_option_size() const { return uninterpreted_option_.size(); diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index 367b16e5..a4b64f65 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -351,6 +351,9 @@ message FileOptions { // generated classes from this .proto. There is no default. optional string objc_class_prefix = 36; + // Namespace for generated classes; defaults to the package. + optional string csharp_namespace = 37; + // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -481,8 +484,6 @@ message FieldOptions { // For Google-internal migration only. Do not use. optional bool weak = 10 [default=false]; - - // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999;