Example #1
0
        /// <summary>
        ///     Starts various parts of the server than loop to keep everything alive.
        /// </summary>
        private void Setup()
        {
            if (Tools.RunningPlatform() == Tools.Platform.Windows)
            {
                HideWindow();
            }
            Console.WriteLine("Creating settings");
            try
            {
                Settings.Initialize("Config.json");
            }
            catch (JsonReaderException)
            {
                Console.WriteLine("Settings broken, fixing.");
                var settingsPath = Path.Combine(AppEnvironment.DataPath, "Config.json");
                //Handle settings failing to create, rarely happens but it does.
                File.Delete(settingsPath);
                Settings.Initialize("Config.json");
            }
            Console.WriteLine("Configuring up server");
            Tools.ConfigureServer();
            var useTerminal  = Convert.ToBoolean(Settings.Get("Terminal").AllowTerminal);
            var useWebServer = Convert.ToBoolean(Settings.Get("WebServer").ToggleWebServer);
            var useWebCams   = Convert.ToBoolean(Settings.Get("Webcams").UseWebcams);

            if (useWebCams)
            {
                Console.WriteLine("Loading Webcams");
                WebCamManager.LoadWebcams();
            }
            if (useWebServer)
            {
                Console.WriteLine("Setting up HTTP Server");
                HttpServer.Setup();
            }
            systemService = new SystemService();
            Console.WriteLine("Creating system service");
            systemService.Start();
            UlteriusApiServer.Start();
            if (useTerminal)
            {
                Console.WriteLine("Starting Terminal API");
                TerminalManagerServer.Start();
            }
            try
            {
                var useUpnp = Convert.ToBoolean(Settings.Get("Network").UpnpEnabled);
                if (useUpnp)
                {
                    Console.WriteLine("Trying to forward ports");
                    Tools.ForwardPorts();
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Failed to forward ports");
            }
        }
Example #2
0
        /// <summary>
        ///     Starts various parts of the server than loop to keep everything alive.
        /// </summary>
        private void Setup()
        {
            Console.WriteLine("Creating settings");

            var settings = Config.Load();



            Console.WriteLine("Configuring up server");
            Tools.ConfigureServer();



            Console.WriteLine(Assembly.GetExecutingAssembly().GetName().Version);
            var useTerminal  = settings.Terminal.AllowTerminal;
            var useWebServer = settings.WebServer.ToggleWebServer;
            var useWebCams   = settings.Webcams.UseWebcams;

            if (useWebCams)
            {
                Console.WriteLine("Loading Webcams");
                WebCamManager.LoadCameras();
            }
            if (useWebServer)
            {
                Console.WriteLine("Setting up HTTP Server");
                HttpServer.Setup();
            }
            systemService = new SystemService();
            Console.WriteLine("Creating system service");
            systemService.Start();
            UlteriusApiServer.RunningAsService = Tools.RunningAsService();
            Console.Write($"Service: {UlteriusApiServer.RunningAsService}");
            UlteriusApiServer.Start();

            if (useTerminal)
            {
                Console.WriteLine("Starting Terminal API");
                TerminalManagerServer.Start();
            }
            try
            {
                var useUpnp = settings.Network.UpnpEnabled;
                if (useUpnp)
                {
                    Console.WriteLine("Trying to forward ports");
                    Tools.ForwardPorts();
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Failed to forward ports");
            }
        }
Example #3
0
        private static void Main(string[] args)
        {
            //fixes wrong screensize for screen share
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            if (!Directory.Exists(AppEnvironment.DataPath))
            {
                Directory.CreateDirectory(AppEnvironment.DataPath);
            }

            if (!Debugger.IsAttached)
            {
                ExceptionHandler.AddGlobalHandlers();
            }


            Console.WriteLine("Exception Handlers attached");


            Settings.Initialize("Config.json");

            Console.Title = Resources.Program_Title;
            Tools.ConfigureServer();
            var useTerminal  = Convert.ToBoolean(Settings.Get("Terminal").AllowTerminal);
            var usePlugins   = Convert.ToBoolean(Settings.Get("Plugins").LoadPlugins);
            var useWebServer = Convert.ToBoolean(Settings.Get("WebServer").UseWebServer);

            WebCamManager.LoadWebcams();
            if (usePlugins)
            {
                PluginHandler.LoadPlugins();
            }
            if (useWebServer)
            {
                HttpServer.Setup();
            }
            var systemUtilities = new SystemUtilities();

            systemUtilities.Start();
            //Keep down here if you actually want a functional program
            TaskManagerServer.Start();
            if (useTerminal)
            {
                TerminalManagerServer.Start();
            }
            Console.ReadLine();
        }
        private static void ConsoleMain(string[] args)
        {
            Console.WriteLine("Command line = {0}", Environment.CommandLine);
            for (var ix = 0; ix < args.Length; ++ix)
                Console.WriteLine("Argument{0} = {1}", ix + 1, args[ix]);
            WebCamManager.LoadWebcams();
            PluginManager.LoadPlugins();
            Tools.GenerateSettings();
            HttpServer.Setup();
            var systemUtilities = new SystemUtilities();
            systemUtilities.Start();

            //Keep down here if you actually want a functional program
            TaskManagerServer.Start();
            TerminalManagerServer.Start();
            Console.ReadLine();
        }
Example #5
0
        /// <summary>
        /// Starts various parts of the server than loop to keep everything alive.
        /// </summary>
        private void Setup()
        {
            HideWindow();
            Console.WriteLine("Creating settings");
            Settings.Initialize("Config.json");
            Console.WriteLine("Configuring up server");
            Tools.ConfigureServer();
            var useTerminal  = Convert.ToBoolean(Settings.Get("Terminal").AllowTerminal);
            var useWebServer = Convert.ToBoolean(Settings.Get("WebServer").ToggleWebServer);

            Console.WriteLine("Loading Webcams");
            WebCamManager.LoadWebcams();
            if (useWebServer)
            {
                Console.WriteLine("Setting up HTTP Server");
                HttpServer.Setup();
            }
            systemService = new SystemService();
            Console.WriteLine("Creating system service");
            systemService.Start();
            UlteriusApiServer.Start();
            if (useTerminal)
            {
                Console.WriteLine("Starting Terminal API");
                TerminalManagerServer.Start();
            }
            try
            {
                var useUpnp = Convert.ToBoolean(Settings.Get("Network").UPnpEnabled);
                if (useUpnp)
                {
                    Console.WriteLine("Trying to forward ports");
                    Tools.ForwardPorts();
                }
            }
            catch (Exception)
            {
                Console.WriteLine("Failed to forward ports");
            }
            UlteriusTray.ShowTray();
            while (!stop)
            {
                Thread.Sleep(1);
            }
        }