Пример #1
0
        public User(IStreamable client, IProtocol protocol, object state)
        {
            State  = state;
            Stream = client;

            _Serialize = protocol.GetSerialize();

            _EnableLock = new object();

            _Peer     = client;
            _Protocol = protocol;



            _Responses = new System.Collections.Concurrent.ConcurrentQueue <ResponsePackage>();
            _Requests  = new System.Collections.Concurrent.ConcurrentQueue <RequestPackage>();
            _Reader    = new PackageReader <RequestPackage>(protocol.GetSerialize());
            _Writer    = new PackageWriter <ResponsePackage>(protocol.GetSerialize());

            _ExternalRequests = new System.Collections.Concurrent.ConcurrentQueue <RequestPackage>();

            _SoulProvider = new SoulProvider(this, this, protocol);

            _Updater = new ThreadUpdater(_AsyncUpdate);
        }
Пример #2
0
        public Agent(IProtocol protocol)
        {
            var protocol1 = protocol;

            _GhostRequest = new GhostRequest(protocol.GetSerialize());
            _AgentCore    = new AgentCore(protocol1);

            _CommandBridge = new CommandBridge(_AgentCore, _GhostRequest);
            _SoulProvider  = new SoulProvider(_CommandBridge.RequestQueue, _CommandBridge.ResponseQueue, protocol1);

            Binder       = _SoulProvider;
            GhostQuerier = this;
            _Launch();
        }
Пример #3
0
        public Peer(Socket client)
        {
            _EnableLock = new object();

            _Socket = client;
            _SoulProvider = new SoulProvider(this, this);
            _Responses = new Regulus.Collection.Queue<ResponsePackage>();
            _Requests = new Regulus.Collection.Queue<RequestPackage>();

            _Enable = true;

            _Reader = new PackageReader<RequestPackage>();
            _Writer = new PackageWriter<ResponsePackage>();
        }
Пример #4
0
        public Peer(IPeer client, IProtocol protocol)
        {
            _Serialize = protocol.GetSerialize();

            _EnableLock = new object();

            _Peer         = client;
            _Protocol     = protocol;
            _SoulProvider = new SoulProvider(this, this, protocol);
            _Responses    = new System.Collections.Concurrent.ConcurrentQueue <ResponsePackage>();
            _Requests     = new System.Collections.Concurrent.ConcurrentQueue <RequestPackage>();

            _Enable = true;

            _Reader = new PackageReader <RequestPackage>(protocol.GetSerialize());
            _Writer = new PackageWriter <ResponsePackage>(protocol.GetSerialize());
        }
Пример #5
0
 public Agent(IProtocol protocol)
 {
     _GhostRequest = new GhostRequest(protocol.GetSerialize());
     _Agent        = new AgentCore(protocol);
     _SoulProvider = new SoulProvider(this, this, protocol);
 }
Пример #6
0
 private void _UpdateProvider(SoulProvider[] providers)
 {
     foreach (var provider in providers)
     {
         provider.Update();
     }
 }