Beispiel #1
0
 public static void CallMetafileRejected(this MetafileHooks hooks, FileHash hash)
 {
     hooks.OnMetafileRejected?.Invoke(new MetafileRejected
     {
         Hash = hash
     });
 }
Beispiel #2
0
        public MetafileContext(MetafileParameters parameters, MetafileDependencies dependencies, MetafileHooks hooks)
        {
            this.parameters   = parameters;
            this.dependencies = dependencies;
            this.hooks        = hooks;

            queue       = new LeakQueue <MetafileContext>(this);
            destination = new MetafileDestination(this);
        }
Beispiel #3
0
 public static void CallMetafileVerified(this MetafileHooks hooks, FileHash hash, Metainfo metainfo, int size)
 {
     hooks.OnMetafileVerified?.Invoke(new MetafileVerified
     {
         Hash     = hash,
         Metainfo = metainfo,
         Size     = size
     });
 }
Beispiel #4
0
 public static void CallMetafileWritten(this MetafileHooks hooks, FileHash hash, int piece, int size)
 {
     hooks.OnMetafileWritten?.Invoke(new MetafileWritten
     {
         Hash  = hash,
         Piece = piece,
         Size  = size
     });
 }
Beispiel #5
0
 public static void CallMetafileRead(this MetafileHooks hooks, FileHash hash, int piece, int total, byte[] data)
 {
     hooks.OnMetafileRead?.Invoke(new MetafileRead
     {
         Hash    = hash,
         Piece   = piece,
         Total   = total,
         Payload = data
     });
 }
Beispiel #6
0
 public MetafileService Build(MetafileHooks hooks)
 {
     return(new MetafileImplementation(parameters, dependencies, hooks));
 }
 public MetafileImplementation(MetafileParameters parameters, MetafileDependencies dependencies, MetafileHooks hooks)
 {
     context = new MetafileContext(parameters, dependencies, hooks);
 }