public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { try { var srcProfile = _srcModel.Profile as IDiskProfile; var destProfile = _destDirModel.Profile as IDiskProfile; var progress = pm.ContainsKey("Progress") ? pm["Progress"] as IProgress <TransferProgress> : NullTransferProgress.Instance; var destMapping = (_destDirModel.Profile as IDiskProfile).DiskIO.Mapper[_destDirModel]; var srcMapping = (_srcModel.Profile as IDiskProfile).DiskIO.Mapper[_srcModel]; string destName = PathFE.GetFileName(srcMapping.IOPath); string destFullName = destProfile.Path.Combine(_destDirModel.FullPath, destName); //PathFE.Combine(destMapping.IOPath, destName); if (_srcModel.IsDirectory) { Func <IEntryModel, bool> filter = em => !em.IsDirectory || (em is SzsRootModel); Func <IEntryModel, bool> lookupFilter = em => em.IsDirectory && !(em is SzsRootModel); return(WPFScriptCommands.List(_srcModel, filter, lookupFilter, true, ems => new SimpleScriptCommandAsync("BatchTransfer", pd => transferAsync(pm, ems, progress, new NotifyChangedCommand(_destDirModel.Profile, destFullName, _srcModel.Profile, _srcModel.FullPath, Defines.ChangeType.Changed))))); } else { return(IOScriptCommands.DiskTransfer(_srcModel, _destDirModel, _removeOriginal)); } return(ResultCommand.NoError); } catch (Exception ex) { return(ResultCommand.Error(ex)); } }
public static IScriptCommand TransferChild(IEntryModel srcModel, IEntryModel destDirModel, Func <IEntryModel, bool> filterFunc = null, bool recrusive = false, IScriptCommand nextCommand = null) { return(WPFScriptCommands.List(srcModel, filterFunc, null, recrusive, ems => WPFScriptCommands.ReportProgress(TransferProgress.IncrementTotalEntries(ems.Length), ScriptCommands.ForEach(ems, em => ScriptCommands.RunInSequence( IOScriptCommands.Transfer(em, destDirModel), WPFScriptCommands.ReportProgress(TransferProgress.IncrementProcessedEntries())), nextCommand)))); }