public static string SendTorrent(string save, string path)
{
ErrorWindow ew = new ErrorWindow();
if (!DirectoryHandler.GetFileExists(SettingsHandler.GetTorrentClientFolder() + "\\uTorrent.exe"))
{
ew.IssueGeneralWarning("Be sure uTorrent folder is correct", "uTorrent.exe does not exist", null);
return "uTorrent.exe does not exist";
}
else
{
try
{
Process sendTorrentProcess = new Process();
//torrentClient.exe /directory "C:\Save Path" "D:\Some folder\your.torrent"
if (DirectoryHandler.GetFileExists(path))
{
string fullArgument = "/directory " + "\"" + save + "\" "
+ "\"" + path + "\"";
sendTorrentProcess.StartInfo.WorkingDirectory = SettingsHandler.GetTorrentClientFolder();
sendTorrentProcess.StartInfo.Arguments = fullArgument;
sendTorrentProcess.StartInfo.FileName = SettingsHandler.GetTorrentClient();
sendTorrentProcess.Start();
Thread.Sleep(100);
sendTorrentProcess.Dispose();
sendTorrentProcess.Close();
}
else
{
return "File does not exist";
}
}
catch (Exception e)
{
if (path == null || path == "")
{
return "Empty file path";
}
else
{
return e.Message;
}
}
return "SUCCESS";
}
}