public static void LoadFastResumeData() { if (Directory.Exists("Fastresume")) { string[] files = Directory.GetFiles("Fastresume", "*.fastresume"); foreach (string s in files) { var data = File.ReadAllBytes(s); var info_hash = Path.GetFileNameWithoutExtension(s); var filename = "Fastresume/" + info_hash + ".torrent"; Core.TorrentInfo ti; if (File.Exists(filename)) { ti = new Core.TorrentInfo(filename); } else { ti = new Core.TorrentInfo(new Core.Sha1Hash(info_hash)); } using (var atp = new Core.AddTorrentParams()) using (ti) { atp.ti = ti; atp.save_path = Settings.User.PathDownload; atp.resume_data = (sbyte[])(Array)data; atp.flags &= ~Core.ATPFlags.flag_auto_managed; // remove auto managed flag atp.flags &= ~Core.ATPFlags.flag_paused; // remove pause on added torrent _torrentSession.async_add_torrent(atp); } } } else { Directory.CreateDirectory("Fastresume"); } }