예제 #1
0
        public static DownloadManagerClientBase CreateDownloadManagerClient(XElement xe, bool useTestManager = false)
        {
            DownloadManagerClientBase downloadManagerClient = null;

            if (!useTestManager)
            {
                //downloadManagerClient = new DownloadManagerClient(XmlConfig.CurrentConfig.GetExplicit("DownloadAutomateManager/DownloadManagerClient/Address"));
                downloadManagerClient = new DownloadManagerClient(xe.zXPathExplicitValue("DownloadManagerClient/Address"));
            }
            else
            {
                downloadManagerClient = new DownloadManagerClientTest(@"c:\pib\_dl\_pib\dl");
            }
            return(downloadManagerClient);
        }
예제 #2
0
        public static void DownloadFile(string url, string directory = null, bool startNow = false, string parameters = null)
        {
            //NamedValues<ZValue> parameters2 = NamedValues.ParseValues(parameters);
            NamedValues <ZValue>      parameters2           = ParseParameters(parameters);
            DownloadManagerClientBase downloadManagerClient = DownloadAutomateManagerCreator.CreateDownloadManagerClient(GetDownloadAutomateManagerConfig(GetTestValue(parameters2)));
            Debrider debrider = DownloadAutomateManagerCreator.CreateDebrider(XmlConfig.CurrentConfig);

            url = debrider.DebridLink(url);
            Uri    uri  = new Uri(url);
            string file = uri.Segments[uri.Segments.Length - 1];

            if (directory != null)
            {
                file = zPath.Combine(directory, file);
            }
            downloadManagerClient.AddDownload(url, file, startNow: startNow);
        }
예제 #3
0
        //public DownloadManager_v2 CreateDownloadManager_v2(bool useTestManager = false)
        public DownloadManager CreateDownloadManager()
        {
            MongoCollectionManager <DownloadedFile> mongoDownloadedFileManager = MongoCollectionManager <DownloadedFile> .Create(_xeConfig.zXPathElement("MongoDownloadedFile"));

            mongoDownloadedFileManager.IdGenerator = new MongoIdGeneratorInt(mongoDownloadedFileManager.GetCollection());
            mongoDownloadedFileManager.KeyName     = "Key"; // Key is the name of key field in DownloadedFile_v2

            //MongoCollectionManager<QueueDownloadFile> mongoQueueDownloadFileManager = MongoCollectionManager<QueueDownloadFile>.Create(_xeConfig.zXPathElement("MongoQueueDownloadFile_new"));
            //mongoQueueDownloadFileManager.IdGenerator = new MongoIdGeneratorInt(mongoQueueDownloadFileManager.GetCollection());
            //mongoDownloadedFileManager.KeyName = "Key";     // Key is the name of key field in QueueDownloadFile_v2
            MongoCollectionManager <QueueDownloadFile> mongoQueueDownloadFileManager = CreateMongoQueueDownloadFileManager(_xeConfig);

            MongoCollectionManager <DownloadLinkRef> mongoCurrentDownloadFileManager = MongoCollectionManager <DownloadLinkRef> .Create(_xeConfig.zXPathElement("MongoCurrentDownloadFile"));

            mongoCurrentDownloadFileManager.IdGenerator = new MongoIdGeneratorInt(mongoCurrentDownloadFileManager.GetCollection());

            ProtectLink protectLink = null;

            //Debrider debrider = null;
            //if (!_useTestManager)
            //    debrider = CreateDebrider();
            //else
            //    debrider = new DebriderAlldebridTest();
            Debrider debrider = CreateDebrider();
            DownloadManagerClientBase downloadManagerClient = CreateDownloadManagerClient();
            UncompressQueueManager    uncompressManager     = CreateUncompressManager();

            DownloadManager downloadManager = new DownloadManager();

            downloadManager.DownloadManagerClient           = downloadManagerClient;
            downloadManager.MongoDownloadedFileManager      = mongoDownloadedFileManager;
            downloadManager.MongoQueueDownloadFileManager   = mongoQueueDownloadFileManager;
            downloadManager.MongoCurrentDownloadFileManager = mongoCurrentDownloadFileManager;
            downloadManager.ProtectLink       = protectLink;
            downloadManager.Debrider          = debrider;
            downloadManager.UncompressManager = uncompressManager;
            return(downloadManager);
        }