Ejemplo n.º 1
0
        public void Start(int port)
        {
            // Module manager handles all modules in the server
            var moduleManager = new ModuleManager();

            // Let's serve our downloaded files (Windows 7 users)
            var fileService = new DiskFileService("/", Settings.WebServerFolder);

            // Create the file module and allow files to be listed.
            var module = new FileModule(fileService)
            {
                ListFiles = false
            };

            var routerModule = new RouterModule();

            // Add the module
            //moduleManager.Add(module);
            moduleManager.Add(new WebServerModule());

            //moduleManager.Add(new BodyDecodingModule(new UrlFormattedDecoder()));

            // And start the server.
            var server = new HttpServer(moduleManager);

            server.Start(IPAddress.Any, port);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            //LogManager.Assign(new SimpleLogManager<ConsoleLogger>());

            // Module manager handles all modules in the server
            var moduleManager = new ModuleManager();

            // Let's serve our downloaded files (Windows 7 users)
            var fileService = new DiskFileService("/", $@"C:\Users\{Environment.UserName}\Downloads");

            // Create the file module and allow files to be listed.
            var module = new FileModule(fileService)
            {
                AllowFileListing = true,
            };



            // Add the module
            moduleManager.Add(module);
            moduleManager.Add(new MyModule());

            moduleManager.Add(new MyModule2());
            // And start the server.
            var server = new HttpServer(moduleManager);

            server.AllowedSslProtocols = SslProtocols.Ssl2;

            server.Start(IPAddress.Any, 0);
            Console.WriteLine("PORT " + server.LocalPort);

            //TrySendARequest(server);

            Console.ReadLine();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            LogManager.Assign(new SimpleLogManager <ConsoleLogger>());

            // Module manager handles all modules in the server
            var moduleManager = new ModuleManager();

            // Let's serve our downloaded files (Windows 7 users)
            var fileService = new DiskFileService("/", string.Format(@"C:\Users\{0}\Downloads", Environment.UserName));

            // Create the file module and allow files to be listed.
            var module = new FileModule(fileService)
            {
                ListFiles = true
            };

            // Add the module
            moduleManager.Add(module);
            moduleManager.Add(new BodyDecodingModule(new UrlFormattedDecoder()));
            moduleManager.Add(new MyModule());

            // And start the server.
            var server = new HttpServer(moduleManager);

            server.Start(IPAddress.Any, 8080);

            Console.ReadLine();
        }
Ejemplo n.º 4
0
        // The disk file service allows you to serve and browse files from flash/disk storage
        public static void Main()
        {
            // Initialize logging
            Logger.Initialize(new DebugLogger(), LoggerLevel.Debug);

            // Create Http server pipeline
            ModuleManager ModuleManager = new ModuleManager();

            // Create file/disk service for storage
            DiskFileService fileService = new DiskFileService(@"/", @"\WINFS\WebSite");

            // Add the file module to pipeline and enable the file listing feature
            ModuleManager.Add(new FileModule(fileService)
            {
                AllowListing = true
            });

            // Add the error module as the last module to pipeline
            ModuleManager.Add(new ErrorModule());

            //  Create the http server
            HttpService HttpServer = new HttpService(ModuleManager);

            // Sets interface ip address
            HttpServer.InterfaceAddress = IPAddress.GetDefaultLocalAddress();

            // Starts Http service
            HttpServer.Start();

            // Set local time
            SntpClient TimeService = new SntpClient();

            TimeService.Synchronize();
        }
Ejemplo n.º 5
0
        public void can_load_a_file_With_direct_reference()
        {
            var sut = new DiskFileService("/", _path);

            var actual = sut.GetFiles(new Uri("http://localhost/temp.txt"))
                         .ToList();

            actual.Should().NotBeEmpty();
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            if (!Environment.UserInteractive)
            {
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                    new ServerSVC()
                };
                ServiceBase.Run(ServicesToRun);
            }
            else
            {
                dnsServer.Responded += DnsServer_Responded;
                dnsServer.Errored   += DnsServer_Error;

                bwThread.DoWork += DnsThread;
                bwThread.RunWorkerAsync();

                if (!Directory.Exists(ServerDirectory))
                {
                    Directory.CreateDirectory(ServerDirectory);
                    File.WriteAllText(ServerDirectory + @"\index.html", DefaultIndexHtml);
                }

                DiskFileService fileService = new DiskFileService("/", ServerDirectory);
                FileModule      module      = new FileModule(fileService)
                {
                    AllowFileListing = false,
                };


                Console.WriteLine("Server IP: " + ServerIP);

                ModuleManager httpManager = new ModuleManager();
                httpManager.Add(module);
                httpManager.Add(new HTTP_Module());
                HttpServer httpServer = new HttpServer(httpManager);
                httpServer.Start(IPAddress.Any, 80);
                Console.WriteLine("HTTP Server Started");



                ModuleManager httpsManager = new ModuleManager();
                httpsManager.Add(module);
                httpsManager.Add(new HTTPS_Module());
                HttpServer       httpsServer = new HttpServer(httpsManager);
                X509Certificate2 certificate = new X509Certificate2(AppDomain.CurrentDomain.BaseDirectory + "\\cert.pfx", "server");
                httpsServer.Start(IPAddress.Any, 443, certificate);
                Console.WriteLine("HTTPS Server Started");


                Console.ReadLine();
            }
        }
Ejemplo n.º 7
0
        public bool Initialize(IHost hostApplication)
        {
            My = hostApplication;
            if (!System.IO.File.Exists("webserver.cfg"))
            {
                WebServer.WebConfig.Add("RootWebDir", "./web/");
                WebServer.WebConfig.Add("MaxPostSize", "102400");
                WebServer.WebConfig.Add("PathToPHP", "/usr/bin/php");
                WebServer.WebConfig.Add("IndexFile", "index.php,index.fritz");
                WebServer.WebConfig.Add("Port", "80");
                FeuerwehrCloud.Helper.AppSettings.Save(WebServer.WebConfig, "webserver.cfg");
            }
            WebServer.WebConfig = FeuerwehrCloud.Helper.AppSettings.Load("webserver.cfg");
            FeuerwehrCloud.Helper.Logger.WriteLine("|  *** WebServer loaded: listening on port: " + WebServer.WebConfig["Port"]);

            WebServer.WSThread = new System.Threading.Thread(delegate() {
                WebServer.listener    = HttpServer.HttpListener.Create(IPAddress.Any, int.Parse(WebServer.WebConfig["Port"]));
                var server            = new Server();
                server.MaxContentSize = int.Parse(WebServer.WebConfig["MaxPostSize"]);
                var deivaModule       = new DEIVAModule(hostApplication);
                server.Add(deivaModule);
                var cgiService = new  CgiService(WebServer.WebConfig["PathToPHP"], "php");
                var cgiModule  = new CgiModule(WebServer.WebConfig["RootWebDir"], cgiService);
                server.Add(cgiModule);
                //var avmModule = new AVMModule(WebServer.WebConfig["RootWebDir"], hostApplication);
                //server.Add(avmModule);
                var fileService = new DiskFileService("/", WebServer.WebConfig["RootWebDir"]);
                var fileModule  = new GzipFileModule(fileService)
                {
                    EnableGzip = true
                };
                server.Add(fileModule);
                var router = new DefaultIndexRouter(WebServer.WebConfig["RootWebDir"]);
                router.AddIndexFile(WebServer.WebConfig["IndexFile"]);
                server.Add(router);
                var dirModule = new DirectoryModule(fileService);
                server.Add(dirModule);
                server.Add(listener);
                try {
                    server.Start(10);
                    ThreadExitEvent.WaitOne();
                    server.Stop(true);
                } catch (System.Exception ex) {
                    if (ex.Message.Contains("already in"))
                    {
                        FeuerwehrCloud.Helper.Logger.WriteLine("Kann FeuerwehrCloud-Server HTTP-Modul nicht starten!");
                    }
                }
            });
            WebServer.WSThread.Start();
            return(true);
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            //LogManager.Assign(new SimpleLogManager<ConsoleLogger>());

            // Module manager handles all modules in the server
            var moduleManager = new ModuleManager();

            // Let's serve our downloaded files (Windows 7 users)
            var fileService = new DiskFileService("/", string.Format(@"C:\Users\{0}\Downloads", Environment.UserName));

            // Create the file module and allow files to be listed.
            var module = new FileModule(fileService)
            {
                ListFiles = true
            };

            // Add the module
            moduleManager.Add(module);
            moduleManager.Add(new MyModule());

            moduleManager.Add(new MyModule2());
            // And start the server.
            var server = new HttpServer(moduleManager);

            server.Start(IPAddress.Any, 0);
            Console.WriteLine("PORT " + server.LocalPort);

            var request =
                @"GET /?signature=1dfea26808d632903549c69d78558fce1c418405&echostr=5867553698596935317&timestamp=1365661332&nonce=1366146317 HTTP/1.0
User-Agent:Mozilla/4.0
Host:58.215.164.183
Pragma:no-cache
Connection/Value:Keep-Alive

";
            var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            socket.Connect(IPAddress.Loopback, server.LocalPort);
            socket.Send(Encoding.UTF8.GetBytes(request));
            var buffer = new byte[65535];
            var len    = socket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
            var answer = Encoding.UTF8.GetString(buffer, 0, len);

            Console.WriteLine(answer);
            len    = socket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
            answer = Encoding.UTF8.GetString(buffer, 0, len);
            Console.WriteLine(answer);

            Console.ReadLine();
        }
Ejemplo n.º 9
0
        protected override void OnStart(string[] args)
        {
            bwThread.DoWork += DnsThread;
            bwThread.RunWorkerAsync();


            if (!Directory.Exists(ServerDirectory))
            {
                Directory.CreateDirectory(ServerDirectory);
                File.WriteAllText(ServerDirectory + @"\index.html", DefaultIndexHtml);
            }

            DiskFileService fileService = new DiskFileService("/", ServerDirectory);
            FileModule      module      = new FileModule(fileService)
            {
                AllowFileListing = false,
            };


            ModuleManager httpManager = new ModuleManager();

            httpManager.Add(module);
            httpManager.Add(new HTTP_Module());
            HttpServer httpServer = new HttpServer(httpManager);

            httpServer.Start(IPAddress.Any, 80);


            ModuleManager httpsManager = new ModuleManager();

            httpsManager.Add(module);
            httpsManager.Add(new HTTPS_Module());
            HttpServer       httpsServer = new HttpServer(httpsManager);
            X509Certificate2 certificate = new X509Certificate2(AppDomain.CurrentDomain.BaseDirectory + "\\cert.pfx", "server");

            httpsServer.Start(IPAddress.Any, 443, certificate);
        }
Ejemplo n.º 10
0
        public void StartAll()
        {
            _service = this;

            // DHCP Service
            if (_dhcpEnabled == true)
            {
                _dhcpService.InterfaceAddress = _interfaceAddress;
                _dhcpService.ServerName       = _serverName;
                _dhcpService.DnsSuffix        = _dnsSuffix;
                _dhcpService.StorageRoot      = _storageRoot;

                if (_sntpEnabled == true)
                {
                    _dhcpService.RemoveOption(DhcpOption.NTPServer);
                    _dhcpService.AddOption(DhcpOption.NTPServer, _interfaceAddress.GetAddressBytes());
                }
                _dhcpService.Start();
            }

            // DNS Service
            if (_dnsEnabled == true)
            {
                _dnsService.InterfaceAddress = _interfaceAddress;
                _dnsService.ServerName       = _serverName;
                _dnsService.DnsSuffix        = _dnsSuffix;

                if (!StringUtility.IsNullOrEmpty(_serverName) || !StringUtility.IsNullOrEmpty(_dnsSuffix))
                {
                    Answer record = new Answer();
                    record.Domain = string.Concat(_serverName, ".", _dnsSuffix);
                    record.Class  = RecordClass.IN;
                    record.Type   = RecordType.A;
                    record.Ttl    = 60;
                    record.Record = new ARecord(_interfaceAddress.GetAddressBytes());

                    _service.DnsService.ZoneFile.Add(record);

                    Logger.WriteInfo(this, "Device registered with dns:  " + record.Domain);
                }

                _dnsService.Start();
            }

            // SNTP Service
            if (_sntpEnabled == true)
            {
                _sntpService.InterfaceAddress = _interfaceAddress;
                _sntpService.Start();
            }

            // HTTP Service
            if (_httpEnabled == true)
            {
                ModuleManager _moduleManager = new ModuleManager();

                // Add the router module as the fist module to pipeline
                _moduleManager.Add(new RouterModule());

                if (StorageRoot != null)
                {
                    // Create disk file service for the root storage
                    DiskFileService fileService = new DiskFileService("/", StorageRoot + @"\" + MicroServer.Net.Http.Constants.HTTP_WEB_ROOT_FOLDER + @"\");

                    // Add the file module to pipeline
                    _moduleManager.Add(new FileModule(fileService)
                    {
                        AllowListing = _allowListing
                    });
                }

                // Add the controller module to pipeline
                _moduleManager.Add(new ControllerModule());

                // Add the error module as the last module to pipeline
                _moduleManager.Add(new ErrorModule());

                //  Create the Http service
                _httpService = new HttpService(_moduleManager);

                _httpService.InterfaceAddress = _interfaceAddress;
                _httpService.Start();
            }

            Logger.WriteInfo(this, "Service Manager started all services");
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Process a request.
        /// </summary>
        /// <param name="context">Request information</param>
        /// <returns>What to do next.</returns>
        /// <exception cref="InternalServerException">Failed to find file extension</exception>
        /// <exception cref="ForbiddenException">Forbidden file type.</exception>
        public ProcessingResult Process(RequestContext context)
        {
            IRequest  request  = context.Request;
            IResponse response = context.Response;

            IFileService _fileService = new DiskFileService("/", _homeDirectory);
            var          fileContext  = new FileContext(context.Request, System.DateTime.Now);

            _fileService.GetFile(fileContext);
            var scriptName = fileContext.Filename;

            if (!fileContext.IsFound)
            {
                response.Status = HttpStatusCode.NotFound;
                return(ProcessingResult.SendResponse);
            }


            try
            {
                string ext = Path.GetExtension(scriptName).TrimStart('.');

                if (!ext.Equals("fritz", StringComparison.OrdinalIgnoreCase))
                {
                    return(ProcessingResult.Continue);
                }

                // TODO: is this a good place to lock?
                lock (_readLock)
                {
                    string fileContent = System.IO.File.ReadAllText(scriptName);


                    string[] XInfo = fileContent.Split(new [] { "{%" }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 1; i < XInfo.Length; i++)
                    {
                        if (XInfo[i].Contains("%}"))
                        {
                            XInfo[i] = XInfo[i].Substring(0, XInfo[i].IndexOf("%}"));
                        }
                    }
                    XInfo = XInfo.RemoveAt(0);


//					Wanpppconn1 service = new Wanpppconn1("https://192.168.178.1");
//					service.SoapHttpClientProtocol.Credentials = new NetworkCredential("dslf-config", "Viking2011");
//					string ip;
//					service.GetExternalIPAddress(out ip);
                    //service.AddPortMapping
                    //service.DeletePortMapping
                    //service.ForceTermination
                    //service.SetUserName
                    //service.SetPassword
                    //service.SetAutoDisconnectTimeSpan
                    //service.SetConnectionType
                    //service.SetConnectionTrigger
                    //service.SetIdleDisconnectTime
                    //service.GetUserName (out ip);
                    //service.GetConnectionTypeInfo (out ip, out ip2);
                    //service.SetUserName ("ar15636672741");
                    //service.SetPassword ("internet");

//					/* Anrufbeantworter */
//					Tam service2 = new Tam("https://l7dmkoihvym5jghm.myfritz.net:499");
//					service2.SoapHttpClientProtocol.Credentials = new NetworkCredential("dslf-config", "Viking2011");
//					string url;
//					service2.GetMessageList(0, out url); // Get Tam message List
//					//service2.SetEnable
//					//service2.DeleteMessage
//					//service2.MarkMessage
//					FritzTR064.Generated.Voip service4;
//					//service4.AddVoIPAccount
//					//service4.DelVoIPAccount
//					//service4.DialSetConfig
//					FritzTR064.Generated.Voip f;

//				    System.Net.WebClient Anrufbeantworter = new WebClient ();
//					Anrufbeantworter.Credentials = service2.SoapHttpClientProtocol.Credentials;
//					string AB = Anrufbeantworter.DownloadString (url);


                    //Deviceconfig service3 = new Deviceconfig("https://fritz.box");
                    //service3.

                    /* Telefonbuch */
                    //Contact service = new Contact("https://fritz.box");
                    //service.AddPhonebook("ExtraID", "Name"); // Create a new Phonebook
                    //string callListUrl;
                    //service.GetCallList(out callListUrl);

                    ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
                    System.Xml.XmlDocument CallList = new System.Xml.XmlDocument();
                    CallList.Load("dyndata/calllist.xml");
                    System.Xml.XmlDocument TamsList = new System.Xml.XmlDocument();
                    TamsList.Load("dyndata/tam1.xml");

                    System.Collections.Generic.Dictionary <string, string> DSL  = FeuerwehrCloud.Helper.AppSettings.Load("dyndata/wandsl.info");
                    System.Collections.Generic.Dictionary <string, string> WLAN = FeuerwehrCloud.Helper.AppSettings.Load("dyndata/wlan.info");
                    System.Collections.Generic.Dictionary <string, string> TAM  = FeuerwehrCloud.Helper.AppSettings.Load("dyndata/tam.info");
                    System.Collections.Generic.Dictionary <string, string> DEVI = FeuerwehrCloud.Helper.AppSettings.Load("dyndata/Deviceinfo.info");
                    System.Collections.Generic.Dictionary <string, string> WAN  = FeuerwehrCloud.Helper.AppSettings.Load("dyndata/wanppp.info");
                    System.Collections.Generic.Dictionary <string, string> TEL  = FeuerwehrCloud.Helper.AppSettings.Load("dyndata/phone.info");

                    foreach (var XP in XInfo)
                    {
                        switch (XP)
                        {
                        case "INCLUDE_HEADER":
                            fileContent = fileContent.Replace("{%" + XP + "%}", System.IO.File.ReadAllText("web/header.html"));
                            break;

                        case "INCLUDE_FOOTER":
                            fileContent = fileContent.Replace("{%" + XP + "%}", System.IO.File.ReadAllText("web/footer.html"));
                            break;

                        case "FAX_ENABLED":
                            fileContent = fileContent.Replace("{%" + XP + "%}", "Alarmfax-System aktiviert");
                            break;

                        case "INFO_LED_TYPE":
                            fileContent = fileContent.Replace("{%" + XP + "%}", "blinkt bei neuen Nachrichten/Anrufen");
                            break;

                        //
                        case "TAM_DATA":
                            int    iTamz = 0;
                            string CLL2  = "";

                            foreach (System.Xml.XmlElement item in TamsList["Root"].SelectNodes("//Message"))
                            {
                                //if(item.Name =="Call") {

                                CLL2 += "<tr><td>" + item["Date"].InnerText + "<td>" + item ["Number"].InnerText + "</td></tr>";
                                iTamz++;

                                //}
                                if (iTamz > 8)
                                {
                                    break;
                                }
                            }
                            fileContent = fileContent.Replace("{%" + XP + "%}", CLL2);
                            break;

                        case "TAM_COUNT":
                            fileContent = fileContent.Replace("{%" + XP + "%}", (TamsList["Root"].SelectNodes("//Message").Count).ToString());
                            break;

                        case "CALL_COUNT":
                            fileContent = fileContent.Replace("{%" + XP + "%}", (CallList["root"].SelectNodes("//Call").Count).ToString());
                            break;

                        case "CALL_LIST":
                            int    iCallZ = 0;
                            string CLL    = "";

                            foreach (System.Xml.XmlElement item in CallList["root"].SelectNodes("//Call"))
                            {
                                //if(item.Name =="Call") {

                                CLL += "<tr><td" + (item ["Type"].InnerText == "2"?" style='color:red'":(item ["Type"].InnerText == "3"?" style='color:#00AA00'":" style='color:#0000CC'")) + ">" + item["Date"].InnerText + "<td" + (item ["Type"].InnerText == "2"?" style='color:red'":(item ["Type"].InnerText == "3"?" style='color:#00AA00'":" style='color:#0000CC'")) + ">" + (item ["Name"].InnerText != ""?item ["Name"].InnerText + " (" + item ["Called"].InnerText + ")" : item ["Called"].InnerText) + "</td></tr>";
                                iCallZ++;

                                //}
                                if (iCallZ > 8)
                                {
                                    break;
                                }
                            }
                            fileContent = fileContent.Replace("{%" + XP + "%}", CLL);
                            break;

                        case "DSL_CONNECTED":
                            fileContent = fileContent.Replace("{%" + XP + "%}", (bool.Parse(DSL["wandslIFEnable"]) == true?"bereit, " + (int.Parse(DSL["DownstreamCurrRate"]) / 1024) + " Mbit/s (down), " + (int.Parse(DSL["UpstreamCurrRate"])) + " kbit/s (up)":"getrennt"));
                            break;

                        case "NETWORK_DEVICE_COUNT":
                            string[] result1      = System.IO.File.ReadAllLines(System.IO.Path.Combine(System.Environment.CurrentDirectory, "network.csv"));
                            int      iDeviceCount = 0;
                            for (int i = 0; i < result1.Length; i++)
                            {
                                string[] Columns = result1[i].Split(new [] { ";" }, StringSplitOptions.None);
                                if (Columns[2] == "up")
                                {
                                    iDeviceCount++;
                                }
                            }
                            fileContent = fileContent.Replace("{%" + XP + "%}", (iDeviceCount.ToString()));
                            break;

                        case "NETWORK_DEVICE_LIST":
                            string[] result2   = System.IO.File.ReadAllLines(System.IO.Path.Combine(System.Environment.CurrentDirectory, "network.csv"));
                            string   HTMLTable = "";
                            int      idev      = 0;
                            for (int i = 0; i < result2.Length; i++)
                            {
                                string[] Columns = result2[i].Split(new [] { ";" }, StringSplitOptions.None);
                                if (Columns[2] == "up")
                                {
                                    HTMLTable += "<tr><td>" + (Columns[4] == ""?"PC-" + Columns[0].Replace(".", "-"):Columns[4]).Replace(".fritz.box", "") + "</td><td>LAN</td></tr>";
                                    idev++;
                                    if (idev == 9)
                                    {
                                        break;
                                    }
                                }
                            }
                            string dHTM = "";
                            for (int i = 0; i < result2.Length; i++)
                            {
                                string[] Columns = result2[i].Split(new [] { ";" }, StringSplitOptions.None);
                                if (Columns[2] == "up")
                                {
                                    dHTM += "<tr><td><a href='http://" + Columns[0] + "' target='_blank'>" + (Columns[4] == ""?"PC-" + Columns[0].Replace(".", "-"):Columns[4]).Replace(".fritz.box", "") + "</a></td><td>" + Columns[0] + "</td><td>" + Columns[5] + "</td><td>" + Columns[6] + "</td></tr>";
                                }
                            }
                            System.IO.File.WriteAllText("web/devices_online.htm", dHTM);
                            dHTM = "";
                            for (int i = 0; i < result2.Length; i++)
                            {
                                string[] Columns = result2[i].Split(new [] { ";" }, StringSplitOptions.None);
                                if (Columns[2] == "down")
                                {
                                    dHTM += "<tr><td>" + (Columns[4] == ""?"PC-" + Columns[0].Replace(".", "-"):Columns[4]).Replace(".fritz.box", "") + "</td><td>" + Columns[0] + "</td><td>" + Columns[5] + "</td><td>" + Columns[6] + "</td></tr>";
                                }
                            }
                            System.IO.File.WriteAllText("web/devices_offline.htm", dHTM);
                            fileContent = fileContent.Replace("{%" + XP + "%}", HTMLTable);
                            break;

                        case "WLAN_CONNECTED":
                            fileContent = fileContent.Replace("{%" + XP + "%}", (bool.Parse(WLAN["Enable"])?"An, " + WLAN["Status"]:"Deaktiviert"));
                            break;

                        case "DECT_CONNECTED":
                            fileContent = fileContent.Replace("{%" + XP + "%}", "Deaktiviert");
                            break;

                        case "USB_CONNECTED":
                            fileContent = fileContent.Replace("{%" + XP + "%}", ((int.Parse(FeuerwehrCloud.Helper.AppSettings.Load("dyndata/usb.info")["Count"])) - 5) + " Geräte angeschlossen");
                            break;

                        case "I2C_CONNECTED":
                            fileContent = fileContent.Replace("{%" + XP + "%}", ((int.Parse(FeuerwehrCloud.Helper.AppSettings.Load("dyndata/i2c.info")["Count"]))) + " Module angeschlossen");
                            break;

                        case "CONNECTED_SINCE4":
                            if (WAN["ConnectionStatus"] == "Connected")
                            {
                                fileContent = fileContent.Replace("{%" + XP + "%}", "verbunden seit " + WAN["Uptime"]);
                            }
                            else
                            {
                                fileContent = fileContent.Replace("{%" + XP + "%}", "nicht verbunden");
                            }
                            break;

                        case "CONNECTED_IP4":
                            fileContent = fileContent.Replace("{%" + XP + "%}", WAN["ExternalIPAddress"]);
                            break;

                        case "CONNECTED_SINCE6":
                            fileContent = fileContent.Replace("{%" + XP + "%}", "");
                            break;

                        case "CONNECTED_IP6":
                            fileContent = fileContent.Replace("{%" + XP + "%}", "");
                            break;

                        case "PHONE_LINES_STRING":
                            fileContent = fileContent.Replace("{%" + XP + "%}", TEL["NumberList"]);
                            break;

                        case "PHONE_LINE_COUNT":
                            fileContent = fileContent.Replace("{%" + XP + "%}", TEL["NumberOfNumbers"]);
                            break;

                        default:
                            fileContent = fileContent.Replace("{%" + XP + "%}", "");
                            break;
                        }
                    }
                    //fileContent = fileContent.Replace("%")


                    string output = fileContent;

                    // Set default content type
                    response.ContentType = new ContentTypeHeader("text/html");

                    //ProcessHeaders(response, CgiFeuerwehrCloud.Helper.ParseCgiHeaders(ref output));

                    response.ContentLength.Value = output.Length;

                    ResponseWriter generator = new ResponseWriter();
                    generator.SendHeaders(context.HttpContext, response);
                    generator.Send(context.HttpContext, output, System.Text.Encoding.UTF8);
                }

                return(ProcessingResult.Abort);
            }
            catch (FileNotFoundException err)
            {
                throw new InternalServerException("Failed to process file '" + request.Uri + "'.", err);
            }
            catch (Exception err)
            {
                throw new InternalServerException("Failed to process file '" + request.Uri + "'.", err);
            }
        }