C# Class InfoPathScraper.Reporting.CommandLineProcessor

Datei anzeigen Open project: OfficeDev/PnP-Transformation Class Usage Examples

Private Properties

Property Type Description
ExpectReadyForNewState void
HandleAppend bool
HandleArgument bool
HandleCsvFile bool
HandleFile bool
HandleFileList bool
HandleOutFile bool
HandleTextFile bool
ProcessArgState void
ProcessArgument void
VerifyArgState void

Public Methods

Method Description
CommandLineProcessor ( ) : System

Initialize collections

ProcessArguments ( string args ) : void

Process each arg and maintain of state machine in ParseState. Once all are processed, check if we could possibly succeed, then process all the info we have to fully set up our Report object.

Private Methods

Method Description
ExpectReadyForNewState ( string arg ) : void

Helper for switch processors. A switch is unexpected right after /file or /output

HandleAppend ( string arg ) : bool

Self-explanatory

HandleArgument ( string arg ) : bool

This is the trickiest one. It handles all non-switch arguments and must use the value of ParseState to decide what to do in each case. For example, in the default state it interprets an arg as a /file name. In each case it needs to know if the switch can take a list or a single parameter. Ex: '/output outfile' we need to flip back to Default state after a single arg Ex: '/file f1 f2 f3 ...' we flip back to Default state after a single arg because Default and File are handled the same Ex: '/filelist fl1 fl2 fl3 ...' we flip to WasInputFile to keep track that fl2, etc need to be treated as such, but to also be ready for other switches

HandleCsvFile ( string arg ) : bool

Self-explanatory

HandleFile ( string arg ) : bool

Self-explanatory

HandleFileList ( string arg ) : bool

Self-explanatory

HandleOutFile ( string arg ) : bool

Self-explanatory

HandleTextFile ( string arg ) : bool

Self-explanatory

ProcessArgState ( ) : void

Use the data we've collected and initialize all the info for our Report

ProcessArgument ( string argument ) : void

Per-argument step function to our state machine. Each handler communicates whether or not it's suitable to handle the argument in question. For example HandleFileList looks only for "/filelist", and returns false for all others. The assumption is that each handler knows what state to leave ParseState in.

VerifyArgState ( ) : void

Self-explanatory

Method Details

CommandLineProcessor() public method

Initialize collections
public CommandLineProcessor ( ) : System
return System

ProcessArguments() public method

Process each arg and maintain of state machine in ParseState. Once all are processed, check if we could possibly succeed, then process all the info we have to fully set up our Report object.
public ProcessArguments ( string args ) : void
args string
return void