Changes recommended by Rider/Resharper

This commit is contained in:
2022-04-08 00:59:51 +02:00
parent 105cec55d4
commit f7c1a581e7
15 changed files with 233 additions and 99 deletions

View File

@@ -3,15 +3,15 @@ using System.Diagnostics;
namespace VAR.HttpServer.MiniServerTest
{
internal class Program
public static class Program
{
private static void Main(string[] args)
private static void Main()
{
HttpServer httpServer = new HttpServer
{
Port = 3000,
Handler = new HelloWorldHttpHandler(),
LogDegugMessage = (msg) => Console.WriteLine("DEBUG: {0}", msg),
LogDebugMessage = (msg) => Console.WriteLine("DEBUG: {0}", msg),
LogException = (ex) =>
{
Console.WriteLine("!!!!! Exception !!!!");
@@ -19,14 +19,14 @@ namespace VAR.HttpServer.MiniServerTest
Console.WriteLine("StackTrace: {0}", ex.StackTrace);
}
};
Console.Title = string.Format("MiniHTTPServer@{0}", httpServer.Port);
Console.Title = $"MiniHTTPServer@{httpServer.Port}";
Console.WriteLine("HTTP Server started on {0} port", httpServer.Port);
httpServer.Start();
Process proc = Process.Start(string.Format("http://localhost:{0}", httpServer.Port));
Process.Start($"http://localhost:{httpServer.Port}");
}
public class HelloWorldHttpHandler : IHttpHandler
private class HelloWorldHttpHandler : IHttpHandler
{
public void HandleRequest(HttpProcessor p)
{
@@ -42,7 +42,7 @@ namespace VAR.HttpServer.MiniServerTest
{
greetedName = "World";
}
string strGreeting = string.Format("Hello {0}!", greetedName);
string strGreeting = $"Hello {greetedName}!";
// Render
p.ResponseSuccess();