public void Register(TrackerGetRegistrant registrant) { context.Queue.Add(() => { context.Collection.Add(registrant); }); }
public void Add(TrackerGetRegistrant registrant) { entries.Add(new TrackerGetEntry { Request = registrant, Next = DateTime.Now }); }
public static void AppendPort(this StringBuilder builder, TrackerGetRegistrant request) { if (request.Port > 0 && request.Port < 65535) { builder.Append("&port="); builder.Append(request.Port); } }
public void Announce(TrackerGetRegistrant request, Action <TimeSpan> callback) { context.Http.Register(new TrackerGetHttpRegistrant { Address = address, Request = request, Callback = callback }); }
public void Announce(TrackerGetRegistrant request, Action <TimeSpan> callback) { context.Udp.Register(new TrackerGetUdpRegistrant { Host = host, Port = port, Request = request, Callback = callback }); }
public static void AppendEvent(this StringBuilder builder, TrackerGetRegistrant request) { switch (request.Event) { case TrackerGetEvent.Started: builder.Append("&event=started"); break; case TrackerGetEvent.Stopped: builder.Append("&event=stopped"); break; case TrackerGetEvent.Completed: builder.Append("&event=completed"); break; } }
public static void AppendProgress(this StringBuilder builder, TrackerGetRegistrant request) { if (request.Progress?.Downloaded >= 0) { builder.Append("&downloaded="); builder.Append(request.Progress.Downloaded); } if (request.Progress?.Uploaded >= 0) { builder.Append("&uploaded="); builder.Append(request.Progress.Uploaded); } if (request.Progress?.Left >= 0) { builder.Append("&left="); builder.Append(request.Progress.Left); } }