public string ExecuteCommand(IRemoteClient remoteClient, IEnumerable<string> parameters) { if (!parameters.Any()) { return "Missing parameters"; } var sourceFilePath = parameters.First(); var targetDirectory = parameters.Count() == 2 ? parameters.Last() : string.Empty; var filePath = remoteClient.UploadFile(sourceFilePath, targetDirectory); return string.Format("Le fichier '{0}' a bien été uploadé à l'emplacement '{1}'.", Path.GetFileName(sourceFilePath), filePath); }
public string ExecuteCommand(IRemoteClient remoteClient, IEnumerable <string> parameters) { if (!parameters.Any()) { return("Missing parameters"); } var sourceFilePath = parameters.First(); var targetDirectory = parameters.Count() == 2 ? parameters.Last() : string.Empty; var filePath = remoteClient.UploadFile(sourceFilePath, targetDirectory); return(string.Format("Le fichier '{0}' a bien été uploadé à l'emplacement '{1}'.", Path.GetFileName(sourceFilePath), filePath)); }
protected override void HandleInternal(CommandLine commandLine, IRemoteClient remoteClient) { var localFilePath = commandLine.Arguments.First(x => x.Name == "unknown"); var remoteFolder = commandLine.Arguments.Last(x => x.Name == "unknown"); if (localFilePath == null) { WriteWarning("You should specify a local file path."); return; } if (remoteFolder == null) { WriteWarning("You should specify a remote folder."); return; } var filePath = remoteClient.UploadFile(localFilePath.Value, remoteFolder.Value); WriteInfo("The file '{0}' has been uploaded to the the remote location '{1}'.", Path.GetFileName(localFilePath.Value), filePath); }
public void UploadModule(string moduleName) { var localModuleFilePath = Path.Combine(Directory.GetCurrentDirectory(), RemoteModuleDirectoryPath, moduleName + ".dll"); _remoteClient.UploadFile(localModuleFilePath, RemoteModuleDirectoryPath); }