Merge pull request #373 from jtattermusch/csharp_generate_proto

C# generate_proto.sh and buildall.sh scripts
pull/379/head
Jon Skeet 10 years ago
commit 98de125a7c
  1. 22
      csharp/buildall.sh
  2. 52
      csharp/generate_protos.sh
  3. 37
      csharp/mono/buildall.sh
  4. 29
      csharp/mono/generatesource.sh
  5. 91
      csharp/mono/readme.txt
  6. 2
      csharp/src/ProtocolBuffers.Test/ProtocolBuffers.Test.csproj
  7. 0
      csharp/src/ProtocolBuffers.Test/TestProtos/FieldPresenceTest.cs
  8. 22
      csharp/src/ProtocolBuffers.Test/TestProtos/GoogleSize.cs
  9. 22
      csharp/src/ProtocolBuffers.Test/TestProtos/GoogleSpeed.cs
  10. 95
      csharp/src/ProtocolBuffers.Test/TestProtos/UnittestDropUnknownFields.cs
  11. 4065
      csharp/src/ProtocolBuffers.Test/TestProtos/UnittestNoFieldPresence.cs
  12. 1320
      csharp/src/ProtocolBuffers.Test/TestProtos/UnittestPreserveUnknownEnum.cs
  13. 684
      csharp/src/ProtocolBuffers.Test/TestProtos/UnittestPreserveUnknownEnum2.cs
  14. 3
      csharp/src/ProtocolBuffersLite.Test/TestProtos/UnittestExtrasFull.cs
  15. 99
      csharp/src/ProtocolBuffersLite.Test/TestProtos/UnittestExtrasLite.cs
  16. 2277
      csharp/src/ProtocolBuffersLite.Test/TestProtos/UnittestExtrasXmltest.cs
  17. 4
      csharp/src/ProtocolBuffersLite.Test/TestProtos/UnittestImportLite.cs
  18. 4
      csharp/src/ProtocolBuffersLite.Test/TestProtos/UnittestImportPublicLite.cs
  19. 3437
      csharp/src/ProtocolBuffersLite.Test/TestProtos/UnittestIssues.cs

@ -0,0 +1,22 @@
#!/bin/bash
# Use mono to build solution and run all tests.
# Adjust these to reflect the location of nunit-console in your system.
NUNIT_CONSOLE=nunit-console
# The rest you can leave intact
CONFIG=Release
KEYFILE=../keys/Google.ProtocolBuffers.snk # TODO(jtattermusch): signing!
SRC=$(dirname $0)/src
set -ex
echo Building the solution.
xbuild /p:Configuration=$CONFIG $SRC/ProtocolBuffers.sln
echo Running tests.
$NUNIT_CONSOLE $SRC/ProtocolBuffers.Test/bin/$CONFIG/Google.ProtocolBuffers.Test.dll
$NUNIT_CONSOLE $SRC/ProtocolBuffersLite.Test/bin/$CONFIG/Google.ProtocolBuffersLite.Test.dll
$NUNIT_CONSOLE $SRC/ProtocolBuffersLite.Test/bin/$CONFIG/Google.ProtocolBuffersMixedLite.Test.dll

@ -0,0 +1,52 @@
#!/bin/bash
# Generates C# source files from .proto files.
# You first need to make sure protoc has been built (see instructions on
# building protoc in root of this repository)
set -ex
# cd to repository root
cd $(dirname $0)/..
# protocol buffer compiler to use
PROTOC=src/protoc
# Descriptor proto
#TODO(jtattermusch): generate descriptor.proto
# ProtocolBuffers.Test protos
$PROTOC -Isrc --csharp_out=csharp/src/ProtocolBuffers.Test/TestProtos \
src/google/protobuf/unittest.proto \
src/google/protobuf/unittest_custom_options.proto \
src/google/protobuf/unittest_drop_unknown_fields.proto \
src/google/protobuf/unittest_enormous_descriptor.proto \
src/google/protobuf/unittest_import.proto \
src/google/protobuf/unittest_import_public.proto \
src/google/protobuf/unittest_mset.proto \
src/google/protobuf/unittest_optimize_for.proto \
src/google/protobuf/unknown_enum_test.proto
$PROTOC -Icsharp/protos/extest --csharp_out=csharp/src/ProtocolBuffers.Test/TestProtos \
csharp/protos/extest/unittest_extras_xmltest.proto \
csharp/protos/extest/unittest_issues.proto
$PROTOC -Icsharp --csharp_out=csharp/src/ProtocolBuffers.Test/TestProtos \
csharp/protos/google/protobuf/field_presence_test.proto
$PROTOC -Ibenchmarks --csharp_out=csharp/src/ProtocolBuffers.Test/TestProtos \
benchmarks/google_size.proto \
benchmarks/google_speed.proto
# ProtocolBuffersLite.Test protos
$PROTOC -Isrc --csharp_out=csharp/src/ProtocolBuffersLite.Test/TestProtos \
src/google/protobuf/unittest.proto \
src/google/protobuf/unittest_import.proto \
src/google/protobuf/unittest_import_lite.proto \
src/google/protobuf/unittest_import_public.proto \
src/google/protobuf/unittest_import_public_lite.proto \
src/google/protobuf/unittest_lite.proto \
src/google/protobuf/unittest_lite_imports_nonlite.proto
$PROTOC -Icsharp/protos/extest --csharp_out=csharp/src/ProtocolBuffersLite.Test/TestProtos \
csharp/protos/extest/unittest_extras_full.proto \
csharp/protos/extest/unittest_extras_lite.proto

@ -1,37 +0,0 @@
#!/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

@ -1,29 +0,0 @@
#!/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

@ -1,91 +0,0 @@
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

@ -84,7 +84,7 @@
<Compile Include="Compatibility\TestResources.cs" /> <Compile Include="Compatibility\TestResources.cs" />
<Compile Include="Compatibility\TextCompatibilityTests.cs" /> <Compile Include="Compatibility\TextCompatibilityTests.cs" />
<Compile Include="Compatibility\XmlCompatibilityTests.cs" /> <Compile Include="Compatibility\XmlCompatibilityTests.cs" />
<Compile Include="TestProtos\FieldPresence.cs" /> <Compile Include="TestProtos\FieldPresenceTest.cs" />
<Compile Include="TestProtos\GoogleSize.cs" /> <Compile Include="TestProtos\GoogleSize.cs" />
<Compile Include="TestProtos\GoogleSpeed.cs" /> <Compile Include="TestProtos\GoogleSpeed.cs" />
<Compile Include="TestProtos\Unittest.cs" /> <Compile Include="TestProtos\Unittest.cs" />

@ -265,14 +265,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int Field5FieldNumber = 5; public const int Field5FieldNumber = 5;
private pbc::PopsicleList<ulong> field5_ = new pbc::PopsicleList<ulong>(); private pbc::PopsicleList<ulong> field5_ = new pbc::PopsicleList<ulong>();
[global::System.CLSCompliant(false)]
public scg::IList<ulong> Field5List { public scg::IList<ulong> Field5List {
get { return pbc::Lists.AsReadOnly(field5_); } get { return pbc::Lists.AsReadOnly(field5_); }
} }
public int Field5Count { public int Field5Count {
get { return field5_.Count; } get { return field5_.Count; }
} }
[global::System.CLSCompliant(false)]
public ulong GetField5(int index) { public ulong GetField5(int index) {
return field5_[index]; return field5_[index];
} }
@ -899,30 +897,25 @@ namespace Google.ProtocolBuffers.TestProtos {
return this; return this;
} }
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> Field5List { public pbc::IPopsicleList<ulong> Field5List {
get { return PrepareBuilder().field5_; } get { return PrepareBuilder().field5_; }
} }
public int Field5Count { public int Field5Count {
get { return result.Field5Count; } get { return result.Field5Count; }
} }
[global::System.CLSCompliant(false)]
public ulong GetField5(int index) { public ulong GetField5(int index) {
return result.GetField5(index); return result.GetField5(index);
} }
[global::System.CLSCompliant(false)]
public Builder SetField5(int index, ulong value) { public Builder SetField5(int index, ulong value) {
PrepareBuilder(); PrepareBuilder();
result.field5_[index] = value; result.field5_[index] = value;
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddField5(ulong value) { public Builder AddField5(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.field5_.Add(value); result.field5_.Add(value);
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddRangeField5(scg::IEnumerable<ulong> values) { public Builder AddRangeField5(scg::IEnumerable<ulong> values) {
PrepareBuilder(); PrepareBuilder();
result.field5_.Add(values); result.field5_.Add(values);
@ -1683,7 +1676,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField21 { public bool HasField21 {
get { return hasField21; } get { return hasField21; }
} }
[global::System.CLSCompliant(false)]
public ulong Field21 { public ulong Field21 {
get { return field21_; } get { return field21_; }
} }
@ -1724,7 +1716,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField203 { public bool HasField203 {
get { return hasField203; } get { return hasField203; }
} }
[global::System.CLSCompliant(false)]
public uint Field203 { public uint Field203 {
get { return field203_; } get { return field203_; }
} }
@ -1755,7 +1746,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField207 { public bool HasField207 {
get { return hasField207; } get { return hasField207; }
} }
[global::System.CLSCompliant(false)]
public ulong Field207 { public ulong Field207 {
get { return field207_; } get { return field207_; }
} }
@ -1766,7 +1756,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField300 { public bool HasField300 {
get { return hasField300; } get { return hasField300; }
} }
[global::System.CLSCompliant(false)]
public ulong Field300 { public ulong Field300 {
get { return field300_; } get { return field300_; }
} }
@ -2102,12 +2091,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField21 { public bool HasField21 {
get { return result.hasField21; } get { return result.hasField21; }
} }
[global::System.CLSCompliant(false)]
public ulong Field21 { public ulong Field21 {
get { return result.Field21; } get { return result.Field21; }
set { SetField21(value); } set { SetField21(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField21(ulong value) { public Builder SetField21(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.hasField21 = true; result.hasField21 = true;
@ -2184,12 +2171,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField203 { public bool HasField203 {
get { return result.hasField203; } get { return result.hasField203; }
} }
[global::System.CLSCompliant(false)]
public uint Field203 { public uint Field203 {
get { return result.Field203; } get { return result.Field203; }
set { SetField203(value); } set { SetField203(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField203(uint value) { public Builder SetField203(uint value) {
PrepareBuilder(); PrepareBuilder();
result.hasField203 = true; result.hasField203 = true;
@ -2247,12 +2232,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField207 { public bool HasField207 {
get { return result.hasField207; } get { return result.hasField207; }
} }
[global::System.CLSCompliant(false)]
public ulong Field207 { public ulong Field207 {
get { return result.Field207; } get { return result.Field207; }
set { SetField207(value); } set { SetField207(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField207(ulong value) { public Builder SetField207(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.hasField207 = true; result.hasField207 = true;
@ -2269,12 +2252,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField300 { public bool HasField300 {
get { return result.hasField300; } get { return result.hasField300; }
} }
[global::System.CLSCompliant(false)]
public ulong Field300 { public ulong Field300 {
get { return result.Field300; } get { return result.Field300; }
set { SetField300(value); } set { SetField300(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField300(ulong value) { public Builder SetField300(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.hasField300 = true; result.hasField300 = true;
@ -2402,7 +2383,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField15 { public bool HasField15 {
get { return hasField15; } get { return hasField15; }
} }
[global::System.CLSCompliant(false)]
public ulong Field15 { public ulong Field15 {
get { return field15_; } get { return field15_; }
} }
@ -2738,12 +2718,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField15 { public bool HasField15 {
get { return result.hasField15; } get { return result.hasField15; }
} }
[global::System.CLSCompliant(false)]
public ulong Field15 { public ulong Field15 {
get { return result.Field15; } get { return result.Field15; }
set { SetField15(value); } set { SetField15(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField15(ulong value) { public Builder SetField15(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.hasField15 = true; result.hasField15 = true;

@ -267,14 +267,12 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int Field5FieldNumber = 5; public const int Field5FieldNumber = 5;
private pbc::PopsicleList<ulong> field5_ = new pbc::PopsicleList<ulong>(); private pbc::PopsicleList<ulong> field5_ = new pbc::PopsicleList<ulong>();
[global::System.CLSCompliant(false)]
public scg::IList<ulong> Field5List { public scg::IList<ulong> Field5List {
get { return pbc::Lists.AsReadOnly(field5_); } get { return pbc::Lists.AsReadOnly(field5_); }
} }
public int Field5Count { public int Field5Count {
get { return field5_.Count; } get { return field5_.Count; }
} }
[global::System.CLSCompliant(false)]
public ulong GetField5(int index) { public ulong GetField5(int index) {
return field5_[index]; return field5_[index];
} }
@ -1540,30 +1538,25 @@ namespace Google.ProtocolBuffers.TestProtos {
return this; return this;
} }
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> Field5List { public pbc::IPopsicleList<ulong> Field5List {
get { return PrepareBuilder().field5_; } get { return PrepareBuilder().field5_; }
} }
public int Field5Count { public int Field5Count {
get { return result.Field5Count; } get { return result.Field5Count; }
} }
[global::System.CLSCompliant(false)]
public ulong GetField5(int index) { public ulong GetField5(int index) {
return result.GetField5(index); return result.GetField5(index);
} }
[global::System.CLSCompliant(false)]
public Builder SetField5(int index, ulong value) { public Builder SetField5(int index, ulong value) {
PrepareBuilder(); PrepareBuilder();
result.field5_[index] = value; result.field5_[index] = value;
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddField5(ulong value) { public Builder AddField5(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.field5_.Add(value); result.field5_.Add(value);
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddRangeField5(scg::IEnumerable<ulong> values) { public Builder AddRangeField5(scg::IEnumerable<ulong> values) {
PrepareBuilder(); PrepareBuilder();
result.field5_.Add(values); result.field5_.Add(values);
@ -2326,7 +2319,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField21 { public bool HasField21 {
get { return hasField21; } get { return hasField21; }
} }
[global::System.CLSCompliant(false)]
public ulong Field21 { public ulong Field21 {
get { return field21_; } get { return field21_; }
} }
@ -2367,7 +2359,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField203 { public bool HasField203 {
get { return hasField203; } get { return hasField203; }
} }
[global::System.CLSCompliant(false)]
public uint Field203 { public uint Field203 {
get { return field203_; } get { return field203_; }
} }
@ -2398,7 +2389,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField207 { public bool HasField207 {
get { return hasField207; } get { return hasField207; }
} }
[global::System.CLSCompliant(false)]
public ulong Field207 { public ulong Field207 {
get { return field207_; } get { return field207_; }
} }
@ -2409,7 +2399,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField300 { public bool HasField300 {
get { return hasField300; } get { return hasField300; }
} }
[global::System.CLSCompliant(false)]
public ulong Field300 { public ulong Field300 {
get { return field300_; } get { return field300_; }
} }
@ -3099,12 +3088,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField21 { public bool HasField21 {
get { return result.hasField21; } get { return result.hasField21; }
} }
[global::System.CLSCompliant(false)]
public ulong Field21 { public ulong Field21 {
get { return result.Field21; } get { return result.Field21; }
set { SetField21(value); } set { SetField21(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField21(ulong value) { public Builder SetField21(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.hasField21 = true; result.hasField21 = true;
@ -3181,12 +3168,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField203 { public bool HasField203 {
get { return result.hasField203; } get { return result.hasField203; }
} }
[global::System.CLSCompliant(false)]
public uint Field203 { public uint Field203 {
get { return result.Field203; } get { return result.Field203; }
set { SetField203(value); } set { SetField203(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField203(uint value) { public Builder SetField203(uint value) {
PrepareBuilder(); PrepareBuilder();
result.hasField203 = true; result.hasField203 = true;
@ -3244,12 +3229,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField207 { public bool HasField207 {
get { return result.hasField207; } get { return result.hasField207; }
} }
[global::System.CLSCompliant(false)]
public ulong Field207 { public ulong Field207 {
get { return result.Field207; } get { return result.Field207; }
set { SetField207(value); } set { SetField207(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField207(ulong value) { public Builder SetField207(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.hasField207 = true; result.hasField207 = true;
@ -3266,12 +3249,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField300 { public bool HasField300 {
get { return result.hasField300; } get { return result.hasField300; }
} }
[global::System.CLSCompliant(false)]
public ulong Field300 { public ulong Field300 {
get { return result.Field300; } get { return result.Field300; }
set { SetField300(value); } set { SetField300(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField300(ulong value) { public Builder SetField300(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.hasField300 = true; result.hasField300 = true;
@ -3403,7 +3384,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField15 { public bool HasField15 {
get { return hasField15; } get { return hasField15; }
} }
[global::System.CLSCompliant(false)]
public ulong Field15 { public ulong Field15 {
get { return field15_; } get { return field15_; }
} }
@ -4064,12 +4044,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasField15 { public bool HasField15 {
get { return result.hasField15; } get { return result.hasField15; }
} }
[global::System.CLSCompliant(false)]
public ulong Field15 { public ulong Field15 {
get { return result.Field15; } get { return result.Field15; }
set { SetField15(value); } set { SetField15(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetField15(ulong value) { public Builder SetField15(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.hasField15 = true; result.hasField15 = true;

@ -103,38 +103,24 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion #endregion
public const int Int32ValueFieldNumber = 1; public const int Int32ValueFieldNumber = 1;
private bool hasInt32Value;
private int int32Value_; private int int32Value_;
public bool HasInt32Value {
get { return hasInt32Value; }
}
public int Int32Value { public int Int32Value {
get { return int32Value_; } get { return int32Value_; }
} }
public const int EnumValueFieldNumber = 2; public const int EnumValueFieldNumber = 2;
private bool hasEnumValue;
private global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum enumValue_ = global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum.FOO; private global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum enumValue_ = global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum.FOO;
public bool HasEnumValue {
get { return hasEnumValue; }
}
public global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum EnumValue { public global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum EnumValue {
get { return enumValue_; } get { return enumValue_; }
} }
public override bool IsInitialized {
get {
return true;
}
}
public override void WriteTo(pb::ICodedOutputStream output) { public override void WriteTo(pb::ICodedOutputStream output) {
CalcSerializedSize(); CalcSerializedSize();
string[] field_names = _fooFieldNames; string[] field_names = _fooFieldNames;
if (hasInt32Value) { if (Int32Value != 0) {
output.WriteInt32(1, field_names[1], Int32Value); output.WriteInt32(1, field_names[1], Int32Value);
} }
if (hasEnumValue) { if (EnumValue != global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum.FOO) {
output.WriteEnum(2, field_names[0], (int) EnumValue, EnumValue); output.WriteEnum(2, field_names[0], (int) EnumValue, EnumValue);
} }
UnknownFields.WriteTo(output); UnknownFields.WriteTo(output);
@ -154,10 +140,10 @@ namespace Google.ProtocolBuffers.TestProtos {
if (size != -1) return size; if (size != -1) return size;
size = 0; size = 0;
if (hasInt32Value) { if (Int32Value != 0) {
size += pb::CodedOutputStream.ComputeInt32Size(1, Int32Value); size += pb::CodedOutputStream.ComputeInt32Size(1, Int32Value);
} }
if (hasEnumValue) { if (EnumValue != global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum.FOO) {
size += pb::CodedOutputStream.ComputeEnumSize(2, (int) EnumValue); size += pb::CodedOutputStream.ComputeEnumSize(2, (int) EnumValue);
} }
size += UnknownFields.SerializedSize; size += UnknownFields.SerializedSize;
@ -282,10 +268,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(Foo other) { public override Builder MergeFrom(Foo other) {
if (other == global::Google.ProtocolBuffers.TestProtos.Foo.DefaultInstance) return this; if (other == global::Google.ProtocolBuffers.TestProtos.Foo.DefaultInstance) return this;
PrepareBuilder(); PrepareBuilder();
if (other.HasInt32Value) { if (other.Int32Value != 0) {
Int32Value = other.Int32Value; Int32Value = other.Int32Value;
} }
if (other.HasEnumValue) { if (other.EnumValue != global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum.FOO) {
EnumValue = other.EnumValue; EnumValue = other.EnumValue;
} }
this.MergeUnknownFields(other.UnknownFields); this.MergeUnknownFields(other.UnknownFields);
@ -332,13 +318,12 @@ namespace Google.ProtocolBuffers.TestProtos {
break; break;
} }
case 8: { case 8: {
result.hasInt32Value = input.ReadInt32(ref result.int32Value_); input.ReadInt32(ref result.int32Value_);
break; break;
} }
case 16: { case 16: {
object unknown; object unknown;
if(input.ReadEnum(ref result.enumValue_, out unknown)) { if(input.ReadEnum(ref result.enumValue_, out unknown)) {
result.hasEnumValue = true;
} else if(unknown is int) { } else if(unknown is int) {
if (unknownFields == null) { if (unknownFields == null) {
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
@ -357,42 +342,32 @@ namespace Google.ProtocolBuffers.TestProtos {
} }
public bool HasInt32Value {
get { return result.hasInt32Value; }
}
public int Int32Value { public int Int32Value {
get { return result.Int32Value; } get { return result.Int32Value; }
set { SetInt32Value(value); } set { SetInt32Value(value); }
} }
public Builder SetInt32Value(int value) { public Builder SetInt32Value(int value) {
PrepareBuilder(); PrepareBuilder();
result.hasInt32Value = true;
result.int32Value_ = value; result.int32Value_ = value;
return this; return this;
} }
public Builder ClearInt32Value() { public Builder ClearInt32Value() {
PrepareBuilder(); PrepareBuilder();
result.hasInt32Value = false;
result.int32Value_ = 0; result.int32Value_ = 0;
return this; return this;
} }
public bool HasEnumValue {
get { return result.hasEnumValue; }
}
public global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum EnumValue { public global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum EnumValue {
get { return result.EnumValue; } get { return result.EnumValue; }
set { SetEnumValue(value); } set { SetEnumValue(value); }
} }
public Builder SetEnumValue(global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum value) { public Builder SetEnumValue(global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum value) {
PrepareBuilder(); PrepareBuilder();
result.hasEnumValue = true;
result.enumValue_ = value; result.enumValue_ = value;
return this; return this;
} }
public Builder ClearEnumValue() { public Builder ClearEnumValue() {
PrepareBuilder(); PrepareBuilder();
result.hasEnumValue = false;
result.enumValue_ = global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum.FOO; result.enumValue_ = global::Google.ProtocolBuffers.TestProtos.Foo.Types.NestedEnum.FOO;
return this; return this;
} }
@ -442,51 +417,33 @@ namespace Google.ProtocolBuffers.TestProtos {
#endregion #endregion
public const int Int32ValueFieldNumber = 1; public const int Int32ValueFieldNumber = 1;
private bool hasInt32Value;
private int int32Value_; private int int32Value_;
public bool HasInt32Value {
get { return hasInt32Value; }
}
public int Int32Value { public int Int32Value {
get { return int32Value_; } get { return int32Value_; }
} }
public const int EnumValueFieldNumber = 2; public const int EnumValueFieldNumber = 2;
private bool hasEnumValue;
private global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum enumValue_ = global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum.FOO; private global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum enumValue_ = global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum.FOO;
public bool HasEnumValue {
get { return hasEnumValue; }
}
public global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum EnumValue { public global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum EnumValue {
get { return enumValue_; } get { return enumValue_; }
} }
public const int ExtraInt32ValueFieldNumber = 3; public const int ExtraInt32ValueFieldNumber = 3;
private bool hasExtraInt32Value;
private int extraInt32Value_; private int extraInt32Value_;
public bool HasExtraInt32Value {
get { return hasExtraInt32Value; }
}
public int ExtraInt32Value { public int ExtraInt32Value {
get { return extraInt32Value_; } get { return extraInt32Value_; }
} }
public override bool IsInitialized {
get {
return true;
}
}
public override void WriteTo(pb::ICodedOutputStream output) { public override void WriteTo(pb::ICodedOutputStream output) {
CalcSerializedSize(); CalcSerializedSize();
string[] field_names = _fooWithExtraFieldsFieldNames; string[] field_names = _fooWithExtraFieldsFieldNames;
if (hasInt32Value) { if (Int32Value != 0) {
output.WriteInt32(1, field_names[2], Int32Value); output.WriteInt32(1, field_names[2], Int32Value);
} }
if (hasEnumValue) { if (EnumValue != global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum.FOO) {
output.WriteEnum(2, field_names[0], (int) EnumValue, EnumValue); output.WriteEnum(2, field_names[0], (int) EnumValue, EnumValue);
} }
if (hasExtraInt32Value) { if (ExtraInt32Value != 0) {
output.WriteInt32(3, field_names[1], ExtraInt32Value); output.WriteInt32(3, field_names[1], ExtraInt32Value);
} }
UnknownFields.WriteTo(output); UnknownFields.WriteTo(output);
@ -506,13 +463,13 @@ namespace Google.ProtocolBuffers.TestProtos {
if (size != -1) return size; if (size != -1) return size;
size = 0; size = 0;
if (hasInt32Value) { if (Int32Value != 0) {
size += pb::CodedOutputStream.ComputeInt32Size(1, Int32Value); size += pb::CodedOutputStream.ComputeInt32Size(1, Int32Value);
} }
if (hasEnumValue) { if (EnumValue != global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum.FOO) {
size += pb::CodedOutputStream.ComputeEnumSize(2, (int) EnumValue); size += pb::CodedOutputStream.ComputeEnumSize(2, (int) EnumValue);
} }
if (hasExtraInt32Value) { if (ExtraInt32Value != 0) {
size += pb::CodedOutputStream.ComputeInt32Size(3, ExtraInt32Value); size += pb::CodedOutputStream.ComputeInt32Size(3, ExtraInt32Value);
} }
size += UnknownFields.SerializedSize; size += UnknownFields.SerializedSize;
@ -637,13 +594,13 @@ namespace Google.ProtocolBuffers.TestProtos {
public override Builder MergeFrom(FooWithExtraFields other) { public override Builder MergeFrom(FooWithExtraFields other) {
if (other == global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.DefaultInstance) return this; if (other == global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.DefaultInstance) return this;
PrepareBuilder(); PrepareBuilder();
if (other.HasInt32Value) { if (other.Int32Value != 0) {
Int32Value = other.Int32Value; Int32Value = other.Int32Value;
} }
if (other.HasEnumValue) { if (other.EnumValue != global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum.FOO) {
EnumValue = other.EnumValue; EnumValue = other.EnumValue;
} }
if (other.HasExtraInt32Value) { if (other.ExtraInt32Value != 0) {
ExtraInt32Value = other.ExtraInt32Value; ExtraInt32Value = other.ExtraInt32Value;
} }
this.MergeUnknownFields(other.UnknownFields); this.MergeUnknownFields(other.UnknownFields);
@ -690,13 +647,12 @@ namespace Google.ProtocolBuffers.TestProtos {
break; break;
} }
case 8: { case 8: {
result.hasInt32Value = input.ReadInt32(ref result.int32Value_); input.ReadInt32(ref result.int32Value_);
break; break;
} }
case 16: { case 16: {
object unknown; object unknown;
if(input.ReadEnum(ref result.enumValue_, out unknown)) { if(input.ReadEnum(ref result.enumValue_, out unknown)) {
result.hasEnumValue = true;
} else if(unknown is int) { } else if(unknown is int) {
if (unknownFields == null) { if (unknownFields == null) {
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields); unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
@ -706,7 +662,7 @@ namespace Google.ProtocolBuffers.TestProtos {
break; break;
} }
case 24: { case 24: {
result.hasExtraInt32Value = input.ReadInt32(ref result.extraInt32Value_); input.ReadInt32(ref result.extraInt32Value_);
break; break;
} }
} }
@ -719,62 +675,47 @@ namespace Google.ProtocolBuffers.TestProtos {
} }
public bool HasInt32Value {
get { return result.hasInt32Value; }
}
public int Int32Value { public int Int32Value {
get { return result.Int32Value; } get { return result.Int32Value; }
set { SetInt32Value(value); } set { SetInt32Value(value); }
} }
public Builder SetInt32Value(int value) { public Builder SetInt32Value(int value) {
PrepareBuilder(); PrepareBuilder();
result.hasInt32Value = true;
result.int32Value_ = value; result.int32Value_ = value;
return this; return this;
} }
public Builder ClearInt32Value() { public Builder ClearInt32Value() {
PrepareBuilder(); PrepareBuilder();
result.hasInt32Value = false;
result.int32Value_ = 0; result.int32Value_ = 0;
return this; return this;
} }
public bool HasEnumValue {
get { return result.hasEnumValue; }
}
public global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum EnumValue { public global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum EnumValue {
get { return result.EnumValue; } get { return result.EnumValue; }
set { SetEnumValue(value); } set { SetEnumValue(value); }
} }
public Builder SetEnumValue(global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum value) { public Builder SetEnumValue(global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum value) {
PrepareBuilder(); PrepareBuilder();
result.hasEnumValue = true;
result.enumValue_ = value; result.enumValue_ = value;
return this; return this;
} }
public Builder ClearEnumValue() { public Builder ClearEnumValue() {
PrepareBuilder(); PrepareBuilder();
result.hasEnumValue = false;
result.enumValue_ = global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum.FOO; result.enumValue_ = global::Google.ProtocolBuffers.TestProtos.FooWithExtraFields.Types.NestedEnum.FOO;
return this; return this;
} }
public bool HasExtraInt32Value {
get { return result.hasExtraInt32Value; }
}
public int ExtraInt32Value { public int ExtraInt32Value {
get { return result.ExtraInt32Value; } get { return result.ExtraInt32Value; }
set { SetExtraInt32Value(value); } set { SetExtraInt32Value(value); }
} }
public Builder SetExtraInt32Value(int value) { public Builder SetExtraInt32Value(int value) {
PrepareBuilder(); PrepareBuilder();
result.hasExtraInt32Value = true;
result.extraInt32Value_ = value; result.extraInt32Value_ = value;
return this; return this;
} }
public Builder ClearExtraInt32Value() { public Builder ClearExtraInt32Value() {
PrepareBuilder(); PrepareBuilder();
result.hasExtraInt32Value = false;
result.extraInt32Value_ = 0; result.extraInt32Value_ = 0;
return this; return this;
} }

@ -1,684 +0,0 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/unittest_preserve_unknown_enum2.proto
#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 UnittestPreserveUnknownEnum2 {
#region Extension registration
public static void RegisterAllExtensions(pb::ExtensionRegistry registry) {
}
#endregion
#region Static variables
internal static pbd::MessageDescriptor internal__static_proto2_preserve_unknown_enum_unittest_MyMessage__Descriptor;
internal static pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.MyMessage, global::Google.ProtocolBuffers.TestProtos.MyMessage.Builder> internal__static_proto2_preserve_unknown_enum_unittest_MyMessage__FieldAccessorTable;
#endregion
#region Descriptor
public static pbd::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbd::FileDescriptor descriptor;
static UnittestPreserveUnknownEnum2() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"CjVnb29nbGUvcHJvdG9idWYvdW5pdHRlc3RfcHJlc2VydmVfdW5rbm93bl9l",
"bnVtMi5wcm90bxIlcHJvdG8yX3ByZXNlcnZlX3Vua25vd25fZW51bV91bml0",
"dGVzdCK4AwoJTXlNZXNzYWdlEjgKAWUYASABKA4yLS5wcm90bzJfcHJlc2Vy",
"dmVfdW5rbm93bl9lbnVtX3VuaXR0ZXN0Lk15RW51bRJBCgpyZXBlYXRlZF9l",
"GAIgAygOMi0ucHJvdG8yX3ByZXNlcnZlX3Vua25vd25fZW51bV91bml0dGVz",
"dC5NeUVudW0STAoRcmVwZWF0ZWRfcGFja2VkX2UYAyADKA4yLS5wcm90bzJf",
"cHJlc2VydmVfdW5rbm93bl9lbnVtX3VuaXR0ZXN0Lk15RW51bUICEAESUwoc",
"cmVwZWF0ZWRfcGFja2VkX3VuZXhwZWN0ZWRfZRgEIAMoDjItLnByb3RvMl9w",
"cmVzZXJ2ZV91bmtub3duX2VudW1fdW5pdHRlc3QuTXlFbnVtEkIKCW9uZW9m",
"X2VfMRgFIAEoDjItLnByb3RvMl9wcmVzZXJ2ZV91bmtub3duX2VudW1fdW5p",
"dHRlc3QuTXlFbnVtSAASQgoJb25lb2ZfZV8yGAYgASgOMi0ucHJvdG8yX3By",
"ZXNlcnZlX3Vua25vd25fZW51bV91bml0dGVzdC5NeUVudW1IAEIDCgFvKiMK",
"Bk15RW51bRIHCgNGT08QABIHCgNCQVIQARIHCgNCQVoQAkIkqgIhR29vZ2xl",
"LlByb3RvY29sQnVmZmVycy5UZXN0UHJvdG9z"));
pbd::FileDescriptor.InternalDescriptorAssigner assigner = delegate(pbd::FileDescriptor root) {
descriptor = root;
internal__static_proto2_preserve_unknown_enum_unittest_MyMessage__Descriptor = Descriptor.MessageTypes[0];
internal__static_proto2_preserve_unknown_enum_unittest_MyMessage__FieldAccessorTable =
new pb::FieldAccess.FieldAccessorTable<global::Google.ProtocolBuffers.TestProtos.MyMessage, global::Google.ProtocolBuffers.TestProtos.MyMessage.Builder>(internal__static_proto2_preserve_unknown_enum_unittest_MyMessage__Descriptor,
new string[] { "E", "RepeatedE", "RepeatedPackedE", "RepeatedPackedUnexpectedE", "OneofE1", "OneofE2", });
pb::ExtensionRegistry registry = pb::ExtensionRegistry.CreateInstance();
RegisterAllExtensions(registry);
return registry;
};
pbd::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
new pbd::FileDescriptor[] {
}, assigner);
}
#endregion
}
#region Enums
public enum MyEnum {
FOO = 0,
BAR = 1,
BAZ = 2,
}
#endregion
#region Messages
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class MyMessage : pb::GeneratedMessage<MyMessage, MyMessage.Builder> {
private MyMessage() { }
private static readonly MyMessage defaultInstance = new MyMessage().MakeReadOnly();
private static readonly string[] _myMessageFieldNames = new string[] { "e", "oneof_e_1", "oneof_e_2", "repeated_e", "repeated_packed_e", "repeated_packed_unexpected_e" };
private static readonly uint[] _myMessageFieldTags = new uint[] { 8, 40, 48, 16, 26, 32 };
public static MyMessage DefaultInstance {
get { return defaultInstance; }
}
public override MyMessage DefaultInstanceForType {
get { return DefaultInstance; }
}
protected override MyMessage ThisMessage {
get { return this; }
}
public static pbd::MessageDescriptor Descriptor {
get { return global::Google.ProtocolBuffers.TestProtos.UnittestPreserveUnknownEnum2.internal__static_proto2_preserve_unknown_enum_unittest_MyMessage__Descriptor; }
}
protected override pb::FieldAccess.FieldAccessorTable<MyMessage, MyMessage.Builder> InternalFieldAccessors {
get { return global::Google.ProtocolBuffers.TestProtos.UnittestPreserveUnknownEnum2.internal__static_proto2_preserve_unknown_enum_unittest_MyMessage__FieldAccessorTable; }
}
public const int EFieldNumber = 1;
private bool hasE;
private global::Google.ProtocolBuffers.TestProtos.MyEnum e_ = global::Google.ProtocolBuffers.TestProtos.MyEnum.FOO;
public bool HasE {
get { return hasE; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum E {
get { return e_; }
}
public const int RepeatedEFieldNumber = 2;
private pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.MyEnum> repeatedE_ = new pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.MyEnum>();
public scg::IList<global::Google.ProtocolBuffers.TestProtos.MyEnum> RepeatedEList {
get { return pbc::Lists.AsReadOnly(repeatedE_); }
}
public int RepeatedECount {
get { return repeatedE_.Count; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum GetRepeatedE(int index) {
return repeatedE_[index];
}
public const int RepeatedPackedEFieldNumber = 3;
private int repeatedPackedEMemoizedSerializedSize;
private pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.MyEnum> repeatedPackedE_ = new pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.MyEnum>();
public scg::IList<global::Google.ProtocolBuffers.TestProtos.MyEnum> RepeatedPackedEList {
get { return pbc::Lists.AsReadOnly(repeatedPackedE_); }
}
public int RepeatedPackedECount {
get { return repeatedPackedE_.Count; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum GetRepeatedPackedE(int index) {
return repeatedPackedE_[index];
}
public const int RepeatedPackedUnexpectedEFieldNumber = 4;
private pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.MyEnum> repeatedPackedUnexpectedE_ = new pbc::PopsicleList<global::Google.ProtocolBuffers.TestProtos.MyEnum>();
public scg::IList<global::Google.ProtocolBuffers.TestProtos.MyEnum> RepeatedPackedUnexpectedEList {
get { return pbc::Lists.AsReadOnly(repeatedPackedUnexpectedE_); }
}
public int RepeatedPackedUnexpectedECount {
get { return repeatedPackedUnexpectedE_.Count; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum GetRepeatedPackedUnexpectedE(int index) {
return repeatedPackedUnexpectedE_[index];
}
public const int OneofE1FieldNumber = 5;
private bool hasOneofE1;
private global::Google.ProtocolBuffers.TestProtos.MyEnum oneofE1_ = global::Google.ProtocolBuffers.TestProtos.MyEnum.FOO;
public bool HasOneofE1 {
get { return hasOneofE1; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum OneofE1 {
get { return oneofE1_; }
}
public const int OneofE2FieldNumber = 6;
private bool hasOneofE2;
private global::Google.ProtocolBuffers.TestProtos.MyEnum oneofE2_ = global::Google.ProtocolBuffers.TestProtos.MyEnum.FOO;
public bool HasOneofE2 {
get { return hasOneofE2; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum OneofE2 {
get { return oneofE2_; }
}
public override bool IsInitialized {
get {
return true;
}
}
public override void WriteTo(pb::ICodedOutputStream output) {
CalcSerializedSize();
string[] field_names = _myMessageFieldNames;
if (hasE) {
output.WriteEnum(1, field_names[0], (int) E, E);
}
if (repeatedE_.Count > 0) {
output.WriteEnumArray(2, field_names[3], repeatedE_);
}
if (repeatedPackedE_.Count > 0) {
output.WritePackedEnumArray(3, field_names[4], repeatedPackedEMemoizedSerializedSize, repeatedPackedE_);
}
if (repeatedPackedUnexpectedE_.Count > 0) {
output.WriteEnumArray(4, field_names[5], repeatedPackedUnexpectedE_);
}
if (hasOneofE1) {
output.WriteEnum(5, field_names[1], (int) OneofE1, OneofE1);
}
if (hasOneofE2) {
output.WriteEnum(6, field_names[2], (int) OneofE2, OneofE2);
}
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 (hasE) {
size += pb::CodedOutputStream.ComputeEnumSize(1, (int) E);
}
{
int dataSize = 0;
if (repeatedE_.Count > 0) {
foreach (global::Google.ProtocolBuffers.TestProtos.MyEnum element in repeatedE_) {
dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);
}
size += dataSize;
size += 1 * repeatedE_.Count;
}
}
{
int dataSize = 0;
if (repeatedPackedE_.Count > 0) {
foreach (global::Google.ProtocolBuffers.TestProtos.MyEnum element in repeatedPackedE_) {
dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);
}
size += dataSize;
size += 1;
size += pb::CodedOutputStream.ComputeRawVarint32Size((uint) dataSize);
}
repeatedPackedEMemoizedSerializedSize = dataSize;
}
{
int dataSize = 0;
if (repeatedPackedUnexpectedE_.Count > 0) {
foreach (global::Google.ProtocolBuffers.TestProtos.MyEnum element in repeatedPackedUnexpectedE_) {
dataSize += pb::CodedOutputStream.ComputeEnumSizeNoTag((int) element);
}
size += dataSize;
size += 1 * repeatedPackedUnexpectedE_.Count;
}
}
if (hasOneofE1) {
size += pb::CodedOutputStream.ComputeEnumSize(5, (int) OneofE1);
}
if (hasOneofE2) {
size += pb::CodedOutputStream.ComputeEnumSize(6, (int) OneofE2);
}
size += UnknownFields.SerializedSize;
memoizedSerializedSize = size;
return size;
}
public static MyMessage ParseFrom(pb::ByteString data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static MyMessage ParseFrom(pb::ByteString data, pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
}
public static MyMessage ParseFrom(byte[] data) {
return ((Builder) CreateBuilder().MergeFrom(data)).BuildParsed();
}
public static MyMessage ParseFrom(byte[] data, pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(data, extensionRegistry)).BuildParsed();
}
public static MyMessage ParseFrom(global::System.IO.Stream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static MyMessage ParseFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
}
public static MyMessage ParseDelimitedFrom(global::System.IO.Stream input) {
return CreateBuilder().MergeDelimitedFrom(input).BuildParsed();
}
public static MyMessage ParseDelimitedFrom(global::System.IO.Stream input, pb::ExtensionRegistry extensionRegistry) {
return CreateBuilder().MergeDelimitedFrom(input, extensionRegistry).BuildParsed();
}
public static MyMessage ParseFrom(pb::ICodedInputStream input) {
return ((Builder) CreateBuilder().MergeFrom(input)).BuildParsed();
}
public static MyMessage ParseFrom(pb::ICodedInputStream input, pb::ExtensionRegistry extensionRegistry) {
return ((Builder) CreateBuilder().MergeFrom(input, extensionRegistry)).BuildParsed();
}
private MyMessage MakeReadOnly() {
repeatedE_.MakeReadOnly();
repeatedPackedE_.MakeReadOnly();
repeatedPackedUnexpectedE_.MakeReadOnly();
return this;
}
public static Builder CreateBuilder() { return new Builder(); }
public override Builder ToBuilder() { return CreateBuilder(this); }
public override Builder CreateBuilderForType() { return new Builder(); }
public static Builder CreateBuilder(MyMessage prototype) {
return new Builder(prototype);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Builder : pb::GeneratedBuilder<MyMessage, Builder> {
protected override Builder ThisBuilder {
get { return this; }
}
public Builder() {
result = DefaultInstance;
resultIsReadOnly = true;
}
internal Builder(MyMessage cloneFrom) {
result = cloneFrom;
resultIsReadOnly = true;
}
private bool resultIsReadOnly;
private MyMessage result;
private MyMessage PrepareBuilder() {
if (resultIsReadOnly) {
MyMessage original = result;
result = new MyMessage();
resultIsReadOnly = false;
MergeFrom(original);
}
return result;
}
public override bool IsInitialized {
get { return result.IsInitialized; }
}
protected override MyMessage MessageBeingBuilt {
get { return PrepareBuilder(); }
}
public override Builder Clear() {
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.MyMessage.Descriptor; }
}
public override MyMessage DefaultInstanceForType {
get { return global::Google.ProtocolBuffers.TestProtos.MyMessage.DefaultInstance; }
}
public override MyMessage BuildPartial() {
if (resultIsReadOnly) {
return result;
}
resultIsReadOnly = true;
return result.MakeReadOnly();
}
public override Builder MergeFrom(pb::IMessage other) {
if (other is MyMessage) {
return MergeFrom((MyMessage) other);
} else {
base.MergeFrom(other);
return this;
}
}
public override Builder MergeFrom(MyMessage other) {
if (other == global::Google.ProtocolBuffers.TestProtos.MyMessage.DefaultInstance) return this;
PrepareBuilder();
if (other.HasE) {
E = other.E;
}
if (other.repeatedE_.Count != 0) {
result.repeatedE_.Add(other.repeatedE_);
}
if (other.repeatedPackedE_.Count != 0) {
result.repeatedPackedE_.Add(other.repeatedPackedE_);
}
if (other.repeatedPackedUnexpectedE_.Count != 0) {
result.repeatedPackedUnexpectedE_.Add(other.repeatedPackedUnexpectedE_);
}
if (other.HasOneofE1) {
OneofE1 = other.OneofE1;
}
if (other.HasOneofE2) {
OneofE2 = other.OneofE2;
}
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(_myMessageFieldNames, field_name, global::System.StringComparer.Ordinal);
if(field_ordinal >= 0)
tag = _myMessageFieldTags[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.e_, out unknown)) {
result.hasE = 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<object> unknownItems;
input.ReadEnumArray<global::Google.ProtocolBuffers.TestProtos.MyEnum>(tag, field_name, result.repeatedE_, 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<object> unknownItems;
input.ReadEnumArray<global::Google.ProtocolBuffers.TestProtos.MyEnum>(tag, field_name, result.repeatedPackedE_, 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:
case 32: {
scg::ICollection<object> unknownItems;
input.ReadEnumArray<global::Google.ProtocolBuffers.TestProtos.MyEnum>(tag, field_name, result.repeatedPackedUnexpectedE_, 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(4, (ulong)(int)rawValue);
}
break;
}
case 40: {
object unknown;
if(input.ReadEnum(ref result.oneofE1_, out unknown)) {
result.hasOneofE1 = true;
} else if(unknown is int) {
if (unknownFields == null) {
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
}
unknownFields.MergeVarintField(5, (ulong)(int)unknown);
}
break;
}
case 48: {
object unknown;
if(input.ReadEnum(ref result.oneofE2_, out unknown)) {
result.hasOneofE2 = true;
} else if(unknown is int) {
if (unknownFields == null) {
unknownFields = pb::UnknownFieldSet.CreateBuilder(this.UnknownFields);
}
unknownFields.MergeVarintField(6, (ulong)(int)unknown);
}
break;
}
}
}
if (unknownFields != null) {
this.UnknownFields = unknownFields.Build();
}
return this;
}
public bool HasE {
get { return result.hasE; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum E {
get { return result.E; }
set { SetE(value); }
}
public Builder SetE(global::Google.ProtocolBuffers.TestProtos.MyEnum value) {
PrepareBuilder();
result.hasE = true;
result.e_ = value;
return this;
}
public Builder ClearE() {
PrepareBuilder();
result.hasE = false;
result.e_ = global::Google.ProtocolBuffers.TestProtos.MyEnum.FOO;
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.MyEnum> RepeatedEList {
get { return PrepareBuilder().repeatedE_; }
}
public int RepeatedECount {
get { return result.RepeatedECount; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum GetRepeatedE(int index) {
return result.GetRepeatedE(index);
}
public Builder SetRepeatedE(int index, global::Google.ProtocolBuffers.TestProtos.MyEnum value) {
PrepareBuilder();
result.repeatedE_[index] = value;
return this;
}
public Builder AddRepeatedE(global::Google.ProtocolBuffers.TestProtos.MyEnum value) {
PrepareBuilder();
result.repeatedE_.Add(value);
return this;
}
public Builder AddRangeRepeatedE(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.MyEnum> values) {
PrepareBuilder();
result.repeatedE_.Add(values);
return this;
}
public Builder ClearRepeatedE() {
PrepareBuilder();
result.repeatedE_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.MyEnum> RepeatedPackedEList {
get { return PrepareBuilder().repeatedPackedE_; }
}
public int RepeatedPackedECount {
get { return result.RepeatedPackedECount; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum GetRepeatedPackedE(int index) {
return result.GetRepeatedPackedE(index);
}
public Builder SetRepeatedPackedE(int index, global::Google.ProtocolBuffers.TestProtos.MyEnum value) {
PrepareBuilder();
result.repeatedPackedE_[index] = value;
return this;
}
public Builder AddRepeatedPackedE(global::Google.ProtocolBuffers.TestProtos.MyEnum value) {
PrepareBuilder();
result.repeatedPackedE_.Add(value);
return this;
}
public Builder AddRangeRepeatedPackedE(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.MyEnum> values) {
PrepareBuilder();
result.repeatedPackedE_.Add(values);
return this;
}
public Builder ClearRepeatedPackedE() {
PrepareBuilder();
result.repeatedPackedE_.Clear();
return this;
}
public pbc::IPopsicleList<global::Google.ProtocolBuffers.TestProtos.MyEnum> RepeatedPackedUnexpectedEList {
get { return PrepareBuilder().repeatedPackedUnexpectedE_; }
}
public int RepeatedPackedUnexpectedECount {
get { return result.RepeatedPackedUnexpectedECount; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum GetRepeatedPackedUnexpectedE(int index) {
return result.GetRepeatedPackedUnexpectedE(index);
}
public Builder SetRepeatedPackedUnexpectedE(int index, global::Google.ProtocolBuffers.TestProtos.MyEnum value) {
PrepareBuilder();
result.repeatedPackedUnexpectedE_[index] = value;
return this;
}
public Builder AddRepeatedPackedUnexpectedE(global::Google.ProtocolBuffers.TestProtos.MyEnum value) {
PrepareBuilder();
result.repeatedPackedUnexpectedE_.Add(value);
return this;
}
public Builder AddRangeRepeatedPackedUnexpectedE(scg::IEnumerable<global::Google.ProtocolBuffers.TestProtos.MyEnum> values) {
PrepareBuilder();
result.repeatedPackedUnexpectedE_.Add(values);
return this;
}
public Builder ClearRepeatedPackedUnexpectedE() {
PrepareBuilder();
result.repeatedPackedUnexpectedE_.Clear();
return this;
}
public bool HasOneofE1 {
get { return result.hasOneofE1; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum OneofE1 {
get { return result.OneofE1; }
set { SetOneofE1(value); }
}
public Builder SetOneofE1(global::Google.ProtocolBuffers.TestProtos.MyEnum value) {
PrepareBuilder();
result.hasOneofE1 = true;
result.oneofE1_ = value;
return this;
}
public Builder ClearOneofE1() {
PrepareBuilder();
result.hasOneofE1 = false;
result.oneofE1_ = global::Google.ProtocolBuffers.TestProtos.MyEnum.FOO;
return this;
}
public bool HasOneofE2 {
get { return result.hasOneofE2; }
}
public global::Google.ProtocolBuffers.TestProtos.MyEnum OneofE2 {
get { return result.OneofE2; }
set { SetOneofE2(value); }
}
public Builder SetOneofE2(global::Google.ProtocolBuffers.TestProtos.MyEnum value) {
PrepareBuilder();
result.hasOneofE2 = true;
result.oneofE2_ = value;
return this;
}
public Builder ClearOneofE2() {
PrepareBuilder();
result.hasOneofE2 = false;
result.oneofE2_ = global::Google.ProtocolBuffers.TestProtos.MyEnum.FOO;
return this;
}
}
static MyMessage() {
object.ReferenceEquals(global::Google.ProtocolBuffers.TestProtos.UnittestPreserveUnknownEnum2.Descriptor, null);
}
}
#endregion
}
#endregion Designer generated code

@ -420,7 +420,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasZip { public bool HasZip {
get { return hasZip; } get { return hasZip; }
} }
[global::System.CLSCompliant(false)]
public uint Zip { public uint Zip {
get { return zip_; } get { return zip_; }
} }
@ -619,12 +618,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasZip { public bool HasZip {
get { return result.hasZip; } get { return result.hasZip; }
} }
[global::System.CLSCompliant(false)]
public uint Zip { public uint Zip {
get { return result.Zip; } get { return result.Zip; }
set { SetZip(value); } set { SetZip(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetZip(uint value) { public Builder SetZip(uint value) {
PrepareBuilder(); PrepareBuilder();
result.hasZip = true; result.hasZip = true;

@ -39,20 +39,16 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int UnpackedInt64ExtensionLiteFieldNumber = 91; public const int UnpackedInt64ExtensionLiteFieldNumber = 91;
public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, long> UnpackedInt64ExtensionLite; public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, long> UnpackedInt64ExtensionLite;
public const int UnpackedUint32ExtensionLiteFieldNumber = 92; public const int UnpackedUint32ExtensionLiteFieldNumber = 92;
[global::System.CLSCompliant(false)]
public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, uint> UnpackedUint32ExtensionLite; public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, uint> UnpackedUint32ExtensionLite;
public const int UnpackedUint64ExtensionLiteFieldNumber = 93; public const int UnpackedUint64ExtensionLiteFieldNumber = 93;
[global::System.CLSCompliant(false)]
public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, ulong> UnpackedUint64ExtensionLite; public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, ulong> UnpackedUint64ExtensionLite;
public const int UnpackedSint32ExtensionLiteFieldNumber = 94; public const int UnpackedSint32ExtensionLiteFieldNumber = 94;
public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, int> UnpackedSint32ExtensionLite; public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, int> UnpackedSint32ExtensionLite;
public const int UnpackedSint64ExtensionLiteFieldNumber = 95; public const int UnpackedSint64ExtensionLiteFieldNumber = 95;
public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, long> UnpackedSint64ExtensionLite; public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, long> UnpackedSint64ExtensionLite;
public const int UnpackedFixed32ExtensionLiteFieldNumber = 96; public const int UnpackedFixed32ExtensionLiteFieldNumber = 96;
[global::System.CLSCompliant(false)]
public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, uint> UnpackedFixed32ExtensionLite; public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, uint> UnpackedFixed32ExtensionLite;
public const int UnpackedFixed64ExtensionLiteFieldNumber = 97; public const int UnpackedFixed64ExtensionLiteFieldNumber = 97;
[global::System.CLSCompliant(false)]
public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, ulong> UnpackedFixed64ExtensionLite; public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, ulong> UnpackedFixed64ExtensionLite;
public const int UnpackedSfixed32ExtensionLiteFieldNumber = 98; public const int UnpackedSfixed32ExtensionLiteFieldNumber = 98;
public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, int> UnpackedSfixed32ExtensionLite; public static pb::GeneratedRepeatExtensionLite<global::Google.ProtocolBuffers.TestProtos.TestUnpackedExtensionsLite, int> UnpackedSfixed32ExtensionLite;
@ -313,8 +309,12 @@ namespace Google.ProtocolBuffers.TestProtos {
#region Lite runtime methods #region Lite runtime methods
public override int GetHashCode() { public override int GetHashCode() {
int hash = GetType().GetHashCode(); int hash = GetType().GetHashCode();
if (hasD) hash ^= d_.GetHashCode(); if (hasD) {
if (hasEn) hash ^= en_.GetHashCode(); hash ^= d_.GetHashCode();
}
if (hasEn) {
hash ^= en_.GetHashCode();
}
return hash; return hash;
} }
@ -657,8 +657,12 @@ namespace Google.ProtocolBuffers.TestProtos {
#region Lite runtime methods #region Lite runtime methods
public override int GetHashCode() { public override int GetHashCode() {
int hash = GetType().GetHashCode(); int hash = GetType().GetHashCode();
if (hasNumber) hash ^= number_.GetHashCode(); if (hasNumber) {
if (hasType) hash ^= type_.GetHashCode(); hash ^= number_.GetHashCode();
}
if (hasType) {
hash ^= type_.GetHashCode();
}
return hash; return hash;
} }
@ -957,7 +961,6 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasZip { public bool HasZip {
get { return hasZip; } get { return hasZip; }
} }
[global::System.CLSCompliant(false)]
public uint Zip { public uint Zip {
get { return zip_; } get { return zip_; }
} }
@ -1027,11 +1030,21 @@ namespace Google.ProtocolBuffers.TestProtos {
#region Lite runtime methods #region Lite runtime methods
public override int GetHashCode() { public override int GetHashCode() {
int hash = GetType().GetHashCode(); int hash = GetType().GetHashCode();
if (hasAddress) hash ^= address_.GetHashCode(); if (hasAddress) {
if (hasAddress2) hash ^= address2_.GetHashCode(); hash ^= address_.GetHashCode();
if (hasCity) hash ^= city_.GetHashCode(); }
if (hasState) hash ^= state_.GetHashCode(); if (hasAddress2) {
if (hasZip) hash ^= zip_.GetHashCode(); hash ^= address2_.GetHashCode();
}
if (hasCity) {
hash ^= city_.GetHashCode();
}
if (hasState) {
hash ^= state_.GetHashCode();
}
if (hasZip) {
hash ^= zip_.GetHashCode();
}
return hash; return hash;
} }
@ -1330,12 +1343,10 @@ namespace Google.ProtocolBuffers.TestProtos {
public bool HasZip { public bool HasZip {
get { return result.hasZip; } get { return result.hasZip; }
} }
[global::System.CLSCompliant(false)]
public uint Zip { public uint Zip {
get { return result.Zip; } get { return result.Zip; }
set { SetZip(value); } set { SetZip(value); }
} }
[global::System.CLSCompliant(false)]
public Builder SetZip(uint value) { public Builder SetZip(uint value) {
PrepareBuilder(); PrepareBuilder();
result.hasZip = true; result.hasZip = true;
@ -1508,9 +1519,15 @@ namespace Google.ProtocolBuffers.TestProtos {
#region Lite runtime methods #region Lite runtime methods
public override int GetHashCode() { public override int GetHashCode() {
int hash = GetType().GetHashCode(); int hash = GetType().GetHashCode();
if (hasName) hash ^= name_.GetHashCode(); if (hasName) {
if (hasId) hash ^= id_.GetHashCode(); hash ^= name_.GetHashCode();
if (hasEmail) hash ^= email_.GetHashCode(); }
if (hasId) {
hash ^= id_.GetHashCode();
}
if (hasEmail) {
hash ^= email_.GetHashCode();
}
foreach(int i in codes_) foreach(int i in codes_)
hash ^= i.GetHashCode(); hash ^= i.GetHashCode();
foreach(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber i in phone_) foreach(global::Google.ProtocolBuffers.TestProtos.TestInteropPersonLite.Types.PhoneNumber i in phone_)
@ -2002,7 +2019,9 @@ namespace Google.ProtocolBuffers.TestProtos {
#region Lite runtime methods #region Lite runtime methods
public override int GetHashCode() { public override int GetHashCode() {
int hash = GetType().GetHashCode(); int hash = GetType().GetHashCode();
if (hasNumber) hash ^= number_.GetHashCode(); if (hasNumber) {
hash ^= number_.GetHashCode();
}
return hash; return hash;
} }
@ -2476,28 +2495,24 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int UnpackedUint32FieldNumber = 92; public const int UnpackedUint32FieldNumber = 92;
private pbc::PopsicleList<uint> unpackedUint32_ = new pbc::PopsicleList<uint>(); private pbc::PopsicleList<uint> unpackedUint32_ = new pbc::PopsicleList<uint>();
[global::System.CLSCompliant(false)]
public scg::IList<uint> UnpackedUint32List { public scg::IList<uint> UnpackedUint32List {
get { return pbc::Lists.AsReadOnly(unpackedUint32_); } get { return pbc::Lists.AsReadOnly(unpackedUint32_); }
} }
public int UnpackedUint32Count { public int UnpackedUint32Count {
get { return unpackedUint32_.Count; } get { return unpackedUint32_.Count; }
} }
[global::System.CLSCompliant(false)]
public uint GetUnpackedUint32(int index) { public uint GetUnpackedUint32(int index) {
return unpackedUint32_[index]; return unpackedUint32_[index];
} }
public const int UnpackedUint64FieldNumber = 93; public const int UnpackedUint64FieldNumber = 93;
private pbc::PopsicleList<ulong> unpackedUint64_ = new pbc::PopsicleList<ulong>(); private pbc::PopsicleList<ulong> unpackedUint64_ = new pbc::PopsicleList<ulong>();
[global::System.CLSCompliant(false)]
public scg::IList<ulong> UnpackedUint64List { public scg::IList<ulong> UnpackedUint64List {
get { return pbc::Lists.AsReadOnly(unpackedUint64_); } get { return pbc::Lists.AsReadOnly(unpackedUint64_); }
} }
public int UnpackedUint64Count { public int UnpackedUint64Count {
get { return unpackedUint64_.Count; } get { return unpackedUint64_.Count; }
} }
[global::System.CLSCompliant(false)]
public ulong GetUnpackedUint64(int index) { public ulong GetUnpackedUint64(int index) {
return unpackedUint64_[index]; return unpackedUint64_[index];
} }
@ -2528,28 +2543,24 @@ namespace Google.ProtocolBuffers.TestProtos {
public const int UnpackedFixed32FieldNumber = 96; public const int UnpackedFixed32FieldNumber = 96;
private pbc::PopsicleList<uint> unpackedFixed32_ = new pbc::PopsicleList<uint>(); private pbc::PopsicleList<uint> unpackedFixed32_ = new pbc::PopsicleList<uint>();
[global::System.CLSCompliant(false)]
public scg::IList<uint> UnpackedFixed32List { public scg::IList<uint> UnpackedFixed32List {
get { return pbc::Lists.AsReadOnly(unpackedFixed32_); } get { return pbc::Lists.AsReadOnly(unpackedFixed32_); }
} }
public int UnpackedFixed32Count { public int UnpackedFixed32Count {
get { return unpackedFixed32_.Count; } get { return unpackedFixed32_.Count; }
} }
[global::System.CLSCompliant(false)]
public uint GetUnpackedFixed32(int index) { public uint GetUnpackedFixed32(int index) {
return unpackedFixed32_[index]; return unpackedFixed32_[index];
} }
public const int UnpackedFixed64FieldNumber = 97; public const int UnpackedFixed64FieldNumber = 97;
private pbc::PopsicleList<ulong> unpackedFixed64_ = new pbc::PopsicleList<ulong>(); private pbc::PopsicleList<ulong> unpackedFixed64_ = new pbc::PopsicleList<ulong>();
[global::System.CLSCompliant(false)]
public scg::IList<ulong> UnpackedFixed64List { public scg::IList<ulong> UnpackedFixed64List {
get { return pbc::Lists.AsReadOnly(unpackedFixed64_); } get { return pbc::Lists.AsReadOnly(unpackedFixed64_); }
} }
public int UnpackedFixed64Count { public int UnpackedFixed64Count {
get { return unpackedFixed64_.Count; } get { return unpackedFixed64_.Count; }
} }
[global::System.CLSCompliant(false)]
public ulong GetUnpackedFixed64(int index) { public ulong GetUnpackedFixed64(int index) {
return unpackedFixed64_[index]; return unpackedFixed64_[index];
} }
@ -3236,30 +3247,25 @@ namespace Google.ProtocolBuffers.TestProtos {
return this; return this;
} }
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedUint32List { public pbc::IPopsicleList<uint> UnpackedUint32List {
get { return PrepareBuilder().unpackedUint32_; } get { return PrepareBuilder().unpackedUint32_; }
} }
public int UnpackedUint32Count { public int UnpackedUint32Count {
get { return result.UnpackedUint32Count; } get { return result.UnpackedUint32Count; }
} }
[global::System.CLSCompliant(false)]
public uint GetUnpackedUint32(int index) { public uint GetUnpackedUint32(int index) {
return result.GetUnpackedUint32(index); return result.GetUnpackedUint32(index);
} }
[global::System.CLSCompliant(false)]
public Builder SetUnpackedUint32(int index, uint value) { public Builder SetUnpackedUint32(int index, uint value) {
PrepareBuilder(); PrepareBuilder();
result.unpackedUint32_[index] = value; result.unpackedUint32_[index] = value;
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddUnpackedUint32(uint value) { public Builder AddUnpackedUint32(uint value) {
PrepareBuilder(); PrepareBuilder();
result.unpackedUint32_.Add(value); result.unpackedUint32_.Add(value);
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedUint32(scg::IEnumerable<uint> values) { public Builder AddRangeUnpackedUint32(scg::IEnumerable<uint> values) {
PrepareBuilder(); PrepareBuilder();
result.unpackedUint32_.Add(values); result.unpackedUint32_.Add(values);
@ -3271,30 +3277,25 @@ namespace Google.ProtocolBuffers.TestProtos {
return this; return this;
} }
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedUint64List { public pbc::IPopsicleList<ulong> UnpackedUint64List {
get { return PrepareBuilder().unpackedUint64_; } get { return PrepareBuilder().unpackedUint64_; }
} }
public int UnpackedUint64Count { public int UnpackedUint64Count {
get { return result.UnpackedUint64Count; } get { return result.UnpackedUint64Count; }
} }
[global::System.CLSCompliant(false)]
public ulong GetUnpackedUint64(int index) { public ulong GetUnpackedUint64(int index) {
return result.GetUnpackedUint64(index); return result.GetUnpackedUint64(index);
} }
[global::System.CLSCompliant(false)]
public Builder SetUnpackedUint64(int index, ulong value) { public Builder SetUnpackedUint64(int index, ulong value) {
PrepareBuilder(); PrepareBuilder();
result.unpackedUint64_[index] = value; result.unpackedUint64_[index] = value;
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddUnpackedUint64(ulong value) { public Builder AddUnpackedUint64(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.unpackedUint64_.Add(value); result.unpackedUint64_.Add(value);
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedUint64(scg::IEnumerable<ulong> values) { public Builder AddRangeUnpackedUint64(scg::IEnumerable<ulong> values) {
PrepareBuilder(); PrepareBuilder();
result.unpackedUint64_.Add(values); result.unpackedUint64_.Add(values);
@ -3366,30 +3367,25 @@ namespace Google.ProtocolBuffers.TestProtos {
return this; return this;
} }
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<uint> UnpackedFixed32List { public pbc::IPopsicleList<uint> UnpackedFixed32List {
get { return PrepareBuilder().unpackedFixed32_; } get { return PrepareBuilder().unpackedFixed32_; }
} }
public int UnpackedFixed32Count { public int UnpackedFixed32Count {
get { return result.UnpackedFixed32Count; } get { return result.UnpackedFixed32Count; }
} }
[global::System.CLSCompliant(false)]
public uint GetUnpackedFixed32(int index) { public uint GetUnpackedFixed32(int index) {
return result.GetUnpackedFixed32(index); return result.GetUnpackedFixed32(index);
} }
[global::System.CLSCompliant(false)]
public Builder SetUnpackedFixed32(int index, uint value) { public Builder SetUnpackedFixed32(int index, uint value) {
PrepareBuilder(); PrepareBuilder();
result.unpackedFixed32_[index] = value; result.unpackedFixed32_[index] = value;
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddUnpackedFixed32(uint value) { public Builder AddUnpackedFixed32(uint value) {
PrepareBuilder(); PrepareBuilder();
result.unpackedFixed32_.Add(value); result.unpackedFixed32_.Add(value);
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedFixed32(scg::IEnumerable<uint> values) { public Builder AddRangeUnpackedFixed32(scg::IEnumerable<uint> values) {
PrepareBuilder(); PrepareBuilder();
result.unpackedFixed32_.Add(values); result.unpackedFixed32_.Add(values);
@ -3401,30 +3397,25 @@ namespace Google.ProtocolBuffers.TestProtos {
return this; return this;
} }
[global::System.CLSCompliant(false)]
public pbc::IPopsicleList<ulong> UnpackedFixed64List { public pbc::IPopsicleList<ulong> UnpackedFixed64List {
get { return PrepareBuilder().unpackedFixed64_; } get { return PrepareBuilder().unpackedFixed64_; }
} }
public int UnpackedFixed64Count { public int UnpackedFixed64Count {
get { return result.UnpackedFixed64Count; } get { return result.UnpackedFixed64Count; }
} }
[global::System.CLSCompliant(false)]
public ulong GetUnpackedFixed64(int index) { public ulong GetUnpackedFixed64(int index) {
return result.GetUnpackedFixed64(index); return result.GetUnpackedFixed64(index);
} }
[global::System.CLSCompliant(false)]
public Builder SetUnpackedFixed64(int index, ulong value) { public Builder SetUnpackedFixed64(int index, ulong value) {
PrepareBuilder(); PrepareBuilder();
result.unpackedFixed64_[index] = value; result.unpackedFixed64_[index] = value;
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddUnpackedFixed64(ulong value) { public Builder AddUnpackedFixed64(ulong value) {
PrepareBuilder(); PrepareBuilder();
result.unpackedFixed64_.Add(value); result.unpackedFixed64_.Add(value);
return this; return this;
} }
[global::System.CLSCompliant(false)]
public Builder AddRangeUnpackedFixed64(scg::IEnumerable<ulong> values) { public Builder AddRangeUnpackedFixed64(scg::IEnumerable<ulong> values) {
PrepareBuilder(); PrepareBuilder();
result.unpackedFixed64_.Add(values); result.unpackedFixed64_.Add(values);
@ -3686,7 +3677,9 @@ namespace Google.ProtocolBuffers.TestProtos {
#region Lite runtime methods #region Lite runtime methods
public override int GetHashCode() { public override int GetHashCode() {
int hash = GetType().GetHashCode(); int hash = GetType().GetHashCode();
if (hasValue) hash ^= value_.GetHashCode(); if (hasValue) {
hash ^= value_.GetHashCode();
}
return hash; return hash;
} }
@ -3969,8 +3962,12 @@ namespace Google.ProtocolBuffers.TestProtos {
#region Lite runtime methods #region Lite runtime methods
public override int GetHashCode() { public override int GetHashCode() {
int hash = GetType().GetHashCode(); int hash = GetType().GetHashCode();
if (hasValue) hash ^= value_.GetHashCode(); if (hasValue) {
if (hasValue2) hash ^= value2_.GetHashCode(); hash ^= value_.GetHashCode();
}
if (hasValue2) {
hash ^= value2_.GetHashCode();
}
return hash; return hash;
} }

@ -101,7 +101,9 @@ namespace Google.ProtocolBuffers.TestProtos {
#region Lite runtime methods #region Lite runtime methods
public override int GetHashCode() { public override int GetHashCode() {
int hash = GetType().GetHashCode(); int hash = GetType().GetHashCode();
if (hasD) hash ^= d_.GetHashCode(); if (hasD) {
hash ^= d_.GetHashCode();
}
return hash; return hash;
} }

@ -92,7 +92,9 @@ namespace Google.ProtocolBuffers.TestProtos {
#region Lite runtime methods #region Lite runtime methods
public override int GetHashCode() { public override int GetHashCode() {
int hash = GetType().GetHashCode(); int hash = GetType().GetHashCode();
if (hasE) hash ^= e_.GetHashCode(); if (hasE) {
hash ^= e_.GetHashCode();
}
return hash; return hash;
} }

Loading…
Cancel
Save