Exemplo n.º 1
0
        private void StartMetaStore(string destination)
        {
            MetafileHooks hooks = new MetafileHooks
            {
                OnMetafileVerified = OnMetafileVerified,
                OnMetafileRead     = data => MetaShare?.Handle(data)
            };

            MetaStore =
                new MetafileBuilder()
                .WithHash(Hash)
                .WithPipeline(Pipeline)
                .WithFiles(Files)
                .WithDestination(Path.Combine(destination, $"{Hash}.metainfo"))
                .Build(hooks);

            MetaStore.Start();
        }
Exemplo n.º 2
0
 private void OnMetadataRequestReceived(MetadataRequested data)
 {
     Notifications.Enqueue(new MetafileRequestedNotification(data.Hash, new PieceInfo(data.Piece)));
     MetaShare?.Handle(data);
 }