├── .gitignore ├── .nuget └── packages.config ├── BasicHttp ├── About this.txt ├── BasicHttp.sln ├── BasicHttp.suo ├── HttpClient │ ├── DcsExample.cs │ ├── HttpClient.csproj │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── ProtoWebClient.cs ├── HttpServer │ ├── Content │ │ └── Site.css │ ├── Controllers │ │ └── CustomerController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── HttpServer.csproj │ ├── HttpServer.csproj.user │ ├── MyHandler.ashx │ ├── MyHandler.ashx.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ProtoHandler.cs │ ├── ProtoPostBinder.cs │ ├── ProtoResult.cs │ ├── Scripts │ │ ├── MicrosoftAjax.debug.js │ │ ├── MicrosoftAjax.js │ │ ├── MicrosoftMvcAjax.debug.js │ │ ├── MicrosoftMvcAjax.js │ │ ├── MicrosoftMvcValidation.debug.js │ │ ├── MicrosoftMvcValidation.js │ │ ├── jquery-1.4.1-vsdoc.js │ │ ├── jquery-1.4.1.js │ │ ├── jquery-1.4.1.min.js │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ └── jquery.validate.min.js │ ├── Views │ │ └── Web.config │ ├── Web.Debug.config │ ├── Web.Release.config │ └── Web.config └── MyDtoLayer │ ├── MyDtoLayer.csproj │ ├── MySchema.cs │ ├── MySchema.proto │ └── Properties │ └── AssemblyInfo.cs ├── DAL ├── DAL.csproj ├── Program.cs └── Properties │ ├── AssemblyInfo.cs │ └── Settings.Designer.cs ├── DataPipeline ├── DataPipeline.csproj ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── DataTableSerializer ├── DataTableSerializer.csproj ├── Program.cs └── Properties │ └── AssemblyInfo.cs ├── Examples ├── Arrays.cs ├── AutoFields.cs ├── AutoTuple.cs ├── Callbacks.cs ├── ComparisonToNDCS.cs ├── DataMemberOffset.cs ├── DesignIdeas │ └── Inheritance.cs ├── DetectMissing.cs ├── DictionaryTests.cs ├── DynamicIFormatter.cs ├── EnumTests.cs ├── Examples.csproj ├── ExtendedTimeTests.cs ├── Extensibility.cs ├── Fields.cs ├── GuidTests.cs ├── ImmutableCollections.cs ├── Inheritance.cs ├── InheritanceMidLevel.cs ├── InternerTests.cs ├── Issues │ ├── AssortedGoLiveRegressions.cs │ ├── ComplexGenerics │ │ └── ComplexGenericExample.cs │ ├── DeserializeExtensible.cs │ ├── DetectMissing │ │ ├── DetectMissing.cs │ │ └── Generated.cs │ ├── Issue124.cs │ ├── Issue152.cs │ ├── Issue170.cs │ ├── Issue174cs.cs │ ├── Issue176.cs │ ├── Issue184.cs │ ├── Issue185.cs │ ├── Issue191.cs │ ├── Issue192.cs │ ├── Issue199.cs │ ├── Issue202.cs │ ├── Issue203.cs │ ├── Issue218.cs │ ├── Issue222.cs │ ├── Issue243.cs │ ├── Issue26.cs │ ├── Issue264.cs │ ├── Issue265.cs │ ├── Issue266.cs │ ├── Issue27.cs │ ├── Issue284.cs │ ├── Issue29.cs │ ├── Issue295.cs │ ├── Issue297.cs │ ├── Issue302.cs │ ├── Issue303.cs │ ├── Issue304.cs │ ├── Issue306.cs │ ├── Issue307.cs │ ├── Issue310.cs │ ├── Issue312.cs │ ├── Issue316.cs │ ├── Issue32.cs │ ├── Issue329.cs │ ├── Issue331.cs │ ├── Issue354.cs │ ├── Issue356.cs │ ├── Issue367.cs │ ├── Issue41.cs │ ├── Issue44.cs │ ├── Issue45.cs │ ├── Issue48.cs │ ├── Issue48 │ │ ├── Issue202.cs │ │ ├── MXP.Common.proto │ │ └── MXP.Extentions.OpenMetaverseFragments.proto │ ├── Issue54.cs │ ├── Issue62.cs │ ├── Issue70.cs │ ├── Issue79.cs │ ├── Issue80.cs │ ├── MB.cs │ ├── MissingBaseTypes.cs │ ├── SO10115538.cs │ ├── SO10841807.cs │ ├── SO11034791.cs │ ├── SO11080108.cs │ ├── SO11317045.cs │ ├── SO11564914.cs │ ├── SO11641262.cs │ ├── SO11656439.cs │ ├── SO11657482.cs │ ├── SO11705351.cs │ ├── SO11730610.cs │ ├── SO11871726.cs │ ├── SO11896228.cs │ ├── SO12040007.cs │ ├── SO12475521.cs │ ├── SO13162642.cs │ ├── SO13275299.cs │ ├── SO13783894.cs │ ├── SO13802844.cs │ ├── SO14020284.cs │ ├── SO14048958.cs │ ├── SO14436606.cs │ ├── SO14532116.cs │ ├── SO14540862.cs │ ├── SO15794274.cs │ ├── SO16756104.cs │ ├── SO16797650.cs │ ├── SO16803233.cs │ ├── SO16838287.cs │ ├── SO17040488.cs │ ├── SO17245073.cs │ ├── SO18277323.cs │ ├── SO18650486.cs │ ├── SO18663361.cs │ ├── SO18695728.cs │ ├── SO19161823.cs │ ├── SO1930209.cs │ ├── SO3083847.cs │ ├── SO3101816.cs │ ├── SO3261310.cs │ ├── SO6109616.cs │ ├── SO6115986.cs │ ├── SO6127380.cs │ ├── SO6174298.cs │ ├── SO6230449.cs │ ├── SO6407130.cs │ ├── SO6476958.cs │ ├── SO6478579.cs │ ├── SO6505590.cs │ ├── SO6651451.cs │ ├── SO6671829.cs │ ├── SO7064824.cs │ ├── SO7078615.cs │ ├── SO7120856.cs │ ├── SO7218127.cs │ ├── SO7219959.cs │ ├── SO7333233.cs │ ├── SO7347694.cs │ ├── SO7654066.cs │ ├── SO7686734.cs │ ├── SO7719000.cs │ ├── SO7727355.cs │ ├── SO7793527.cs │ ├── SO8093623.cs │ ├── SO8466936.cs │ ├── SO9144967.cs │ ├── SO9151111.cs │ ├── SO9151111b.cs │ ├── SO9398578.cs │ ├── SO9408133.cs │ ├── SO9491933.cs │ └── SurrogateForObjectUsage.cs ├── ItemsWithLengthPrefix.cs ├── ListAsInterfaceTests.cs ├── ListTests.cs ├── ListsWithInheritance.cs ├── MultiTypesWithLengthPrefix.cs ├── NWind │ ├── CompatDb.cs │ ├── DataContext.cs │ └── NWind.cs ├── NetObjectOptions.cs ├── NonGeneric.cs ├── NonPublic_Compile.cs ├── NonSeekableStreams.cs ├── OldProgram.cs ├── OptionalData.cs ├── PEVerify.cs ├── Parseable.cs ├── PartialClasses.cs ├── Pipeline.cs ├── Ppt │ └── Ppt.cs ├── PrimativeSerializationTests.cs ├── Primatives.cs ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ └── Settings.settings ├── ProtoGen │ ├── Empty.proto │ ├── Enums.proto │ ├── Generator.cs │ ├── InputLoader.cs │ ├── LITE.proto │ ├── OptionParser.cs │ ├── WithBom.proto │ ├── csharp_options.proto │ ├── gps.proto │ ├── jons.bin │ ├── keywords.proto │ ├── person.bin │ ├── person.proto │ ├── rpc.bin │ ├── rpc.proto │ ├── searchRequest.cs │ └── searchRequest.proto ├── ProtoGeneration.cs ├── Recursion.cs ├── Remoting.cs ├── Remoting │ └── RemotingDemo.cs ├── Rpc.cs ├── Rpc │ └── HttpBasic.cs ├── RpcTest.cs ├── ServiceModel │ └── WcfTest.cs ├── ShadowSetters.cs ├── SimpleStream │ ├── Collections.cs │ ├── GroupedData.cs │ ├── NullTypes.cs │ ├── SimplePerfTests.cs │ └── SimpleStreamDemo.cs ├── StupidlyComplexModel.cs ├── TagInference.cs ├── TestNumbers │ └── NumberTests.cs ├── TraceError.cs ├── Tuples.cs ├── Type.cs ├── TypeFactory.cs ├── UnwrappedOuters.cs ├── ValueWrapper.cs ├── WcfProtoBridge.cs ├── app.config ├── memcached.cs ├── packages.config └── person.cs ├── FX11 ├── App.config ├── FX11.csproj └── Program.cs ├── Info.txt ├── LateLoaded ├── FooBar.cs └── LateLoaded.csproj ├── Licence.txt ├── MetroDto ├── MetroDto.csproj ├── MyDtos.cs ├── OnceMoreWithFeeling.cs ├── Properties │ └── AssemblyInfo.cs └── Sample.cs ├── Metro_DevRig ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── Logo.png │ ├── SmallLogo.png │ ├── SplashScreen.png │ └── StoreLogo.png ├── Common │ └── StandardStyles.xaml ├── MainPage.xaml ├── MainPage.xaml.cs ├── Metro_DevRig.csproj ├── Metro_DevRig_TemporaryKey.pfx ├── Package.appxmanifest └── Properties │ └── AssemblyInfo.cs ├── MonoDroid_DevRig ├── Activity1.cs ├── MonoDroid_DevRig.csproj ├── MonoDroid_DevRig.csproj.user ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs └── Resources │ ├── AboutResources.txt │ ├── Resource.Designer.cs │ ├── drawable-hdpi │ └── icon.png │ ├── drawable-ldpi │ └── icon.png │ ├── drawable-mdpi │ └── icon.png │ ├── layout │ └── main.xml │ └── values │ └── strings.xml ├── MonoDto ├── MonoDto.csproj ├── MonoDto.csproj.user ├── Orders.cs └── Properties │ └── AssemblyInfo.cs ├── MonoSerBuilder ├── MonoSerBuilder.csproj ├── Program.cs ├── Properties │ └── AssemblyInfo.cs └── app.config ├── Net11_Poco ├── AssemblyInfo.cs ├── DAL.cs ├── Net11_Poco.csproj ├── Net11_Poco.sln └── Net11_Poco.suo ├── Net11_Runner ├── App.ico ├── AssemblyInfo.cs ├── Net11_Runner.csproj └── Program.cs ├── Net45Dto ├── MyDtos.cs ├── Net45Dto.csproj └── Properties │ └── AssemblyInfo.cs ├── NuGet.Config ├── Nuget └── protobuf-net.nuspec ├── Phone8Dto ├── MyDtos.cs ├── Phone8Dto.csproj ├── Phone8Dto.csproj.user └── Properties │ └── AssemblyInfo.cs ├── Phone8_DevRig ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── AlignmentGrid.png │ ├── ApplicationIcon.png │ └── Tiles │ │ ├── FlipCycleTileLarge.png │ │ ├── FlipCycleTileMedium.png │ │ ├── FlipCycleTileSmall.png │ │ ├── IconicTileMediumLarge.png │ │ └── IconicTileSmall.png ├── LocalizedStrings.cs ├── MainPage.xaml ├── MainPage.xaml.cs ├── Phone8DtoSerializer.dll ├── Phone8_DevRig.csproj ├── Phone8_DevRig.csproj.user ├── Properties │ ├── AppManifest.xml │ ├── AssemblyInfo.cs │ └── WMAppManifest.xml └── Resources │ ├── AppResources.Designer.cs │ └── AppResources.resx ├── PhoneDto ├── MyDtos.cs ├── PhoneDto.csproj └── Properties │ └── AssemblyInfo.cs ├── Phone_DevRig ├── App.xaml ├── App.xaml.cs ├── ApplicationIcon.jpg ├── Background.jpg ├── MainPage.xaml ├── MainPage.xaml.cs ├── Phone_DevRig.csproj ├── Properties │ ├── AppManifest.xml │ ├── AssemblyInfo.cs │ └── WMAppManifest.xml ├── Resource1.Designer.cs ├── Resource1.resx ├── SplashScreenImage.jpg ├── foo.cs └── foo.proto ├── Proto 2008.sln ├── Proto 2010.sln ├── Proto 2012.sln ├── Proto 2013.sln ├── Proto.sln.cache ├── ProtoBuf.snk ├── ProtoBufGenerator ├── CustomTool │ ├── CustomToolBase.cs │ ├── CustomToolRegistrationAttribute.cs │ ├── Delegates.cs │ ├── ExtensionMethods.cs │ ├── GenerationError.cs │ ├── GenerationEventArgs.cs │ ├── GenerationProgressFacade.cs │ └── GenerationWarning.cs ├── ItemTemplates │ └── csharp │ │ └── data │ │ └── 1033 │ │ └── ProtoBuf.zip ├── Properties │ └── AssemblyInfo.cs ├── ProtoBufGenerator.csproj ├── ProtoBufGenerator.ico ├── ProtoBufTool.cs ├── Tools │ ├── ProtoBufGenerator.reg │ ├── register.bat │ └── unregister.bat └── VSPackage.resx ├── ProtoGen ├── CommandLineOptions.cs ├── InputFileLoader.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ └── Usage.txt ├── ProtoGen.csproj ├── ProtoGen.ico ├── app.config ├── common.xslt ├── csharp.xslt ├── descriptor.cs ├── descriptor.proto ├── protobuf-net.proto ├── vb.xslt └── xml.xslt ├── QuickStart ├── 1 Data Objects.cs ├── 2 File Access.cs ├── 3 Sockets.cs ├── Program.cs ├── QuickStart.csproj └── app.config ├── README.md ├── SO11895998 ├── DTOs.cs ├── Properties │ └── AssemblyInfo.cs └── SO11895998.csproj ├── SO11895998_Portable ├── DTOs.cs ├── Properties │ └── AssemblyInfo.cs └── SO11895998_Portable.csproj ├── SampleDto ├── Class1.cs ├── Order.cs ├── Orders.cs ├── Product.cs ├── Properties │ └── AssemblyInfo.cs ├── SampleDto.csproj └── app.config ├── SignedDto ├── Class1.cs ├── Properties │ └── AssemblyInfo.cs ├── ProtoBuf.snk └── SignedDto.csproj ├── SilverDto ├── MyDtos.cs ├── Properties │ └── AssemblyInfo.cs └── SilverDto.csproj ├── SilverlightExtended ├── App.xaml ├── App.xaml.cs ├── Default.html ├── ISerializerTestAgent.cs ├── Nuxleus.Asynchronous │ ├── Async.cs │ ├── AsyncOperation.cs │ ├── NuxleusAsyncResult.cs │ ├── OperationProgressChangedEventArgs.cs │ ├── OperationProgressChangedEventHandler.cs │ └── ProtoBufOperationAsyncResult.cs ├── Nuxleus.Extension │ ├── ExtensionMethods.cs │ └── Substring.cs ├── Nuxleus.Messaging │ └── Protobuf │ │ └── Person.cs ├── Nuxleus.MetaData │ └── Label.cs ├── Nuxleus.Performance │ ├── PerformanceLog.cs │ └── PerformanceTimer.cs ├── Nuxleus.Web │ └── HttpGetAsyncResponse.cs ├── Nuxleus.WebService │ ├── HttpWebService.cs │ ├── IRequest.cs │ ├── IResponse.cs │ ├── ITask.cs │ ├── PutObject.cs │ ├── PutObjectRequest.cs │ ├── PutObjectResponse.cs │ ├── RequestType.cs │ └── WebServiceType.cs ├── Page.xaml ├── Page.xaml.cs ├── PerformanceLogSummary.cs ├── Properties │ ├── AppManifest.xml │ └── AssemblyInfo.cs ├── SilverlightExtended.csproj ├── SummaryDetailsView.xaml ├── SummaryDetailsView.xaml.cs ├── clientaccesspolicy.xml ├── crossdomain.xml └── web.config ├── SilverlightExtended_HttpHandler ├── Nuxleus.Web │ └── NuxleusHttpAsyncProtoBufHandler.cs ├── Properties │ └── AssemblyInfo.cs └── SilverlightExtended_HttpHandler.csproj ├── SilverlightExtended_Web ├── App_Code │ └── Default.aspx.cs ├── Default.aspx ├── SilverlightExtended_Web.csproj └── Web.config ├── Spikes └── NetObjectCache_Sharded.cs ├── SqlClr ├── MyUdt.cs ├── Properties │ └── AssemblyInfo.cs ├── SqlClr.csproj └── app.config ├── StartHere.txt ├── TestWcfClient ├── Program.cs ├── Properties │ ├── AssemblyInfo.cs │ └── DataSources │ │ └── TestWcfDto.CompositeType.datasource ├── Service References │ └── ServiceReference1 │ │ ├── Reference.cs │ │ ├── Reference.svcmap │ │ ├── Service1.wsdl │ │ ├── Service1.xsd │ │ ├── Service11.xsd │ │ ├── Service12.xsd │ │ ├── configuration.svcinfo │ │ └── configuration91.svcinfo ├── TestWcfClient.csproj └── app.config ├── TestWcfDto ├── IService1.cs ├── Properties │ └── AssemblyInfo.cs └── TestWcfDto.csproj ├── TestWcfServer ├── Properties │ └── AssemblyInfo.cs ├── Service1.svc ├── Service1.svc.cs ├── TestWcfServer.csproj └── Web.config ├── Tests.Dnx ├── SmokeTest.cs ├── TestBridge.cs ├── Tests.Dnx.xproj └── project.json ├── Tools ├── Enyim.Caching.dll ├── IKVM-LICENSE ├── IKVM.Reflection.dll ├── MiscUtil.dll ├── NHibernate lgpl.txt ├── NHibernate.dll ├── ProtoSharp.Core.dll ├── ProtoSharp.Core.pdb ├── Protocol Buffers.ppt ├── bcl.proto ├── log4net.dll ├── nunit.framework.dll ├── nwind.groups.proto ├── nwind.groups.proto.bin ├── nwind.proto ├── nwind.proto.bin ├── protoc-license.txt └── protoc.exe ├── VBTestRig ├── Module1.vb ├── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── VBTestRig.vbproj ├── VBTestRig.vbproj.user └── descriptor.vb ├── WcfPerfTest ├── Demo.sln ├── Demo.suo ├── WcfClient │ ├── Form1.Designer.cs │ ├── Form1.cs │ ├── Form1.resx │ ├── NWind.cs │ ├── Program.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── DataSources │ │ │ └── WcfClient.NWind.OrderSet.datasource │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── WcfClient.csproj │ └── app.config ├── WcfServer │ ├── BasicMessage.cs │ ├── BasicMessage.proto │ ├── BasicService.asmx │ ├── BasicService.asmx.cs │ ├── BasicService.svc │ ├── BasicService.svc.cs │ ├── IBasicService.cs │ ├── INWindService.cs │ ├── NWind.dbml │ ├── NWind.dbml.layout │ ├── NWind.designer.cs │ ├── NWindMtomService.svc │ ├── NWindService.svc.cs │ ├── NWindTextService.svc │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── WcfServer.Publish.xml │ ├── WcfServer.csproj │ └── Web.config └── What is this.txt ├── What Files Do I Need.txt ├── all.build ├── build.bat ├── build_cf20.bat ├── build_fx11.bat ├── build_fx20.bat ├── build_gmcs.bat ├── build_gmcs_basic.bat ├── build_mcs.bat ├── build_mf30.bat ├── buildkit20.build ├── buildkit35.build ├── buildpack.cmd ├── demo-rpc-client-silverlight ├── App.xaml ├── App.xaml.cs ├── Northwind.cs ├── Page.xaml ├── Page.xaml.cs ├── Properties │ ├── AppManifest.xml │ └── AssemblyInfo.cs ├── Service References │ └── Northwind │ │ ├── Reference.cs │ │ ├── Reference.svcmap │ │ ├── configuration.svcinfo │ │ ├── configuration91.svcinfo │ │ ├── demo_rpc_client_silverlight.Northwind.Customer.datasource │ │ ├── demo_rpc_client_silverlight.Northwind.Order.datasource │ │ ├── demo_rpc_server_mvc.Models.xsd │ │ ├── service.wsdl │ │ ├── service.xsd │ │ ├── service1.wsdl │ │ └── service1.xsd ├── ServiceReferences.ClientConfig └── demo-rpc-client-silverlight.csproj ├── demo-rpc-server-mvc ├── App_Data │ ├── NORTHWIND.MDF │ └── NORTHWIND_log.ldf ├── ClientBin │ └── demo-rpc-client-silverlight.xap ├── Content │ └── Site.css ├── Controllers │ ├── HomeController.cs │ └── NorthwindController.cs ├── Default.aspx ├── Default.aspx.cs ├── Global.asax ├── Global.asax.cs ├── Helpers │ ├── ControllerExtensions.cs │ ├── HtmlHelperExtensions.cs │ └── ProtoController.cs ├── Models │ ├── INorthwind.cs │ ├── Northwind.dbml │ ├── Northwind.dbml.layout │ └── Northwind.designer.cs ├── Northwind.svc ├── Northwind.svc.cs ├── Properties │ └── AssemblyInfo.cs ├── Scripts │ ├── MicrosoftAjax.debug.js │ ├── MicrosoftAjax.js │ ├── MicrosoftMvcAjax.debug.js │ ├── MicrosoftMvcAjax.js │ ├── Silverlight.js │ ├── jquery-1.2.6-vsdoc.js │ ├── jquery-1.2.6.js │ ├── jquery-1.2.6.min-vsdoc.js │ └── jquery-1.2.6.min.js ├── Views │ ├── Home │ │ ├── About.aspx │ │ └── Index.aspx │ ├── Shared │ │ ├── Error.aspx │ │ ├── LogOnUserControl.ascx │ │ ├── Silverlight.aspx │ │ └── Site.Master │ └── Web.config ├── Web.config └── demo-rpc-server-mvc.csproj ├── global.json ├── nugetpush.cmd ├── precompile.tests ├── BasicTests.cs ├── Issues │ ├── Net11.cs │ ├── SO11639029.cs │ └── SO11895998.cs ├── Properties │ └── AssemblyInfo.cs └── precompile.tests.csproj ├── precompile ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── precompile.csproj └── precompile.ico ├── proto_dnx.sln ├── protobuf-net-CF20 └── protobuf-net-CF20.csproj ├── protobuf-net-CF35 └── protobuf-net-CF35.csproj ├── protobuf-net-VS9 └── protobuf-net-VS9.vdproj ├── protobuf-net-mono └── protobuf-net-mono.build ├── protobuf-net.Enyim ├── .nuget │ ├── NuGet.Config │ ├── NuGet.exe │ ├── NuGet.targets │ └── packages.config ├── packages │ ├── EnyimMemcached.2.12 │ │ ├── EnyimMemcached.2.12.nupkg │ │ ├── EnyimMemcached.2.12.nuspec │ │ └── lib │ │ │ └── net35 │ │ │ ├── Enyim.Caching.dll │ │ │ ├── Enyim.Caching.pdb │ │ │ └── Enyim.Caching.xml │ ├── NUnit.2.6.2 │ │ ├── NUnit.2.6.2.nupkg │ │ ├── NUnit.2.6.2.nuspec │ │ ├── lib │ │ │ ├── nunit.framework.dll │ │ │ └── nunit.framework.xml │ │ └── license.txt │ ├── NuGet.CommandLine.2.1.2 │ │ ├── NuGet.CommandLine.2.1.2.nupkg │ │ ├── NuGet.CommandLine.2.1.2.nuspec │ │ └── tools │ │ │ └── NuGet.exe │ ├── protobuf-net.2.0.0.602 │ │ ├── lib │ │ │ ├── net20-cf │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── net20 │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── net30 │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── net35-cf │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── net35 │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── net40-cf │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── net40 │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── netcore45 │ │ │ │ ├── protobuf-net.XML │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.pri │ │ │ ├── portable-sl4+wp71+windows8 │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── sl3-wp │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── sl4-windowsphone71 │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ ├── sl4 │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ │ └── windowsphone8 │ │ │ │ ├── protobuf-net.dll │ │ │ │ ├── protobuf-net.pdb │ │ │ │ └── protobuf-net.xml │ │ ├── protobuf-net.2.0.0.602.nupkg │ │ └── protobuf-net.2.0.0.602.nuspec │ └── repositories.config ├── protobuf-net.Enyim.1.0.nupkg ├── protobuf-net.Enyim.Tests │ ├── BasicTests.cs │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── app.config │ ├── packages.config │ └── protobuf-net.Enyim.Tests.csproj ├── protobuf-net.Enyim.nuspec ├── protobuf-net.Enyim.sln └── protobuf-net.Enyim │ ├── ByteSegmentComparer.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── ProtoTranscoder.cs │ ├── packages.config │ └── protobuf-net.Enyim.csproj ├── protobuf-net.Extensions-CF35 └── protobuf-net.Extensions-CF35.csproj ├── protobuf-net.Extensions ├── Caching │ ├── ByteSegmentComparer.cs │ └── Enyim │ │ └── ProtoTranscoder.cs ├── Expressions │ └── Expression.cs ├── Properties │ └── AssemblyInfo.cs ├── ServiceModel │ └── Client │ │ └── ProtoClientExtensions.cs └── protobuf-net.Extensions.csproj ├── protobuf-net.unittest ├── Attribs │ ├── Basic.cs │ ├── ComplexMultiTypes.cs │ ├── MultiTypes.cs │ └── PointStruct.cs ├── FX11.cs ├── Issues │ ├── SO8933251.cs │ └── TurkishL.cs ├── Meta │ ├── AbstractListsWithInheritance.cs │ ├── Basic.cs │ ├── Callbacks.cs │ ├── Enums.cs │ ├── Guids.cs │ ├── Inheritance.cs │ ├── Interfaces.cs │ ├── Lists.cs │ ├── LockContention.cs │ ├── PocoStruct.cs │ ├── Struct.cs │ ├── SubItems.cs │ └── ThreadRace.cs ├── PEVerify.cs ├── Perf │ ├── Issue103.cs │ ├── Types103.cs │ └── Types103.proto ├── Properties │ └── AssemblyInfo.cs ├── Serializers │ ├── DateTimeTests.cs │ ├── KeyValuePairTests.cs │ ├── NilSerializer.cs │ ├── SubItems.cs │ ├── Tag.cs │ ├── Util.cs │ └── Writer.cs ├── ThirdParty │ └── NHibernateProxies.cs └── protobuf-net.unittest.csproj ├── protobuf-net ├── BclHelpers.cs ├── BufferExtension.cs ├── BufferPool.cs ├── CallbackAttributes.cs ├── Compiler │ ├── CompilerContext.cs │ ├── CompilerDelegates.cs │ └── Local.cs ├── DataFormat.cs ├── Extensible.cs ├── ExtensibleUtil.cs ├── GlobalSuppressions.cs ├── Helpers.cs ├── IExtensible.cs ├── IExtension.cs ├── ImplicitFields.cs ├── KeyValuePairProxy.cs ├── Meta │ ├── AttributeMap.cs │ ├── BasicList.cs │ ├── CallbackSet.cs │ ├── MetaType.cs │ ├── RuntimeTypeModel.cs │ ├── SubType.cs │ ├── TypeFormatEventArgs.cs │ ├── TypeModel.cs │ └── ValueMember.cs ├── NetObjectCache.cs ├── PrefixStyle.cs ├── Properties │ └── AssemblyInfo.cs ├── ProtoContractAttribute.cs ├── ProtoConverterAttribute.cs ├── ProtoEnumAttribute.cs ├── ProtoException.cs ├── ProtoIgnoreAttribute.cs ├── ProtoIncludeAttribute.cs ├── ProtoMemberAttribute.cs ├── ProtoReader.cs ├── ProtoWriter.cs ├── SerializationContext.cs ├── Serializer.cs ├── Serializers │ ├── ArrayDecorator.cs │ ├── BlobSerializer.cs │ ├── BooleanSerializer.cs │ ├── ByteSerializer.cs │ ├── CharSerializer.cs │ ├── CompiledSerializer.cs │ ├── DateTimeSerializer.cs │ ├── DecimalSerializer.cs │ ├── DefaultValueDecorator.cs │ ├── DoubleSerializer.cs │ ├── EnumSerializer.cs │ ├── FieldDecorator.cs │ ├── GuidSerializer.cs │ ├── IProtoSerializer.cs │ ├── IProtoTypeSerializer.cs │ ├── ISerializerProxy.cs │ ├── ImmutableCollectionDecorator.cs │ ├── Int16Serializer.cs │ ├── Int32Serializer.cs │ ├── Int64Serializer.cs │ ├── KeyValuePairDecorator.cs │ ├── ListDecorator.cs │ ├── MemberSpecifiedDecorator.cs │ ├── NetObjectSerializer.cs │ ├── NullDecorator.cs │ ├── ParseableSerializer.cs │ ├── PropertyDecorator.cs │ ├── ProtoDecoratorBase.cs │ ├── ReflectedUriDecorator.cs │ ├── SByteSerializer.cs │ ├── SingleSerializer.cs │ ├── StringSerializer.cs │ ├── SubItemSerializer.cs │ ├── SurrogateSerializer.cs │ ├── SystemTypeSerializer.cs │ ├── TagDecorator.cs │ ├── TimeSpanSerializer.cs │ ├── TupleSerializer.cs │ ├── TypeSerializer.cs │ ├── UInt16Serializer.cs │ ├── UInt32Serializer.cs │ ├── UInt64Serializer.cs │ └── UriDecorator.cs ├── ServiceModel │ ├── ProtoBehaviorAttribute.cs │ ├── ProtoBehaviorExtensionElement.cs │ ├── ProtoEndpointBehavior.cs │ ├── ProtoOperationBehavior.cs │ └── XmlProtoSerializer.cs ├── SubItemToken.cs ├── Web │ └── TODO.txt ├── WireType.cs ├── project.json ├── protobuf-net.csproj └── protobuf_net.xproj ├── protobuf-net_IKVM └── protobuf-net_IKVM.csproj ├── protobuf-net_MonoDroid └── protobuf-net_MonoDroid.csproj ├── protobuf-net_Phone7 ├── Properties │ └── AssemblyInfo.cs └── protobuf-net_Phone7.csproj ├── protobuf-net_Phone8 ├── protobuf-net_Phone8.csproj └── protobuf-net_Phone8.csproj.user ├── protobuf-net_Portable └── protobuf-net_Portable.csproj ├── protobuf-net_Silverlight ├── protobuf-net_Silverlight.csproj └── protobuf-net_Silverlight.csproj.user ├── protobuf-net_WinRT └── protobuf-net_WinRT.csproj └── push.cmd /.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | artifacts 3 | bin 4 | obj 5 | *.user 6 | TestFiles/ 7 | *.suo 8 | Tools/PEVerify.* 9 | packages/ 10 | project.lock.json 11 | Tests.Dnx/*.dll -------------------------------------------------------------------------------- /.nuget/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /BasicHttp/BasicHttp.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingsoft-topgame/protobuf-net/1bb4337c1d2bfe34ac35b3afd4cd76fb24f3075b/BasicHttp/BasicHttp.suo -------------------------------------------------------------------------------- /BasicHttp/HttpClient/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | using MyDtoLayer; 4 | using System.Collections.Generic; 5 | 6 | namespace HttpClient { 7 | class Program { 8 | static void Main() { 9 | // create a request 10 | var req = new GetCustomerRequest { id = 1 }; 11 | GetCustomerResponse resp; 12 | 13 | // ask the server (IHttpHandler) 14 | using (var client = new WebClient { BaseAddress = "http://localhost:22174" }) { 15 | resp = client.UploadProto("/MyHandler.ashx", req); 16 | } 17 | 18 | // write the answer 19 | WriteCustomer(resp.cust); 20 | 21 | // ask the server (ASP.NET MVC) 22 | using (var client = new WebClient { BaseAddress = "http://localhost:22174" }) { 23 | resp = client.UploadProto("/Customer/GetCustomer", req); 24 | } 25 | 26 | // write the answer 27 | WriteCustomer(resp.cust); 28 | } 29 | 30 | static void WriteCustomer(Customer cust) 31 | { 32 | Console.WriteLine(cust.id); 33 | Console.WriteLine(cust.name); 34 | var addr = cust.address; 35 | Console.WriteLine(addr.line1); 36 | Console.WriteLine(addr.zip); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /BasicHttp/HttpServer/Content/Site.css: -------------------------------------------------------------------------------- 1 | /* Styles for validation helpers 2 | -----------------------------------------------------------*/ 3 | .field-validation-error 4 | { 5 | color: #ff0000; 6 | } 7 | 8 | .field-validation-valid 9 | { 10 | display: none; 11 | } 12 | 13 | .input-validation-error 14 | { 15 | border: 1px solid #ff0000; 16 | background-color: #ffeeee; 17 | } 18 | 19 | .validation-summary-errors 20 | { 21 | font-weight: bold; 22 | color: #ff0000; 23 | } 24 | 25 | .validation-summary-valid 26 | { 27 | display: none; 28 | } 29 | -------------------------------------------------------------------------------- /BasicHttp/HttpServer/Controllers/CustomerController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using MyDtoLayer; 7 | 8 | namespace HttpServer.Controllers 9 | { 10 | public class CustomerController : Controller 11 | { 12 | public ActionResult GetCustomer([ProtoPost] GetCustomerRequest req) 13 | { 14 | // create a response 15 | var resp = new GetCustomerResponse { 16 | cust = new Customer { 17 | id = req.id, 18 | name = "Name of cust " + req.id, 19 | address = new Address { 20 | line1 = "27 wood lane", zip = "pl1" 21 | } 22 | } 23 | }; 24 | return new ProtoResult(resp); 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BasicHttp/HttpServer/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="HttpServer.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /BasicHttp/HttpServer/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace HttpServer 9 | { 10 | // Note: For instructions on enabling IIS6 or IIS7 classic mode, 11 | // visit http://go.microsoft.com/?LinkId=9394801 12 | 13 | public class MvcApplication : System.Web.HttpApplication 14 | { 15 | public static void RegisterRoutes(RouteCollection routes) 16 | { 17 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 18 | 19 | routes.MapRoute( 20 | "Default", // Route name 21 | "{controller}/{action}/{id}", // URL with parameters 22 | new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults 23 | ); 24 | 25 | } 26 | 27 | protected void Application_Start() 28 | { 29 | AreaRegistration.RegisterAllAreas(); 30 | 31 | RegisterRoutes(RouteTable.Routes); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /BasicHttp/HttpServer/HttpServer.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | NoStartPage 10 | True 11 | False 12 | False 13 | False 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | False 23 | True 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BasicHttp/HttpServer/MyHandler.ashx: -------------------------------------------------------------------------------- 1 | <%@ WebHandler Language="C#" CodeBehind="MyHandler.ashx.cs" Class="HttpServer.MyHandler" %> 2 | -------------------------------------------------------------------------------- /BasicHttp/HttpServer/MyHandler.ashx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using MyDtoLayer; 4 | 5 | namespace HttpServer 6 | { 7 | public class MyHandler : ProtoHandler 8 | { 9 | public override object Execute(HttpContext context, object request) { 10 | // inspect the incoming request 11 | var req = (GetCustomerRequest)request; 12 | 13 | // create a response 14 | var resp = new GetCustomerResponse { 15 | cust = new Customer { 16 | id = req.id, 17 | name = "Name of cust " + req.id, 18 | address = new Address { 19 | line1 = "27 wood lane", zip = "pl1" 20 | } 21 | } 22 | }; 23 | return resp; 24 | } 25 | protected override Type GetRequestType(HttpContext context) 26 | { 27 | // tell the base what type of request we should expect (this could vary with context) 28 | return typeof(GetCustomerRequest); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /BasicHttp/HttpServer/ProtoHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web; 3 | using ProtoBuf; 4 | 5 | namespace HttpServer 6 | { 7 | /// 8 | /// Base handler for working with .proto 9 | /// 10 | public abstract class ProtoHandler : IHttpHandler 11 | { 12 | bool IHttpHandler.IsReusable { get { return false; } } 13 | 14 | void IHttpHandler.ProcessRequest(HttpContext context) 15 | { 16 | object request = null; 17 | Type requestType; 18 | if (context.Request.HttpMethod == "POST" && (requestType = GetRequestType(context)) != null) 19 | { 20 | request = Serializer.NonGeneric.Deserialize(requestType, context.Request.InputStream); 21 | } 22 | object response = Execute(context, request); 23 | if (response != null) 24 | { 25 | Serializer.NonGeneric.Serialize(context.Response.OutputStream, response); 26 | } 27 | } 28 | 29 | protected virtual Type GetRequestType(HttpContext context) { 30 | return null; 31 | } 32 | 33 | public abstract object Execute(HttpContext context, object request); 34 | 35 | 36 | } 37 | } -------------------------------------------------------------------------------- /BasicHttp/HttpServer/ProtoPostBinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using ProtoBuf; 7 | 8 | namespace HttpServer 9 | { 10 | public class ProtoPostBinder : IModelBinder 11 | { 12 | object IModelBinder.BindModel(ControllerContext controllerContext, 13 | ModelBindingContext bindingContext) 14 | { 15 | var req = controllerContext.HttpContext.Request; 16 | if(req.HttpMethod == "POST") 17 | { 18 | return Serializer.NonGeneric.Deserialize( 19 | bindingContext.ModelType, req.InputStream); 20 | } 21 | return null; 22 | } 23 | } 24 | 25 | public class ProtoPostAttribute : CustomModelBinderAttribute 26 | { 27 | public override IModelBinder GetBinder() 28 | { 29 | return new ProtoPostBinder(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /BasicHttp/HttpServer/ProtoResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using ProtoBuf; 7 | 8 | namespace HttpServer 9 | { 10 | public class ProtoResult : ActionResult 11 | { 12 | // somewhere to store the value the controller gives us 13 | private readonly object result; 14 | public ProtoResult(object result) { this.result = result; } 15 | 16 | // write the response 17 | public override void ExecuteResult(ControllerContext context) 18 | { 19 | var resp = context.HttpContext.Response; 20 | if (result != null) 21 | { 22 | Serializer.NonGeneric.Serialize(resp.OutputStream, result); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /BasicHttp/HttpServer/Web.Debug.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /BasicHttp/HttpServer/Web.Release.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /BasicHttp/MyDtoLayer/MySchema.proto: -------------------------------------------------------------------------------- 1 | message Customer { 2 | required int32 id = 1; 3 | required string name = 2; 4 | optional Address address = 3; 5 | 6 | } 7 | message Address { 8 | required string line1 = 1; 9 | optional string line2 = 2; 10 | 11 | optional string zip = 7; 12 | } 13 | message GetCustomerRequest { 14 | required int32 id = 1; 15 | } 16 | message GetCustomerResponse { 17 | optional Customer cust = 1; 18 | } -------------------------------------------------------------------------------- /Examples/Issues/Issue170.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using ProtoBuf; 3 | using System.Linq; 4 | using System; 5 | namespace Examples.Issues 6 | { 7 | [TestFixture] 8 | public class Issue170 9 | { 10 | 11 | [Test] 12 | public void ArrayWithoutNullContentShouldClone() 13 | { 14 | var arr = new[] { "aaa","bbb" }; 15 | Assert.IsTrue(Serializer.DeepClone(arr).SequenceEqual(arr)); 16 | } 17 | [Test] 18 | public void ArrayWithNullContentShouldThrow() 19 | { 20 | Program.ExpectFailure(() => 21 | { 22 | var arr = new[] { "aaa", null, "bbb" }; 23 | var arr2 = Serializer.DeepClone(arr); 24 | }); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Examples/Issues/Issue174cs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NUnit.Framework; 6 | using ProtoBuf; 7 | using NUnit.Framework.SyntaxHelpers; 8 | using System.IO; 9 | 10 | namespace Examples.Issues 11 | { 12 | [TestFixture] 13 | public class Issue174cs 14 | { 15 | [Test] 16 | public void TestDynamic() 17 | { 18 | Program.ExpectFailure(() => 19 | { 20 | var myVal = new TestProto { Value = true }; 21 | byte[] serialized; 22 | using (var ms = new MemoryStream()) 23 | { 24 | Serializer.Serialize(ms, myVal); 25 | serialized = ms.ToArray(); 26 | } 27 | Assert.IsNotNull(serialized); 28 | }, "Dynamic type is not a contract-type: Boolean"); 29 | } 30 | 31 | [ProtoContract] 32 | public class TestProto 33 | { 34 | [ProtoMember(1, DynamicType = true)] 35 | public object Value { get; internal set; } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Examples/Issues/Issue264.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NUnit.Framework; 3 | using ProtoBuf; 4 | 5 | namespace Examples.Issues 6 | { 7 | [TestFixture] 8 | public class Issue264 9 | { 10 | [Test] 11 | public void TestNakedDecimals() 12 | { 13 | Test(123.45M); 14 | Test(0M); 15 | Test(decimal.MinValue); 16 | Test(decimal.MaxValue); 17 | } 18 | [Test] 19 | public void TestNakedDoubles() 20 | { 21 | Test(123.45D); 22 | Test(0D); 23 | Test(double.MinValue); 24 | Test(double.MaxValue); 25 | } 26 | [Test] 27 | public void TestNakedFloats() 28 | { 29 | Test(123.45F); 30 | Test(0F); 31 | Test(float.MinValue); 32 | Test(float.MaxValue); 33 | } 34 | static void Test(T value) 35 | { 36 | T result = Serializer.DeepClone(value); 37 | Assert.AreEqual(value, result, value.ToString() + ":DeepClone"); 38 | using(var ms = new MemoryStream()) 39 | { 40 | Serializer.Serialize(ms, value); 41 | ms.Position = 0; 42 | result = Serializer.Deserialize(ms); 43 | Assert.AreEqual(value, result, value.ToString() + ":Serialize/Deserialize"); 44 | } 45 | } 46 | 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Examples/Issues/Issue284.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NUnit.Framework; 3 | using ProtoBuf; 4 | using System; 5 | 6 | namespace Examples.Issues 7 | { 8 | [TestFixture] 9 | public class Issue284 10 | { 11 | [Test] 12 | public void Execute() 13 | { 14 | Program.ExpectFailure(() => 15 | { 16 | MyArgs test = new MyArgs 17 | { 18 | Value = 12, 19 | }; 20 | 21 | byte[] buffer = new byte[256]; 22 | using (MemoryStream ms = new MemoryStream(buffer)) 23 | { 24 | Serializer.Serialize(ms, test); 25 | } 26 | 27 | using (MemoryStream ms = new MemoryStream(buffer)) 28 | { 29 | Serializer.Deserialize(ms); 30 | } 31 | }, "Dynamic type is not a contract-type: Int32"); 32 | } 33 | 34 | [ProtoContract] 35 | public class MyArgs 36 | { 37 | [ProtoMember(1, DynamicType = true)] 38 | public object Value; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Examples/Issues/Issue295.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using NUnit.Framework; 3 | using ProtoBuf; 4 | 5 | namespace Examples.Issues 6 | { 7 | [TestFixture] 8 | public class Issue295 9 | { 10 | [ProtoContract(SkipConstructor = true)] 11 | [ProtoInclude(500, typeof(Plant))] 12 | public class Asset 13 | { 14 | public Asset() 15 | { 16 | AllAssets = new List(); 17 | ChildAssets = new List(); 18 | } 19 | [ProtoMember(1)] 20 | public List AllAssets { get; private set; } 21 | 22 | [ProtoMember(2)] 23 | public List AssetHierarcy { get; private set; } 24 | 25 | [ProtoMember(3)] 26 | public List ChildAssets { get; private set; } 27 | } 28 | [ProtoContract(SkipConstructor = true)] 29 | public class Plant : Asset 30 | { 31 | [ProtoMember(105)] 32 | public Asset Blowers { get; set; } 33 | } 34 | 35 | [Test] 36 | public void Execute() 37 | { 38 | Asset asset = new Plant {Blowers = new Asset(), ChildAssets = {new Plant()}}; 39 | var clone = Serializer.DeepClone(asset); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Examples/Issues/Issue302.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NUnit.Framework; 3 | using ProtoBuf; 4 | using ProtoBuf.Meta; 5 | 6 | namespace Examples.Issues 7 | { 8 | [TestFixture] 9 | public class Issue302 10 | { 11 | [Test] 12 | public void RoundTripUInt32EnumValue() 13 | { 14 | var model = TypeModel.Create(); 15 | model.AutoCompile = false; 16 | var foo = new Foo {Value = StateEnum.Deleted}; 17 | 18 | var clone = (Foo)model.DeepClone(foo); 19 | Assert.AreEqual(StateEnum.Deleted, clone.Value, "Runtime"); 20 | 21 | model.Compile("Issue302", "Issue302.dll"); 22 | PEVerify.AssertValid("Issue302.dll"); 23 | 24 | model.CompileInPlace(); 25 | clone = (Foo)model.DeepClone(foo); 26 | Assert.AreEqual(StateEnum.Deleted, clone.Value, "CompileInPlace"); 27 | 28 | clone = (Foo)model.Compile().DeepClone(foo); 29 | Assert.AreEqual(StateEnum.Deleted, clone.Value, "Compile"); 30 | } 31 | 32 | [ProtoContract] 33 | public class Foo 34 | { 35 | [ProtoMember(1)] 36 | public StateEnum Value { get; set; } 37 | } 38 | 39 | [Flags] 40 | public enum StateEnum : uint 41 | { 42 | Active = 0x00000001, 43 | Acknowledged = 0x00000002, 44 | Deleted = 0x80000000 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Examples/Issues/Issue304.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using NUnit.Framework; 3 | using ProtoBuf; 4 | 5 | namespace Examples.Issues 6 | { 7 | [TestFixture] 8 | public class Issue304 9 | { 10 | [Test] 11 | public void DefaultValuesForBoolMustBeLowerCase() 12 | { 13 | Assert.AreEqual(@"package Examples.Issues; 14 | 15 | message Foo { 16 | optional bool Bar = 1 [default = true]; 17 | } 18 | ", 19 | 20 | Serializer.GetProto() 21 | 22 | ); 23 | } 24 | [ProtoContract] 25 | public class Foo 26 | { 27 | [DefaultValue(true), ProtoMember(1)] 28 | public bool Bar { get; set; } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Examples/Issues/Issue306.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NUnit.Framework; 6 | using ProtoBuf; 7 | using ProtoBuf.Meta; 8 | 9 | namespace Examples.Issues 10 | { 11 | [TestFixture] 12 | public class Issue306 13 | { 14 | [Test] 15 | public void TestTuple() 16 | { 17 | var model = TypeModel.Create(); 18 | model.Add(typeof (Foo), true); 19 | 20 | string schema = model.GetSchema(typeof (Foo)); 21 | 22 | Assert.AreEqual(@"package Examples.Issues; 23 | 24 | message Foo { 25 | repeated KeyValuePair_Int32_String Lookup = 1; 26 | } 27 | message KeyValuePair_Int32_String { 28 | optional int32 Key = 1; 29 | optional string Value = 2; 30 | } 31 | ", schema); 32 | } 33 | 34 | [ProtoContract] 35 | public class Foo 36 | { 37 | [ProtoMember(1)] 38 | public Dictionary Lookup { get; set; } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Examples/Issues/Issue32.cs: -------------------------------------------------------------------------------- 1 | #if !NO_CODEGEN 2 | using System.IO; 3 | using NUnit.Framework; 4 | using Examples.ProtoGen; 5 | 6 | namespace Examples.Issues 7 | { 8 | [TestFixture] 9 | public class Issue32 10 | { 11 | [Test] 12 | public void TestGpsProtoGen() 13 | { 14 | string xml = Generator.GetCode(@"-i:ProtoGen\gps.proto", "-t:xml"); 15 | File.WriteAllText("gps.xml", xml); 16 | string code = Generator.GetCode(@"-i:ProtoGen\gps.proto"); 17 | File.WriteAllText("gps.cs", code); 18 | 19 | Generator.TestCompileCSharp(code); 20 | } 21 | } 22 | } 23 | #endif -------------------------------------------------------------------------------- /Examples/Issues/Issue48/MXP.Common.proto: -------------------------------------------------------------------------------- 1 | // Metaverse Structured Data Types 2 | 3 | message MsdVector3f { 4 | required float X=1; 5 | required float Y=2; 6 | required float Z=3; 7 | } 8 | 9 | message MsdQuaternion4f { 10 | required float X=1; 11 | required float Y=2; 12 | required float Z=3; 13 | required float W=4; 14 | } 15 | 16 | message MsdColor4f { 17 | required float R=1; 18 | required float G=2; 19 | required float B=3; 20 | required float A=4; 21 | } 22 | -------------------------------------------------------------------------------- /Examples/Issues/Issue54.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using NUnit.Framework; 4 | using ProtoBuf; 5 | 6 | namespace Examples.Issues 7 | { 8 | [TestFixture] 9 | public class Issue54 10 | { 11 | [ProtoContract] 12 | class Test54 13 | { 14 | [ProtoMember(1)] 15 | public Dictionary> Lists { get; set; } 16 | } 17 | 18 | 19 | [Test] 20 | public void TestNestedLists() 21 | { 22 | Test54 obj = new Test54 23 | { 24 | Lists = 25 | new Dictionary> { 26 | {123.45F, new List {1,2,3}}, 27 | {678.90F, new List {4,5,6}}, 28 | } 29 | }, clone = Serializer.DeepClone(obj); 30 | Assert.AreNotSame(obj, clone); 31 | Assert.IsNotNull(clone.Lists); 32 | Assert.AreEqual(obj.Lists.Count, clone.Lists.Count); 33 | foreach (var key in obj.Lists.Keys) 34 | { 35 | Assert.IsTrue(clone.Lists.ContainsKey(key), key.ToString()); 36 | var list = clone.Lists[key]; 37 | Assert.IsNotNull(list, key.ToString()); 38 | Assert.IsTrue(obj.Lists[key].SequenceEqual(list), key.ToString()); 39 | } 40 | } 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /Examples/Issues/SO10841807.cs: -------------------------------------------------------------------------------- 1 | #if !NO_WCF 2 | using System; 3 | using System.Text.RegularExpressions; 4 | using NUnit.Framework; 5 | using ProtoBuf.ServiceModel; 6 | 7 | namespace Examples.Issues 8 | { 9 | [TestFixture] 10 | public class SO10841807 11 | { 12 | [Test] 13 | public void Execute() 14 | { 15 | string aqn = typeof (ProtoBehaviorExtension).AssemblyQualifiedName; 16 | Assert.IsTrue(Regex.IsMatch(aqn, @"ProtoBuf\.ServiceModel\.ProtoBehaviorExtension, protobuf\-net, Version=[0-9.]+, Culture=neutral, PublicKeyToken=257b51d87d2e4d67")); 17 | Console.WriteLine("WCF AQN: " + aqn); 18 | } 19 | } 20 | } 21 | #endif -------------------------------------------------------------------------------- /Examples/Issues/SO11034791.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using NUnit.Framework; 4 | using ProtoBuf.Meta; 5 | 6 | namespace Examples.Issues 7 | { 8 | [TestFixture] 9 | public class SO11034791 10 | { 11 | [Test] 12 | public void Execute() 13 | { 14 | RuntimeTypeModel model = RuntimeTypeModel.Create(); 15 | 16 | var original = new Custom { "C#" }; 17 | var clone = (Custom)model.DeepClone(original); 18 | Assert.AreEqual(1, clone.Count); 19 | Assert.AreEqual("C#", clone.Single()); 20 | } 21 | public class Custom : List { } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Examples/Issues/SO11657482.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NUnit.Framework; 3 | using ProtoBuf; 4 | 5 | namespace Examples.Issues 6 | { 7 | [TestFixture] 8 | public class SO11657482 9 | { 10 | [ProtoContract] 11 | [ProtoInclude(1, typeof(Derived))] 12 | public abstract class Base { } 13 | 14 | [ProtoContract] 15 | public class Derived : Base 16 | { 17 | [ProtoMember(1)] 18 | public int SomeProperty { get; set; } 19 | } 20 | 21 | [ProtoContract] 22 | public class Aggregate 23 | { 24 | [ProtoMember(1, AsReference = true)] 25 | public Base Base { get; set; } 26 | } 27 | 28 | [Test] 29 | public void TestMethod1() 30 | { 31 | var value = new Aggregate { Base = new Derived() }; 32 | using (var stream = new MemoryStream()) 33 | { 34 | Serializer.Serialize(stream, value); 35 | stream.Position = 0; 36 | 37 | var obj = Serializer.Deserialize(stream); 38 | Assert.AreEqual(typeof(Derived), obj.Base.GetType()); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Examples/Issues/SO11871726.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using ProtoBuf.Meta; 3 | using System; 4 | using System.Runtime.Serialization; 5 | 6 | namespace Examples.Issues 7 | { 8 | [TestFixture] 9 | public class SO11871726 10 | { 11 | [Test] 12 | public void ExecuteWithoutAutoAddProtoContractTypesOnlyShouldWork() 13 | { 14 | var model = TypeModel.Create(); 15 | Assert.IsInstanceOfType(typeof(Foo), model.DeepClone(new Foo())); 16 | } 17 | [Test] 18 | public void ExecuteWithAutoAddProtoContractTypesOnlyShouldFail() 19 | { 20 | Program.ExpectFailure(() => 21 | { 22 | var model = TypeModel.Create(); 23 | model.AutoAddProtoContractTypesOnly = true; 24 | Assert.IsInstanceOfType(typeof(Foo), model.DeepClone(new Foo())); 25 | }, "Type is not expected, and no contract can be inferred: Examples.Issues.SO11871726+Foo"); 26 | } 27 | 28 | [DataContract] 29 | public class Foo { } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Examples/Issues/SO12475521.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using ProtoBuf; 3 | using System; 4 | 5 | namespace Examples.Issues 6 | { 7 | [TestFixture] 8 | public class SO12475521 9 | { 10 | [Test] 11 | public void Execute() 12 | { 13 | var obj = new HazType { X = 1, Type = typeof(string), AnotherType = typeof(ProtoReader) }; 14 | 15 | var clone = Serializer.DeepClone(obj); 16 | 17 | Assert.AreEqual(1, clone.X); 18 | Assert.AreEqual(typeof(string), clone.Type); 19 | Assert.AreEqual(typeof(ProtoReader), clone.AnotherType); 20 | } 21 | 22 | [ProtoContract] 23 | public class HazType 24 | { 25 | [ProtoMember(1)] 26 | public int X { get; set; } 27 | 28 | [ProtoMember(2)] 29 | public Type Type { get; set; } 30 | 31 | [ProtoMember(3)] 32 | public Type AnotherType { get; set; } 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Examples/Issues/SO13802844.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using ProtoBuf; 3 | using ProtoBuf.Meta; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | 9 | namespace Examples.Issues 10 | { 11 | [TestFixture] 12 | public class SO13802844 13 | { 14 | enum AnimationCode { 15 | [ProtoEnum(Name = "AnimationCode_None")] 16 | None = 0, 17 | Idle = 1 18 | } 19 | 20 | [Test] 21 | public void Execute() 22 | { 23 | string s = Serializer.GetProto(); 24 | 25 | Assert.AreEqual(@"package Examples.Issues; 26 | 27 | enum AnimationCode { 28 | AnimationCode_None = 0; 29 | Idle = 1; 30 | } 31 | ", s); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Examples/Issues/SO16756104.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using ProtoBuf; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace Examples.Issues 10 | { 11 | [TestFixture] 12 | public class SO16756104 13 | { 14 | [Test] 15 | public void TestNullableDoubleList() 16 | { 17 | Program.ExpectFailure(() => 18 | { 19 | var list = new List { 1, null, 2 }; 20 | Serializer.DeepClone(list); 21 | }); 22 | } 23 | 24 | [Test] 25 | public void TestNullableInt32List() 26 | { 27 | Program.ExpectFailure(() => 28 | { 29 | var list = new List { 1, null, 2 }; 30 | Serializer.DeepClone(list); 31 | }); 32 | } 33 | 34 | [Test] 35 | public void TestNullableStringList() 36 | { 37 | Program.ExpectFailure(() => 38 | { 39 | var list = new List { "abc", null, "def" }; 40 | Serializer.DeepClone(list); 41 | }); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Examples/Issues/SO3101816.cs: -------------------------------------------------------------------------------- 1 | //using System; 2 | //using System.Collections.Generic; 3 | //using System.IO; 4 | //using System.Linq; 5 | //using System.Text; 6 | //using NUnit.Framework; 7 | //using ProtoBuf; 8 | //using ProtoBuf.Meta; 9 | 10 | //namespace Examples.Issues 11 | //{ 12 | // [TestFixture] 13 | // public class SO3101816 14 | // { 15 | // [ProtoContract] 16 | // public class A 17 | // { 18 | // [ProtoMember(1)] 19 | // public IB B { get; set; } 20 | // } 21 | 22 | // public interface IB 23 | // { 24 | // } 25 | 26 | // [ProtoContract] 27 | // public class B : IB 28 | // { 29 | // [ProtoMember(1)] 30 | // public int SomeProperty { get; set; } 31 | // } 32 | 33 | 34 | // [Test] 35 | // public void Test() 36 | // { 37 | // var a = new A { B = new B() }; 38 | // var model = TypeModel.Create(); 39 | // model.Add(typeof(B), ) 40 | // using (var m = new MemoryStream()) 41 | // { 42 | // Serializer.NonGeneric.Serialize(, a); 43 | // } 44 | // } 45 | // } 46 | //} 47 | -------------------------------------------------------------------------------- /Examples/Issues/SO7218127.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using ProtoBuf; 3 | 4 | namespace Examples.Issues 5 | { 6 | 7 | [TestFixture] 8 | public class SO7218127 9 | { 10 | [Test] 11 | public void Test() 12 | { 13 | var orig = new SomeWrapper {Value = new SubType { Foo = 123, Bar = "abc"}}; 14 | var clone = Serializer.DeepClone(orig); 15 | Assert.AreEqual(123, orig.Value.Foo); 16 | Assert.AreEqual("abc", ((SubType) clone.Value).Bar); 17 | } 18 | [ProtoContract] 19 | public class SomeWrapper 20 | { 21 | [ProtoMember(1, DynamicType = true)] 22 | public BaseType Value { get; set; } 23 | } 24 | [ProtoContract] 25 | public class BaseType 26 | { 27 | [ProtoMember(1)] 28 | public int Foo { get; set; } 29 | } 30 | [ProtoContract] 31 | public class SubType : BaseType 32 | { 33 | [ProtoMember(2)] 34 | public string Bar { get; set; } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Examples/Issues/SO7654066.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using NUnit.Framework; 7 | using ProtoBuf; 8 | 9 | namespace Examples.Issues 10 | { 11 | [TestFixture] 12 | public class SO7654066 13 | { 14 | [ProtoContract(IgnoreListHandling = true)] 15 | public class MyClass : IEnumerable 16 | { 17 | [ProtoMember(1, IsPacked = true)] 18 | public int[] data { get; set; } 19 | 20 | // Comment out this indexed property to prevent the crash 21 | public int this[int i] { get { return data[i]; } set { data[i] = value; } } 22 | 23 | public IEnumerator GetEnumerator() { foreach (var x in data) yield return x; } 24 | IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } 25 | } 26 | [Test] 27 | public void Execute() 28 | { 29 | Serializer.PrepareSerializer(); 30 | var obj = new MyClass {data = new[] {1, 2, 3}}; 31 | var clone = Serializer.DeepClone(obj); 32 | Assert.AreEqual(3, clone.data.Length); 33 | Assert.AreEqual(1, clone.data[0]); 34 | Assert.AreEqual(2, clone.data[1]); 35 | Assert.AreEqual(3, clone.data[2]); 36 | } 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Examples/NonGeneric.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Runtime.Serialization; 3 | using NUnit.Framework; 4 | using ProtoBuf; 5 | using System; 6 | 7 | namespace Examples 8 | { 9 | [DataContract] 10 | public class NonGenericBasic { 11 | [DataMember(Order=1)] 12 | public int Value {get;set;} 13 | } 14 | [TestFixture] 15 | public class NonGeneric 16 | { 17 | [Test] 18 | public void TestDeepClone() 19 | { 20 | NonGenericBasic ngb = new NonGenericBasic { Value = 123 }, 21 | clone = (NonGenericBasic) Serializer.NonGeneric.DeepClone(ngb); 22 | 23 | Assert.AreNotSame(ngb, clone); 24 | Assert.AreEqual(ngb.Value, clone.Value); 25 | } 26 | 27 | [Test] 28 | public void TestManualCloneViaSerializeDeserialize() 29 | { 30 | NonGenericBasic ngb = new NonGenericBasic { Value = 123 }, clone; 31 | using (MemoryStream ms = new MemoryStream()) 32 | { 33 | Serializer.NonGeneric.Serialize(ms, ngb); 34 | ms.Position = 0; 35 | clone = (NonGenericBasic)Serializer.NonGeneric.Deserialize( 36 | ngb.GetType(), ms); 37 | } 38 | Assert.AreNotSame(ngb, clone); 39 | Assert.AreEqual(ngb.Value, clone.Value); 40 | } 41 | 42 | 43 | } 44 | 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Examples/PEVerify.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using NUnit.Framework; 4 | 5 | namespace Examples 6 | { 7 | public static class PEVerify 8 | { 9 | public static bool AssertValid(string path) 10 | { 11 | // note; PEVerify can be found %ProgramFiles%\Microsoft SDKs\Windows\v6.0A\bin 12 | const string exePath = "PEVerify.exe"; 13 | using (Process proc = Process.Start(exePath, path)) 14 | { 15 | if (proc.WaitForExit(10000)) 16 | { 17 | Assert.AreEqual(0, proc.ExitCode, path); 18 | return proc.ExitCode == 0; 19 | } 20 | else 21 | { 22 | proc.Kill(); 23 | throw new TimeoutException(); 24 | } 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Examples/Parseable.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using NUnit.Framework; 3 | using ProtoBuf; 4 | using ProtoBuf.Meta; 5 | 6 | namespace Examples 7 | { 8 | [ProtoContract] 9 | public class WithIP 10 | { 11 | [ProtoMember(1)] 12 | public IPAddress Address { get; set; } 13 | } 14 | 15 | [TestFixture] 16 | public class Parseable 17 | { 18 | [Test] 19 | public void TestIPAddess() 20 | { 21 | var model = TypeModel.Create(); 22 | model.AllowParseableTypes = true; 23 | WithIP obj = new WithIP { Address = IPAddress.Parse("100.90.80.100") }, 24 | clone = (WithIP) model.DeepClone(obj); 25 | 26 | Assert.AreEqual(obj.Address, clone.Address); 27 | 28 | obj.Address = null; 29 | clone = (WithIP)model.DeepClone(obj); 30 | 31 | Assert.IsNull(obj.Address, "obj"); 32 | Assert.IsNull(clone.Address, "clone"); 33 | 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Examples/Ppt/Ppt.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.ServiceModel; 3 | 4 | namespace Examples.Ppt 5 | { 6 | [DataContract] 7 | public class Test1 8 | { 9 | [DataMember(Name="a", Order=1, IsRequired=true)] 10 | public int A {get;set;} 11 | } 12 | 13 | [DataContract] 14 | public class Test3 15 | { 16 | [DataMember(Name="c", Order=3, IsRequired=false)] 17 | public Test1 C {get;set;} 18 | } 19 | #if !COREFX 20 | [ServiceContract] 21 | public interface ISearchService 22 | { 23 | [OperationContract] 24 | SearchResponse Search(SearchRequest request); 25 | } 26 | #endif 27 | public class SearchRequest {} 28 | public class SearchResponse { } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Examples/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | <?xml version="1.0" encoding="utf-16"?> 7 | <SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 8 | <ConnectionString>Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWIND.MDF;Integrated Security=True;User Instance=True</ConnectionString> 9 | <ProviderName>System.Data.SqlClient</ProviderName> 10 | </SerializableConnectionString> 11 | Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWIND.MDF;Integrated Security=True;User Instance=True 12 | 13 | 14 | -------------------------------------------------------------------------------- /Examples/ProtoGen/Empty.proto: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingsoft-topgame/protobuf-net/1bb4337c1d2bfe34ac35b3afd4cd76fb24f3075b/Examples/ProtoGen/Empty.proto -------------------------------------------------------------------------------- /Examples/ProtoGen/Enums.proto: -------------------------------------------------------------------------------- 1 | message CosDgp 2 | { 3 | enum Type 4 | { 5 | Offline = 1; 6 | Online = 2; 7 | //... skipped 8 | } 9 | 10 | enum RestartReason 11 | { 12 | ResetPin = 1; 13 | PowerCycle = 2; 14 | //...skipped 15 | } 16 | 17 | enum ActiveTask 18 | { 19 | HeartBeat = 1; 20 | Task0 = 2; 21 | //... skipped 22 | } 23 | 24 | //Cos type 25 | required Type type = 1; 26 | 27 | //Panel number 28 | required int32 panel = 2; 29 | 30 | //Dgp number 31 | required int32 dgp = 3; 32 | 33 | //User number (used for types Isolated, Deisolated, DePolled and Polled) 34 | optional int32 user = 5; 35 | 36 | //Restart reason (used for type CpuRestart) 37 | optional RestartReason restart_reason = 6; 38 | 39 | //Active task at reset (used for type CpuRestart) 40 | optional ActiveTask active_task = 7; 41 | 42 | //Checkpoint (used for type CpuRestart) 43 | optional int32 checkpoint = 8; 44 | 45 | //Time and date 46 | required int32 time = 9; 47 | } -------------------------------------------------------------------------------- /Examples/ProtoGen/LITE.proto: -------------------------------------------------------------------------------- 1 | package com.idatt.dto; 2 | 3 | option java_package = "com.idatt.dto"; 4 | option java_outer_classname = "Protos"; 5 | option optimize_for = LITE_RUNTIME; 6 | 7 | message Positions 8 | { 9 | repeated Position Items = 1; 10 | } 11 | message Position {} -------------------------------------------------------------------------------- /Examples/ProtoGen/WithBom.proto: -------------------------------------------------------------------------------- 1 | package WithBom; 2 | message expectToFail { 3 | required string name = 1; 4 | } -------------------------------------------------------------------------------- /Examples/ProtoGen/csharp_options.proto: -------------------------------------------------------------------------------- 1 | // Extra options for C# generator 2 | 3 | import "google/protobuf/descriptor.proto"; 4 | 5 | package google.protobuf; 6 | 7 | option (CSharpNamespace) = "Google.ProtocolBuffers.DescriptorProtos"; 8 | option (CSharpUmbrellaClassname) = "CSharpOptions"; 9 | 10 | extend FileOptions { 11 | optional string CSharpNamespace = 20000; 12 | optional string CSharpUmbrellaClassname = 20001; 13 | optional bool CSharpMultipleFiles = 20002; 14 | optional bool CSharpNestClasses = 20003; 15 | optional bool CSharpPublicClasses = 20004; 16 | } 17 | -------------------------------------------------------------------------------- /Examples/ProtoGen/gps.proto: -------------------------------------------------------------------------------- 1 | package issue32; 2 | message GPS 3 | { 4 | required int64 Date=1; 5 | optional double Latitude = 2; 6 | optional double Longitude = 3; 7 | } -------------------------------------------------------------------------------- /Examples/ProtoGen/jons.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingsoft-topgame/protobuf-net/1bb4337c1d2bfe34ac35b3afd4cd76fb24f3075b/Examples/ProtoGen/jons.bin -------------------------------------------------------------------------------- /Examples/ProtoGen/keywords.proto: -------------------------------------------------------------------------------- 1 | message CanHazValue 2 | { 3 | optional int32 value = 1; 4 | 5 | optional int32 int = 2; 6 | } -------------------------------------------------------------------------------- /Examples/ProtoGen/person.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingsoft-topgame/protobuf-net/1bb4337c1d2bfe34ac35b3afd4cd76fb24f3075b/Examples/ProtoGen/person.bin -------------------------------------------------------------------------------- /Examples/ProtoGen/person.proto: -------------------------------------------------------------------------------- 1 | package people; 2 | message person { 3 | required string name = 1; 4 | optional int32 id = 2; 5 | optional string email = 3; 6 | enum phone_type { 7 | mobile = 0; 8 | home = 1; 9 | work = 2; 10 | } 11 | message phone_number { 12 | required string number = 1; 13 | optional phone_type type = 2 [default = home]; 14 | } 15 | repeated phone_number phone = 4; 16 | repeated int32 test_packed = 5 [packed = true]; 17 | optional int32 test_deprecated = 6 [deprecated = true]; 18 | optional int32 foreach = 7; 19 | } 20 | message opaque_message_list { repeated bytes messages_list=1; } -------------------------------------------------------------------------------- /Examples/ProtoGen/rpc.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingsoft-topgame/protobuf-net/1bb4337c1d2bfe34ac35b3afd4cd76fb24f3075b/Examples/ProtoGen/rpc.bin -------------------------------------------------------------------------------- /Examples/ProtoGen/rpc.proto: -------------------------------------------------------------------------------- 1 | message SearchRequest { 2 | required string query = 1; 3 | optional int32 page_number = 2; 4 | optional int32 result_per_page = 3; 5 | } 6 | message SearchResponse { 7 | repeated string result = 1; 8 | } 9 | service SearchService { 10 | rpc Search (SearchRequest) returns (SearchResponse); 11 | } -------------------------------------------------------------------------------- /Examples/ProtoGen/searchRequest.proto: -------------------------------------------------------------------------------- 1 | import "protobuf-net.proto"; 2 | option (protobuf_net.namespace) = "protobuf.options.example"; 3 | 4 | message searchRequest { 5 | required string query = 1; 6 | 7 | optional int32 page_number = 2; 8 | optional int32 result_per_page = 3 [default = 10]; 9 | enum corpus { 10 | universal = 0; 11 | web = 1; 12 | images = 2; 13 | local = 3; 14 | news = 4; 15 | products = 5; 16 | video = 6; 17 | } 18 | optional corpus corpus1 = 4 [default = universal]; 19 | } -------------------------------------------------------------------------------- /Examples/Recursion.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using NUnit.Framework; 3 | using ProtoBuf; 4 | 5 | namespace Examples 6 | { 7 | [ProtoContract] 8 | public class RecursiveObject 9 | { 10 | [ProtoMember(1)] 11 | public RecursiveObject Yeuch { get; set; } 12 | } 13 | [TestFixture] 14 | public class Recursion 15 | { 16 | [Test] 17 | public void BlowUp() 18 | { 19 | Program.ExpectFailure(() => 20 | { 21 | RecursiveObject obj = new RecursiveObject(); 22 | obj.Yeuch = obj; 23 | Serializer.Serialize(Stream.Null, obj); 24 | }); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Examples/SimpleStream/NullTypes.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using NUnit.Framework; 3 | using ProtoBuf; 4 | 5 | namespace Examples.SimpleStream 6 | { 7 | [TestFixture] 8 | public class NullTypes 9 | { 10 | [DataContract] 11 | class TypeWithNulls 12 | { 13 | [DataMember(Order = 1)] 14 | public int? Foo { get; set; } 15 | } 16 | [Test] 17 | public void TestNull() 18 | { 19 | TypeWithNulls twn = new TypeWithNulls { Foo = null }, 20 | clone = Serializer.DeepClone(twn); 21 | Assert.IsNull(twn.Foo); 22 | Assert.IsTrue(Program.CheckBytes(twn, new byte[0])); 23 | } 24 | [Test] 25 | public void TestNotNull() 26 | { 27 | TypeWithNulls twn = new TypeWithNulls { Foo = 150 }, 28 | clone = Serializer.DeepClone(twn); 29 | Assert.IsNotNull(twn.Foo); 30 | Assert.IsTrue(Program.CheckBytes(twn, 0x08, 0x96, 0x01)); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Examples/UnwrappedOuters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using NUnit.Framework; 4 | using ProtoBuf; 5 | using System.IO; 6 | 7 | namespace Examples 8 | { 9 | [TestFixture] 10 | public class UnwrappedOuters 11 | { 12 | [Test] 13 | public void TestNakedByteArray() 14 | { 15 | Random rand = new Random(12345); 16 | byte[] data = new byte[100], clone; 17 | rand.NextBytes(data); 18 | using(var ms = new MemoryStream()) 19 | { 20 | Serializer.Serialize(ms, data); 21 | ms.Position = 0; 22 | clone = Serializer.Deserialize(ms); 23 | } 24 | Assert.IsTrue(data.SequenceEqual(clone)); 25 | } 26 | 27 | [Test] 28 | public void TestNakedString() 29 | { 30 | Random rand = new Random(12345); 31 | byte[] data = new byte[100], clone; 32 | rand.NextBytes(data); 33 | using (var ms = new MemoryStream()) 34 | { 35 | Serializer.Serialize(ms, Convert.ToBase64String(data)); 36 | ms.Position = 0; 37 | clone = Convert.FromBase64String(Serializer.Deserialize(ms)); 38 | } 39 | 40 | Assert.IsTrue(data.SequenceEqual(clone)); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Examples/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /FX11/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /Info.txt: -------------------------------------------------------------------------------- 1 | See blog for notes on this: http://marcgravell.blogspot.com/2009/11/controlling-wcf-protobuf-net-at.html 2 | -------------------------------------------------------------------------------- /LateLoaded/FooBar.cs: -------------------------------------------------------------------------------- 1 |  2 | using ProtoBuf; 3 | namespace LateLoaded 4 | { 5 | [ProtoContract] 6 | [ProtoInclude(2, typeof(Bar))] 7 | public class Foo 8 | { 9 | [ProtoMember(1)] 10 | public string BaseProp { get; set; } 11 | } 12 | 13 | [ProtoContract] 14 | public class Bar : Foo 15 | { 16 | [ProtoMember(1)] 17 | public string ChildProp { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Licence.txt: -------------------------------------------------------------------------------- 1 | The core Protocol Buffers technology is provided courtesy of Google. 2 | At the time of writing, this is released under the BSD license. 3 | Full details can be found here: 4 | 5 | http://code.google.com/p/protobuf/ 6 | 7 | 8 | This .NET implementation is Copyright 2008 Marc Gravell 9 | 10 | Licensed under the Apache License, Version 2.0 (the "License"); 11 | you may not use this file except in compliance with the License. 12 | You may obtain a copy of the License at 13 | 14 | http://www.apache.org/licenses/LICENSE-2.0 15 | 16 | Unless required by applicable law or agreed to in writing, software 17 | distributed under the License is distributed on an "AS IS" BASIS, 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | See the License for the specific language governing permissions and 20 | limitations under the License. 21 | -------------------------------------------------------------------------------- /MetroDto/OnceMoreWithFeeling.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.Serialization; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using ProtoBuf; 8 | 9 | namespace MetroDto 10 | { 11 | [DataContract, ProtoContract] 12 | public class TestClass 13 | { 14 | [DataMember(Order = 1), ProtoMember(1)] 15 | public int IntVal { get; set; } 16 | [DataMember(Order = 2), ProtoMember(2)] 17 | public string StrVal { get; set; } 18 | [DataMember(Order = 3), ProtoMember(3)] 19 | public MyEnum EnumVal { get; set; } 20 | } 21 | 22 | public enum MyEnum 23 | { 24 | Foo, 25 | Bar 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /MetroDto/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MetroDto")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("MetroDto")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /Metro_DevRig/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Metro_DevRig/Assets/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingsoft-topgame/protobuf-net/1bb4337c1d2bfe34ac35b3afd4cd76fb24f3075b/Metro_DevRig/Assets/Logo.png -------------------------------------------------------------------------------- /Metro_DevRig/Assets/SmallLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingsoft-topgame/protobuf-net/1bb4337c1d2bfe34ac35b3afd4cd76fb24f3075b/Metro_DevRig/Assets/SmallLogo.png -------------------------------------------------------------------------------- /Metro_DevRig/Assets/SplashScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingsoft-topgame/protobuf-net/1bb4337c1d2bfe34ac35b3afd4cd76fb24f3075b/Metro_DevRig/Assets/SplashScreen.png -------------------------------------------------------------------------------- /Metro_DevRig/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kingsoft-topgame/protobuf-net/1bb4337c1d2bfe34ac35b3afd4cd76fb24f3075b/Metro_DevRig/Assets/StoreLogo.png -------------------------------------------------------------------------------- /Metro_DevRig/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 |