Exemple #1
0
        public bool Initialize(FeuerwehrCloud.Plugin.IHost hostApplication)
        {
            FeuerwehrCloud.Helper.Logger.WriteLine("|  *** Maps plugin loaded...");
            if (!System.IO.File.Exists("copies.cfg"))
            {
                CopiesConfig.Add("count", "1");
                FeuerwehrCloud.Helper.AppSettings.Save(CopiesConfig, "copies.cfg");
            }
            CopiesConfig = FeuerwehrCloud.Helper.AppSettings.Load("copies.cfg");
            if (!System.IO.File.Exists("mapprint.cfg"))
            {
                Configuration.Add("zoom", "15");
                Configuration.Add("start", "Feuerwehr");
                FeuerwehrCloud.Helper.AppSettings.Save(Configuration, "mapprint.cfg");
            }
            Configuration = FeuerwehrCloud.Helper.AppSettings.Load("mapprint.cfg");

            watcher      = new FileSystemWatcher();
            watcher.Path = System.Environment.CurrentDirectory;
            watcher.IncludeSubdirectories = false;
            watcher.Filter              = "mapprint.cfg";
            watcher.NotifyFilter        = NotifyFilters.LastWrite | NotifyFilters.LastAccess | NotifyFilters.DirectoryName | NotifyFilters.FileName;
            watcher.Changed            += new FileSystemEventHandler((object sender, FileSystemEventArgs e) => Configuration = FeuerwehrCloud.Helper.AppSettings.Load("mapprint.cfg"));
            watcher.EnableRaisingEvents = true;

            return(true);
        }
Exemple #2
0
 public bool Initialize(IHost hostApplication)
 {
     My       = hostApplication;
     BGThread = new System.Threading.Thread(JoypadReader);
     BGThread.Start();
     return(true);
 }
Exemple #3
0
        public bool Initialize(FeuerwehrCloud.Plugin.IHost hostApplication)
        {
            ListenSockThread = new System.Threading.Thread(new System.Threading.ThreadStart(HandleThreadStart));
            ListenSockThread.Start();

            return(true);
        }
Exemple #4
0
        public bool Initialize(IHost hostApplication)
        {
            My = hostApplication;

            if (!System.IO.File.Exists("ILS.cfg"))
            {
                FAXConfig.Add("Target", "");
                FeuerwehrCloud.Helper.AppSettings.Save(FAXConfig, "ILS.cfg");
            }
            FAXConfig = FeuerwehrCloud.Helper.AppSettings.Load("ILS.cfg");
            if (!System.IO.File.Exists("copies.cfg"))
            {
                CopiesConfig.Add("count", "1");
                FeuerwehrCloud.Helper.AppSettings.Save(CopiesConfig, "copies.cfg");
            }
            CopiesConfig = FeuerwehrCloud.Helper.AppSettings.Load("copies.cfg");

            FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX] *** Waiting for Fax from:");
            foreach (var item in FAXConfig.Values)
            {
                FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FAX]     " + item);
            }

            //System.Environment.MachineName +
            ListenSockThread = new System.Threading.Thread(new System.Threading.ThreadStart(HandleThreadStart));
            ListenSockThread.Start();
            return(true);
        }
Exemple #5
0
 public bool Initialize(IHost hostApplication)
 {
     My       = hostApplication;
     WSThread = new System.Threading.Timer(delegate(object state) {
         System.Diagnostics.Debug.WriteLine(">> Backup THREAD");
         try {
             using (ZipFile zip = new ZipFile())
             {
                 zip.AlternateEncoding      = System.Text.Encoding.UTF8;
                 zip.AlternateEncodingUsage = ZipOption.AsNecessary;
                 zip.AddFiles(System.IO.Directory.GetFiles("./", "*.cfg"));
                 zip.AddFiles(System.IO.Directory.GetFiles("./", "*.lua"));
                 zip.AddFiles(System.IO.Directory.GetFiles("./", "*.txt"));
                 zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
                 zip.Comment          = "Backup created at " + System.DateTime.Now.ToString("G");
                 string bFile         = "backups/" + string.Format("backup{0}.zip", System.DateTime.Now.Ticks);
                 zip.Save(bFile);
                 using (var WC = new System.Net.WebClient()) {
                     WC.UploadFile(new Uri("http://www.feuerwehrcloud.de/deiva/backup.php?HID=" + System.Environment.MachineName), "POST", bFile);
                 }
             }
         } catch (Exception ex) {
             ex.ToString();
         }
         WSThread.Change(0, 86400000);
     });
     WSThread.Change(0, 86400000);
     return(true);
 }
        public bool Initialize(IHost hostApplication)
        {
            My = hostApplication;
            FeuerwehrCloud.Helper.Logger.WriteLine("|  *** FRITZCallMonitor loaded...");
            FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** Searching for AVM FRITZ!Box...");
            if (!System.IO.File.Exists("ILS.cfg"))
            {
                BOSConfig.Add("Target", "");
                FeuerwehrCloud.Helper.AppSettings.Save(BOSConfig, "ILS.cfg");
            }
            BOSConfig = FeuerwehrCloud.Helper.AppSettings.Load("ILS.cfg");

            FRITZCallMonitor.Gw = FRITZCallMonitor.GetDefaultGateway();
            if (FRITZCallMonitor.Gw == null)
            {
                FRITZCallMonitor.Gw = IPAddress.Parse("192.168.172.1");
            }
            try {
                M = new System.Threading.Thread((object obj) => ConnectAsTcpClient(obj));
                M.Start(this);
                return(true);
            } catch (Exception ex) {
                FeuerwehrCloud.Helper.Logger.WriteLine("|  < [FRITZCallMonitor] *** Connection to FRITZ!Box timed out...");
                return(false);
            }
        }
Exemple #7
0
        public bool Initialize(IHost hostApplication)
        {
            My = hostApplication;

            if (!System.IO.File.Exists("SMTP.cfg"))
            {
                SMTPConfig.Add("SMTPPort", "25");
                SMTPConfig.Add("RootMailDir", "./mail/");
                FeuerwehrCloud.Helper.AppSettings.Save(SMTPConfig, "SMTP.cfg");
            }
            SMTPConfig = FeuerwehrCloud.Helper.AppSettings.Load("SMTP.cfg");
            //System.Environment.MachineName +



            smtpServer = new SmtpServer
            {
                Configuration =
                {
                    DefaultGreeting = System.Environment.MachineName + ".feuerwehrcloud.de FeuerwehrCloud DEIVA BOSMTP MAIL service ready at"
                }
            };
            smtpServer.DefaultResponderFactory =
                new SmtpResponderFactory(smtpServer.Configuration)
            {
                DataResponder = new BOSSMTPDataResponder(smtpServer.Configuration, SMTPConfig["RootMailDir"], this)
            };
            FeuerwehrCloud.Helper.Logger.WriteLine("|  *** SMTPServer loaded: listening on port: " + SMTPConfig["SMTPPort"]);
            smtpServer.BindAndListenTo(IPAddress.Any, int.Parse(SMTPConfig["SMTPPort"]));
            return(true);
        }
Exemple #8
0
 public bool Initialize(FeuerwehrCloud.Plugin.IHost hostApplication)
 {
     FeuerwehrCloud.Helper.Logger.WriteLine("|  *** Relay plugin loaded...");
     if (!System.IO.File.Exists("relay.cfg"))
     {
         Configuration.Add("relaisnum", "");
         FeuerwehrCloud.Helper.AppSettings.Save(Configuration, "relay.cfg");
     }
     Configuration = FeuerwehrCloud.Helper.AppSettings.Load("relay.cfg");
     return(true);
 }
Exemple #9
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);
        }
 public bool Initialize(IHost hostApplication)
 {
     My = hostApplication;
     FeuerwehrCloud.Helper.Logger.WriteLine("| [" + System.DateTime.Now.ToString("T") + "] |-> [LCDProc] *** Initializing...");
     try {
         System.Threading.Thread t = new System.Threading.Thread(Connector);
         t.Start();
     } catch (Exception ex2) {
         FeuerwehrCloud.Helper.Logger.WriteLine("| [" + System.DateTime.Now.ToString("T") + "] |-> [LCDProc] *** ERROR: " + ex2);
         RaiseFinish("text", "ERROR", ex2.ToString());
     }
     return(true);
 }
        public bool Initialize(IHost hostApplication)
        {
            My = hostApplication;
            FeuerwehrCloud.Helper.Logger.WriteLine("|  *** BosMon-Compatibility loaded: listening on Port 3334");
            try {
                serverSocket = new TcpListener(IPAddress.Any, 3334);

                serverSocket.Start();
                serverSocket.BeginAcceptSocket(new AsyncCallback(AcceptCallback), null);
            } catch (Exception ex) {
            }


            return(true);
        }
Exemple #12
0
 public bool Initialize(IHost hostApplication)
 {
     My = hostApplication;
     FeuerwehrCloud.Helper.Logger.WriteLine("|  *** Statistics loaded...");
     WSThread = new System.Threading.Timer(delegate(object state) {
         System.Diagnostics.Debug.WriteLine(">> Statistics THREAD");
         try {
             string Temp   = FeuerwehrCloud.Helper.Helper.exec("/usr/bin/vcgencmd", " measure_temp");
             string memory = FeuerwehrCloud.Helper.Helper.exec("/usr/bin/vcgencmd", " get_mem arm");
             string uptime = FeuerwehrCloud.Helper.Helper.exec("/usr/bin/uptime", "");
             using (System.Net.WebClient wc = new System.Net.WebClient())
             {
                 wc.Headers[System.Net.HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                 string HtmlResult = wc.UploadString(new Uri("http://www.feuerwehrcloud.de/deiva/runtime.php"), ("HID=" + System.Environment.MachineName + "&" + Temp + "&" + memory + "&utime=" + uptime));
             }
         } catch (Exception ex) {
             FeuerwehrCloud.Helper.Logger.WriteLine(FeuerwehrCloud.Helper.Helper.GetExceptionDescription(ex));
         }
     });
     WSThread.Change(0, 7200000);
     return(true);
 }
        public bool Initialize(IHost hostApplication)
        {
            My = hostApplication;

            if (!System.IO.File.Exists("probealarm.cfg"))
            {
                FAXConfig.Add("Target", "");
                FeuerwehrCloud.Helper.AppSettings.Save(FAXConfig, "probealarm.cfg");
            }
            FAXConfig = FeuerwehrCloud.Helper.AppSettings.Load("probealarm.cfg");
            if (!System.IO.File.Exists("copies.cfg"))
            {
                CopiesConfig.Add("count", "1");
                FeuerwehrCloud.Helper.AppSettings.Save(CopiesConfig, "copies.cfg");
            }
            CopiesConfig = FeuerwehrCloud.Helper.AppSettings.Load("copies.cfg");

            //System.Environment.MachineName +
            ListenSockThread = new System.Threading.Thread(new System.Threading.ThreadStart(HandleThreadStart));
            ListenSockThread.Start();
            return(true);
        }
Exemple #14
0
 public bool Initialize(IHost hostApplication)
 {
     My = hostApplication;
     if (!System.IO.File.Exists("ddns.cfg"))
     {
         DDNSConfig.Add("Username", "CHANGEME");
         DDNSConfig.Add("Password", "CHANGEME\t");
         FeuerwehrCloud.Helper.AppSettings.Save(DDNSConfig, "ddns.cfg");
     }
     DDNSConfig = FeuerwehrCloud.Helper.AppSettings.Load("ddns.cfg");
     FeuerwehrCloud.Helper.Logger.WriteLine("|  *** DDNS loaded...");
     WSThread = new System.Threading.Timer(delegate(object state) {
         System.Diagnostics.Debug.WriteLine(">> DDNS THREAD");
         try {
             System.Net.WebClient WC = new System.Net.WebClient();
             WC.DownloadStringAsync(new Uri("http://www.feuerwehrcloud.de/deiva/ddns.php?HID=" + System.Environment.MachineName + "&username="******"Username"] + "&password="******"Password"]));
         } catch (Exception ex) {
             ex.ToString();
         }
     });
     WSThread.Change(0, 3600000);
     return(true);
 }
Exemple #15
0
        public bool Initialize(IHost hostApplication)
        {
            My = hostApplication;


            if (!System.IO.File.Exists("WhatsApp.cfg"))
            {
                WAConfig.Add("Target", "");
                WAConfig.Add("NickName", "");
                WAConfig.Add("Sender", "");
                WAConfig.Add("Password", "");
                de.SYStemiya.Helper.AppSettings.Save(WAConfig, "WhatsApp.cfg");
            }
            WAConfig = de.SYStemiya.Helper.AppSettings.Load("WhatsApp.cfg");

            //string nickname = "FFW-Neubeuern";
            //string sender = "4980353749";
            //string password = "******";
            //"491739561779"; //"4980353749-1391848501"
            // Prepare WhatsApp
            de.SYStemiya.Helper.Logger.WriteLine("|  *** WhatsApp loaded...");

            return(true);
        }
        public bool Initialize(IHost hostApplication)
        {
            My = hostApplication;
            FeuerwehrCloud.Helper.Logger.WriteLine("|  *** Update loaded...");



            WSThread = new System.Threading.Timer(delegate(object state) {
                System.Diagnostics.Debug.WriteLine(">> UPDATE THREAD");
                try {
                    using (System.Net.WebClient wc = new System.Net.WebClient())
                    {
                        System.Collections.Generic.Dictionary <string, string> Updates = new Dictionary <string, string>();
                        var AllAssemblys  = AppDomain.CurrentDomain.GetAssemblies();
                        string HtmlResult = wc.DownloadString(new Uri("http://www.feuerwehrcloud.de/deiva/version.php"));
                        string[] eachLine = HtmlResult.Replace("\r", "").Split(new [] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                        foreach (var item in eachLine)
                        {
                            string[] ALine = item.Split(new [] { ":" }, StringSplitOptions.None);
                            Version V      = new Version(ALine[1]);
                            foreach (var asmbly in AllAssemblys)
                            {
                                var cAssembly = asmbly.FullName.Split(new [] { "," }, StringSplitOptions.RemoveEmptyEntries);
                                if (cAssembly[0].Trim() == ALine[0])
                                {
                                    Version MV = new Version(cAssembly[1].Replace("Version=", ""));
                                    if (V > MV)
                                    {
                                        // Es gibt ein Major-Update?!
                                        Updates.Add(cAssembly[0].Trim(), System.Web.HttpUtility.UrlDecode((new Uri(asmbly.CodeBase)).AbsolutePath));
                                    }
                                }
                                //AssemblyName M  = AssemblyName.GetAssemblyName(asmbly.CodeBase);
                                System.Diagnostics.Debug.Write("");
                            }
                        }

                        if (Updates.Count > 0)
                        {
                            foreach (var item in Updates)
                            {
                                using (var WC = new System.Net.WebClient()) {
                                    try {
                                        byte[] data = WC.DownloadData("http://www.feuerwehrcloud.de/deiva/update/" + System.IO.Path.GetFileName(item.Value));
                                        System.IO.File.WriteAllBytes(item.Value, data);
                                    } catch (Exception ex) {
                                    }
                                }
                            }
                            System.Diagnostics.Process.Start("updatehelper.sh", System.Diagnostics.Process.GetCurrentProcess().Id.ToString());
                            System.Environment.FailFast("ENDE");
                        }
                    }
                } catch (Exception ex) {
                    FeuerwehrCloud.Helper.Logger.WriteLine(FeuerwehrCloud.Helper.Helper.GetExceptionDescription(ex));
                }
            });
            WSThread.Change(0, 7200000);

            return(true);
        }
 public bool Initialize(IHost hostApplication)
 {
     My = hostApplication;
     FeuerwehrCloud.Helper.Logger.WriteLine("|  *** WakeUp On LAN loaded...");
     return(true);
 }
Exemple #18
0
 public bool Initialize(FeuerwehrCloud.Plugin.IHost hostApplication)
 {
     My = hostApplication;
     FeuerwehrCloud.Helper.Logger.WriteLine("|  *** Parser: Rosenheim loaded...");
     return(true);
 }
Exemple #19
0
 public bool Initialize(IHost hostApplication)
 {
     My = hostApplication;
     FeuerwehrCloud.Helper.Logger.WriteLine("|  *** FileWriter loaded");
     return(true);
 }
Exemple #20
0
        public bool Initialize(IHost hostApplication)
        {
            My = hostApplication;
            if (!System.IO.File.Exists("printerstatus.cfg"))
            {
                PrinterStatusConfig.Add("email", "CHANGEME");
                PrinterStatusConfig.Add("interval", "CHANGEME");
                PrinterStatusConfig.Add("lastnotificated", "0");
                PrinterStatusConfig.Add("printers", "1");
                PrinterStatusConfig.Add("printertype1", "CHANGEME");
                PrinterStatusConfig.Add("address1", "CHANGEME");
                FeuerwehrCloud.Helper.AppSettings.Save(PrinterStatusConfig, "printerstatus.cfg");
            }
            if (!System.IO.File.Exists("smtp.cfg"))
            {
                SMTPConfig.Add("host", "");
                SMTPConfig.Add("ssl", "");
                SMTPConfig.Add("username", "");
                SMTPConfig.Add("password", "");
                SMTPConfig.Add("port", "");
                FeuerwehrCloud.Helper.AppSettings.Save(SMTPConfig, "smtp.cfg");
            }
            SMTPConfig          = FeuerwehrCloud.Helper.AppSettings.Load("smtp.cfg");
            PrinterStatusConfig = FeuerwehrCloud.Helper.AppSettings.Load("printerstatus.cfg");


            watcher      = new FileSystemWatcher();
            watcher.Path = System.Environment.CurrentDirectory;
            watcher.IncludeSubdirectories = false;
            watcher.Filter       = "smtp.cfg;printerstatus.cfg";
            watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.LastAccess | NotifyFilters.DirectoryName | NotifyFilters.FileName;
            watcher.Changed     += new FileSystemEventHandler(delegate(object sender, FileSystemEventArgs e) {
                SMTPConfig          = FeuerwehrCloud.Helper.AppSettings.Load("smtp.cfg");
                PrinterStatusConfig = FeuerwehrCloud.Helper.AppSettings.Load("printerstatus.cfg");
            });
            watcher.EnableRaisingEvents = true;

            FeuerwehrCloud.Helper.Logger.WriteLine("|  *** PrinterStatus loaded...");
            FeuerwehrCloud.Helper.Logger.WriteLine("|  = [PrinterStatus] active for:");
            for (int i = 1; i <= int.Parse(PrinterStatusConfig["printers"]); i++)
            {
                FeuerwehrCloud.Helper.Logger.WriteLine("|  = [PrinterStatus]     " + PrinterStatusConfig["printertype" + i.ToString()] + ": " + PrinterStatusConfig["address" + i.ToString()]);
            }
            WSThread = new System.Threading.Timer(delegate(object state) {
                System.Diagnostics.Debug.WriteLine(">> PrinterStatus THREAD");
                if (Helper.Helper.exec("/usr/bin/lpq", "").IndexOf("no entries") > -1)
                {
                    for (int i = 1; i <= int.Parse(PrinterStatusConfig["printers"]); i++)
                    {
                        try {
                            string StatusText = WritePJL(((string)PrinterStatusConfig["printertype" + i.ToString()]).ToLower(), ((string)PrinterStatusConfig["address" + i.ToString()]), String.Format("\x1B%-12345X@PJL INFO STATUS \r\n\x1B%-12345X\r\n"));
                            //string PAGECOUNT = WritePJL(((string)PrinterStatusConfig["printertype"+i.ToString()]).ToLower(),((string)PrinterStatusConfig["address"+i.ToString()]),String.Format ("\x1B%-12345X@PJL INFO PAGECOUNT \r\n\x1B%-12345X\r\n"));
                            //string SERIAL = WritePJL(((string)PrinterStatusConfig["printertype"+i.ToString()]).ToLower(),((string)PrinterStatusConfig["address"+i.ToString()]),String.Format ("\x1B%-12345X@PJL INQUIRE SERIALNUMBER \r\n\x1B%-12345X\r\n"));
                            string ID = WritePJL(((string)PrinterStatusConfig["printertype" + i.ToString()]).ToLower(), ((string)PrinterStatusConfig["address" + i.ToString()]), String.Format("\x1B%-12345X@PJL INFO ID \r\n\x1B%-12345X\r\n"));
                            //string SELFTEXT1 = WritePJL(((string)PrinterStatusConfig["printertype"+i.ToString()]).ToLower(),((string)PrinterStatusConfig["address"+i.ToString()]),String.Format ("\x1B%-12345X@PJL INFO VARIABLES \r\n\x1B%-12345X\r\n"));
                            //string SELFTEXT2 = WritePJL(((string)PrinterStatusConfig["printertype"+i.ToString()]).ToLower(),((string)PrinterStatusConfig["address"+i.ToString()]),String.Format ("\x1B%-12345X@PJL INFO USTATUS \r\n\x1B%-12345X\r\n"));
                            //string SELFTEXT3 = WritePJL(((string)PrinterStatusConfig["printertype"+i.ToString()]).ToLower(),((string)PrinterStatusConfig["address"+i.ToString()]),String.Format ("\x1B%-12345X@PJL INQUIRE RESOLUTION \r\n\x1B%-12345X\r\n"));
                            //string SELFTEXT4 = WritePJL(((string)PrinterStatusConfig["printertype"+i.ToString()]).ToLower(),((string)PrinterStatusConfig["address"+i.ToString()]),String.Format ("\x1B%-12345X@PJL INFO PRODINFO \r\n\x1B%-12345X\r\n"));
                            //string SELFTEXT5 = WritePJL(((string)PrinterStatusConfig["printertype"+i.ToString()]).ToLower(),((string)PrinterStatusConfig["address"+i.ToString()]),String.Format ("\x1B%-12345X@PJL INFO FILESYS \r\n\x1B%-12345X\r\n"));
                            //string SELFTEXT6 = WritePJL(((string)PrinterStatusConfig["printertype"+i.ToString()]).ToLower(),((string)PrinterStatusConfig["address"+i.ToString()]),String.Format ("\x1BZ\r\n\x1BE\r\n"));
                            //StatusText = "CODE=41038\nDISPLAY=ONLINE\nONLINE=TRUE\n";
                            string XCode = "";
                            if (StatusText.IndexOf("CODE=") > -1)
                            {
                                XCode = StatusText.Substring(StatusText.IndexOf("CODE=") + 5);
                                XCode = XCode.Substring(0, XCode.IndexOf("\n")).Replace("\r", "");
                                if (StatusToText(XCode) != "")
                                {
                                    if (Int32.Parse(PrinterStatusConfig["lastnotificated" + i.ToString()]) + Int32.Parse(PrinterStatusConfig["interval"]) < (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds)
                                    {
                                        PrinterStatusConfig.Remove("lastnotificated" + i.ToString());
                                        PrinterStatusConfig.Add("lastnotificated" + i.ToString(), ((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString());
                                        FeuerwehrCloud.Helper.AppSettings.Save(PrinterStatusConfig, "printerstatus.cfg");

                                        System.Net.Mail.SmtpClient SMTP = new System.Net.Mail.SmtpClient();
                                        SMTP.Host        = SMTPConfig ["host"];
                                        SMTP.Port        = (SMTPConfig ["port"] != ""? int.Parse(SMTPConfig ["port"]):25);
                                        SMTP.EnableSsl   = bool.Parse(SMTPConfig ["ssl"]);
                                        SMTP.Credentials = new System.Net.NetworkCredential(SMTPConfig ["username"], SMTPConfig ["password"]);
                                        System.Net.Mail.MailMessage Msg = new System.Net.Mail.MailMessage("printeralert@" + System.Environment.MachineName + ".feuerwehrcloud.de", PrinterStatusConfig["email"]);
                                        if (Template != "")
                                        {
                                            Msg.IsBodyHtml = true;
                                            Msg.Body       = System.IO.File.ReadAllText("plugins/" + Template).Replace("%STATUS%", StatusToText(XCode));
                                        }
                                        else
                                        {
                                            Msg.Body = StatusToText(XCode);
                                        }
                                        Msg.Subject = "PRINTER IS IN ALERT STATE";
                                        SMTP.Send(Msg);
                                    }
                                }
                            }
                            if (ID.IndexOf("\n") > -1)
                            {
                                ID = ID.Substring(ID.IndexOf("\n") + 2).Trim().Replace("\0", "");
                                if (ID.StartsWith("\""))
                                {
                                    ID = ID.Substring(1);
                                }
                                if (ID.EndsWith("\""))
                                {
                                    ID = ID.Substring(0, ID.Length - 1);
                                }
                            }
                            else
                            {
                                ID = "Generic Printer";
                            }
                            using (System.Net.WebClient wc = new System.Net.WebClient())
                            {
                                wc.Headers[System.Net.HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                                string HtmlResult = wc.UploadString(new Uri("http://www.feuerwehrcloud.de/deiva/printerstate.php"), ("HID=" + System.Environment.MachineName + "&ptype=" + ((string)PrinterStatusConfig["printertype" + i.ToString()]).ToLower() + "&paddr=" + ((string)PrinterStatusConfig["address" + i.ToString()]) + "&model=" + ID + "&error=" + XCode));
                            }
                        } catch (Exception ex) {
                            FeuerwehrCloud.Helper.Logger.WriteLine(FeuerwehrCloud.Helper.Helper.GetExceptionDescription(ex));
                        }
                    }
                }
            });
            WSThread.Change(0, 600 * 1000);
            return(true);
        }