예제 #1
0
        private static void SendLinkToIDM(DownloadTask task, IDManFlags flags)
        {
            string localPath     = null;
            string localFileName = null;
            string fileName      = task.FileName;

            if (!string.IsNullOrEmpty(fileName))
            {
                try
                {
                    localPath     = Path.GetDirectoryName(fileName);
                    localFileName = Path.GetFileName(fileName);

                    string ext = Path.GetExtension(localFileName);
                    if (string.IsNullOrEmpty(ext))
                    {
                        ext           = Path.GetExtension(task.Url);
                        localFileName = Path.GetFileNameWithoutExtension(localFileName) + ext;
                    }
                }
                catch (Exception)
                {
                    localPath     = null;
                    localFileName = null;
                }
            }

            if (File.Exists(Path.Combine(localPath, localFileName)))
            {
                Log.Verbose("Skips existing file: " + localFileName);
            }
            else
            {
                _transmitter.SendLinkToIDM(task.Url, null, null, null, null, null, localPath, localFileName, (int)flags);
                Log.Verbose("Send link to IDM: " + task.Url);
            }
        }
예제 #2
0
 public static void Download(DownloadTask task)
 {
     SendLinkToIDM(task, IDManFlags.HideConfigDialog);
 }
예제 #3
0
 public static void Enqueue(DownloadTask task)
 {
     SendLinkToIDM(task, IDManFlags.HideConfigDialog | IDManFlags.AddToQueueOnly);
 }