public void AddTorrent(string filename) { var data = System.IO.File.ReadAllBytes(filename); string newfilePath; using (var atp = new Core.AddTorrentParams()) using (var ti = new Core.TorrentInfo(filename)) { atp.save_path = Settings.User.PathDownload; atp.ti = ti; atp.flags &= ~Core.ATPFlags.flag_auto_managed; // remove auto managed flag atp.flags &= ~Core.ATPFlags.flag_paused; // remove pause on added torrent atp.flags &= ~Core.ATPFlags.flag_use_resume_save_path; // newfilePath = "./Fastresume/" + ti.info_hash().ToString() + ".torrent"; if (!System.IO.File.Exists(newfilePath)) { using (var bw = new System.IO.BinaryWriter(new System.IO.FileStream(newfilePath, System.IO.FileMode.Create))) { bw.Write(data); bw.Close(); } } _torrentSession.async_add_torrent(atp); } }