Exemplo n.º 1
0
        public Session(GlobalConfiguration globalConfiguration,
                       IAccountManager accountManager,
                       IZoneManager zoneManager,
                       ICustomDictionary customDictionary,
                       Socket socket,
                       Func <string, Command> commandFactory,
                       RequestHandlerFactory <IRequest> requestHandlerFactory,
                       RequestHandlerFactory <IZoneRequest> zoneRequestHandlerFactory)
        {
            Id = SessionID.New();

            _connection = new SessionConnection(socket)
            {
                RsaKeyReceived = OnRsaKeyReceived
            };
            _connection.Disconnected  += OnDisconnected;
            _connection.Received      += OnDataReceived;
            _globalConfiguration       = globalConfiguration;
            _accountManager            = accountManager;
            _zoneManager               = zoneManager;
            _customDictionary          = customDictionary;
            _commandFactory            = commandFactory;
            _requestHandlerFactory     = requestHandlerFactory;
            _zoneRequestHandlerFactory = zoneRequestHandlerFactory;

            _accessLevel = AccessLevel.notDefined;
        }
Exemplo n.º 2
0
 public bool AddWordByDictionary(Word word, ICustomDictionary customDictionary = null)
 {
     if (customDictionary != null)
     {
         return(customDictionary.AddWord(word));
     }
     return(dictionary.AddWord(word));
 }
Exemplo n.º 3
0
 public bool RemoveWordByDictionary(string word, ICustomDictionary customDictionary = null)
 {
     if (customDictionary != null)
     {
         return(customDictionary.RemoveWord(word));
     }
     return(dictionary.RemoveWord(word));
 }
Exemplo n.º 4
0
        public bool FindWordByDictionary(string word, out Word wordOut, ICustomDictionary customDictionary = null)
        {
            if (customDictionary != null)
            {
                wordOut = customDictionary.Find(word);
            }
            wordOut = dictionary.Find(word);

            if (wordOut == null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }