Class Utils
Inheritance
Namespace: AutoCheck.Core
Assembly: AutoCheck.Core.dll
Syntax
public static class Utils : object
Properties
| Improve this Doc View SourceAppFolder
Returns the current app root folder
Declaration
public static string AppFolder { get; }
Property Value
Type | Description |
---|---|
System.String | A folder's path. |
ConfigFolder
Returns the current app config folder
Declaration
public static string ConfigFolder { get; }
Property Value
Type | Description |
---|---|
System.String | A folder's path. |
CurrentOS
Returns the current OS host type (Windows; Mac; GNU/Linux)
Declaration
public static Utils.OS CurrentOS { get; }
Property Value
Type | Description |
---|---|
Utils.OS |
ExecutionFolder
Returns the current app execution folder
Declaration
public static string ExecutionFolder { get; }
Property Value
Type | Description |
---|---|
System.String | A folder's path. |
ScriptsFolder
Returns the current app scripts folder
Declaration
public static string ScriptsFolder { get; }
Property Value
Type | Description |
---|---|
System.String | A folder's path. |
TempFolder
Returns the current app config folder
Declaration
public static string TempFolder { get; }
Property Value
Type | Description |
---|---|
System.String | A folder's path. |
UtilsFolder
Returns the current app utils folder
Declaration
public static string UtilsFolder { get; }
Property Value
Type | Description |
---|---|
System.String | A folder's path. |
Methods
| Improve this Doc View SourceConfigFile(String)
Returns the requested app config file
Declaration
public static string ConfigFile(string file)
Parameters
Type | Name | Description |
---|---|---|
System.String | file |
Returns
Type | Description |
---|---|
System.String | A file's path. |
GetProductVersion(Assembly)
Returns the product version for the given assembly, which has been setup within the .csproj file.
Declaration
public static string GetProductVersion(Assembly assembly)
Parameters
Type | Name | Description |
---|---|---|
Assembly | assembly | The assembly to use. |
Returns
Type | Description |
---|---|
System.String | The product version. |
PathToCurrentOS(String)
Returns a path that uses the directory separators of the current OS.
Declaration
public static string PathToCurrentOS(string path)
Parameters
Type | Name | Description |
---|---|---|
System.String | path |
Returns
Type | Description |
---|---|
System.String | A path. |
PathToRemoteOS(String, Utils.OS)
Returns a path that uses the directory separators of the remote OS.
Declaration
public static string PathToRemoteOS(string path, Utils.OS remoteOS)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | |
Utils.OS | remoteOS |
Returns
Type | Description |
---|---|
System.String | A path. |
RemoveDiacritics(String)
Replaces the characters using diacritics with their equivalents without them (ñ->n; ü->u, etc.).
Declaration
public static string RemoveDiacritics(this string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The original string. |
Returns
Type | Description |
---|---|
System.String | The replaced string. |
RunWithRetry<T>(Action, Int32, Int32)
Runs the given action and retries it only for the given exception type (use Exception for generic behaviour).
Declaration
public static void RunWithRetry<T>(Action action, int max = 10, int wait = 250)
where T : Exception
Parameters
Type | Name | Description |
---|---|---|
Action | action | The action to run. |
System.Int32 | max | Max retries. |
System.Int32 | wait | Retry time will be exponential as step*wait. |
Type Parameters
Name | Description |
---|---|
T |
RunWithRetry<R, T>(Func<R>, Int32, Int32)
Runs the given action and retries it only for the given exception type (use Exception for generic behaviour).
Declaration
public static R RunWithRetry<R, T>(Func<R> function, int max = 10, int wait = 250)
where R : class where T : Exception
Parameters
Type | Name | Description |
---|---|---|
Func<R> | function | |
System.Int32 | max | Max retries. |
System.Int32 | wait | Retry time will be exponential as step*wait. |
Returns
Type | Description |
---|---|
R |
Type Parameters
Name | Description |
---|---|
R | |
T |
ToCamelCase(String)
Converts the string to its camelcase convention.
Declaration
public static string ToCamelCase(this string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The original input |
Returns
Type | Description |
---|---|
System.String |