Exemplo n.º 1
0
        private string _channelid  = "";    //通道标识

        #region ctor
        /// <summary>
        ///
        /// </summary>
        /// <param name="imUserInfoService"></param>
        /// <param name="userGroupService"></param>
        /// <param name="channelMessageService"></param>
        /// <param name="groupInfoService"></param>
        public GroupController(IImUserInfoService imUserInfoService, IUserGroupService userGroupService, IChannelMessageService channelMessageService, IGroupInfoService groupInfoService)
        {
            _imUserInfoService     = imUserInfoService;
            _userGroupService      = userGroupService;
            _channelMessageService = channelMessageService;
            _groupInfoService      = groupInfoService;
        }
Exemplo n.º 2
0
        private void OneTimeSetup()
        {
            _channelLocator          = _services.Get <IChannelLocator>();
            _channelMethodDescriptor = _services.Get <IChannelMethodDescriptor>();
            _requestActivator        = _services.Get <IChannelMethodRequestActivator>();
            _msgService            = _services.Get <IChannelMessageService>();
            _contextProvider       = _services.Get <IChannelMethodContextProvider>();
            _configuration         = _services.Get <IChannelConfiguration>();
            _authenticationService = _services.Get <IChannelAuthenticationService>();
            _heuristics            = _services.Get <IChannelHeuristics>();

            Debug.Assert(_channelLocator != null);
            Debug.Assert(_channelMethodDescriptor != null);
            Debug.Assert(_requestActivator != null);
            Debug.Assert(_msgService != null);
            Debug.Assert(_contextProvider != null);
            Debug.Assert(_configuration != null);
            Debug.Assert(_authenticationService != null);
            Debug.Assert(_heuristics != null);

            _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();
            }

            _sessionKeys = new List <Cookie>();
        }
Exemplo n.º 3
0
        public ChannelMethodRequestActivator()
        {
            _services              = ServiceLocatorBuilder.CreateServiceLocator();
            _channelMethodInvoker  = _services.Get <IChannelMethodInvoker>();
            _channelMessageService = _services.Get <IChannelMessageService>();

            Debug.Assert(_services != null);
            Debug.Assert(_channelMethodInvoker != null);
            Debug.Assert(_channelMessageService != null);
        }
        public ChannelHeuristics()
        {
            _services   = ServiceLocatorBuilder.CreateServiceLocator();
            _descriptor = _services.Get <IChannelMethodDescriptor>();
            _msgService = _services.Get <IChannelMessageService>();
            _events     = _services.Get <IChannelHeuristicEvents>();

            _events.AddToHeuristics      += _events_AddToHeuristics;
            _events.RemoveFromHeuristics += _events_RemoveFromHeuristics;
            _cachedInfos = new List <HeuristicsInfo>();
        }
Exemplo n.º 5
0
 public MessageReceiver(
     IAuthorizedUserHelper authorizedUserHelper,
     IChannelMessageService channelMessageService,
     IChatMessageService chatMessageService,
     ISocketStream socketStream
     )
 {
     _authorizedUserHelper  = authorizedUserHelper;
     _channelMessageService = channelMessageService;
     _chatMessageService    = chatMessageService;
     _socketStream          = socketStream;
 }
Exemplo n.º 6
0
 public ChannelAuthenticationInspector(IChannelAuthenticationService authService,
                                       IChannelMessageService msgService,
                                       AuthenticationSettings settings,
                                       ISessionService session,
                                       Func <string, string, bool> basicAuthMethod,
                                       Func <string, bool> tokenAuthMethod)
 {
     _authenticationService = authService;
     _msgService            = msgService;
     _session  = session;
     _settings = settings;
     _basicAuthenticationMethod = basicAuthMethod;
     _tokenAuthenticationMethod = tokenAuthMethod;
 }
        public ChannelMethodInvoker()
        {
            _services = ServiceLocatorBuilder.CreateServiceLocator();
            _channelMessageService = _services.Get <IChannelMessageService>();
            _channelMessageWriter  = _services.Get <IChannelMessageOutputWriter>();
            _eventService          = _services.Get <IChannelRedirectionEvents>();
            _channelGenerator      = _services.Get <IChannelGenerator>();
            _heurCtx = _services.Get <IChannelHeuristicContext>();

            Debug.Assert(_services != null);
            Debug.Assert(_channelMessageService != null);
            Debug.Assert(_channelMessageWriter != null);
            Debug.Assert(_eventService != null);
            Debug.Assert(_channelGenerator != null);
            Debug.Assert(_heurCtx != null);

            _channelMessageWriter.OnPostMessageServiceInvoked += _channelMessageWriter_OnPostMessageServiceInvoked;
            _eventService.OnRedirectionInvoked += _eventService_OnRedirectionInvoked;
        }
        public ChannelMethodHandler(IServiceLocator services, Type channel, MethodInfo method, AuthenticationSettings settings, string baseURL, string channelHandlerId)
        {
            _services  = services ?? throw new ArgumentNullException(nameof(services));
            _method    = method ?? throw new ArgumentNullException(nameof(method));
            _channel   = channel ?? throw new ArgumentNullException(nameof(channel));
            _settings  = settings;
            _baseURL   = baseURL;
            _isManaged = false;

            _channelMethodDescriptor = _services.Get <IChannelMethodDescriptor>();
            _requestActivator        = _services.Get <IChannelMethodRequestActivator>();
            _msgService            = _services.Get <IChannelMessageService>();
            _contextProvider       = _services.Get <IChannelMethodContextProvider>();
            _configuration         = _services.Get <IChannelConfiguration>();
            _authenticationService = _services.Get <IChannelAuthenticationService>();
            _heuristics            = _services.Get <IChannelHeuristics>();
            _session = _services.Get <ISessionService>();

            HandlerId        = $"{Guid.NewGuid()}";
            ChannelHandlerId = channelHandlerId;

            _isDisposed = false;
            _safeHandle = new SafeFileHandle(IntPtr.Zero, true);
        }
Exemplo n.º 9
0
 public ChannelMethodCacheInspector(IChannelMessageService msgService, IChannelHeuristics heuristics)
 {
     _msgService = msgService;
     _heuristics = heuristics;
 }
Exemplo n.º 10
0
 public ChannelMessageController(IChannelMessageService channelMessageService)
 {
     _channelMessageService = channelMessageService;
 }
 public ChannelMethodCaller(IChannelMessageService msgService, IChannelMethodContextProvider contextProvider, IChannelMethodRequestActivator requestActivator)
 {
     _contextProvider  = contextProvider;
     _requestActivator = requestActivator;
     _msgService       = msgService;
 }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="channelMessageService"></param>
 public ChannelController(IChannelMessageService channelMessageService, IChannelInfoService channelInfoService)
 {
     _channelMessageService = channelMessageService;
     _channelInfoService    = channelInfoService;
 }
Exemplo n.º 13
0
 public ChannelMessageOutputWriter()
 {
     _services   = ServiceLocatorBuilder.CreateServiceLocator();
     _msgService = _services.Get <IChannelMessageService>();
 }