public void DirAllFilesDirect(string Platform, string[] Files) { Platform platform = null; if (Cfg.PlatformsDict.Keys.Contains(Platform)) { platform = Cfg.PlatformsDict[Platform]; } if (platform != null) { IFileTransferWorker ftw = null; switch (platform.ActiveTransferProtocol) { case TransferProtocolType.none: break; case TransferProtocolType.WCF: ftw = new WCFFileTransferWorker(); break; } if (ftw != null) { ftw.DirFile(Files, platform); } } }
private void TransferAllFiles(Platform platform, IList <FileTransferBase> toTransfer, Manager mgr) { IFileTransferWorker ftw = null; switch (platform.ActiveTransferProtocol) { case TransferProtocolType.none: break; case TransferProtocolType.WCF: ftw = new WCFFileTransferWorker(); break; } if (ftw != null) { ImpersonateHelper imp = new ImpersonateHelper(Cfg); imp.BeginImpersonate(); ftw.CurrentConfiguration = Cfg; ftw.CurrentPlatform = platform; foreach (var file in toTransfer) { try { file.Status = TransferStatus.Copying; //mgr.BeginTransaction(); mgr.SaveFileTransaction(file); //mgr.Commit(); ftw.TransferFile(file, platform); //file.Status = TransferStatus.Completed; //mgr.SaveFile(file); //mgr.BeginTransaction(); mgr.SaveFileTransaction(file); if (file.Status == TransferStatus.ReadyToUnzip) { ServiceReferenceUnzip.UnzipMQServiceClient serviceunzip = new ServiceReferenceUnzip.UnzipMQServiceClient(); serviceunzip.FileUnzipNotification(platform.Name, file.UniqueIdVersion); } } catch (Exception ex) { //throw ex; } //mgr.Commit(); } imp.EndImpersonate(); } else { } }