Ejemplo n.º 1
0
        public static void StartAll()
        {
            Kooboo.Data.AppSettings.SetCustomSslCheck();

            var settingPort = AppSettingsUtility.Get("Port");

            if (string.IsNullOrEmpty(settingPort))
            {
                settingPort = AppSettingsUtility.Get("port");
            }
            var port = DataConstants.DefaultPort;

            if (string.IsNullOrEmpty(settingPort))
            {
                while (Lib.Helper.NetworkHelper.IsPortInUse(port) && port < 65535)
                {
                    port += 1;
                }
            }
            else if (int.TryParse(settingPort, out port) && Lib.Helper.NetworkHelper.IsPortInUse(port))
            {
                string message = Data.Language.Hardcoded.GetValue("Port") + " " + port.ToString() + " " + Data.Language.Hardcoded.GetValue("is in use");
                MessageBox.Show(message);
                return;
            }
            AppSettings.CurrentUsedPort = port;
            SystemStatus.Port           = port;

            Web.SystemStart.Start(port);
            Mail.EmailWorkers.Start();
        }
Ejemplo n.º 2
0
        public static void StartAll()
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                System.IO.File.AppendAllText("log.txt", "Unhandled exception: " + args.ExceptionObject);
                Environment.Exit(1);
            };

            var settingPort = AppSettingsUtility.Get("Port");

            if (string.IsNullOrEmpty(settingPort))
            {
                settingPort = AppSettingsUtility.Get("port");
            }
            var port = DataConstants.DefaultPort;

            if (string.IsNullOrEmpty(settingPort))
            {
                while (Lib.Helper.NetworkHelper.IsPortInUse(port) && port < 65535)
                {
                    port += 1;
                }
            }
            else if (int.TryParse(settingPort, out port) && Lib.Helper.NetworkHelper.IsPortInUse(port))
            {
                string message = Data.Language.Hardcoded.GetValue("Port") + " " + port.ToString() + " " + Data.Language.Hardcoded.GetValue("is in use");
                MessageBox.Show(message);
                return;
            }
            AppSettings.CurrentUsedPort = port;
            SystemStatus.Port           = port;

            Web.SystemStart.Start(port);
            Mail.EmailWorkers.Start();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Kooboo.Lib.Compatible.CompatibleManager.Instance.Framework.RegisterEncoding();

            Kooboo.Data.AppSettings.SetCustomSslCheck();

            GlobalSettings.RootPath = Kooboo.Data.AppSettings.DatabasePath;
            var settingPort = AppSettingsUtility.Get("Port");

            if (string.IsNullOrEmpty(settingPort))
            {
                settingPort = AppSettingsUtility.Get("port");
            }
            var port = DataConstants.DefaultPort;

            if (string.IsNullOrEmpty(settingPort))
            {
                port = Kooboo.Lib.Compatible.CompatibleManager.Instance.System.GetPort(port);
            }
            else if (int.TryParse(settingPort, out port) && Kooboo.Lib.Compatible.CompatibleManager.Instance.System.IsPortInUsed(port))
            {
                string message = Data.Language.Hardcoded.GetValue("Port") + " " + port.ToString() + " " + Data.Language.Hardcoded.GetValue("is in use");
                Console.WriteLine(message);
                return;
            }

            Kooboo.Data.Hosts.WindowsHost.change = new Data.Hosts.HostChange()
            {
                NoChange = true
            };
            Kooboo.Data.AppSettings.DefaultLocalHost = "localkooboo.com";
            Kooboo.Data.AppSettings.StartHost        = "127.0.0.1";


            AppSettings.CurrentUsedPort = port;

            Web.SystemStart.Start(port);
            Console.WriteLine("Web Server Started");
            Console.WriteLine("port:" + port);

            Mail.EmailWorkers.Start();

            //if(UpgradeHelper.HasNewVersion())
            //{
            //    UpgradeHelper.Download();
            //}
            Kooboo.Lib.Compatible.CompatibleManager.Instance.Framework.ConsoleWait();
        }