Namespace Neon.Common
Classes
AppDomainExtensions
Implements AppDomain extension methods.
Block
Used to reference a block in a BlockArray or BlockStream.
BlockArray
Implements an array of Block instances.
ByteEncoding
Implements a text encoding that simply reads and writes bytes without any changes. This corresponds to the Windows codepage 1252.
ByteUnits
Converts a size string with optional units into a count.
K or KB | 1,000 |
Ki or kiB | 1,024 |
M or MB | 1000000 |
Mi or MiB | 1,048,576 |
G or GB | 1,000,000,000 |
Gi or GiB | 1,073,741,824 |
T or TB | 1,000,000,000,000 |
Ti or TiB | 1,099,511,627,776 |
P or PB | 1,000,000,000,000,000 |
Pi or PiB | 1,125,899,906,842,624 |
E or EB | 1,000,000,000,000,000,000 |
Ei or EiB | 1,152,921,504,606,846,976 |
CommandLine
Performs common operations on application a DOS or Linux command line.
CommandLine.OptionDefinition
Associates one or more option names with a default value.
Credentials
Used to persist credentials.
DateTimeExtensions
DateTime extensions.
EnumExtensions
Enum extensions.
EnvironmentParser
Handles parsing of environment variables by default or optionally variables
from a custom source. This has built-in methods for parsing: int
,
long
, double
, TimeSpan
, string
and enum
variables as well as mechanisms to parse custom types.
note
This class logs details about parsed variables. By default, these logs include
actual value that could not be parsed. This may not be desirable for variables
defining secrets. Pass redact: true
for these cases.
When debugging, it's useful to ignore redact
arguments and include
these values in any logged events anyway. You can accomplish this by setting
the NEON_REDACT_OVERRIDE=1
environment variable.
IMPORTANT: Never set NEON_REDACT_OVERRIDE=1
for production.
ExceptionExtensions
Exception extensions.
ExecuteException
Thrown by EnsureSuccess(bool) if the executed command did not return a zero exit code.
ExecuteResponse
Holds the process exit code and captured standard output from a process launched by any of the ExecuteCapture(string, object[], TimeSpan?, Process, string, bool, Dictionary<string, string>, Action<string>, Action<string>, TextReader, Encoding, Action<Process>) related methods.
GlobPattern
Implements a very simple glob matcher inspired by the GitHub .gitignore
patterns
described here.
HttpClientExtensions
HttpClient extension methods, mostly related to easily supporting custom headers.
HttpResponseMessageExtensions
Implements HttpResponseMessage extension methods.
IEnumerableExtensions
IEnumerable<T> extension methods.
IOExtensions
Implements I/O related class extensions.
IStaticDirectoryExtensions
Extension methods for IStaticDirectory.
LabelSelector
Implements label related utilities.
LabelSelector<TItem>
Implements a Kubernetes compatible general purpose label-based selector mechanism that can select a set of items from a collection based on the set of labels assigned to each item. This class supports some simple fixed query methods as well as a simple text-based query language.
This is suitable for operations like selecting Kubernetes related items by labels or annotations.
NeonAssemblyExtensions
Implements custom Assembly extension methods.
NeonExtendedHelper
Implements extended helper methods.
NeonHelper
Provides global common utilities and state.
NewtonsoftExtensions
Newtonsoft JSON Linq extensions.
NotReadyException
Indicates that a component is not ready to perform an operation but may become ready in the future.
ProcessExtensions
string extension methods.
ProgramExitException
Used to signal that a program or tool should exit.
ProgramRunner
Used to implement unit tests on command line tools by simulating their execution on a thread rather than forking the tool as a process. This is makes debugging easier and also deals with the fact that unit tests may leave orphan processes running.
RandomExtensions
Random class extension methods.
ReflectionExtensions
Reflection related extension methods.
SemanticVersion
Implements a semantic version as defined by the Semantic Versioning 2.0.0 specification. This is similar to the base Version class but includes support for pre-release identifiers as well as build information.
ServiceContainer
This class combines the capabilities of a IServiceCollection and IServiceProvider into a single object that implements the combined IServiceContainer interface.
StringBuilderExtensions
System class extensions.
StringExtensions
string extension methods.
Stub
Used in situations where an innocous parameter is required to disambiguate constructor or method overloads.
TaskExtensions
Task extension methods.
TimeSpanExtensions
TimeSpan extensions.
ToolException
Typically thrown when a tool or subprocess is executed an fails.
WeakEventController
Implements a weak event listener that allows the owner to be garbage collected if it is the only remaining link is an event handler.
YamlDotNetExtensions
YamlDotNet related class extensions.
Structs
Stub.Value
An empty value structure.
Interfaces
ILabeled
Used by LabelSelector<TItem> to retrieve the label dictionary for a specific item. Labels are simply key/value pairs assigned to an object and LabelSelector<TItem> can be used to select items based on their assigned labels.
IServiceContainer
This interface combines the capabilities of IServiceCollection and IServiceProvider to define an object that can dynamically add and remove service implementations. See the default implementation ServiceCollection for more information.
note
Implementations must be thread-safe.
Enums
CpuArchitecture
Enumerates the known CPU architectures.
HexDumpOption
Enumerates the option flags for the HexDump(byte[], int, int, int, HexDumpOption) and HexDump(byte[], int, HexDumpOption) > methods.
LabelSelectorOptions
LabelSelector<TItem> related options.
NetFramework
Enumerates the known .NET Framework implementations.
StaticZipOptions
Enumerates the ZIP options for Zip(IStaticDirectory, Stream, string, SearchOption, StaticZipOptions) and Zip(IStaticDirectory, string, string, SearchOption, StaticZipOptions). These may be bitwise ORed togther in various combinations.
TriState
Used to specify a tristate boolean with values: true, false, and default.
WindowsEdition
Enumerates the known Windows Editions.
WindowsFeatureStatus
Enumerates the possible states of an optional Windows feature.
Delegates
CommandLine.Redactor
Handles redaction of command line arguments and/or options for the ToFormatted(string, bool, bool, Redactor)
method. Return null
if no redaction is required for the item or the string to be used instead.
EnvironmentParser.Parser<T>
Attempts to parse an environment variable as a specific type.
EnvironmentParser.Validator<T>
Validates that a parsed environment variable is valid.
EnvironmentParser.VariableSource
Used for custom variable lookup implementation. This will be passed
a variable name and should return the value as a string when the variable
exists or null
if it does not.
Pass a custom implementation to the EnvironmentParser constructor when necessary.
ProgramEntrypoint
Synchronous main entry point method signature.
ProgramEntrypointAsync
Asynchronous main entry point method signature.