예제 #1
0
        public ApplicationStarter()
        {
            PrepareFolders();

            var db = new NanoDB();

            new DownloadCheckDaemon(db);
            db.ReadPosts();

            /*form.FormClosed += (object sender, FormClosedEventArgs e) => {
             *  daemon.Stop();
             *  new PngMailer().FillOutbox(db);
             * };*/

            try
            {
                if (!File.Exists("port.txt"))
                {
                    File.WriteAllText("port.txt", "7345");
                }
            }
            catch
            {
                Logger.LogError("Cant write to port.txt");
            }

            int port = 0;

            try
            {
                int.TryParse(File.ReadAllText("port.txt"), out port);
            }
            catch
            {
                Logger.LogError("Error reading port.txt");
            }

            if (port <= 0)
            {
                port = 7345;
            }

            Console.WriteLine("Do not terminate manually, use shutdown action in web-interface.");
            var serv = new NanoHttpServerBuilder(db).Build(port);

            serv.Run();
        }
예제 #2
0
        public ApplicationStarter()
        {
            PrepareFolders();

            var db = new NanoDB();
            new DownloadCheckDaemon(db);
            db.ReadPosts();
            /*form.FormClosed += (object sender, FormClosedEventArgs e) => {
                daemon.Stop();
                new PngMailer().FillOutbox(db);
            };*/

            try
            {
                if (!File.Exists("port.txt"))
                {
                    File.WriteAllText("port.txt", "7345");
                }
            }
            catch
            {
                Logger.LogError("Cant write to port.txt");
            }

            int port = 0;
            try
            {
                int.TryParse(File.ReadAllText("port.txt"), out port);
            }
            catch
            {
                Logger.LogError("Error reading port.txt");
            }

            if (port <= 0)
            {
                port = 7345;
            }

            Console.WriteLine("Do not terminate manually, use shutdown action in web-interface.");
            var serv = new NanoHttpServerBuilder(db).Build(port);
            serv.Run();
        }