public void AppendAllTextTest() { ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value SftpClient target = new SftpClient(connectionInfo); // TODO: Initialize to an appropriate value string path = string.Empty; // TODO: Initialize to an appropriate value string contents = string.Empty; // TODO: Initialize to an appropriate value target.AppendAllText(path, contents); Assert.Inconclusive("A method that does not return a value cannot be verified."); }
public override async Task AppendFileAsync(string path, byte[] contents, CancellationToken cancellationToken = default) { await GetFileAsync(path, cancellationToken); try { var stringContents = Encoding.UTF8.GetString(contents, 0, contents.Length); await Task.Run(() => client.AppendAllText(PrependRootPath(path), stringContents), cancellationToken); } catch (SshConnectionException exception) { throw new ConnectionException(exception); } catch (Exception exception) { throw new AdapterRuntimeException(exception); } }
//サーバー上のテキストファイルに文字を追加 public bool File_Append(string To_File, string Text, bool IsErrorLogMode = false) { if (!IsConnected) { return(false); } else if (!SFTP_Server.IsConnected) { SFTP_Server.Connect(); } try { SFTP_Server.AppendAllText(To_File, Text); return(true); } catch (Exception e) { if (IsErrorLogMode) { Sub_Code.Error_Log_Write(e.Message); } return(false); } }