예제 #1
0
 public void Start()
 {
     _ulterius = new Ulterius();
     _ulterius.Start(true);
     HandleMonitor();
     var hardware = new HardwareSurvey();
     hardware.Setup(true);
     Console.ReadLine();
 }
예제 #2
0
파일: Program.cs 프로젝트: Ulterius/server
        //Evan will have to support me and my cat once this gets released into the public.


        private static void Main(string[] args)

        {

            if (!Debugger.IsAttached)
            {

                ExceptionHandler.AddGlobalHandlers();
                Console.WriteLine("Exception Handlers Attached");
            }
            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);
                }
            }
        }