c# formating rules
This commit is contained in:
parent
9e82a3bc58
commit
d7f22d62b0
@ -32,10 +32,10 @@ namespace BlubbFish.Utils.IoT.Bots {
|
|||||||
Console.WriteLine("Webserver is Running...");
|
Console.WriteLine("Webserver is Running...");
|
||||||
try {
|
try {
|
||||||
while(this.httplistener.IsListening) {
|
while(this.httplistener.IsListening) {
|
||||||
ThreadPool.QueueUserWorkItem((state) => {
|
_ = ThreadPool.QueueUserWorkItem((state) => {
|
||||||
HttpListenerContext httplistenercontext = state as HttpListenerContext;
|
HttpListenerContext httplistenercontext = state as HttpListenerContext;
|
||||||
try {
|
try {
|
||||||
this.SendWebserverResponse(httplistenercontext);
|
_ = this.SendWebserverResponse(httplistenercontext);
|
||||||
} catch { } finally {
|
} catch { } finally {
|
||||||
httplistenercontext.Response.OutputStream.Close();
|
httplistenercontext.Response.OutputStream.Close();
|
||||||
}
|
}
|
||||||
@ -48,11 +48,7 @@ namespace BlubbFish.Utils.IoT.Bots {
|
|||||||
public static Boolean SendFileResponse(HttpListenerContext cont, String folder = "resources", Boolean printOutput = true) {
|
public static Boolean SendFileResponse(HttpListenerContext cont, String folder = "resources", Boolean printOutput = true) {
|
||||||
String restr = cont.Request.Url.PathAndQuery;
|
String restr = cont.Request.Url.PathAndQuery;
|
||||||
if(restr.StartsWith("/")) {
|
if(restr.StartsWith("/")) {
|
||||||
if(restr.IndexOf("?") != -1) {
|
restr = restr.IndexOf("?") != -1 ? restr.Substring(1, restr.IndexOf("?") - 1) : restr.Substring(1);
|
||||||
restr = restr.Substring(1, restr.IndexOf("?") - 1);
|
|
||||||
} else {
|
|
||||||
restr = restr.Substring(1);
|
|
||||||
}
|
|
||||||
if(Directory.Exists(folder + "/" + restr)) {
|
if(Directory.Exists(folder + "/" + restr)) {
|
||||||
restr += "/index.html";
|
restr += "/index.html";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user