C# Класс Applitools.Utils.CommonUtils

Common utilities
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
Equals ( ) : System

Описание методов

BytesToHexString() публичный статический Метод

public static BytesToHexString ( Array array ) : string
array Array
Результат string

ConvertDictionaryKeys() публичный статический Метод

public static ConvertDictionaryKeys ( Dictionary obj ) : TVal>.Dictionary
obj Dictionary
Результат TVal>.Dictionary

CopyUpTo() публичный статический Метод

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
Результат void

DisposeIfNotNull() публичный статический Метод

Disposes of the input object unless it is null.
public static DisposeIfNotNull ( IDisposable disposable ) : void
disposable IDisposable
Результат void

DontThrow() публичный статический Метод

Executes the input action and returns an exception if one was thrown.
public static DontThrow ( Action action ) : Exception
action Action
Результат Exception

GetAssemblyTargetFramework_() публичный статический Метод

public static GetAssemblyTargetFramework_ ( Assembly eyesSeleniumAsm ) : string
eyesSeleniumAsm Assembly
Результат string

GetAttribute() публичный статический Метод

public static GetAttribute ( Enum value ) : TAttribute
value Enum
Результат TAttribute

GetAttribute() публичный статический Метод

public static GetAttribute ( object value ) : TAttribute
value object
Результат TAttribute

GetDotNetVersion() публичный статический Метод

public static GetDotNetVersion ( ) : string
Результат string

GetEnvVar() публичный статический Метод

public static GetEnvVar ( string envVarName ) : string
envVarName string
Результат string

GetInnerException() публичный статический Метод

public static GetInnerException ( Exception ex ) : T
ex Exception
Результат T

GetSha256Hash() публичный статический Метод

public static GetSha256Hash ( Array bytes ) : string
bytes Array
Результат string

ReadResourceBytes() публичный статический Метод

public static ReadResourceBytes ( string filename ) : byte[]
filename string
Результат byte[]

ReadResourceFile() публичный статический Метод

public static ReadResourceFile ( string filename ) : string
filename string
Результат string

ReadResourceFileAsLines() публичный статический Метод

public static ReadResourceFileAsLines ( string filename ) : IList
filename string
Результат IList

ReadResourceStream() публичный статический Метод

public static ReadResourceStream ( string filename ) : Stream
filename string
Результат Stream

ReadStreamAsLines() публичный статический Метод

public static ReadStreamAsLines ( Stream stream ) : IList
stream Stream
Результат IList

ReadToEnd() публичный статический Метод

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
Результат byte[]

Retry() публичный статический Метод

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
Результат bool

SanitizeUrl() публичный статический Метод

public static SanitizeUrl ( string url ) : string
url string
Результат string

ToBytesBE() публичный статический Метод

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
Результат void

ToBytesBE() публичный статический Метод

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
Результат void