//public static void QueueDownloadFile(string[] filePartLinks, string file = null) public static void QueueDownloadFile(MongoCollectionManager<QueueDownloadFile> mongoQueueDownloadFileManager, string[] filePartLinks, string directory = null, string filename = null) { //ServerKey key = null; //key = new ServerKey { }; //Uri uri = new Uri(url); //string file = uri.Segments[uri.Segments.Length - 1]; //IRequestDownloadLinks downloadLinks = null; //DownloadItemLink[] downloadItemLinks = DownloadItemLink.CreateDownloadItemLinkArray(downloadLinks); //string[] downloadLinks2 = null; //PostDownloadLinks postDownloadLinks = PostDownloadLinks.Create(downloadLinks2); //DownloadItemLink[] downloadItemLinks2 = DownloadItemLink.CreateDownloadItemLinkArray(postDownloadLinks); DownloadItemLink itemLink = DownloadItemLink.CreateDownloadItemLink(filePartLinks); // Key (ServerKey) of QueueDownloadFile is null, no save to _mongoDownloadedFileManager in DownloadManager QueueDownloadFile downloadFile = new QueueDownloadFile { DownloadItemLinks = new DownloadItemLink[] { itemLink }, RequestTime = DateTime.Now, Directory = directory, Filename = filename //Directory = file != null ? zPath.GetDirectoryName(file) : null, //Filename = file != null ? zPath.GetFileName(file) : null }; downloadFile.Id = mongoQueueDownloadFileManager.GetNewId(); mongoQueueDownloadFileManager.Save(downloadFile.Id, downloadFile); }
//public static void QueueDownloadFile(string[] filePartLinks, string file = null) public static void QueueDownloadFile(MongoCollectionManager <QueueDownloadFile> mongoQueueDownloadFileManager, string[] filePartLinks, string directory = null, string filename = null) { //ServerKey key = null; //key = new ServerKey { }; //Uri uri = new Uri(url); //string file = uri.Segments[uri.Segments.Length - 1]; //IRequestDownloadLinks downloadLinks = null; //DownloadItemLink[] downloadItemLinks = DownloadItemLink.CreateDownloadItemLinkArray(downloadLinks); //string[] downloadLinks2 = null; //PostDownloadLinks postDownloadLinks = PostDownloadLinks.Create(downloadLinks2); //DownloadItemLink[] downloadItemLinks2 = DownloadItemLink.CreateDownloadItemLinkArray(postDownloadLinks); DownloadItemLink itemLink = DownloadItemLink.CreateDownloadItemLink(filePartLinks); // Key (ServerKey) of QueueDownloadFile is null, no save to _mongoDownloadedFileManager in DownloadManager QueueDownloadFile downloadFile = new QueueDownloadFile { DownloadItemLinks = new DownloadItemLink[] { itemLink }, RequestTime = DateTime.Now, Directory = directory, Filename = filename //Directory = file != null ? zPath.GetDirectoryName(file) : null, //Filename = file != null ? zPath.GetFileName(file) : null }; downloadFile.Id = mongoQueueDownloadFileManager.GetNewId(); mongoQueueDownloadFileManager.Save(downloadFile.Id, downloadFile); }
public static MongoCollectionManager <QueueDownloadFile> CreateMongoQueueDownloadFileManager(XElement xe) { MongoCollectionManager <QueueDownloadFile> mongoQueueDownloadFileManager = MongoCollectionManager <QueueDownloadFile> .Create(xe.zXPathElement("MongoQueueDownloadFile_new")); mongoQueueDownloadFileManager.IdGenerator = new MongoIdGeneratorInt(mongoQueueDownloadFileManager.GetCollection()); return(mongoQueueDownloadFileManager); }
// add an item to mongoQueueDownloadFile public static void QueueDownloadFile(string[] filePartLinks, string directory = null, string filename = null, string parameters = null) { //NamedValues<ZValue> parameters2 = NamedValues.ParseValues(parameters); NamedValues <ZValue> parameters2 = ParseParameters(parameters); MongoCollectionManager <QueueDownloadFile> mongoQueueDownloadFileManager = DownloadAutomateManagerCreator.CreateMongoQueueDownloadFileManager(GetDownloadAutomateManagerConfig(GetTestValue(parameters2))); QueueDownloadFile(mongoQueueDownloadFileManager, filePartLinks, directory, filename); }
public static void QueueDownloadFiles(string[] fileLinks, string directory = null, string parameters = null) { //NamedValues<ZValue> parameters2 = NamedValues.ParseValues(parameters); NamedValues <ZValue> parameters2 = ParseParameters(parameters); MongoCollectionManager <QueueDownloadFile> mongoQueueDownloadFileManager = DownloadAutomateManagerCreator.CreateMongoQueueDownloadFileManager(GetDownloadAutomateManagerConfig(GetTestValue(parameters2))); foreach (string fileLink in fileLinks) { QueueDownloadFile(mongoQueueDownloadFileManager, new string[] { fileLink }, directory: directory); } }
//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); }