Пример #1
0
        public FileChannelServer(string channel, string directory = null, IFileChannelFormatter formatter = null)
        {
            if (string.IsNullOrEmpty(channel))
            {
                throw new ArgumentNullException(nameof(channel));
            }

            if (string.IsNullOrEmpty(directory))
            {
                directory = AppDomain.CurrentDomain.BaseDirectory;
            }

            if (formatter == null)
            {
                formatter = JsonFileChannelFormatter.Instance;
            }

            _dispatcher = new FileChannelServerDispatcher(directory, channel, formatter, OnReciveRequestMessage);
            _handlers = new Dictionary<string, IFileChannelHandler>();
        }
Пример #2
0
        public FileChannelServer(string channel, string directory = null, IFileChannelFormatter formatter = null)
        {
            if (string.IsNullOrEmpty(channel))
            {
                throw new ArgumentNullException(nameof(channel));
            }

            if (string.IsNullOrEmpty(directory))
            {
                directory = AppDomain.CurrentDomain.BaseDirectory;
            }

            if (formatter == null)
            {
                formatter = JsonFileChannelFormatter.Instance;
            }

            _dispatcher = new FileChannelServerDispatcher(directory, channel, formatter, OnReciveRequestMessage);
            _handlers   = new Dictionary <string, IFileChannelHandler>();
        }