public ChronokeeperService GetChronokeeperService(RyuContainer ryu) {
    var remoteChronokeeperConfiguration = ryu.Get<RemoteChronokeeperConfiguration>();
    var networkingProxy = ryu.Get<INetworkingProxy>();
    var endpoint = networkingProxy.CreateEndPoint(remoteChronokeeperConfiguration.Host, remoteChronokeeperConfiguration.Port);
    var serviceClientFactory = ryu.Get<ServiceClientFactory>();
    var serviceClient = serviceClientFactory.Remote(endpoint.ToIPEndPoint());
    return serviceClient.GetService<ChronokeeperService>();
 }
 private PlatformNetworkingResources ConstructPlatformNetworkingResources(RyuContainer ryu) {
    var configuration = ryu.Get<PlatformConfiguration>();
    var serviceClientFactory = ryu.Get<ServiceClientFactory>();
    var serviceClient = serviceClientFactory.Local(configuration.ServicePort, ClusteringRole.HostOrGuest);
    return new PlatformNetworkingResourcesImpl {
       LocalServiceClient = serviceClient
    };
 }
 public static ChronokeeperServiceImpl CreateChronokeeperServiceImpl(RyuContainer ryu) {
    var configuration = ryu.Get<ChronokeeperServiceConfiguration>();
    var timeProxy = ryu.Get<TimeProxy>();
    var workers = Util.Generate(
       configuration.WorkerCount,
       workerId => (ChronokeeperWorker)new ChronokeeperWorkerImpl(
          new ChronokeeperWorkerConfigurationImpl {
             DatacenterId = configuration.DatacenterId,
             WorkerId = workerId
          }, timeProxy
       )
    );
    return new ChronokeeperServiceImpl(workers);
 }
      private HydarNetworkingResources ConstructHydarNetworkingResources(RyuContainer ryu) {
         var hydarConfiguration = ryu.Get<HydarConfiguration>();

         // Initialize Dargon.Services
         var serviceClientFactory = ryu.Get<ServiceClientFactory>();
         var serviceClient = serviceClientFactory.Local(hydarConfiguration.ServicePort, ClusteringRole.HostOnly);

         // Initialize Dargon.Courier
         var courierClientFactory = ryu.Get<CourierClientFactory>();
         var courierClient = courierClientFactory.CreateUdpCourierClient(hydarConfiguration.CourierPort);

         return new HydarNetworkingResourcesImpl {
            LocalServiceClient = serviceClient,
            LocalCourierClient = courierClient
         };
      }
 private Gamepad ConstructGamepad(RyuContainer ryu)
 {
     var gamepad = new RemoteGamepad();
      const int kPort = 21337;
      var courierClientFactory = ryu.Get<CourierClientFactory>();
      var courierClient = courierClientFactory.CreateUdpCourierClient(kPort,
     new CourierClientConfiguration {
        Identifier = Guid.NewGuid()
     });
      ryu.Set(courierClient);
      courierClient.RegisterPayloadHandler<GamepadStateDto>(x => gamepad.Update(x.Payload));
      Console.WriteLine("Constructed courier client");
      return gamepad;
 }
 private CacheFactory ConstructCacheFactory(RyuContainer ryu) {
    var networkingResources = ryu.Get<HydarNetworkingResources>();
    return new CacheFactoryImpl(
       ryu.Get<GuidHelper>(),
       ryu.Get<ServiceClientFactory>(),
       networkingResources.LocalServiceClient,
       networkingResources.LocalCourierClient,
       ryu.Get<ILocalManagementServer>(),
       ryu.Get<ReceivedMessageFactory>(),
       ryu.Get<IPofContext>()
    );
 }
 public RemoteChronokeeperConfiguration GetRemoteChronokeeperConfiguration(RyuContainer ryu) {
    var configurationFactory = ryu.Get<RemoteChronokeeperConfigurationFactory>();
    return configurationFactory.Create();
 }
 private CacheDispatcher ConstructCacheDispatcher(RyuContainer ryu) {
    var networkingResources = ryu.Get<HydarNetworkingResources>();
    MessageRouter messageRouter = networkingResources.LocalCourierClient;
    return new CacheDispatcherImpl(messageRouter);
 }