From 760a492c53de5261c23de256a7ad06646a27e742 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 25 Jul 2018 18:32:19 +0200 Subject: move helloworld -> HelloworldLegacyCsproj --- .../GreeterServer/.gitignore | 2 + .../GreeterServer/GreeterServer.csproj | 70 ++++++++++++++++++++++ .../GreeterServer/Program.cs | 51 ++++++++++++++++ .../GreeterServer/Properties/AssemblyInfo.cs | 40 +++++++++++++ .../GreeterServer/packages.config | 7 +++ 5 files changed, 170 insertions(+) create mode 100644 examples/csharp/HelloworldLegacyCsproj/GreeterServer/.gitignore create mode 100644 examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj create mode 100644 examples/csharp/HelloworldLegacyCsproj/GreeterServer/Program.cs create mode 100644 examples/csharp/HelloworldLegacyCsproj/GreeterServer/Properties/AssemblyInfo.cs create mode 100644 examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config (limited to 'examples/csharp/HelloworldLegacyCsproj/GreeterServer') diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/.gitignore b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/.gitignore new file mode 100644 index 0000000000..1746e3269e --- /dev/null +++ b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/.gitignore @@ -0,0 +1,2 @@ +bin +obj diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj new file mode 100644 index 0000000000..82e2961cad --- /dev/null +++ b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/GreeterServer.csproj @@ -0,0 +1,70 @@ + + + + Debug + AnyCPU + 10.0.0 + 2.0 + {A7706C84-92D2-4B7A-B779-76B64D2950EC} + Exe + GreeterServer + GreeterServer + v4.5 + + + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + true + + + full + true + bin\Release + prompt + 4 + true + + + + ..\packages\Google.Protobuf.3.5.0\lib\net45\Google.Protobuf.dll + True + + + ..\packages\Grpc.Core.1.8.0\lib\net45\Grpc.Core.dll + True + + + + ..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll + True + + + + + + + + + + {724DFC8C-4B57-4C3F-811C-0463BE2A2829} + Greeter + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/Program.cs b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/Program.cs new file mode 100644 index 0000000000..2b787ecf0f --- /dev/null +++ b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/Program.cs @@ -0,0 +1,51 @@ +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.Threading.Tasks; +using Grpc.Core; +using Helloworld; + +namespace GreeterServer +{ + class GreeterImpl : Greeter.GreeterBase + { + // Server side handler of the SayHello RPC + public override Task SayHello(HelloRequest request, ServerCallContext context) + { + return Task.FromResult(new HelloReply { Message = "Hello " + request.Name }); + } + } + + class Program + { + const int Port = 50051; + + public static void Main(string[] args) + { + Server server = new Server + { + Services = { Greeter.BindService(new GreeterImpl()) }, + Ports = { new ServerPort("localhost", Port, ServerCredentials.Insecure) } + }; + server.Start(); + + Console.WriteLine("Greeter server listening on port " + Port); + Console.WriteLine("Press any key to stop the server..."); + Console.ReadKey(); + + server.ShutdownAsync().Wait(); + } + } +} diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/Properties/AssemblyInfo.cs b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..c0f2961cd3 --- /dev/null +++ b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/Properties/AssemblyInfo.cs @@ -0,0 +1,40 @@ +#region Copyright notice and license + +// Copyright 2015 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#endregion + +using System.Reflection; +using System.Runtime.CompilerServices; + +// Information about this assembly is defined by the following attributes. +// Change them to the values specific to your project. +[assembly: AssemblyTitle("GreeterServer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("jtattermusch")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". +// The form "{Major}.{Minor}.*" will automatically update the build and revision, +// and "{Major}.{Minor}.{Build}.*" will update just the revision. +[assembly: AssemblyVersion("1.0.*")] +// The following attributes are used to specify the signing key for the assembly, +// if desired. See the Mono documentation for more information about signing. +//[assembly: AssemblyDelaySign(false)] +//[assembly: AssemblyKeyFile("")] + diff --git a/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config new file mode 100644 index 0000000000..4b3684edfd --- /dev/null +++ b/examples/csharp/HelloworldLegacyCsproj/GreeterServer/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file -- cgit v1.2.3