C# 클래스 Gammtek.Conduit.Text.Formatting.FormatInfoUtils

Stateless static class which exposes methods used to help format strings. This class is internal and cannot be used directly. It is rather used by other classes declared in the SysExpand.Text.Formatting namespace to help format strings.
파일 보기 프로젝트 열기: ME3Explorer/ME3Explorer 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
DefaultMaxFormattedLength int
DefaultMaximumDepth int
DefaultNullFormatted string
InfiniteLoopReport string

공개 메소드들

메소드 설명
BestTryFormat ( StringBuilder sb, string format, object arg, IEnumerable formatProviders, int &maxLength ) : bool

Attempts to format string which represents given object using series of verbose format providers. Operation ends in success when the first available format provider successfully formats the string. Operation ends in failure if none of the format providers is able to successfully format the string. Use this method to implement two-pass formatting, where in first pass single-lined formatting is attempted with restricted destination string length and in second pass multi-lined formatting without length restrictions is performed.

CombineMaxFormattedLengths ( int length1, int length2 ) : int

Combines two values of the maximum allowed formatted string length.

CopyFormatting ( VerboseFormatInfoBase src, VerboseFormatInfoBase dest ) : VerboseFormatInfoBase

Copies formatting-related property values from one verbose formatter to another one. Use this method to change active formatter so that it formats string in the way in which other formatter would do, but preserving other settings, like indentation details, maximum depth when recursively iterating through contents of the object etc.

CreateMultiLinedFormatter ( ) : VerboseFormatInfoBase

Creates new instance of verbose formatter which can be applied to format multi-lined string without any decorations. This format is applicable to objets of medium complexity. Indentation is performed using multiple whitespace characters.

CreateSimpleFormatter ( ) : VerboseFormatInfoBase

Creates new instance of verbose formatter which can be applied to format simplest possible strings. Only the first level of depth is presented in the formatted string and format is single-lined. This format is applicable to objects of unpredictable complexity, which should be presented by strings of limited length.

CreateSingleLinedFormatter ( ) : VerboseFormatInfoBase

Creates new instance of verbose formatter which formats single-lined strings.

CreateTabbedMultiLinedFormatter ( ) : VerboseFormatInfoBase

Creates new instance of verbose formatter which can be applied to format multi-lined strings without any decorations. This format is applicable to objects of medium complexity. Indentation is performed using horizontal tab characters.

CreateTreeMultiLinedFromatter ( ) : VerboseFormatInfoBase

Creates new instance of verbose formatter which can be applied to format multi-lined string which is decorated as to resemble the look of a tree structure. This format is applicable to complex objects.

ReportInfiniteLoop ( StringBuilder sb, object arg, string argName, int &maxLength ) : bool

Appends information that specified argument produces infinite loop to the given string builder.

TryAppendChar ( VerboseFormatInfoBase formatter, StringBuilder sb, char c, bool success, int &maxLength ) : bool

Tries to append character to the string builder within given amount of characters allowed. Always succeeds in multi-lined formatters.

TryAppendSpaceIfNeeded ( VerboseFormatInfoBase formatter, StringBuilder sb, bool success, int &maxLength ) : bool

Tries to append single white space if string builder doesn't end with space or new line character. Use this method to separate successive items appended to string builder.

TryAppendString ( VerboseFormatInfoBase formatter, StringBuilder sb, string s, bool success, int &maxLength ) : bool

Tries to append string to the string builder within given amount of characters allowed. Always succeeds in multi-lined formatters.

메소드 상세

BestTryFormat() 공개 정적인 메소드

Attempts to format string which represents given object using series of verbose format providers. Operation ends in success when the first available format provider successfully formats the string. Operation ends in failure if none of the format providers is able to successfully format the string. Use this method to implement two-pass formatting, where in first pass single-lined formatting is attempted with restricted destination string length and in second pass multi-lined formatting without length restrictions is performed.
public static BestTryFormat ( StringBuilder sb, string format, object arg, IEnumerable formatProviders, int &maxLength ) : bool
sb StringBuilder String builder to which formatted string is appended.
format string Format string containing formatting specifications.
arg object An object to format.
formatProviders IEnumerable /// Series of format providers which are contacted one at a time until the first performs /// formatting successfully. ///
maxLength int /// Maximum number of characters allowed to the formatter. Formatting will fail (and return false) /// if this number of characters is breached. Multi-lined formatters will ignore this parameter. /// Negative value indicates that formatter has unlimited space available. /// On output contains remaining number of characters available. ///
리턴 bool

CombineMaxFormattedLengths() 공개 정적인 메소드

Combines two values of the maximum allowed formatted string length.
public static CombineMaxFormattedLengths ( int length1, int length2 ) : int
length1 int First maximum formatted string length; negative value indicates infinite allowed length.
length2 int Second maximum formatted string length; negative value indicates infinite allowed length.
리턴 int

CopyFormatting() 공개 정적인 메소드

Copies formatting-related property values from one verbose formatter to another one. Use this method to change active formatter so that it formats string in the way in which other formatter would do, but preserving other settings, like indentation details, maximum depth when recursively iterating through contents of the object etc.
public static CopyFormatting ( VerboseFormatInfoBase src, VerboseFormatInfoBase dest ) : VerboseFormatInfoBase
src VerboseFormatInfoBase Formatter from which formatting property values are copied.
dest VerboseFormatInfoBase Formatter into which formatting property values are copied.
리턴 VerboseFormatInfoBase

CreateMultiLinedFormatter() 공개 정적인 메소드

Creates new instance of verbose formatter which can be applied to format multi-lined string without any decorations. This format is applicable to objets of medium complexity. Indentation is performed using multiple whitespace characters.
public static CreateMultiLinedFormatter ( ) : VerboseFormatInfoBase
리턴 VerboseFormatInfoBase

CreateSimpleFormatter() 공개 정적인 메소드

Creates new instance of verbose formatter which can be applied to format simplest possible strings. Only the first level of depth is presented in the formatted string and format is single-lined. This format is applicable to objects of unpredictable complexity, which should be presented by strings of limited length.
public static CreateSimpleFormatter ( ) : VerboseFormatInfoBase
리턴 VerboseFormatInfoBase

CreateSingleLinedFormatter() 공개 정적인 메소드

Creates new instance of verbose formatter which formats single-lined strings.
public static CreateSingleLinedFormatter ( ) : VerboseFormatInfoBase
리턴 VerboseFormatInfoBase

CreateTabbedMultiLinedFormatter() 공개 정적인 메소드

Creates new instance of verbose formatter which can be applied to format multi-lined strings without any decorations. This format is applicable to objects of medium complexity. Indentation is performed using horizontal tab characters.
public static CreateTabbedMultiLinedFormatter ( ) : VerboseFormatInfoBase
리턴 VerboseFormatInfoBase

CreateTreeMultiLinedFromatter() 공개 정적인 메소드

Creates new instance of verbose formatter which can be applied to format multi-lined string which is decorated as to resemble the look of a tree structure. This format is applicable to complex objects.
public static CreateTreeMultiLinedFromatter ( ) : VerboseFormatInfoBase
리턴 VerboseFormatInfoBase

ReportInfiniteLoop() 공개 정적인 메소드

Appends information that specified argument produces infinite loop to the given string builder.
public static ReportInfiniteLoop ( StringBuilder sb, object arg, string argName, int &maxLength ) : bool
sb StringBuilder String builder to which information about the argument is appended.
arg object /// Value which has already been appended to in the current line of /// references and should not be visited again or infinite loop would be formed. ///
argName string Optional name of the instance which is reported, if available.
maxLength int /// Maximum number of characters allowed to the formatter. Formatting will fail (and return false) /// if this number of characters is breached. Multi-lined formatters will ignore this parameter. /// Negative value indicates that formatter has unlimited space available. On output contains remaining number of characters available. ///
리턴 bool

TryAppendChar() 공개 정적인 메소드

Tries to append character to the string builder within given amount of characters allowed. Always succeeds in multi-lined formatters.
public static TryAppendChar ( VerboseFormatInfoBase formatter, StringBuilder sb, char c, bool success, int &maxLength ) : bool
formatter VerboseFormatInfoBase Formatter which has requested character to be appended.
sb StringBuilder String builder to which string should be appended.
c char Character which should be appended.
success bool /// Indicates whether appending operations this far have been successful (true) /// or some of the previous append operations has already failed (false). If false, appending will not be attempted. ///
maxLength int /// On input contains maximum number of characters that are allowed to be appended to the string builder. /// On output indicates remaining character positions allowed before appending will fail. ///
리턴 bool

TryAppendSpaceIfNeeded() 공개 정적인 메소드

Tries to append single white space if string builder doesn't end with space or new line character. Use this method to separate successive items appended to string builder.
public static TryAppendSpaceIfNeeded ( VerboseFormatInfoBase formatter, StringBuilder sb, bool success, int &maxLength ) : bool
formatter VerboseFormatInfoBase Formatter which has requested character to be appended.
sb StringBuilder String builder to which whitespace is appended.
success bool /// Indicates whether appending operations this far have been successful (true) /// or some of the previous append operations has already failed (false). If false, appending will not be attempted. ///
maxLength int /// Maximum number of characters allowed to the formatter. Formatting will fail (and return false) /// if this number of characters is breached. Multi-lined formatters will ignore this parameter. /// Negative value indicates that formatter has unlimited space available. On output contains remaining number of characters available. ///
리턴 bool

TryAppendString() 공개 정적인 메소드

Tries to append string to the string builder within given amount of characters allowed. Always succeeds in multi-lined formatters.
public static TryAppendString ( VerboseFormatInfoBase formatter, StringBuilder sb, string s, bool success, int &maxLength ) : bool
formatter VerboseFormatInfoBase Formatter which has requested character to be appended.
sb StringBuilder String builder to which string should be appended.
s string String which should be appended.
success bool /// Indicates whether appending operations this far have been successful (true) /// or some of the previous append operations has already failed (false). If false, appending will not be attempted. ///
maxLength int /// On input contains maximum number of characters that are allowed to be appended to the string builder. /// On output indicates remaining character positions allowed before appending will fail. ///
리턴 bool

프로퍼티 상세

DefaultMaxFormattedLength 공개적으로 정적으로 프로퍼티

Default maximum allowed length of the single-lined string produced by verbose format providers.
public static int DefaultMaxFormattedLength
리턴 int

DefaultMaximumDepth 공개적으로 정적으로 프로퍼티

Maximum depth applied to formatting if no other depth is specified.
public static int DefaultMaximumDepth
리턴 int

DefaultNullFormatted 공개적으로 정적으로 프로퍼티

Default string shown when null value should be represented.
public static string DefaultNullFormatted
리턴 string

InfiniteLoopReport 공개적으로 정적으로 프로퍼티

String used to report circular reference when formatting string.
public static string InfiniteLoopReport
리턴 string