C# Class Applitools.Utils.CommonUtils

Common utilities
Afficher le fichier Open project: applitools/Eyes.Sdk.DotNet

Méthodes publiques

Méthode Description
BytesToHexString ( Array array ) : string
ConvertDictionaryKeys ( Dictionary obj ) : TVal>.Dictionary
CopyUpTo ( Stream source, Stream destination, long maxBytes, int bufferSize = 1024 ) : void

Copies up to the specified maximal number of bytes to the destination stream.

DisposeIfNotNull ( IDisposable disposable ) : void

Disposes of the input object unless it is null.

DontThrow ( Action action ) : Exception

Executes the input action and returns an exception if one was thrown.

GetAssemblyTargetFramework_ ( Assembly eyesSeleniumAsm ) : string
GetAttribute ( Enum value ) : TAttribute
GetAttribute ( object value ) : TAttribute
GetDotNetVersion ( ) : string
GetEnvVar ( string envVarName ) : string
GetInnerException ( Exception ex ) : T
GetSha256Hash ( Array bytes ) : string
ReadResourceBytes ( string filename ) : byte[]
ReadResourceFile ( string filename ) : string
ReadResourceFileAsLines ( string filename ) : IList
ReadResourceStream ( string filename ) : Stream
ReadStreamAsLines ( Stream stream ) : IList
ReadToEnd ( Stream stream, int bufferSize = 1024, int length, long maxLength, Logger logger = null ) : byte[]

Returns all the bytes of the input stream.

Retry ( TimeSpan timeout, TimeSpan interval, Func action ) : bool

Runs the input action upon each expiry of interval until action returns true or timeout expires.

SanitizeUrl ( string url ) : string
ToBytesBE ( int value, Stream stream ) : void

Writes the big-endian byte representation of the input value to the target stream.

ToBytesBE ( short value, Stream stream ) : void

Writes the big-endian byte representation of the input value to the target stream.

Private Methods

Méthode Description
Equals ( ) : System

Method Details

BytesToHexString() public static méthode

public static BytesToHexString ( Array array ) : string
array Array
Résultat string

ConvertDictionaryKeys() public static méthode

public static ConvertDictionaryKeys ( Dictionary obj ) : TVal>.Dictionary
obj Dictionary
Résultat TVal>.Dictionary

CopyUpTo() public static méthode

Copies up to the specified maximal number of bytes to the destination stream.
Thrown if the source stream contains more than /// maxBytes bytes
public static CopyUpTo ( Stream source, Stream destination, long maxBytes, int bufferSize = 1024 ) : void
source Stream Source stream
destination Stream Destination stream
maxBytes long Maximal number of bytes to copy or -1 to allow /// any number of bytes to be copied
bufferSize int Size of chunks read and written
Résultat void

DisposeIfNotNull() public static méthode

Disposes of the input object unless it is null.
public static DisposeIfNotNull ( IDisposable disposable ) : void
disposable IDisposable
Résultat void

DontThrow() public static méthode

Executes the input action and returns an exception if one was thrown.
public static DontThrow ( Action action ) : Exception
action Action
Résultat Exception

GetAssemblyTargetFramework_() public static méthode

public static GetAssemblyTargetFramework_ ( Assembly eyesSeleniumAsm ) : string
eyesSeleniumAsm Assembly
Résultat string

GetAttribute() public static méthode

public static GetAttribute ( Enum value ) : TAttribute
value Enum
Résultat TAttribute

GetAttribute() public static méthode

public static GetAttribute ( object value ) : TAttribute
value object
Résultat TAttribute

GetDotNetVersion() public static méthode

public static GetDotNetVersion ( ) : string
Résultat string

GetEnvVar() public static méthode

public static GetEnvVar ( string envVarName ) : string
envVarName string
Résultat string

GetInnerException() public static méthode

public static GetInnerException ( Exception ex ) : T
ex Exception
Résultat T

GetSha256Hash() public static méthode

public static GetSha256Hash ( Array bytes ) : string
bytes Array
Résultat string

ReadResourceBytes() public static méthode

public static ReadResourceBytes ( string filename ) : byte[]
filename string
Résultat byte[]

ReadResourceFile() public static méthode

public static ReadResourceFile ( string filename ) : string
filename string
Résultat string

ReadResourceFileAsLines() public static méthode

public static ReadResourceFileAsLines ( string filename ) : IList
filename string
Résultat IList

ReadResourceStream() public static méthode

public static ReadResourceStream ( string filename ) : Stream
filename string
Résultat Stream

ReadStreamAsLines() public static méthode

public static ReadStreamAsLines ( Stream stream ) : IList
stream Stream
Résultat IList

ReadToEnd() public static méthode

Returns all the bytes of the input stream.
public static ReadToEnd ( Stream stream, int bufferSize = 1024, int length, long maxLength, Logger logger = null ) : byte[]
stream Stream
bufferSize int
length int
maxLength long
logger Logger
Résultat byte[]

Retry() public static méthode

Runs the input action upon each expiry of interval until action returns true or timeout expires.
public static Retry ( TimeSpan timeout, TimeSpan interval, Func action ) : bool
timeout TimeSpan
interval TimeSpan
action Func
Résultat bool

SanitizeUrl() public static méthode

public static SanitizeUrl ( string url ) : string
url string
Résultat string

ToBytesBE() public static méthode

Writes the big-endian byte representation of the input value to the target stream.
public static ToBytesBE ( int value, Stream stream ) : void
value int
stream Stream
Résultat void

ToBytesBE() public static méthode

Writes the big-endian byte representation of the input value to the target stream.
public static ToBytesBE ( short value, Stream stream ) : void
value short
stream Stream
Résultat void