Exemplo n.º 1
0
        public HastyClient(Uri serverUrl, string realm, string username, string password, CommandDefinitions definitions, string baseDir, object target, ILog log)
        {
            this.username = username;
            this.password = password;
            this.realm    = realm;
            this.log      = log.CreateLog(typeof(HastyClient));
            var storage = new StreamStorage(baseDir, log);

            preferences      = new Preferences(baseDir, log);
            streamStorage    = storage;
            this.definitions = definitions;
            defaultTarget    = target;

            SetStatus(ConnectionStatus.Idle);
            SetState(ConnectionState.Establishing);
            connectionMaintainer = new ConnectionMaintainer(serverUrl, realm, log);
            connectionMaintainer.OnPacketRead += OnPacketRead;
            connectionMaintainer.OnDisconnect += OnDisconnect;
            connectionMaintainer.OnConnecting += OnConnecting;
            connectionMaintainer.OnConnected  += OnMaintainerConnected;

            ulong userAssignedChannelId;

            var foundUserAssignedChannel = preferences.GetUserChannel(serverUrl.ToString(), realm, out userAssignedChannelId);

            if (foundUserAssignedChannel)
            {
                Subscribe((uint)userAssignedChannelId, target);
            }

            connectionMaintainer.Start();
        }
Exemplo n.º 2
0
        public StreamApiController(IStreamStorage streamStorage)
        {
            if (streamStorage == null)
            {
                throw new ArgumentNullException("streamStorage");
            }

            this.streamStorage = streamStorage;
        }
        public StreamController(IStreamStorage streamStorage)
        {
            if (streamStorage == null)
            {
                throw new ArgumentNullException("streamStorage");
            }

            this.streamStorage = streamStorage;
        }
 private StreamController BuildStreamController(IStreamStorage fakeStorage)
 {
     return(new StreamController(fakeStorage)
     {
         Request = new HttpRequestMessage
         {
             Properties =
             {
                 { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() }
             }
         }
     });
 }
Exemplo n.º 5
0
        public StreamReprocessor(IItemProcessor streamProcessor, IStreamStorage streamStorage)
        {
            if (streamProcessor == null)
            {
                throw new ArgumentNullException("streamProcessor");
            }

            if (streamStorage == null)
            {
                throw new ArgumentNullException("streamStorage");
            }

            this.streamProcessor = streamProcessor;
            this.streamStorage   = streamStorage;
        }
Exemplo n.º 6
0
        public StreamReprocessor(IItemProcessor streamProcessor, IStreamStorage streamStorage)
        {
            if (streamProcessor == null)
            {
                throw new ArgumentNullException("streamProcessor");
            }

            if (streamStorage == null)
            {
                throw new ArgumentNullException("streamStorage");
            }

            this.streamProcessor = streamProcessor;
            this.streamStorage = streamStorage;
        }
 private StreamController BuildStreamController(IStreamStorage fakeStorage)
 {
     return new StreamController(fakeStorage)
     {
         Request = new HttpRequestMessage
         {
             Properties =
             {
                 { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() }
             }
         }
     };
 }
Exemplo n.º 8
0
 public void AddStorage(IStreamStorage action)
 {
     Storages.Add(action);
 }