public static int Main() { ICollectionFactory collectionFactory = new CollectionFactory(); ProxyGenerator proxyGenerator = new ProxyGenerator(); IThreadingFactory threadingFactory = new ThreadingFactory(); ISynchronizationFactory synchronizationFactory = new SynchronizationFactory(); IThreadingProxy threadingProxy = new ThreadingProxy(threadingFactory, synchronizationFactory); IDnsProxy dnsProxy = new DnsProxy(); ITcpEndPointFactory tcpEndPointFactory = new TcpEndPointFactory(dnsProxy); IStreamFactory streamFactory = new StreamFactory(); INetworkingInternalFactory networkingInternalFactory = new NetworkingInternalFactory(threadingProxy, streamFactory); ISocketFactory socketFactory = new SocketFactory(tcpEndPointFactory, networkingInternalFactory); INetworkingProxy networkingProxy = new NetworkingProxy(socketFactory, tcpEndPointFactory); IPofContext pofContext = new ClientPofContext(); IPofSerializer pofSerializer = new PofSerializer(pofContext); PofStreamsFactory pofStreamsFactory = new PofStreamsFactoryImpl(threadingProxy, streamFactory, pofSerializer); var serviceConfiguration = new ClientClusteringConfiguration(); var serviceClientFactory = new ServiceClientFactoryImpl(proxyGenerator, streamFactory, collectionFactory, threadingProxy, networkingProxy, pofSerializer, pofStreamsFactory); var localEndPoint = tcpEndPointFactory.CreateLoopbackEndPoint(serviceConfiguration.Port); var reconnectAttempts = 10; var reconnectDelay = 1000; var serviceClient = TryConnectToEndpoint(reconnectAttempts, reconnectDelay, serviceClientFactory, serviceConfiguration); if (serviceClient == null) { Console.Error.WriteLine("Failed to connect to endpoint."); return(1); } else { var dispatcher = new DispatcherCommand("registered commands"); dispatcher.RegisterCommand(new ShutdownCommand(serviceClient)); // dispatcher.RegisterCommand(new ModCommand(serviceClient)); dispatcher.RegisterCommand(new ExitCommand()); dispatcher.RegisterCommand(new ServiceCommand(serviceClient)); var repl = new DargonREPL(dispatcher); repl.Run(); return(0); } }
public static int Main() { ICollectionFactory collectionFactory = new CollectionFactory(); ProxyGenerator proxyGenerator = new ProxyGenerator(); IThreadingFactory threadingFactory = new ThreadingFactory(); ISynchronizationFactory synchronizationFactory = new SynchronizationFactory(); IThreadingProxy threadingProxy = new ThreadingProxy(threadingFactory, synchronizationFactory); IDnsProxy dnsProxy = new DnsProxy(); ITcpEndPointFactory tcpEndPointFactory = new TcpEndPointFactory(dnsProxy); IStreamFactory streamFactory = new StreamFactory(); INetworkingInternalFactory networkingInternalFactory = new NetworkingInternalFactory(threadingProxy, streamFactory); ISocketFactory socketFactory = new SocketFactory(tcpEndPointFactory, networkingInternalFactory); INetworkingProxy networkingProxy = new NetworkingProxy(socketFactory, tcpEndPointFactory); IPofContext pofContext = new ClientPofContext(); IPofSerializer pofSerializer = new PofSerializer(pofContext); PofStreamsFactory pofStreamsFactory = new PofStreamsFactoryImpl(threadingProxy, streamFactory, pofSerializer); var serviceConfiguration = new ClientClusteringConfiguration(); var serviceClientFactory = new ServiceClientFactoryImpl(proxyGenerator, streamFactory, collectionFactory, threadingProxy, networkingProxy, pofSerializer, pofStreamsFactory); var localEndPoint = tcpEndPointFactory.CreateLoopbackEndPoint(serviceConfiguration.Port); var reconnectAttempts = 10; var reconnectDelay = 1000; var serviceClient = TryConnectToEndpoint(reconnectAttempts, reconnectDelay, serviceClientFactory, serviceConfiguration); if (serviceClient == null) { Console.Error.WriteLine("Failed to connect to endpoint."); return 1; } else { var dispatcher = new DispatcherCommand("registered commands"); dispatcher.RegisterCommand(new ShutdownCommand(serviceClient)); // dispatcher.RegisterCommand(new ModCommand(serviceClient)); dispatcher.RegisterCommand(new ExitCommand()); dispatcher.RegisterCommand(new ServiceCommand(serviceClient)); var repl = new DargonREPL(dispatcher); repl.Run(); return 0; } }