예제 #1
0
 public static void CallMetafileRejected(this MetafileHooks hooks, FileHash hash)
 {
     hooks.OnMetafileRejected?.Invoke(new MetafileRejected
     {
         Hash = hash
     });
 }
예제 #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);
        }
예제 #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
     });
 }
예제 #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
     });
 }
예제 #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
     });
 }
예제 #6
0
 public MetafileService Build(MetafileHooks hooks)
 {
     return(new MetafileImplementation(parameters, dependencies, hooks));
 }
예제 #7
0
 public MetafileImplementation(MetafileParameters parameters, MetafileDependencies dependencies, MetafileHooks hooks)
 {
     context = new MetafileContext(parameters, dependencies, hooks);
 }