Types in CilBrowser.Core namespace: AssemblyServer CilBrowserOptions FileUtils HtmlAttribute HtmlBuilder HtmlGenerator ServerBase SourceServer Utils WebsiteGenerator |
.class public abstract auto ansi beforefieldinit CilBrowser.Core.ServerBase
extends [netstandard]System.Object
implements [netstandard]System.IDisposable
{
.field family string _urlHost
.field family string _urlPrefix
.field private class [netstandard]System.Net.HttpListener _listener
.field private class [netstandard]System.Collections.Generic.Dictionary`2<string, string> _cache
.field public static literal string DefaultUrlHost = "http://localhost:8080"
.field public static literal string DefaultUrlPrefix = "/CilBrowser/"
.field private static literal int32 CacheCapacity = int32(200)
.method family hidebysig specialname rtspecialname instance void .ctor(
string urlHost,
string urlPrefix
) cil managed
{
.maxstack 8
ldarg.0
ldc.i4 200
newobj instance void class [netstandard]System.Collections.Generic.Dictionary`2<string, string>::.ctor(int32)
stfld class [netstandard]System.Collections.Generic.Dictionary`2<string, string> CilBrowser.Core.ServerBase::_cache
ldarg.0
call instance void [netstandard]System.Object::.ctor()
nop
nop
ldarg.0
ldarg.1
stfld string CilBrowser.Core.ServerBase::_urlHost
ldarg.0
ldarg.2
stfld string CilBrowser.Core.ServerBase::_urlPrefix
ldarg.0
newobj instance void [netstandard]System.Net.HttpListener::.ctor()
stfld class [netstandard]System.Net.HttpListener CilBrowser.Core.ServerBase::_listener
ret
}
.method family hidebysig abstract newslot virtual instance void OnStart() cil managed
{
}
.method family hidebysig abstract newslot virtual instance void RenderFrontPage(
class [netstandard]System.Net.HttpListenerResponse response
) cil managed
{
}
.method family hidebysig abstract newslot virtual instance void RenderPage(
string url,
class [netstandard]System.Net.HttpListenerResponse response
) cil managed
{
}
.method assembly hidebysig instance void AddToCache(
string url,
string content
) cil managed
{
.maxstack 3
.locals init (bool V_0,
bool V_1)
nop
ldarg.2
call bool [netstandard]System.String::IsNullOrEmpty(string)
brtrue.s IL_0001
ldarg.2
callvirt instance int32 [netstandard]System.String::get_Length()
ldc.i4.s 20
clt
br.s IL_0002
IL_0001: ldc.i4.1
IL_0002: stloc.0
ldloc.0
brfalse.s IL_0003
br.s IL_0005
IL_0003: ldarg.0
ldfld class [netstandard]System.Collections.Generic.Dictionary`2<string, string> CilBrowser.Core.ServerBase::_cache
callvirt instance int32 class [netstandard]System.Collections.Generic.Dictionary`2<string, string>::get_Count()
ldc.i4 200
clt
ldc.i4.0
ceq
stloc.1
ldloc.1
brfalse.s IL_0004
ldarg.0
ldfld class [netstandard]System.Collections.Generic.Dictionary`2<string, string> CilBrowser.Core.ServerBase::_cache
callvirt instance void class [netstandard]System.Collections.Generic.Dictionary`2<string, string>::Clear()
nop
IL_0004: ldarg.0
ldfld class [netstandard]System.Collections.Generic.Dictionary`2<string, string> CilBrowser.Core.ServerBase::_cache
ldarg.1
ldarg.2
callvirt instance void class [netstandard]System.Collections.Generic.Dictionary`2<string, string>::set_Item(!0, !1)
nop
IL_0005: ret
}
.method private hidebysig instance string TryGetFromCache(
string url
) cil managed
{
.maxstack 3
.locals init (string V_0,
bool V_1,
string V_2)
nop
ldarg.0
ldfld class [netstandard]System.Collections.Generic.Dictionary`2<string, string> CilBrowser.Core.ServerBase::_cache
ldarg.1
ldloca.s V_0
callvirt instance bool class [netstandard]System.Collections.Generic.Dictionary`2<string, string>::TryGetValue(!0, !1&)
stloc.1
ldloc.1
brfalse.s IL_0001
ldloc.0
stloc.2
br.s IL_0002
IL_0001: ldsfld string [netstandard]System.String::Empty
stloc.2
br.s IL_0002
IL_0002: ldloc.2
ret
}
.method assembly hidebysig instance string StripURL(
string url
) cil managed
{
.maxstack 3
.locals init (int32 V_0,
string V_1,
bool V_2,
string V_3,
bool V_4)
nop
ldarg.0
ldfld string CilBrowser.Core.ServerBase::_urlPrefix
callvirt instance int32 [netstandard]System.String::get_Length()
stloc.0
ldloc.0
ldarg.1
callvirt instance int32 [netstandard]System.String::get_Length()
clt
ldc.i4.0
ceq
stloc.2
ldloc.2
brfalse.s IL_0001
ldsfld string [netstandard]System.String::Empty
stloc.3
br.s IL_0003
IL_0001: ldarg.1
ldloc.0
callvirt instance string [netstandard]System.String::Substring(int32)
stloc.1
ldloc.1
ldc.i4.s 46
callvirt instance int32 [netstandard]System.String::LastIndexOf(char)
stloc.0
ldloc.0
ldc.i4.0
clt
stloc.s V_4
ldloc.s V_4
brfalse.s IL_0002
ldloc.1
callvirt instance int32 [netstandard]System.String::get_Length()
stloc.0
IL_0002: ldloc.1
ldc.i4.0
ldloc.0
callvirt instance string [netstandard]System.String::Substring(int32, int32)
stloc.1
ldloc.1
stloc.3
br.s IL_0003
IL_0003: ldloc.3
ret
}
.method assembly hidebysig instance string StripPrefix(
string url
) cil managed
{
.maxstack 2
.locals init (int32 V_0,
bool V_1,
string V_2)
nop
ldarg.0
ldfld string CilBrowser.Core.ServerBase::_urlPrefix
callvirt instance int32 [netstandard]System.String::get_Length()
stloc.0
ldloc.0
ldarg.1
callvirt instance int32 [netstandard]System.String::get_Length()
clt
ldc.i4.0
ceq
stloc.1
ldloc.1
brfalse.s IL_0001
ldsfld string [netstandard]System.String::Empty
stloc.2
br.s IL_0002
IL_0001: ldarg.1
ldloc.0
callvirt instance string [netstandard]System.String::Substring(int32)
stloc.2
br.s IL_0002
IL_0002: ldloc.2
ret
}
.method assembly hidebysig static void SendHtmlResponse(
class [netstandard]System.Net.HttpListenerResponse response,
string content
) cil managed
{
.maxstack 2
.locals init (class [netstandard]System.IO.Stream V_0,
class [netstandard]System.IO.StreamWriter V_1,
class [netstandard]System.IO.StreamWriter V_2)
nop
ldarg.0
ldstr "text/html; charset=utf-8"
callvirt instance void [netstandard]System.Net.HttpListenerResponse::set_ContentType(string)
nop
ldarg.0
callvirt instance class [netstandard]System.IO.Stream [netstandard]System.Net.HttpListenerResponse::get_OutputStream()
stloc.0
ldloc.0
newobj instance void [netstandard]System.IO.StreamWriter::.ctor(class [netstandard]System.IO.Stream)
stloc.1
ldloc.1
stloc.2
.try
{
nop
ldloc.1
ldarg.1
callvirt instance void [netstandard]System.IO.TextWriter::Write(string)
nop
nop
leave.s IL_0002
}
finally
{
ldloc.2
brfalse.s IL_0001
ldloc.2
callvirt instance void [netstandard]System.IDisposable::Dispose()
nop
IL_0001: endfinally
}
IL_0002: ldarg.0
callvirt instance void [netstandard]System.Net.HttpListenerResponse::Close()
nop
ret
}
.method assembly hidebysig static void SendErrorResponse(
class [netstandard]System.Net.HttpListenerResponse response,
int32 code,
string status
) cil managed
{
.maxstack 8
nop
ldarg.0
ldarg.1
callvirt instance void [netstandard]System.Net.HttpListenerResponse::set_StatusCode(int32)
nop
ldarg.0
ldarg.2
callvirt instance void [netstandard]System.Net.HttpListenerResponse::set_StatusDescription(string)
nop
ldarg.0
callvirt instance void [netstandard]System.Net.HttpListenerResponse::Close()
nop
ret
}
.method public hidebysig instance void Run() cil managed
{
.maxstack 3
.locals init (class [netstandard]System.Net.HttpListener V_0,
class [netstandard]System.Net.HttpListenerContext V_1,
class [netstandard]System.Net.HttpListenerRequest V_2,
string V_3,
class [netstandard]System.Net.HttpListenerResponse V_4,
string V_5,
bool V_6,
bool V_7,
bool V_8,
bool V_9,
bool V_10)
nop
ldarg.0
ldfld class [netstandard]System.Net.HttpListener CilBrowser.Core.ServerBase::_listener
stloc.0
ldloc.0
callvirt instance class [netstandard]System.Net.HttpListenerPrefixCollection [netstandard]System.Net.HttpListener::get_Prefixes()
ldarg.0
ldfld string CilBrowser.Core.ServerBase::_urlHost
ldarg.0
ldfld string CilBrowser.Core.ServerBase::_urlPrefix
call string [netstandard]System.String::Concat(string, string)
callvirt instance void [netstandard]System.Net.HttpListenerPrefixCollection::Add(string)
nop
ldloc.0
callvirt instance void [netstandard]System.Net.HttpListener::Start()
nop
ldarg.0
callvirt instance void CilBrowser.Core.ServerBase::OnStart()
nop
ldstr "Displaying web UI on "
ldarg.0
ldfld string CilBrowser.Core.ServerBase::_urlHost
ldarg.0
ldfld string CilBrowser.Core.ServerBase::_urlPrefix
call string [netstandard]System.String::Concat(string, string, string)
call void [netstandard]System.Console::WriteLine(string)
nop
ldstr "Press E to stop server"
call void [netstandard]System.Console::WriteLine(string)
nop
br IL_0009
IL_0001: nop
ldloc.0
callvirt instance class [netstandard]System.Net.HttpListenerContext [netstandard]System.Net.HttpListener::GetContext()
stloc.1
ldloc.0
callvirt instance bool [netstandard]System.Net.HttpListener::get_IsListening()
ldc.i4.0
ceq
stloc.s V_6
ldloc.s V_6
brfalse.s IL_0002
nop
ldstr "Server was stopped"
call void [netstandard]System.Console::WriteLine(string)
nop
br IL_0010
IL_0002: ldloc.1
callvirt instance class [netstandard]System.Net.HttpListenerRequest [netstandard]System.Net.HttpListenerContext::get_Request()
stloc.2
ldloc.2
callvirt instance string [netstandard]System.Net.HttpListenerRequest::get_RawUrl()
stloc.3
ldloc.1
callvirt instance class [netstandard]System.Net.HttpListenerResponse [netstandard]System.Net.HttpListenerContext::get_Response()
stloc.s V_4
ldloc.3
ldarg.0
ldfld string CilBrowser.Core.ServerBase::_urlPrefix
callvirt instance bool [netstandard]System.String::StartsWith(string)
ldc.i4.0
ceq
stloc.s V_7
ldloc.s V_7
brfalse.s IL_0003
nop
ldloc.s V_4
ldc.i4 404
ldstr "Not found"
call void CilBrowser.Core.ServerBase::SendErrorResponse(class [netstandard]System.Net.HttpListenerResponse, int32, string)
nop
br IL_0009
IL_0003: ldloc.s V_4
callvirt instance class [netstandard]System.Net.WebHeaderCollection [netstandard]System.Net.HttpListenerResponse::get_Headers()
ldstr "Expires: Tue, 01 Jul 2000 06:00:00 GMT"
callvirt instance void [netstandard]System.Net.WebHeaderCollection::Add(string)
nop
ldloc.s V_4
callvirt instance class [netstandard]System.Net.WebHeaderCollection [netstandard]System.Net.HttpListenerResponse::get_Headers()
ldstr "Cache-Control: max-age=0, no-cache, must-revalidate"
callvirt instance void [netstandard]System.Net.WebHeaderCollection::Add(string)
nop
ldarg.0
ldloc.3
call instance string CilBrowser.Core.ServerBase::TryGetFromCache(string)
stloc.s V_5
ldloc.s V_5
callvirt instance int32 [netstandard]System.String::get_Length()
ldc.i4.0
cgt
stloc.s V_8
ldloc.s V_8
brfalse.s IL_0004
nop
ldloc.s V_4
ldloc.s V_5
call void CilBrowser.Core.ServerBase::SendHtmlResponse(class [netstandard]System.Net.HttpListenerResponse, string)
nop
br.s IL_0009
IL_0004: ldloc.3
ldarg.0
ldfld string CilBrowser.Core.ServerBase::_urlPrefix
call bool CilBrowser.Core.Utils::StrEquals(string, string)
brtrue.s IL_0005
ldloc.3
ldarg.0
ldfld string CilBrowser.Core.ServerBase::_urlPrefix
ldstr "index.html"
call string [netstandard]System.String::Concat(string, string)
call bool CilBrowser.Core.Utils::StrEquals(string, string)
br.s IL_0006
IL_0005: ldc.i4.1
IL_0006: stloc.s V_9
ldloc.s V_9
brfalse.s IL_0007
nop
ldarg.0
ldloc.s V_4
callvirt instance void CilBrowser.Core.ServerBase::RenderFrontPage(class [netstandard]System.Net.HttpListenerResponse)
nop
ldloc.s V_4
callvirt instance void [netstandard]System.Net.HttpListenerResponse::Close()
nop
nop
br.s IL_0008
IL_0007: nop
ldarg.0
ldloc.3
ldloc.s V_4
callvirt instance void CilBrowser.Core.ServerBase::RenderPage(string, class [netstandard]System.Net.HttpListenerResponse)
nop
ldloc.s V_4
callvirt instance void [netstandard]System.Net.HttpListenerResponse::Close()
nop
nop
IL_0008: nop
IL_0009: ldc.i4.1
stloc.s V_10
br IL_0001
IL_0010: ret
}
.method public hidebysig instance void Stop() cil managed
{
.maxstack 8
nop
ldarg.0
ldfld class [netstandard]System.Net.HttpListener CilBrowser.Core.ServerBase::_listener
callvirt instance void [netstandard]System.Net.HttpListener::Stop()
nop
ret
}
.method public hidebysig newslot virtual final instance void Dispose() cil managed
{
.maxstack 8
nop
ldarg.0
ldfld class [netstandard]System.Net.HttpListener CilBrowser.Core.ServerBase::_listener
callvirt instance void [netstandard]System.Net.HttpListener::Close()
nop
ret
}
.method public hidebysig instance void RunInBackground() cil managed
{
.maxstack 2
.locals init (class [netstandard]System.Threading.Thread V_0)
nop
ldarg.0
ldftn instance void CilBrowser.Core.ServerBase::Run()
newobj instance void [netstandard]System.Threading.ThreadStart::.ctor(object, native int)
newobj instance void [netstandard]System.Threading.Thread::.ctor(class [netstandard]System.Threading.ThreadStart)
stloc.0
ldloc.0
ldc.i4.1
callvirt instance void [netstandard]System.Threading.Thread::set_IsBackground(bool)
nop
ldloc.0
callvirt instance void [netstandard]System.Threading.Thread::Start()
nop
ret
}
.method public hidebysig instance void WaitForExit() cil managed
{
.maxstack 2
.locals init (valuetype [netstandard]System.ConsoleKeyInfo V_0,
bool V_1,
bool V_2)
nop
br.s IL_0003
IL_0001: nop
call valuetype [netstandard]System.ConsoleKeyInfo [netstandard]System.Console::ReadKey()
stloc.0
ldloca.s V_0
call instance valuetype [netstandard]System.ConsoleKey [netstandard]System.ConsoleKeyInfo::get_Key()
ldc.i4.s 69
ceq
stloc.1
ldloc.1
brfalse.s IL_0002
nop
ldarg.0
call instance void CilBrowser.Core.ServerBase::Stop()
nop
ldarg.0
call instance void CilBrowser.Core.ServerBase::Dispose()
nop
br.s IL_0004
IL_0002: nop
IL_0003: ldc.i4.1
stloc.2
br.s IL_0001
IL_0004: ret
}
}
|