LanguageExt.Sys

LanguageExt.Sys Live

Contents

struct ConsoleIO Source #

Fields

field Sys.Traits.ConsoleIO Default = new ConsoleIO() Source #

Properties

property ConsoleColor BgColor Source #

property ConsoleColor Color Source #

Methods

method Option<ConsoleKeyInfo> ReadKey () Source #

method Unit Clear () Source #

method Unit SetBgColor (ConsoleColor color) Source #

method Unit SetColor (ConsoleColor color) Source #

method Unit ResetColor () Source #

method Option<int> Read () Source #

method Option<string> ReadLine () Source #

method Unit WriteLine () Source #

method Unit WriteLine (string value) Source #

method Unit Write (string value) Source #

class DirectoryIO Source #

Fields

field Traits.DirectoryIO Default = new DirectoryIO() Source #

Methods

method Unit Create (string path) Source #

method Unit Delete (string path, bool recursive = true) Source #

method Option<DirectoryInfo> GetParent (string path) Source #

method bool Exists (string path) Source #

method Unit SetCreationTime (string path, DateTime creationTime) Source #

method Unit SetCreationTimeUtc (string path, DateTime creationTimeUtc) Source #

method DateTime GetCreationTime (string path) Source #

method DateTime GetCreationTimeUtc (string path) Source #

method Unit SetLastWriteTime (string path, DateTime lastWriteTime) Source #

method Unit SetLastWriteTimeUtc (string path, DateTime lastWriteTimeUtc) Source #

method DateTime GetLastWriteTime (string path) Source #

method DateTime GetLastWriteTimeUtc (string path) Source #

method Unit SetLastAccessTime (string path, DateTime lastAccessTime) Source #

method Unit SetLastAccessTimeUtc (string path, DateTime lastAccessTimeUtc) Source #

method DateTime GetLastAccessTime (string path) Source #

method DateTime GetLastAccessTimeUtc (string path) Source #

method Seq<string> EnumerateDirectories (string path) Source #

method Seq<string> EnumerateDirectories (string path, string searchPattern) Source #

method Seq<string> EnumerateDirectories (string path, string searchPattern, SearchOption searchOption) Source #

method Seq<string> EnumerateFiles (string path) Source #

method Seq<string> EnumerateFiles (string path, string searchPattern) Source #

method Seq<string> EnumerateFiles (string path, string searchPattern, SearchOption searchOption) Source #

method Seq<string> EnumerateFileSystemEntries (string path) Source #

method Seq<string> EnumerateFileSystemEntries (string path, string searchPattern) Source #

method Seq<string> EnumerateFileSystemEntries (string path, string searchPattern, SearchOption searchOption) Source #

method string GetDirectoryRoot (string path) Source #

method string GetCurrentDirectory () Source #

method Unit SetCurrentDirectory (string path) Source #

method Unit Move (string sourceDirName, string destDirName) Source #

method Seq<string> GetLogicalDrives () Source #

struct EnvironmentIO Source #

Fields

field Sys.Traits.EnvironmentIO Default = new EnvironmentIO() Source #

Methods

method string CommandLine () Source #

Gets the command line for this process.

method Unit SetCurrentDirectory (string directory) Source #

Sets the fully qualified path of the current working directory.

method int CurrentManagedThreadId () Source #

Gets a unique identifier for the current managed thread.

method Unit Exit (int exitCode) Source #

Terminates this process and returns an exit code to the operating system.

method int ExitCode () Source #

Gets the exit code of the process.

method Unit SetExitCode (int exitCode) Source #

Sets the exit code of the process.

method string ExpandEnvironmentVariables (string name) Source #

Replaces the name of each environment variable embedded in the specified string with the string equivalent of the value of the variable, then returns the resulting string.

method Unit FailFast (Option<string> message) Source #

Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message in error reporting to Microsoft.

method Unit FailFast (Option<string> message, Option<Exception> exception) Source #

Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message and exception information in error reporting to Microsoft.

method Seq<string> GetCommandLineArgs () Source #

Returns a string array containing the command-line arguments for the current process.

method Option<string> GetEnvironmentVariable (string variable) Source #

Retrieves the value of an environment variable from the current process.

method Option<string> GetEnvironmentVariable (string variable, EnvironmentVariableTarget target) Source #

Retrieves the value of an environment variable from the current process or from the Windows operating system registry key for the current user or local machine.

method HashMap<string, string> GetEnvironmentVariables () Source #

Retrieves all environment variable names and their values from the current process.

method HashMap<string, string> GetEnvironmentVariables (EnvironmentVariableTarget target) Source #

Retrieves all environment variable names and their values from the current process, or from the Windows operating system registry key for the current user or local machine.

method string GetFolderPath (System.Environment.SpecialFolder folder) Source #

Gets the path to the system special folder that is identified by the specified enumeration.

method string GetFolderPath (System.Environment.SpecialFolder folder, System.Environment.SpecialFolderOption option) Source #

Gets the path to the system special folder that is identified by the specified enumeration, and uses a specified option for accessing special folders.

method Seq<string> GetLogicalDrives () Source #

Returns an array of string containing the names of the logical drives on the current computer.

method bool HasShutdownStarted () Source #

Gets a value that indicates whether the current application domain is being unloaded or the common language runtime (CLR) is shutting down.

method bool Is64BitOperatingSystem () Source #

Determines whether the current operating system is a 64-bit operating system.

method bool Is64BitProcess () Source #

Determines whether the current process is a 64-bit process.

method string MachineName () Source #

Gets the NetBIOS name of this local computer.

method string NewLine () Source #

Gets the newline string defined for this environment.

method OperatingSystem OSVersion () Source #

Gets an OperatingSystem object that contains the current platform identifier and version number.

method int ProcessorCount () Source #

Gets the number of processors on the current machine.

method Unit SetEnvironmentVariable (string variable, Option<string> value) Source #

Creates, modifies, or deletes an environment variable stored in the current process.

method Unit SetEnvironmentVariable (string variable, Option<string> value, EnvironmentVariableTarget target) Source #

Creates, modifies, or deletes an environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine.

method string StackTrace () Source #

Gets current stack trace information.

method string SystemDirectory () Source #

Gets the fully qualified path of the system directory.

method int SystemPageSize () Source #

Gets the number of bytes in the operating system's memory page.

method int TickCount () Source #

Gets the number of milliseconds elapsed since the system started.

method string UserDomainName () Source #

Gets the network domain name associated with the current user.

method bool UserInteractive () Source #

Gets a value indicating whether the current process is running in user interactive mode.

method string UserName () Source #

Gets the user name of the person who is currently logged on to the operating system.

method Version Version () Source #

Gets a Version object that describes the major, minor, build, and revision numbers of the common language runtime.

method long WorkingSet () Source #

Gets the amount of physical memory mapped to the process context.

struct FileIO Source #

Real world interaction with the file-system

Fields

field Sys.Traits.FileIO Default = new FileIO() Source #

Methods

method Unit Copy (string fromPath, string toPath, bool overwrite = false) Source #

Copy file from one place to another

method ValueTask<Unit> AppendAllLines (string path, IEnumerable<string> lines, Encoding encoding, CancellationToken token) Source #

Append lines to the end of a file

method ValueTask<Seq<string>> ReadAllLines (string path, Encoding encoding, CancellationToken token) Source #

Read all lines from a file

method ValueTask<Unit> WriteAllLines (string path, IEnumerable<string> lines, Encoding encoding, CancellationToken token) Source #

Write all lines to a file

method ValueTask<string> ReadAllText (string path, Encoding encoding, CancellationToken token) Source #

Read text from a file

method ValueTask<byte[]> ReadAllBytes (string path, CancellationToken token) Source #

Read data from a file

method ValueTask<Unit> WriteAllText (string path, string text, Encoding encoding, CancellationToken token) Source #

Write text to a file

method ValueTask<Unit> WriteAllBytes (string path, byte[] data, CancellationToken token) Source #

Write data to a file

method Unit Delete (string path) Source #

Delete a file

method bool Exists (string path) Source #

True if a file at the path exists

method TextReader OpenText (string path) Source #

Open a text file

method TextWriter CreateText (string path) Source #

Create a new text file to stream to

method TextWriter AppendText (string path) Source #

Return a stream to append text to

method Stream OpenRead (string path) Source #

Open a file-stream

method Stream Open (string path, FileMode mode) Source #

Open a file-stream

method Stream Open (string path, FileMode mode, FileAccess access) Source #

Open a file-stream

method Stream OpenWrite (string path) Source #

Open a file-stream

struct Runtime Source #

Live IO runtime

Properties

property RuntimeEnv Env Source #

Configuration environment accessor

property Runtime LocalCancel Source #

Create a new Runtime with a fresh cancellation token

Used by localCancel to create new cancellation context for its sub-environment

Parameters

returns

New runtime

property CancellationToken CancellationToken Source #

Direct access to cancellation token

property CancellationTokenSource CancellationTokenSource Source #

Directly access the cancellation token source

Parameters

returns

CancellationTokenSource

property Encoding Encoding Source #

Get encoding

Parameters

returns

property Eff<Runtime, Traits.ConsoleIO> ConsoleEff Source #

Access the console environment

Parameters

returns

Console environment

property Eff<Runtime, Traits.FileIO> FileEff Source #

Access the file environment

Parameters

returns

File environment

property Eff<Runtime, Traits.DirectoryIO> DirectoryEff Source #

Access the directory environment

Parameters

returns

Directory environment

property Eff<Runtime, Traits.TextReadIO> TextReadEff Source #

Access the TextReader environment

Parameters

returns

TextReader environment

property Eff<Runtime, Traits.TimeIO> TimeEff Source #

Access the time environment

Parameters

returns

Time environment

property Eff<Runtime, Traits.EnvironmentIO> EnvironmentEff Source #

Access the operating-system environment

Parameters

returns

Operating-system environment environment

Methods

method Runtime New () Source #

Constructor function

method Runtime New (CancellationTokenSource source) Source #

Constructor function

Parameters

param source

Cancellation token source

method Runtime New (Encoding encoding) Source #

Constructor function

Parameters

param encoding

Text encoding

method Runtime New (Encoding encoding, CancellationTokenSource source) Source #

Constructor function

Parameters

param encoding

Text encoding

param source

Cancellation token source

class RuntimeEnv Source #

Fields

field CancellationTokenSource Source Source #

field CancellationToken Token Source #

field Encoding Encoding Source #

Constructors

constructor RuntimeEnv (CancellationTokenSource source, CancellationToken token, Encoding encoding) Source #

constructor RuntimeEnv (CancellationTokenSource source, Encoding encoding) Source #

struct TextReadIO Source #

Fields

field Sys.Traits.TextReadIO Default = new TextReadIO() Source #

Methods

method ValueTask<Option<string>> ReadLine (TextReader reader) Source #

Read a line of text from the stream

method ValueTask<string> ReadToEnd (TextReader reader) Source #

Read the rest of the text in the stream

method ValueTask<int> Read (TextReader reader, Memory<char> buffer) Source #

Read chars from the stream into the buffer Returns the number of chars read

method Unit Close (TextReader reader) Source #

Close the reader

struct TimeIO Source #

Fields

field Sys.Traits.TimeIO Default = new TimeIO() Source #

Properties

property DateTime Now Source #

Current date time

property DateTime UtcNow Source #

Current date time

property DateTime Today Source #

Today's date

Methods

method ValueTask<Unit> SleepUntil (DateTime dt, CancellationToken token) Source #

Pause a task until a specified time

method ValueTask<Unit> SleepFor (TimeSpan ts, CancellationToken token) Source #

Pause a task until for a specified length of time