diff --git a/Bot-Utils/Properties/AssemblyInfo.cs b/Bot-Utils/Properties/AssemblyInfo.cs index cc646a1..30e939b 100644 --- a/Bot-Utils/Properties/AssemblyInfo.cs +++ b/Bot-Utils/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden @@ -10,7 +9,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("BlubbFish")] [assembly: AssemblyProduct("Bot-Utils")] -[assembly: AssemblyCopyright("Copyright © 2018 - 15.04.2019")] +[assembly: AssemblyCopyright("Copyright © 2018 - 21.04.2019")] [assembly: AssemblyTrademark("© BlubbFish")] [assembly: AssemblyCulture("")] @@ -32,8 +31,8 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.1.8")] -[assembly: AssemblyFileVersion("1.1.8")] +[assembly: AssemblyVersion("1.1.9")] +[assembly: AssemblyFileVersion("1.1.9")] /* * 1.1.0 Remove Helper from Bot-Utils @@ -46,4 +45,5 @@ using System.Runtime.InteropServices; * also put returntype boolean, add function that parse post params, if path is a dictionary try to load index.html * 1.1.7 Restrucutre loading, so that all is init and after the listener is started, REQUEST_URL_HOST gives now host and port * 1.1.8 Add logger to Webserver Class + * 1.1.9 Modify Output of SendFileResponse */ diff --git a/Bot-Utils/Webserver.cs b/Bot-Utils/Webserver.cs index 12bb1b8..8096a46 100644 --- a/Bot-Utils/Webserver.cs +++ b/Bot-Utils/Webserver.cs @@ -46,7 +46,7 @@ namespace BlubbFish.Utils.IoT.Bots { }); } - public static Boolean SendFileResponse(HttpListenerContext cont, String folder = "resources") { + public static Boolean SendFileResponse(HttpListenerContext cont, String folder = "resources", Boolean printOutput = true) { String restr = cont.Request.Url.PathAndQuery; if(restr.StartsWith("/")) { if(restr.IndexOf("?") != -1) { @@ -71,6 +71,9 @@ namespace BlubbFish.Utils.IoT.Bots { break; } cont.Response.OutputStream.Write(output, 0, output.Length); + if(printOutput) { + Console.WriteLine("200 - " + cont.Request.Url.PathAndQuery); + } return true; } else { String file = File.ReadAllText(folder + "/" + restr); @@ -89,7 +92,9 @@ namespace BlubbFish.Utils.IoT.Bots { break; } cont.Response.OutputStream.Write(buf, 0, buf.Length); - Console.WriteLine("200 - " + cont.Request.Url.PathAndQuery); + if(printOutput) { + Console.WriteLine("200 - " + cont.Request.Url.PathAndQuery); + } return true; } } catch(Exception e) { @@ -99,7 +104,9 @@ namespace BlubbFish.Utils.IoT.Bots { } } } - Helper.WriteError("404 - " + cont.Request.Url.PathAndQuery + " not found!"); + if(printOutput) { + Helper.WriteError("404 - " + cont.Request.Url.PathAndQuery + " not found!"); + } cont.Response.StatusCode = 404; return false; }