public override IScriptCommand Execute(ParameterDic pm) { IProfile[] rootProfiles = pm.GetValue <IProfile[]>(ProfilesKey); if (rootProfiles == null || rootProfiles.Length == 0) { return(ResultCommand.Error(new ArgumentException(ProfilesKey))); } if (rootProfiles.Length == 1) { pm.SetValue(DestinationKey, rootProfiles[0]); return(NextCommand); } else { IWindowManager wm = pm.GetValue <IWindowManager>(WindowManagerKey) ?? new WindowManager(); logger.Debug("Showing"); SelectProfileViewModel spvm = new SelectProfileViewModel(rootProfiles); if (wm.ShowDialog(spvm).Value) { logger.Info(String.Format("Selected {0}", spvm.SelectedRootProfile)); pm.SetValue(DestinationKey, spvm.SelectedRootProfile); return(NextCommand); } else { logger.Debug("Cancelled"); return(CancelCommand); } } }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { var evm = pm.GetValue <IExplorerViewModel>(ExplorerKey); var dm = DirectoryEntryKey == null ? null : (await pm.GetValueAsEntryModelArrayAsync(DirectoryEntryKey)).FirstOrDefault(); if (evm == null) { var events = pm.GetValue <IEventAggregator>(EventsKey); if (events != null) { events.PublishOnUIThread(new DirectoryChangedEvent(this, dm, null)); } else { return(ResultCommand.Error(new ArgumentNullException(ExplorerKey))); } } else { await evm.GoAsync(dm); } logger.Info("Path = " + dm.FullPath); return(NextCommand); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { IEntryModel entryModel = pm.GetValue <IEntryModel>(EntryKey); if (entryModel == null) { return(ResultCommand.Error(new ArgumentException(EntryKey + " is not found or not IEntryModel"))); } IDiskProfile profile = entryModel.Profile as IDiskProfile; if (profile == null) { return(ResultCommand.Error(new NotSupportedException(EntryKey + "'s Profile is not IDiskProfile"))); } using (var stream = await profile.DiskIO.OpenStreamAsync(entryModel, Access, pm.CancellationToken)) { ParameterDic pmClone = pm.Clone(); pmClone.SetValue(StreamKey, stream); logger.Debug(String.Format("{0} = Stream of {1}", StreamKey, EntryKey)); await ScriptRunner.RunScriptAsync(pmClone, NextCommand); } if (Access == FileAccess.ReadWrite || Access == FileAccess.Write) { return(CoreScriptCommands.NotifyEntryChangedProfile(ChangeType.Changed, null, EntryKey, ThenCommand)); } else { return(ThenCommand); } }
public override IScriptCommand Execute(ParameterDic pm) { switch (Mode) { case RunMode.Parallel: case RunMode.Queue: ScriptRunner.RunScript(pm, ScriptCommands); break; case RunMode.Sequence: foreach (var cmd in ScriptCommands) { ScriptRunner.RunScript(pm, cmd); if (pm.Error != null) { return(ResultCommand.Error(pm.Error)); } } break; default: return(ResultCommand.Error(new NotSupportedException(Mode.ToString()))); } if (pm.Error != null) { return(ResultCommand.Error(pm.Error)); } else { return(NextCommand); } }
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 override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { DestinationKey = DestinationKey ?? "{Explorer}"; var tevm = pm.GetValue <ITabbedExplorerViewModel>(TabbedExplorerKey); if (tevm == null) { return(ResultCommand.Error(new ArgumentNullException(TabbedExplorerKey))); } var dm = DirectoryEntryKey == null ? null : (await pm.GetValueAsEntryModelArrayAsync(DirectoryEntryKey)).FirstOrDefault(); if (dm != null && !dm.IsDirectory) { dm = null; } var destTab = tevm.OpenTab(dm); logger.Info(String.Format("New Tab #{0}", tevm.GetTabIndex(destTab))); logger.Debug(String.Format("{0} = {1}", DestinationKey, destTab)); pm.SetValue(DestinationKey, destTab); return(NextCommand); }
public override IScriptCommand Execute(ParameterDic pm) { IExplorerViewModel evm = pm.GetValue <IExplorerViewModel>(ExplorerKey); if (evm == null) { return(ResultCommand.Error(new KeyNotFoundException(ExplorerKey))); } ParameterDic startupParameters = new ParameterDic(); foreach (var key in VariableKeys.Split(',')) { var val = pm.GetValue(key); startupParameters.SetValue(key, val); } addStartupParameters(evm.Commands, startupParameters); addStartupParameters(evm.FileList.Commands, startupParameters); addStartupParameters(evm.DirectoryTree.Commands, startupParameters); addStartupParameters(evm.Navigation.Commands, startupParameters); addStartupParameters(evm.Breadcrumb.Commands, startupParameters); return(NextCommand); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { var flValue = pm.GetValue(FileListKey); IFileListViewModel flvm = flValue is IExplorerViewModel ? (flValue as IExplorerViewModel).FileList : flValue as IFileListViewModel; if (flvm == null) { return(ResultCommand.Error(new KeyNotFoundException(FileListKey))); } IEntryModel[] value = new IEntryModel[] { }; switch (AssignType) { case FileListAssignType.All: value = flvm.ProcessedEntries.EntriesHelper.AllNonBindable .Select(evm => evm.EntryModel).ToArray(); break; case FileListAssignType.Selected: value = flvm.Selection.SelectedItems.Select(evm => evm.EntryModel).ToArray(); break; default: return(ResultCommand.Error(new NotSupportedException("AssignType"))); } return(ScriptCommands.Assign(DestinationKey, value, false, NextCommand)); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { IEntryModel entry = pm.GetValue <IEntryModel>(EntryKey); if (entry == null) { return(ResultCommand.Error(new KeyNotFoundException(EntryKey))); } IDiskProfile profile = entry.Profile as IDiskProfile; if (profile == null) { return(ResultCommand.Error(new ArgumentException(EntryKey + "'s Profile is not IDiskProfile"))); } var entryMapping = profile.DiskIO.Mapper[entry]; if (entryMapping.IsVirtual) { await profile.DiskIO.WriteToCacheAsync(entry, pm.CancellationToken, true); } if (ExecutableKey == null) //Default implementation { if (entry.IsDirectory) { try { Process.Start(entryMapping.IOPath); } catch (Exception ex) { return(ResultCommand.Error(ex)); } } else { if (File.Exists(entryMapping.IOPath)) { ProcessStartInfo psi = null; if (ExecutableKey == "OpenAs") { psi = new ProcessStartInfo("Rundll32.exe"); psi.Arguments = String.Format(" shell32.dll, OpenAs_RunDLL {0}", entryMapping.IOPath); } else { psi = new ProcessStartInfo(entryMapping.IOPath); } if (psi != null) { try { Process.Start(psi); } catch (Exception ex) { return(ResultCommand.Error(ex)); } } } } } else { } return(NextCommand); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { IEntryModel[] srcEntries = null; IEntryModel destEntry = null; try { srcEntries = await pm.GetValueAsEntryModelArrayAsync(SourceEntryKey); destEntry = await pm.GetValueAsEntryModelAsync(DestinationDirectoryEntryKey, null); } catch (ArgumentException ex) { return(ResultCommand.Error(ex)); } if (!destEntry.IsDirectory) { return(ResultCommand.Error(new ArgumentException(DestinationDirectoryEntryKey + " is not a folder."))); } if (srcEntries.Length == 0) { return(ResultCommand.Error(new ArgumentException("Nothing to transfer."))); } var srcProfile = srcEntries.First().Profile as IDiskProfile; var destProfile = destEntry.Profile as IDiskProfile; if (srcEntries == null || destProfile == null) { return(ResultCommand.Error(new ArgumentException("Either source or dest is not IDiskProfile."))); } var progress = pm.GetProgress() ?? NullTransferProgress.Instance; if (AllowCustomImplementation) { logger.Info(String.Format("{0} {1} -> {2} using CustomImplementation", RemoveOriginal ? "Move" : "Copy", srcEntries.GetDescription(), destEntry.Name)); return(destProfile.DiskIO .GetTransferCommand(SourceEntryKey, DestinationDirectoryEntryKey, DestinationKey, RemoveOriginal, NextCommand)); } else { var srcMapper = srcProfile.DiskIO.Mapper; var destMapping = destProfile.DiskIO.Mapper[destEntry]; if (!destMapping.IsVirtual && RemoveOriginal && srcEntries.All(entry => !srcMapper[entry].IsVirtual)) { return(await transferSystemIOAsync(pm, srcEntries, destEntry, DestinationKey)); } else { return(await transferScriptCommandAsync(pm, srcEntries, destEntry, DestinationKey)); } } }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { var pdv = pm.GetValue <IProgress <TransferProgress> >("{Progress}", NullTransferProgress.Instance); string url = pm.GetValue <string>(UrlKey); if (url == null) { return(ResultCommand.Error(new ArgumentException("Unspecified Url."))); } try { using (var httpClient = pm.ContainsKey(HttpClientKey) && pm[HttpClientKey] is Func <HttpClient>?((Func <HttpClient>)pm[HttpClientKey])() : new HttpClient()) { var response = await httpClient.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, pm.CancellationToken); if (!response.IsSuccessStatusCode) { throw new WebException(String.Format("{0} when downloading {1}", response.StatusCode, url)); } MemoryStream destStream = new MemoryStream(); logger.Info(String.Format("{0} = Stream of {1}", DestinationKey, url)); using (Stream srcStream = await response.Content.ReadAsStreamAsync()) { pdv.Report(TransferProgress.From(url)); byte[] buffer = new byte[1024]; ulong totalBytesRead = 0; ulong totalBytes = 0; try { totalBytes = (ulong)srcStream.Length; } catch (NotSupportedException) { } int byteRead = await srcStream.ReadAsync(buffer, 0, buffer.Length, pm.CancellationToken); while (byteRead > 0) { await destStream.WriteAsync(buffer, 0, byteRead, pm.CancellationToken); totalBytesRead = totalBytesRead + (uint)byteRead; short percentCompleted = (short)((float)totalBytesRead / (float)totalBytes * 100.0f); pdv.Report(TransferProgress.UpdateCurrentProgress(percentCompleted)); byteRead = await srcStream.ReadAsync(buffer, 0, buffer.Length, pm.CancellationToken); } await destStream.FlushAsync(); } pm.SetValue(DestinationKey, destStream.ToByteArray()); return(NextCommand); } } catch (Exception ex) { return(ResultCommand.Error(ex)); } }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { IWindowManager wm = pm.GetValue <IWindowManager>(WindowManagerKey) ?? new WindowManager(); IEventAggregator events = pm.GetValue <IEventAggregator>(EventAggregatorKey) ?? new EventAggregator(); IExplorerInitializer initializer = new ScriptCommandInitializer() { StartupParameters = pm, WindowManager = wm, Events = events, OnModelCreated = ScriptCommands.Run(OnModelCreatedKey), OnViewAttached = ScriptCommands.Run(OnViewAttachedKey) }; ExplorerViewModel evm = null; switch (ExplorerMode) { case Script.ExplorerMode.Normal: evm = new ExplorerViewModel(wm, events) { Initializer = initializer }; break; case Script.ExplorerMode.FileOpen: evm = new FilePickerViewModel(wm, events) { Initializer = initializer, PickerMode = FilePickerMode.Open }; break; case Script.ExplorerMode.FileSave: evm = new FilePickerViewModel(wm, events) { Initializer = initializer, PickerMode = FilePickerMode.Save }; break; case Script.ExplorerMode.DirectoryOpen: evm = new DirectoryPickerViewModel(wm, events) { Initializer = initializer }; break; default: return(ResultCommand.Error(new NotSupportedException(ExplorerMode.ToString()))); } logger.Info(String.Format("Creating {0}", evm)); pm.SetValue(DestinationKey, evm, false); return(NextCommand); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { VM evm = (VM)pm[_viewModelName]; if (evm == null) { return(ResultCommand.Error(new ArgumentException(_viewModelName))); } return(await _commandFunc(evm, pm)); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { if (CanExecute(pm)) { return(NextCommand); } else { return(ResultCommand.Error(pm.Error ?? new ArgumentException("pm"))); } }
public override IScriptCommand Execute(ParameterDic pm) { ScriptRunner.RunScript(pm, ScriptCommands); if (pm.Error != null) { return(ResultCommand.Error(pm.Error)); } else { return(_nextCommand); } }
public override IScriptCommand Execute(ParameterDic pm) { IScriptCommand command = pm.GetValue <IScriptCommand>(CommandKey); if (command == null && ThrowIfError) { return(ResultCommand.Error(new ArgumentNullException(CommandKey))); } command = command ?? ResultCommand.NoError; logger.Info("Running " + CommandKey); return(ScriptCommands.RunQueue(NextCommand, command)); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { await ScriptRunner.RunScriptAsync(pm, ScriptCommands); if (pm.Error != null) { return(ResultCommand.Error(pm.Error)); } else { return(_nextCommand); } }
/// <summary> /// Serializable, Copy contents from file1 to file2 /// </summary> /// <param name="sourceFileVariable">Filepath of source</param> /// <param name="destinationFileVariable">Filepath of destination</param> /// <param name="nextCommand"></param> /// <returns></returns> public static IScriptCommand DiskCopyFile(string sourceProfileVariable = "{SourceProfile}", string sourceFileVariable = "{SourceFile}", string destinationProfileVariable = "{DestinationProfile}", string destinationFileVariable = "{DestinationFile}", IScriptCommand nextCommand = null) { return(CoreScriptCommands.ParsePath(sourceProfileVariable, sourceFileVariable, dcSourceVariable, CoreScriptCommands.DiskParseOrCreateFile(destinationProfileVariable, destinationFileVariable, dcDestVariable, CoreScriptCommands.DiskOpenStream(dcSourceVariable, "{SourceStream}", FileExplorer.Defines.FileAccess.Read, CoreScriptCommands.DiskOpenStream(dcDestVariable, "{DestinationStream}", FileExplorer.Defines.FileAccess.Write, CoreScriptCommands.CopyStream("{SourceStream}", "{DestinationStream}", CoreScriptCommands.NotifyEntryChanged(ChangeType.Created, null, dcSourceVariable, null, dcDestVariable, ScriptCommands.Reset(nextCommand, dcSourceVariable, dcDestVariable)))))), ResultCommand.Error(new FileNotFoundException(sourceFileVariable)))); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { var events = pm.GetValue <IEventAggregator>(EventsKey); if (events == null) { return(ResultCommand.Error(new ArgumentNullException(EventsKey))); } logger.Info(String.Format("Broadcasting {0}", Event)); events.PublishOnUIThread(Event); return(NextCommand); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { var evm = pm.GetValue <IExplorerViewModel>(ExplorerKey); if (evm == null) { return(ResultCommand.Error(new KeyNotFoundException(ExplorerKey))); } return (Direction == ParameterDirection.Set ? await setParameterAsync(pm, evm) : await getParameterAsync(pm, evm)); }
public static IScriptCommand ParseOrCreateArchive(IDiskProfile profile, string path, Func <IEntryModel, IScriptCommand> thenFunc) { string type = profile.Path.GetExtension(path).ToLower(); byte[] bytes = SevenZipWrapper.GetArchiveBytes(type); if (bytes == null) { return(ResultCommand.Error(new ArgumentException(type + " is not recognized type."))); } return(WPFScriptCommands.ParseOrCreatePath(profile, path, false, em => WPFScriptCommands.WriteBytes(em, bytes, thenFunc))); }
public override IScriptCommand Execute(ParameterDic pm) { IExplorerViewModel evm = pm.GetValue <IExplorerViewModel>(ExplorerKey); if (evm == null) { return(ResultCommand.Error(new KeyNotFoundException(ExplorerKey))); } DoAction(evm); logger.Info("Completed"); return(NextCommand); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { IWindowManager wm = pm.GetValue <IWindowManager>(WindowManagerKey) ?? new WindowManager(); IExplorerViewModel evm = pm.GetValue <IExplorerViewModel>(ExplorerKey); if (evm == null) { return(ResultCommand.Error(new KeyNotFoundException(ExplorerKey))); } logger.Info(String.Format("Showing {0}", evm)); if (evm is DirectoryPickerViewModel) { DirectoryPickerViewModel dpvm = evm as DirectoryPickerViewModel; bool result = wm.ShowDialog(dpvm).Value; pm.SetValue(DialogResultKey, result); if (result) { pm.SetValue(SelectionPathsKey, dpvm.SelectedDirectory.FullPath); pm.SetValue(SelectionEntriesKey, dpvm.SelectedDirectory); } } else if (evm is FilePickerViewModel) { FilePickerViewModel fpvm = evm as FilePickerViewModel; bool result = wm.ShowDialog(fpvm).Value; pm.SetValue(DialogResultKey, result); if (result) { switch (fpvm.PickerMode) { case FilePickerMode.Save: pm.SetValue(SelectionPathsKey, fpvm.FileName); break; case FilePickerMode.Open: pm.SetValue(SelectionPathsKey, fpvm.SelectedFiles.Select(m => m.FullPath).ToArray()); pm.SetValue(SelectionEntriesKey, fpvm.SelectedFiles); break; } } } else { wm.ShowWindow(evm); } return(NextCommand); }
public static IScriptCommand CreatePath(IProfile profile, string path, bool isFolder, bool renameIfExists, Func <IEntryModel, IScriptCommand> thenFunc) { if (profile is IDiskProfile) { string parentPath = profile.Path.GetDirectoryName(path); string name = profile.Path.GetFileName(path); return(new DiskCreateCommand(profile as IDiskProfile, parentPath, renameIfExists ? FileNameGenerator.Rename(name) : FileNameGenerator.NoRename(name), isFolder, thenFunc)); } return(ResultCommand.Error(new NotSupportedException("Profile is not IDiskProfile."))); }
public static IScriptCommand CreateArchive(IEntryModel entryModel, string name, bool renameIfExists, Func <IEntryModel, IScriptCommand> thenFunc) { string type = entryModel.Profile.Path.GetExtension(name).ToLower(); byte[] bytes = SevenZipWrapper.GetArchiveBytes(type); if (bytes == null) { return(ResultCommand.Error(new ArgumentException(type + " is not recognized type."))); } return(WPFScriptCommands.CreatePath(entryModel, name, false, renameIfExists, em => WPFScriptCommands.WriteBytes(em, bytes, thenFunc))); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { var flValue = pm.GetValue(FileListKey); IFileListViewModel flvm = flValue is IExplorerViewModel ? (flValue as IExplorerViewModel).FileList : flValue as IFileListViewModel; if (flvm == null) { return(ResultCommand.Error(new KeyNotFoundException(FileListKey))); } return(ScriptCommands.Assign(DestinationKey, flvm.Selection.SelectedItems.Select(evm => evm.EntryModel).ToArray(), false, NextCommand)); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { var flValue = pm.GetValue(ExplorerKey); IEntryModel em = flValue is IExplorerViewModel ? (flValue as IExplorerViewModel).CurrentDirectory.EntryModel : flValue is IFileListViewModel ? (flValue as IFileListViewModel).CurrentDirectory : flValue is IDirectoryTreeViewModel ? (flValue as IDirectoryTreeViewModel).Selection.SelectedChild : flValue is IBreadcrumbViewModel ? (flValue as IBreadcrumbViewModel).Selection.SelectedChild : null; if (em == null) { return(ResultCommand.Error(new KeyNotFoundException(ExplorerKey))); } pm.SetValue(DestinationKey, em, true); return(NextCommand); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { var flValue = pm.GetValue(FileListKey); IFileListViewModel flvm = flValue is IExplorerViewModel ? (flValue as IExplorerViewModel).FileList : flValue as IFileListViewModel; if (flvm == null) { return(ResultCommand.Error(new KeyNotFoundException(FileListKey))); } await flvm.ProcessedEntries.EntriesHelper.LoadAsync(UpdateMode.Update, Force); return(NextCommand); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { IEnumerable e = pm.GetValue <IEnumerable>(ItemsKey); if (e == null) { return(ResultCommand.Error(new ArgumentException(ItemsKey))); } IProgress <TransferProgress> progress = NullTransferProgress.Instance; if (IsProgressEnabled) { List <object> list; e = list = e.Cast <object>().ToList(); progress = pm.GetProgress(); progress.Report(TransferProgress.IncrementTotalEntries(list.Count)); } uint counter = 0; pm.SetValue <bool>(BreakKey, false); foreach (var item in e) { if (pm.GetValue <bool>(BreakKey)) { break; } counter++; pm.SetValue(CurrentItemKey, item); await ScriptRunner.RunScriptAsync(pm, NextCommand); progress.Report(TransferProgress.IncrementProcessedEntries()); if (pm.Error != null) { pm.SetValue <Object>(CurrentItemKey, null); return(ResultCommand.Error(pm.Error)); } } logger.Info("Looped {0} items", counter); pm.SetValue <Object>(CurrentItemKey, null); return(ThenCommand); }
public override async Task <IScriptCommand> ExecuteAsync(ParameterDic pm) { var destProfile = _destDirModel.Profile as IDiskProfile; 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); IEntryModel destModel = await _destDirModel.Profile.ParseAsync(destFullName); if (destModel == null) { destModel = await destProfile.DiskIO.CreateAsync(destFullName, true, pm.CancellationToken); destModel = (await _destDirModel.Profile.ListAsync(_destDirModel, CancellationToken.None, em => em.FullPath.Equals(destFullName, StringComparison.CurrentCultureIgnoreCase), true)).FirstOrDefault(); _destDirModel.Profile.Events.PublishOnUIThread(new EntryChangedEvent(ChangeType.Created, destFullName)); } if (destModel == null) { return(ResultCommand.Error(new Exception("Cannot construct destination " + destFullName))); } else { _progress.Report(TransferProgress.From(_srcModel.FullPath, destFullName)); _progress.Report(TransferProgress.IncrementProcessedEntries()); //dest directory created } var srcSubModels = (await _srcModel.Profile.ListAsync(_srcModel, CancellationToken.None)).ToList(); _progress.Report(TransferProgress.IncrementTotalEntries(srcSubModels.Count())); //source entries var resultCommands = srcSubModels.Select(m => (IScriptCommand) new FileTransferScriptCommand(m, destModel, _removeOriginal)).ToList(); resultCommands.Add(new NotifyChangedCommand(_destDirModel.Profile, destFullName, ChangeType.Created)); //if (_removeOriginal) // resultCommands.Add(new DeleteEntryCommand(_srcModel)); return(new RunInSequenceScriptCommand(resultCommands.ToArray())); }