コード例 #1
0
ファイル: IDMan.cs プロジェクト: dangh/UdacityDownloader
        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
ファイル: IDMan.cs プロジェクト: dangh/UdacityDownloader
 public static void Download(DownloadTask task)
 {
     SendLinkToIDM(task, IDManFlags.HideConfigDialog);
 }
コード例 #3
0
ファイル: IDMan.cs プロジェクト: dangh/UdacityDownloader
 public static void Enqueue(DownloadTask task)
 {
     SendLinkToIDM(task, IDManFlags.HideConfigDialog | IDManFlags.AddToQueueOnly);
 }