Example #1
0
        //Evan will have to support me and my cat once this gets released into the public.


        private static void Main(string[] args)

        {
            if (System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Count() > 1)
            {
                return;
            }

            ProfileOptimization.SetProfileRoot(AppEnvironment.DataPath);
            ProfileOptimization.StartProfile("Startup.Profile");

            if (args.Length > 0)
            {
                HostFactory.Run(x =>                                                     //1
                {
                    x.Service <UlteriusAgent>(s =>                                       //2
                    {
                        s.ConstructUsing(name => new UlteriusAgent());                   //3
                        s.WhenStarted(tc => tc.Start());                                 //4
                        s.WhenStopped(tc => tc.Stop());
                        s.WhenSessionChanged((se, e, id) => { se.HandleEvent(e, id); }); //5
                    });
                    x.RunAsLocalSystem();                                                //6
                    x.EnableSessionChanged();
                    x.SetDescription("The server that powers Ulterius");                 //7
                    x.SetDisplayName("Ulterius Server");                                 //8
                    x.SetServiceName("UlteriusServer");                                  //9
                });
            }
            else
            {
                var ulterius = new Ulterius();
                ulterius.Start();
                var hardware = new HardwareSurvey();
                hardware.Setup();
                if (Tools.RunningPlatform() == Tools.Platform.Windows)
                {
                    UlteriusTray.ShowTray();
                }
                else
                {
                    Console.ReadKey(true);
                }
            }
        }
Example #2
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);
            }
        }
Example #3
0
        //Evan will have to support me and my cat once this gets released into the public.


        private static void Main(string[] args)

        {
            ProfileOptimization.SetProfileRoot(AppEnvironment.DataPath);
            ProfileOptimization.StartProfile("Startup.Profile");

            var ulterius = new Ulterius();

            ulterius.Start();
            var hardware = new HardwareSurvey();

            hardware.Setup();
            //TODO Gdk tray icons
            if (Tools.RunningPlatform() == Tools.Platform.Windows)
            {
                UlteriusTray.ShowTray();
            }
            else
            {
                Console.ReadKey(true);
            }
        }
Example #4
0
        private static void Main(string[] args)

        {
            //Fix screensize issues for Screen Share
            if (Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }
            HideWindow();
            try
            {
                if (
                    Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location))
                    .Count() > 1)
                {
                    return;
                }

                ProfileOptimization.SetProfileRoot(AppEnvironment.DataPath);
                ProfileOptimization.StartProfile("Startup.Profile");

                if (args.Length > 0)
                {
                    HostFactory.Run(x =>                                                     //1
                    {
                        x.Service <UlteriusAgent>(s =>                                       //2
                        {
                            s.ConstructUsing(name => new UlteriusAgent());                   //3
                            s.WhenStarted(tc => tc.Start());                                 //4
                            s.WhenStopped(tc => tc.Stop());
                            s.WhenSessionChanged((se, e, id) => { se.HandleEvent(e, id); }); //5
                        });
                        x.RunAsLocalSystem();                                                //6
                        x.EnableSessionChanged();
                        x.EnableServiceRecovery(r => { r.RestartService(1); });
                        x.SetDescription("The server that powers Ulterius"); //7
                        x.SetDisplayName("Ulterius Server");                 //8
                        x.SetServiceName("UlteriusServer");                  //9
                    });
                }
                else
                {
                    var ulterius = new Ulterius();
                    ulterius.Start();
                    var hardware = new HardwareSurvey();
                    hardware.Setup();
                    if (Tools.RunningPlatform() == Tools.Platform.Windows)
                    {
                        UlteriusTray.ShowTray();
                    }
                    else
                    {
                        Console.ReadKey(true);
                    }
                }
            }
            catch
            {
                Console.WriteLine("Something unexpected occured");
            }
        }