Files
PipeMethodCallsDemo/Server/Calculator.cs
T
Matthias Heil 06763d6c15 Rename shared namespace and preserve pipe handling
Rename `Shared` to `ClientServerShared` across client, server, calculator, interface, and serializer code. Update pipe-name parsing to use ordinal comparison while retaining the `PipeDemo` default. Preserve custom JSON serialization with public field support for `Vector3`.
2026-11-10 09:31:18 +01:00

29 lines
721 B
C#

using System.Numerics;
using ClientServerShared;
namespace Server;
public class Calculator : ICalculator
{
public int Add(int a, int b) => a + b;
public Vector3 AddVector(Vector3 a, Vector3 b) => a + b;
public double Divide(double a, double b)
{
if (b == 0)
throw new DivideByZeroException("Division durch 0 ist nicht erlaubt.");
return a / b;
}
public async Task<string> EchoAsync(string text)
{
await Task.Delay(50);
if (string.IsNullOrEmpty(text))
throw new ArgumentException("Text darf nicht leer sein.", nameof(text));
return $"Echo: {text}";
}
public void Crash(int exitCode) => Environment.Exit(exitCode);
}