• Tutorials
  • Api Documentation
  • Download
  • Credits
Show / Hide Table of Contents
  • AutoCheck.Core
    • Output
    • Output.Log
    • Output.Style
    • Output.Type
    • Script
    • Script.ExecutionMode
    • Utils
    • Utils.OS
  • AutoCheck.Core.Connectors
    • Atom
    • Base
    • Compressed
    • Css
    • Csv
    • CsvDocument
    • Dmoj
    • GDrive
    • Html
    • Math
    • Odoo
    • Operator
    • PlainText
    • PlainText.PlainTextDocument
    • Postgres
    • Rss
    • Shell
    • TextStream
    • Xml
    • Xml.XmlNodeType
  • AutoCheck.Core.CopyDetectors
    • Base
    • Base.Mode
    • Css
    • Html
    • PlainText
    • PlainText.File
    • SourceCode
    • SqlLog
    • Xml
  • AutoCheck.Core.Events
    • LogUpdateEventArgs
    • StatusUpdateEventArgs
    • StatusUpdateEventArgs.ExecutionEvent
  • AutoCheck.Core.Exceptions
    • ArgumentInvalidException
    • ArgumentNotFoundException
    • ConfigFileMissingException
    • ConnectionInvalidException
    • ConnectorInvalidException
    • ConnectorNotFoundException
    • DocumentInvalidException
    • DownloadFailedException
    • ItemNotFoundException
    • PorpertyNotFoundException
    • QueryInvalidException
    • RegexInvalidException
    • ResultMismatchException
    • ScriptInvalidException
    • ScriptNotFoundException
    • StyleInvalidException
    • StyleNotAppliedException
    • StyleNotFoundException
    • TableInconsistencyException
    • VariableInvalidException
    • VariableNotFoundException
  • Google.DiffMatchPatch
    • Diff
    • DiffMatchPatch
    • Operation
    • Patch

Class Shell

Allows in/out operations and/or data validations with a local (bash) or remote computer (like ssh, scp, etc.).

Inheritance
System.Object
Base
Shell
Inherited Members
Base.ProcessRemoteFile(Utils.OS, String, String, String, Int32, String, Action<String>)
Namespace: AutoCheck.Core.Connectors
Assembly: AutoCheck.Core.dll
Syntax
public class Shell : Base

Constructors

| Improve this Doc View Source

Shell()

Creates a new local shell connector instance.

Declaration
public Shell()
| Improve this Doc View Source

Shell(Utils.OS, String, String, String, Int32)

Declaration
public Shell(Utils.OS remoteOS, string host, string username, string password, int port = 22)
Parameters
Type Name Description
Utils.OS remoteOS
System.String host
System.String username
System.String password
System.Int32 port
| Improve this Doc View Source

Shell(String, String, String, String, Int32)

Declaration
public Shell(string remoteOS, string host, string username, string password, int port = 22)
Parameters
Type Name Description
System.String remoteOS
System.String host
System.String username
System.String password
System.Int32 port

Properties

| Improve this Doc View Source

Host

The remote host address.

Declaration
public string Host { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

IsLocal

Returns true if the current Shell instance has been instanced into local mode, false otherwise.

Declaration
public bool IsLocal { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsRemote

Returns true if the current Shell instance has been instanced into remote mode, false otherwise.

Declaration
public bool IsRemote { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Password

The remote host password used to login.

Declaration
public string Password { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Port

The remote host port, where SSH is listening to.

Declaration
public int Port { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

RemoteOS

The remote host OS.

Declaration
public Utils.OS RemoteOS { get; }
Property Value
Type Description
Utils.OS
| Improve this Doc View Source

Username

The remote host username used to login.

Declaration
public string Username { get; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

CountFiles(String, Boolean)

Returns how many files has been found within the given path.

Declaration
public virtual int CountFiles(string path, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the files will be searched into.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.Int32

The amount of files.

| Improve this Doc View Source

CountFiles(String, String, Boolean)

Returns how many files has been found within the given path.

Declaration
public int CountFiles(string path, string searchpattern, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the files will be searched into.

System.String searchpattern

The folder search pattern.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.Int32

The amount of files.

| Improve this Doc View Source

CountFolders(String, Boolean)

Returns how many folders has been found within the given path.

Declaration
public virtual int CountFolders(string path, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the folders will be searched into.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.Int32

The amount of folders.

| Improve this Doc View Source

CountFolders(String, String, Boolean)

Returns how many folders has been found within the given path.

Declaration
public int CountFolders(string path, string searchpattern, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the folders will be searched into.

System.String searchpattern

The folder search pattern.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.Int32

The amount of folders.

| Improve this Doc View Source

Dispose()

Disposes the object releasing its unmanaged properties.

Declaration
public override void Dispose()
Overrides
Base.Dispose()
| Improve this Doc View Source

DownloadFile(String, String)

Downloads the remote file into the local system.

Declaration
public string DownloadFile(string file, string folder = null)
Parameters
Type Name Description
System.String file

The file to get including its path.

System.String folder

The folder where the file will be downloaded.

Returns
Type Description
System.String

The local file path once downloaded.

| Improve this Doc View Source

DownloadFolder(String, Boolean)

Downloads the remote file into the local system.

Declaration
public string DownloadFolder(string path, bool recursive)
Parameters
Type Name Description
System.String path

The file to get including its path.

System.Boolean recursive

The entire file and folder structure will be downloaded recursivelly.

Returns
Type Description
System.String

The local file path once downloaded.

| Improve this Doc View Source

DownloadFolder(String, String, Boolean)

Downloads the remote file into the local system.

Declaration
public string DownloadFolder(string path, string folder = null, bool recursive = false)
Parameters
Type Name Description
System.String path

The file to get including its path.

System.String folder

The folder where the file will be downloaded.

System.Boolean recursive

The entire file and folder structure will be downloaded recursivelly.

Returns
Type Description
System.String

The local folder path once downloaded.

| Improve this Doc View Source

ExistsFile(String)

Determines if a file exists.

Declaration
public bool ExistsFile(string file)
Parameters
Type Name Description
System.String file

The file to get including its path.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ExistsFile(String, String, Boolean)

Determines if a file exists.

Declaration
public bool ExistsFile(string path, string file, bool recursive = false)
Parameters
Type Name Description
System.String path

Path where the file will be searched into.

System.String file

The file to search.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.Boolean

If the file exists or not.

| Improve this Doc View Source

ExistsFolder(String)

Determines if a folder exists.

Declaration
public bool ExistsFolder(string folder)
Parameters
Type Name Description
System.String folder

The folder to get including its path.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ExistsFolder(String, String, Boolean)

Determines if a folder exists.

Declaration
public bool ExistsFolder(string path, string folder, bool recursive = false)
Parameters
Type Name Description
System.String path

Path where the folder will be searched into.

System.String folder

The folder to search.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.Boolean

If the folder exists or not.

| Improve this Doc View Source

GetFile(String, String, Boolean)

Returns the first file's path found, using the given file name or search pattern.

Declaration
public virtual string GetFile(string path, string file, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the file will be searched into.

System.String file

The file to search (searchpattern).

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.String

File's full path, NULL if does not exists.

| Improve this Doc View Source

GetFiles(String, Boolean)

Returns a set of file's path found, using the given file name or search pattern.

Declaration
public virtual string[] GetFiles(string path, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the file will be searched into.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.String[]

File's full paths.

| Improve this Doc View Source

GetFiles(String, String, Boolean)

Returns a set of file's path found, using the given file name or search pattern.

Declaration
public string[] GetFiles(string path, string searchpattern, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the file will be searched into.

System.String searchpattern

The folder search pattern.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.String[]

File's full paths.

| Improve this Doc View Source

GetFolder(String, String, Boolean)

Returns the first folder's path found, using the given folder name or search pattern.

Declaration
public virtual string GetFolder(string path, string folder, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the folder will be searched into.

System.String folder

The folder to search (searchpattern).

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.String

Folder's full path, NULL if does not exists.

| Improve this Doc View Source

GetFolders(String, Boolean)

Returns a set of folder's path found, using the given folder name or search pattern.

Declaration
public virtual string[] GetFolders(string path, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the folders will be searched into.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.String[]

Folder's full path.

| Improve this Doc View Source

GetFolders(String, String, Boolean)

Returns a set of folder's path found, using the given folder name or search pattern.

Declaration
public string[] GetFolders(string path, string searchpattern, bool recursive = true)
Parameters
Type Name Description
System.String path

Path where the folders will be searched into.

System.String searchpattern

The folder search pattern.

System.Boolean recursive

Recursive deep search.

Returns
Type Description
System.String[]

Folder's full path.

| Improve this Doc View Source

Run(String, Int32)

Runs a shell command.

Declaration
public (int code, string response) Run(string command, int timeout = 0)
Parameters
Type Name Description
System.String command

The command to run.

System.Int32 timeout

Timeout in milliseconds, 0 for no timeout.

Returns
Type Description
System.ValueTuple<System.Int32, System.String>

The return code and the complete response.

| Improve this Doc View Source

Run(String, String, Int32)

Runs a shell command.

Declaration
public (int code, string response) Run(string command, string path, int timeout = 0)
Parameters
Type Name Description
System.String command

The command to run.

System.String path

The path where the command must run.

System.Int32 timeout

Timeout in milliseconds, 0 for no timeout.

Returns
Type Description
System.ValueTuple<System.Int32, System.String>

The return code and the complete response.

| Improve this Doc View Source

TestConnection()

Test the connection to the remote host, so an exception will be thrown if any problem occurs.

Declaration
public void TestConnection()
| Improve this Doc View Source

Wait(Int32)

The current thread execution will sleep for the given time.

Declaration
public void Wait(int milliseconds)
Parameters
Type Name Description
System.Int32 milliseconds

The time to sleep.

Extension Methods

ObjectExtensions.DeepClone<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX