Exemple #1
0
        public void RescanSharedDirectories()
        {
            if (ShareBuilder.Going)
            {
                LoggingService.LogDebug("Starting scan over!!");
                ShareBuilder.Stop();
            }

            ShareBuilder.Start();
        }
Exemple #2
0
        public Core(ISettings settings, IPlatform platform)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (platform == null)
            {
                throw new ArgumentNullException(nameof(platform));
            }

            Settings = settings;
            Platform = platform;

            KeyManager keyManager = new KeyManager(settings);

            rsaProvider = new RSACryptoServiceProvider();
            rsaProvider.ImportParameters(keyManager.EncryptionParameters);
            nodeID = Common.Utils.SHA512Str(rsaProvider.ToXmlString(false));

            FileSystem = new FileSystemProvider(this);

            ShareBuilder = new ShareBuilder(this);
            ShareBuilder.FinishedIndexing += ShareBuilder_FinishedIndexing;

            shareWatcher = new ShareWatcher(this);

            ShareHasher = new ShareHasher();

            transportManager = new TransportManager(this);

            FileTransferManager = new FileTransferManager(this);

            FileSearchManager = new FileSearchManager(this);

            DestinationManager = new DestinationManager(this);

            // XXX: Use reflection to load these:
            DestinationManager.RegisterSource(new TCPIPv4DestinationSource(this));
            DestinationManager.RegisterSource(new TCPIPv6DestinationSource(this));

            TrackerFactory.Register("meshwork", typeof(MeshworkTracker));

            ITransportListener tcpListener = new TcpTransportListener(this, Settings.TcpListenPort);

            transportListeners.Add(tcpListener);

            if (FinishedLoading != null)
            {
                FinishedLoading(null, EventArgs.Empty);
            }
        }
        private IEnumerable <ShareVested> Vest(int amount, float exerciseCost, float shareValue, int year, string transactionId)
        {
            var shares = new ShareBuilder()
                         .WithExerciseCost(exerciseCost)
                         .WithShareValue(shareValue)
                         .WithYear(year)
                         .Build(amount)
                         .ToList();

            foreach (var share in shares)
            {
                this.sharesRepository.Add(share);

                yield return(share.Vest(transactionId));
            }
        }