public void MoveTorrent(TorrentWrapper torrent, string path) { Task.Factory.StartNew(() => { path = Path.Combine(path, Path.GetFileName(torrent.Path)); if (!Directory.Exists(path)) Directory.CreateDirectory(path); var oldPath = torrent.Path; torrent.Stop(); while (torrent.State != TorrentState.Stopped) ; torrent.MoveFiles(path, true); torrent.Start(); Directory.Delete(oldPath, true); var cache = Path.Combine(SettingsManager.TorrentCachePath, Path.GetFileName(oldPath)); File.WriteAllText(Path.Combine(Path.GetDirectoryName(cache), Path.GetFileName(cache)) + ".info", path); }); }