示例#1
0
 public ServerCommandInterpreter()
 {
     _channelHandlers = ServiceLocatorBuilder
                        .CreateServiceLocator()
                        .Get <IChannelHandlerCollection>()
                        ?? throw new ArgumentNullException(nameof(_channelHandlers));
 }
        private void OneTimeSetup(IServiceLocator services)
        {
            Debug.Assert(services != null);
            Debug.Assert(HttpListener.IsSupported);

            _services        = services;
            _channelLocator  = _services.Get <IChannelLocator>();
            _methodHandlers  = _services.Get <IChannelMethodHandlerCollection>();
            _channelHandlers = _services.Get <IChannelHandlerCollection>();

            _rootPath = (new FileInfo(AppDomain.CurrentDomain.BaseDirectory)).Directory.Parent.Parent.Parent.FullName;
            DirectoryInfo logsDirectory = new DirectoryInfo(Path.Combine(_rootPath, "Logs"));

            if (!Directory.Exists(logsDirectory.FullName))
            {
                logsDirectory.Create();
            }
        }
 public ServerChannel()
 {
     _methodHandlers  = Services.Get <IChannelMethodHandlerCollection>();
     _channelHandlers = Services.Get <IChannelHandlerCollection>();
     _commandFactory  = Services.Get <IServerCommandFactory>();
 }
 public ServerCommandFactory()
 {
     _services        = ServiceLocatorBuilder.CreateServiceLocator();
     _channelHandlers = _services.Get <IChannelHandlerCollection>();
     _methodHandlers  = _services.Get <IChannelMethodHandlerCollection>();
 }