コード例 #1
0
        public UploadManager(ConnectionsManager connectionsManager, CacheManager cacheManager, BufferManager bufferManager)
        {
            _connectionsManager = connectionsManager;
            _cacheManager = cacheManager;
            _bufferManager = bufferManager;

            _settings = new Settings(this.ThisLock);

            _watchTimer = new WatchTimer(this.WatchTimer, Timeout.Infinite);
        }
コード例 #2
0
        public DownloadManager(ConnectionsManager connectionsManager, CacheManager cacheManager, BufferManager bufferManager)
        {
            _connectionsManager = connectionsManager;
            _cacheManager = cacheManager;
            _bufferManager = bufferManager;

            _cache_Metadata_Profile_Pairs = new VolatileHashDictionary<ProfileMetadata, Profile>(new TimeSpan(0, 30, 0));
            _cache_Metadata_SignatureMessage_Pairs_Dictionary = new VolatileHashDictionary<string, Dictionary<SignatureMessageMetadata, SignatureMessage>>(new TimeSpan(0, 30, 0));
            _cache_Metadata_WikiDocument_Pairs_Dictionary = new VolatileHashDictionary<Wiki, Dictionary<WikiDocumentMetadata, WikiDocument>>(new TimeSpan(0, 30, 0));
            _cache_Metadata_ChatMessage_Pairs_Dictionary = new VolatileHashDictionary<Chat, Dictionary<ChatMessageMetadata, ChatMessage>>(new TimeSpan(0, 30, 0));

            _watchTimer = new WatchTimer(this.WatchTimer, new TimeSpan(0, 0, 30));

            _settings = new Settings(this.ThisLock);

            _connectionsManager.GetLockSignaturesEvent = (object sender) =>
            {
                var signatures = new HashSet<string>();
                signatures.UnionWith(_settings.TrustSignatures);
                signatures.UnionWith(_cache_Metadata_Profile_Pairs.Keys.Select(n => n.Certificate.ToString()));
                signatures.UnionWith(_cache_Metadata_SignatureMessage_Pairs_Dictionary.Keys);

                return signatures;
            };

            _connectionsManager.GetLockWikisEvent = (object sender) =>
            {
                var wikis = new HashSet<Wiki>();
                wikis.UnionWith(_cache_Metadata_WikiDocument_Pairs_Dictionary.Keys);

                return wikis;
            };

            _connectionsManager.GetLockChatsEvent = (object sender) =>
            {
                var chats = new HashSet<Chat>();
                chats.UnionWith(_cache_Metadata_ChatMessage_Pairs_Dictionary.Keys);

                return chats;
            };
        }
コード例 #3
0
        public OutoposManager(string bitmapPath, string cachePath, BufferManager bufferManager)
        {
            _bitmapPath = bitmapPath;
            _cachePath = cachePath;
            _bufferManager = bufferManager;

            _clientManager = new ClientManager(_bufferManager);
            _serverManager = new ServerManager(_bufferManager);
            _bitmapManager = new BitmapManager(_bitmapPath, _bufferManager);
            _cacheManager = new CacheManager(_cachePath, _bitmapManager, _bufferManager);
            _connectionsManager = new ConnectionsManager(_clientManager, _serverManager, _cacheManager, _bufferManager);
            _downloadManager = new DownloadManager(_connectionsManager, _cacheManager, _bufferManager);
            _uploadManager = new UploadManager(_connectionsManager, _cacheManager, _bufferManager);

            _clientManager.CreateCapEvent = (object sender, string uri) =>
            {
                if (_createCapEvent != null)
                {
                    return _createCapEvent(this, uri);
                }

                return null;
            };

            _serverManager.AcceptCapEvent = (object sender, out string uri) =>
            {
                uri = null;

                if (_acceptCapEvent != null)
                {
                    return _acceptCapEvent(this, out uri);
                }

                return null;
            };

            _clientManager.CheckUriEvent = (object sender, string uri) =>
            {
                if (_checkUriEvent != null)
                {
                    return _checkUriEvent(this, uri);
                }

                return true;
            };

            _serverManager.CheckUriEvent = (object sender, string uri) =>
            {
                if (_checkUriEvent != null)
                {
                    return _checkUriEvent(this, uri);
                }

                return true;
            };

            _connectionsManager.GetLockSignaturesEvent = (object sender) =>
            {
                if (_getLockSignaturesEvent != null)
                {
                    return _getLockSignaturesEvent(this);
                }

                return null;
            };

            _connectionsManager.GetLockWikisEvent = (object sender) =>
            {
                if (_getLockWikisEvent != null)
                {
                    return _getLockWikisEvent(this);
                }

                return null;
            };

            _connectionsManager.GetLockChatsEvent = (object sender) =>
            {
                if (_getLockChatsEvent != null)
                {
                    return _getLockChatsEvent(this);
                }

                return null;
            };
        }