private static void TerminateSaveResume() { _torrentSession.clear_alert_dispatch(); using (var entry = _torrentSession.save_state(0xfffffff)) { var data = Core.Util.bencode(entry); File.WriteAllBytes(".session_state", data); } _torrentSession?.Dispose(); _torrentSession = null; }
private void TerminateSaveResume() { _torrentSession.clear_alert_callback(); using (var entry = _torrentSession.save_state(0xfffffff)) { var data = Core.Util.bencode(entry); File.WriteAllBytes(".session_state", data); } Task.Run(() => { _torrentSession?.Dispose(); _torrentSession = null; }); }