C# 클래스 FastFind.ArgParser

A command line argument parsing class.
This class is based on the WordCount version from the Framework SDK samples. Any errors are mine.

There are two arrays of flags you'll pass to the constructors. The flagSymbols are supposed to be standalone switches that toggle an option on. The dataSymbols are for switches that take data values. For example, if your application needs a switch, -c, to set the count, you'd put "c" in the dataSymbols. This code will allow both "-c100" and the usual "-c" "100" both to be passed on the command line. Note that you can pass null/Nothing for dataSymbols if you don't need them.

파일 보기 프로젝트 열기: Wintellect/FastFileFinder

공개 메소드들

메소드 설명
OnUsage ( String errorInfo ) : void

Reports correct command line usage.

Parse ( String args ) : System.Boolean

Parses an arbitrary set of arguments.

보호된 메소드들

메소드 설명
OnDoneParse ( ) : SwitchStatus

Called when parsing is finished so final sanity checking can be performed.

OnNonSwitch ( String value ) : SwitchStatus

Called when a non-switch value is parsed out.

OnSwitch ( String switchSymbol, String switchValue ) : SwitchStatus

Called when a switch is parsed out.

Every derived class must implement an OnSwitch method or a switch is considered an error.

비공개 메소드들

메소드 설명
ArgParser ( String flagSymbols, String dataSymbols, System.Boolean caseSensitiveSwitches ) : System
ArgParser ( String flagSymbols, String dataSymbols, System.Boolean caseSensitiveSwitches, String switchChars ) : System
IsSwitchInArray ( String switchArray, String value ) : Int32

Looks to see if the switch is in the array.

StartsWithSwitchChar ( String value ) : System.Boolean

Looks to see if this string starts with a switch character.

메소드 상세

OnDoneParse() 보호된 메소드

Called when parsing is finished so final sanity checking can be performed.
protected OnDoneParse ( ) : SwitchStatus
리턴 SwitchStatus

OnNonSwitch() 보호된 메소드

Called when a non-switch value is parsed out.
protected OnNonSwitch ( String value ) : SwitchStatus
value String /// The value parsed out. ///
리턴 SwitchStatus

OnSwitch() 보호된 메소드

Called when a switch is parsed out.
Every derived class must implement an OnSwitch method or a switch is considered an error.
protected OnSwitch ( String switchSymbol, String switchValue ) : SwitchStatus
switchSymbol String /// The switch value parsed out. ///
switchValue String /// The value of the switch. For flag switches this is null/Nothing. ///
리턴 SwitchStatus

OnUsage() 공개 추상적인 메소드

Reports correct command line usage.
public abstract OnUsage ( String errorInfo ) : void
errorInfo String /// The string with the invalid command line option. ///
리턴 void

Parse() 공개 메소드

Parses an arbitrary set of arguments.
/// Thrown if is null. ///
public Parse ( String args ) : System.Boolean
args String /// The string array to parse through. ///
리턴 System.Boolean