C# Class HFMCmd.OutputHelper

Helper class providing convenience methods that can be used with any IOutput implementations to ease output of common cases, such as: - a blank line - a single line with no field information - a single record with a single field - a line per object in an IEnumerable
ファイルを表示 Open project: agardiner/hfmcmd

Public Properties

Property Type Description
LINEBREAKS char[]
WHITESPACE char[]
WORDBREAKS char[]
_log log4net.ILog

Public Methods

Method Description
End ( this output ) : void

Convenience for the common case of not suppressing footer record

GetFieldNamesAndWidths ( object fields, int &widths ) : string[]

Converts the object[] passed to SetHeader into field names and widths. The field names are returned as a string[], while the field widths are returned in an out int[].

InitProgress ( this output, string operation ) : void

Helper method for initiating an operation whose progress will be monitored. Provides defaults for iteration (1) and total (100).

InitProgress ( this output, string operation, int iterations ) : void

Helper method for initiating an operation whose progress will be monitored. Provides default for total (100).

ShouldCancel ( ) : bool

Method that can be used by IOutput implementations to determine the appropriate value to send for the cancel return value in a call to SetProgress.

WrapText ( object value, int width ) : List

Method for wrapping text to a certain width.

WriteEnumerable ( this output, IEnumerable enumerable ) : void

Eases use of the IOutput interface for cases where we want to output a collection of records with a single column.

WriteLine ( this output ) : void

Eases use of the IOutput interface for cases where we just want to output a blank line.

WriteSingleRecord ( this output ) : void

Eases use of the IOutput interface for cases where we just want to output a single record with multiple fields.

WriteSingleValue ( this output, object value ) : void

Eases use of the IOutput interface for cases where we just want to output a single record with a single field.

Method Details

End() public static method

Convenience for the common case of not suppressing footer record
public static End ( this output ) : void
output this
return void

GetFieldNamesAndWidths() public static method

Converts the object[] passed to SetHeader into field names and widths. The field names are returned as a string[], while the field widths are returned in an out int[].
public static GetFieldNamesAndWidths ( object fields, int &widths ) : string[]
fields object
widths int
return string[]

InitProgress() public static method

Helper method for initiating an operation whose progress will be monitored. Provides defaults for iteration (1) and total (100).
public static InitProgress ( this output, string operation ) : void
output this
operation string
return void

InitProgress() public static method

Helper method for initiating an operation whose progress will be monitored. Provides default for total (100).
public static InitProgress ( this output, string operation, int iterations ) : void
output this
operation string
iterations int
return void

ShouldCancel() public static method

Method that can be used by IOutput implementations to determine the appropriate value to send for the cancel return value in a call to SetProgress.
public static ShouldCancel ( ) : bool
return bool

WrapText() public static method

Method for wrapping text to a certain width.
public static WrapText ( object value, int width ) : List
value object
width int
return List

WriteEnumerable() public static method

Eases use of the IOutput interface for cases where we want to output a collection of records with a single column.
public static WriteEnumerable ( this output, IEnumerable enumerable ) : void
output this
enumerable IEnumerable
return void

WriteLine() public static method

Eases use of the IOutput interface for cases where we just want to output a blank line.
public static WriteLine ( this output ) : void
output this
return void

WriteSingleRecord() public static method

Eases use of the IOutput interface for cases where we just want to output a single record with multiple fields.
public static WriteSingleRecord ( this output ) : void
output this
return void

WriteSingleValue() public static method

Eases use of the IOutput interface for cases where we just want to output a single record with a single field.
public static WriteSingleValue ( this output, object value ) : void
output this
value object
return void

Property Details

LINEBREAKS public_oe static_oe property

public static char[] LINEBREAKS
return char[]

WHITESPACE public_oe static_oe property

public static char[] WHITESPACE
return char[]

WORDBREAKS public_oe static_oe property

public static char[] WORDBREAKS
return char[]

_log public_oe static_oe property

public static ILog,log4net _log
return log4net.ILog