Ejemplo n.º 1
0
        public SkynetHost(string hostName, IServer server, IPackageExplorer packageExplorer)
        {
            this.packageExplorer = packageExplorer;
            HostName             = hostName;
            var currentProcess = Process.GetCurrentProcess();

            processId        = currentProcess.Id;
            ServerId         = Guid.NewGuid();
            this.server      = server;
            connectedClients = new ConcurrentList <SkynetConnection>();
            container        = new BasicContainer();
            packageRepo      = new BasicFilePackageRepository();
            processRegistry  = new SkynetProcessRegistry(packageRepo);
            processRegistry.Heartbeat(ServerId, processId);
            container.Register(() => packageRepo);
            container.Register(() => processRegistry);
            container.Register(() => this);
            container.Register(() => packageExplorer);
            var serverProcess = processRegistry.GetProcesss(processId);
            var repository    = LogManager.GetRepository() as log4net.Repository.Hierarchy.Hierarchy;

            repository.Root.AddAppender(new OutputAppender(serverProcess.Output));
            container.Register(() => serverProcess.Output);
            timer = new Timer(x => { processRegistry.Heartbeat(ServerId, processId); }, null, TimeSpan.FromMilliseconds(1), TimeSpan.FromSeconds(10));
        }
Ejemplo n.º 2
0
 public SkynetClient(string clientName, IClient client, T800 runner)
 {
     this.client = client;
     ClientName  = clientName;
     container   = new BasicContainer();
     container.Register(() => this);
     container.Register <T800>(() => new BasicModel(runner));
     timer = new Timer((x) => { if (SkynetConnection != null)
                                {
                                    SkynetConnection.SendMessage(new Heartbeat(Process.GetCurrentProcess().Id));
                                }
                       }, null, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(10));
     subscription = client.Subscribe(this);
 }
Ejemplo n.º 3
0
 public void when_registered_with_valid_generic_arguments_succeeds()
 {
     _classUnderTest.Register <ICalculator, ScientificCalculator>();
 }