Difference between revisions of "Unit Shell"
Line 205: | Line 205: | ||
---- | ---- | ||
− | '' | + | |
+ | '''Shell manager''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellManager = class(TObject)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TCriticalSectionHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FShells:TLinkedList;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FCommands:TLinkedList;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function GetShell(APrevious:TShell; ALock,AUnlock:Boolean):TShell;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FindShell(const AName:String):TShell;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function RegisterShell(AShell:TShell):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DeregisterShell(AShell:TShell):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetCommand(APrevious:TShellCommand; ALock,AUnlock:Boolean):TShellCommand;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FindCommand(const AName:String):TShellCommand;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DefaultCommand:TShellCommand;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function RegisterCommand(ACommand:TShellCommand):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DeregisterCommand(ACommand:TShellCommand):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShell = class(TListObject)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FManager:TShellManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FAuthenticator:TAuthenticator;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FLock:TCriticalSectionHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FSessions:TLinkedList;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FCommands:TLinkedList;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FBanner:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FPrompt:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FError:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FName:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FHash:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FFlags:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetAuthenticator(AAuthenticator:TAuthenticator);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetBanner:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetBanner(const ABanner:String);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetPrompt:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetPrompt(const APrompt:String);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetError:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetError(const AError:String);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetName:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetName(const AName:String);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetFlags(AFlags:LongWord);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Manager:TShellManager read FManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Authenticator:TAuthenticator read FAuthenticator write SetAuthenticator;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Banner:String read GetBanner write SetBanner;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Prompt:String read GetPrompt write SetPrompt;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Error:String read GetError write SetError;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Name:String read GetName write SetName;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Hash:LongWord read FHash;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Flags:LongWord read FFlags write SetFlags;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoClear(ASession:TShellSession):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoBanner(ASession:TShellSession):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoPrompt(ASession:TShellSession):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoError(ASession:TShellSession):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoInput(ASession:TShellSession; var AInput:String):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoOutput(ASession:TShellSession; const AOutput:String):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoOutputEx(ASession:TShellSession; const AOutput:String; AReturn:Boolean):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoGetSize(ASession:TShellSession; var ARows,ACols:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoSetSize(ASession:TShellSession; ARows,ACols:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoGetCursor(ASession:TShellSession; var ARow,ACol:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoSetCursor(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoGetColors(ASession:TShellSession; var AForecolor,ABackcolor:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoSetColors(ASession:TShellSession; AForecolor,ABackcolor:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoGetCoordinates(ASession:TShellSession; var ARow,ACol:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoSetCoordinates(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetSession(APrevious:TShellSession; ALock,AUnlock:Boolean):TShellSession;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FindSession(AIdentifier:LongWord):TShellSession;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function CreateSession(AIdentifier:LongWord):TShellSession;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DestroySession(ASession:TShellSession):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function RegisterSession(ASession:TShellSession):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DeregisterSession(ASession:TShellSession):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetCommand(APrevious:TShellCommand; ALock,AUnlock:Boolean):TShellCommand;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FindCommand(const AName:String):TShellCommand;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DefaultCommand:TShellCommand;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function RegisterCommand(ACommand:TShellCommand):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DeregisterCommand(ACommand:TShellCommand):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function MatchCommand(const ACommand:String; var AContinue:Boolean):TShellCommand; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessCommand(ASession:TShellSession; const ACommand:String):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function CommandName(const ACommand:String):String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CommandSplit(const ACommand:String):TStrings;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CommandParse(const ACommand:String; var AName:String; var AParameters:TStrings):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CommandIndex(AIndex:Integer; const ACommand:String):String;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ParameterIndex(AIndex:Integer; AParameters:TStrings):String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ParameterValue(const AParameter:String; AParameters:TStrings):String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ParameterExists(const AParameter:String; AParameters:TStrings):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ParameterValueEx(const AParameter:String; AParameters:TStrings; APlus,AMinus:Boolean):String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ParameterExistsEx(const AParameter:String; AParameters:TStrings; APlus,AMinus:Boolean):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddOutput(var AOutput:String; ACol:LongWord; const AValue:String):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell session''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellSession = class(TListObject)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create(AShell:TShell; AIdentifier:LongWord);</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FShell:TShell;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FLock:TCriticalSectionHandle; </code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FIdentifier:LongWord;</code> | ||
+ | | Unique identifier for this session | ||
+ | |- | ||
+ | | <code>FFlags:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FPrompt:String;</code> | ||
+ | | Current prompt for this session | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FData:Pointer;</code> | ||
+ | | Shell private data for this session | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetFlags(AFlags:LongWord);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetData(AData:Pointer);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetPrompt:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetPrompt(const APrompt:String);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Shell:TShell read FShell;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Identifier:LongWord read FIdentifier;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Flags:LongWord read FFlags write SetFlags;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Prompt:String read GetPrompt write SetPrompt;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Data:Pointer read FData write SetData;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommand = class(TListObject)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FManager:TShellManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FLock:TCriticalSectionHandle; </code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FAliases:TLinkedList;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FName:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FHash:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FFlags:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetName:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetName(const AName:String);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetFlags(AFlags:LongWord);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Manager:TShellManager read FManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Name:String read GetName write SetName;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Hash:LongWord read FHash;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Flags:LongWord read FFlags write SetFlags;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoDefault(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoExtended(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetAlias(APrevious:TShellAlias; ALock,AUnlock:Boolean):TShellAlias;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FindAlias(const AName:String):TShellAlias;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function RegisterAlias(AAlias:TShellAlias):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DeregisterAlias(AAlias:TShellAlias):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell alias''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellAlias = class(TListObject)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TCriticalSectionHandle; </code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FName:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FHash:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FFlags:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetName:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetName(const AName:String);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetFlags(AFlags:LongWord);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Name:String read GetName write SetName;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Hash:LongWord read FHash;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Flags:LongWord read FFlags write SetFlags;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command help''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandHelp = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command information''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandInfo = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command version''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandVer = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command time''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandTime = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command clear''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandClear = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command restart''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandRestart = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command shutdown''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandShutdown = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command uptime''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandUptime = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command threads''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandThreads = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command memory''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandMemory = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''Shell command devices''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TShellCommandDevices = class(TShellCommand)</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 05:15, 21 March 2017
Return to Unit Reference
Contents
Description
Ultibo Generic Shell unit
To be documented
Constants
SHELL_*
SHELL_LINE_END = Chr(13) + Chr(10); {CR LF}
|
|
SHELL_DEFAULT_BANNER = 'Ultibo Core (Release: ' + ULTIBO_RELEASE_NAME + ' Version: ' + ULTIBO_RELEASE_VERSION + ' Date: ' + ULTIBO_RELEASE_DATE + ')';
|
|
SHELL_DEFAULT_PROMPT = '>';
|
|
SHELL_DEFAULT_ERROR = 'Huh?';
|
SHELL_FLAG_*
SHELL_FLAG_NONE = $00000000;
|
|
SHELL_FLAG_CLEAR = $00000001;
|
|
SHELL_FLAG_SIZE = $00000002;
|
|
SHELL_FLAG_CURSOR = $00000004;
|
|
SHELL_FLAG_COLORS = $00000008;
|
|
SHELL_FLAG_COORDINATES = $00000010;
|
SHELL_SESSION_FLAG_*
SHELL_SESSION_FLAG_NONE = $00000000;
|
SHELL_COMMAND_FLAG_*
SHELL_COMMAND_FLAG_NONE = $00000000;
|
|
SHELL_COMMAND_FLAG_HIDDEN = $00000001;
|
Hidden command, do not show in HELP or INFO |
SHELL_COMMAND_FLAG_HELP = $00000002;
|
Command has HELP available |
SHELL_COMMAND_FLAG_INFO = $00000004;
|
Command has INFO available |
SHELL_COMMAND_FLAG_DEFAULT = $00000008;
|
Default command, pass unknown commands to this before showing error |
SHELL_COMMAND_FLAG_EXTENDED = $00000008;
|
Extended command, pass command name to command for extended handling |
SHELL_ALIAS_FLAG_*
SHELL_ALIAS_FLAG_NONE = $00000000;
|
|
SHELL_ALIAS_FLAG_HIDDEN = $00000001;
|
Hidden alias, do not show in HELP or INFO |
SHELL_COMMAND_*
SHELL_COMMAND_HELP = 'HELP';
|
|
SHELL_COMMAND_INFO = 'INFO';
|
|
SHELL_COMMAND_VER = 'VER';
|
|
SHELL_COMMAND_TIME = 'TIME';
|
|
SHELL_COMMAND_CLS = 'CLS';
|
|
SHELL_COMMAND_RESTART = 'RESTART';
|
|
SHELL_COMMAND_SHUTDOWN = 'SHUTDOWN';
|
|
SHELL_COMMAND_CPU = 'CPU';
|
|
SHELL_COMMAND_UPTIME = 'UPTIME';
|
|
SHELL_COMMAND_WORKER = 'WORKER';
|
|
SHELL_COMMAND_THREAD = 'THREAD';
|
|
SHELL_COMMAND_MEMORY = 'MEMORY';
|
|
SHELL_COMMAND_DEVICE = 'DEVICE';
|
SHELL_ALIAS_*
SHELL_ALIAS_HELP = '?';
|
|
SHELL_ALIAS_VERSION = 'VERSION';
|
|
SHELL_ALIAS_CLEAR = 'CLEAR';
|
SHELL_LOG_*
SHELL_LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;
|
Shell debugging messages |
SHELL_LOG_LEVEL_INFO = LOG_LEVEL_INFO;
|
Shell informational messages |
SHELL_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;
|
Shell error messages |
SHELL_LOG_LEVEL_NONE = LOG_LEVEL_NONE;
|
No Shell messages |
Type definitions
None defined
Class definitions
Shell manager
TShellManager = class(TObject)
public
| |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TCriticalSectionHandle;
|
|
FShells:TLinkedList;
|
|
FCommands:TLinkedList;
|
|
protected
| |
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
public
| |
function GetShell(APrevious:TShell; ALock,AUnlock:Boolean):TShell;
|
|
function FindShell(const AName:String):TShell;
|
|
function RegisterShell(AShell:TShell):Boolean;
|
|
function DeregisterShell(AShell:TShell):Boolean;
|
|
function GetCommand(APrevious:TShellCommand; ALock,AUnlock:Boolean):TShellCommand;
|
|
function FindCommand(const AName:String):TShellCommand;
|
|
function DefaultCommand:TShellCommand;
|
|
function RegisterCommand(ACommand:TShellCommand):Boolean;
|
|
function DeregisterCommand(ACommand:TShellCommand):Boolean;
|
Shell
TShell = class(TListObject)
public
| |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FManager:TShellManager;
|
|
FAuthenticator:TAuthenticator;
|
|
FLock:TCriticalSectionHandle;
|
|
FSessions:TLinkedList;
|
|
FCommands:TLinkedList;
|
|
FBanner:String;
|
|
FPrompt:String;
|
|
FError:String;
|
|
FName:String;
|
|
FHash:LongWord;
|
|
FFlags:LongWord;
|
|
procedure SetAuthenticator(AAuthenticator:TAuthenticator);
|
|
function GetBanner:String;
|
|
procedure SetBanner(const ABanner:String);
|
|
function GetPrompt:String;
|
|
procedure SetPrompt(const APrompt:String);
|
|
function GetError:String;
|
|
procedure SetError(const AError:String);
|
|
function GetName:String;
|
|
procedure SetName(const AName:String);
|
|
procedure SetFlags(AFlags:LongWord);
|
|
protected
| |
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
public
| |
property Manager:TShellManager read FManager;
|
|
property Authenticator:TAuthenticator read FAuthenticator write SetAuthenticator;
|
|
property Banner:String read GetBanner write SetBanner;
|
|
property Prompt:String read GetPrompt write SetPrompt;
|
|
property Error:String read GetError write SetError;
|
|
property Name:String read GetName write SetName;
|
|
property Hash:LongWord read FHash;
|
|
property Flags:LongWord read FFlags write SetFlags;
|
|
function DoClear(ASession:TShellSession):Boolean; virtual;
|
|
function DoBanner(ASession:TShellSession):Boolean; virtual;
|
|
function DoPrompt(ASession:TShellSession):Boolean; virtual;
|
|
function DoError(ASession:TShellSession):Boolean; virtual;
|
|
function DoInput(ASession:TShellSession; var AInput:String):Boolean; virtual;
|
|
function DoOutput(ASession:TShellSession; const AOutput:String):Boolean; virtual;
|
|
function DoOutputEx(ASession:TShellSession; const AOutput:String; AReturn:Boolean):Boolean; virtual;
|
|
function DoGetSize(ASession:TShellSession; var ARows,ACols:LongWord):Boolean; virtual;
|
|
function DoSetSize(ASession:TShellSession; ARows,ACols:LongWord):Boolean; virtual;
|
|
function DoGetCursor(ASession:TShellSession; var ARow,ACol:LongWord):Boolean; virtual;
|
|
function DoSetCursor(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;
|
|
function DoGetColors(ASession:TShellSession; var AForecolor,ABackcolor:LongWord):Boolean; virtual;
|
|
function DoSetColors(ASession:TShellSession; AForecolor,ABackcolor:LongWord):Boolean; virtual;
|
|
function DoGetCoordinates(ASession:TShellSession; var ARow,ACol:LongWord):Boolean; virtual;
|
|
function DoSetCoordinates(ASession:TShellSession; ARow,ACol:LongWord):Boolean; virtual;
|
|
function GetSession(APrevious:TShellSession; ALock,AUnlock:Boolean):TShellSession;
|
|
function FindSession(AIdentifier:LongWord):TShellSession;
|
|
function CreateSession(AIdentifier:LongWord):TShellSession;
|
|
function DestroySession(ASession:TShellSession):Boolean;
|
|
function RegisterSession(ASession:TShellSession):Boolean;
|
|
function DeregisterSession(ASession:TShellSession):Boolean;
|
|
function GetCommand(APrevious:TShellCommand; ALock,AUnlock:Boolean):TShellCommand;
|
|
function FindCommand(const AName:String):TShellCommand;
|
|
function DefaultCommand:TShellCommand;
|
|
function RegisterCommand(ACommand:TShellCommand):Boolean;
|
|
function DeregisterCommand(ACommand:TShellCommand):Boolean;
|
|
function MatchCommand(const ACommand:String; var AContinue:Boolean):TShellCommand; virtual;
|
|
function ProcessCommand(ASession:TShellSession; const ACommand:String):Boolean; virtual;
|
|
function CommandName(const ACommand:String):String;
|
|
function CommandSplit(const ACommand:String):TStrings;
|
|
function CommandParse(const ACommand:String; var AName:String; var AParameters:TStrings):Boolean;
|
|
function CommandIndex(AIndex:Integer; const ACommand:String):String;
|
|
function ParameterIndex(AIndex:Integer; AParameters:TStrings):String;
|
|
function ParameterValue(const AParameter:String; AParameters:TStrings):String;
|
|
function ParameterExists(const AParameter:String; AParameters:TStrings):Boolean;
|
|
function ParameterValueEx(const AParameter:String; AParameters:TStrings; APlus,AMinus:Boolean):String;
|
|
function ParameterExistsEx(const AParameter:String; AParameters:TStrings; APlus,AMinus:Boolean):Boolean;
|
|
function AddOutput(var AOutput:String; ACol:LongWord; const AValue:String):Boolean;
|
Shell session
TShellSession = class(TListObject)
public
| |
constructor Create(AShell:TShell; AIdentifier:LongWord);
|
|
destructor Destroy; override;
|
|
private
| |
FShell:TShell;
|
|
FLock:TCriticalSectionHandle;
|
|
FIdentifier:LongWord;
|
Unique identifier for this session |
FFlags:LongWord;
|
|
FPrompt:String;
|
Current prompt for this session |
FData:Pointer;
|
Shell private data for this session |
procedure SetFlags(AFlags:LongWord);
|
|
procedure SetData(AData:Pointer);
|
|
function GetPrompt:String;
|
|
procedure SetPrompt(const APrompt:String);
|
|
protected
| |
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
public
| |
property Shell:TShell read FShell;
|
|
property Identifier:LongWord read FIdentifier;
|
|
property Flags:LongWord read FFlags write SetFlags;
|
|
property Prompt:String read GetPrompt write SetPrompt;
|
|
property Data:Pointer read FData write SetData;
|
Shell command
TShellCommand = class(TListObject)
public
| |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FManager:TShellManager;
|
|
FLock:TCriticalSectionHandle;
|
|
FAliases:TLinkedList;
|
|
FName:String;
|
|
FHash:LongWord;
|
|
FFlags:LongWord;
|
|
function GetName:String;
|
|
procedure SetName(const AName:String);
|
|
procedure SetFlags(AFlags:LongWord);
|
|
protected
| |
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
public
| |
property Manager:TShellManager read FManager;
|
|
property Name:String read GetName write SetName;
|
|
property Hash:LongWord read FHash;
|
|
property Flags:LongWord read FFlags write SetFlags;
|
|
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; virtual;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; virtual;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; virtual;
|
|
function DoDefault(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings):Boolean; virtual;
|
|
function DoExtended(AShell:TShell; ASession:TShellSession; const AName:String; AParameters:TStrings):Boolean; virtual;
|
|
function GetAlias(APrevious:TShellAlias; ALock,AUnlock:Boolean):TShellAlias;
|
|
function FindAlias(const AName:String):TShellAlias;
|
|
function RegisterAlias(AAlias:TShellAlias):Boolean;
|
|
function DeregisterAlias(AAlias:TShellAlias):Boolean;
|
Shell alias
TShellAlias = class(TListObject)
public
| |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TCriticalSectionHandle;
|
|
FName:String;
|
|
FHash:LongWord;
|
|
FFlags:LongWord;
|
|
function GetName:String;
|
|
procedure SetName(const AName:String);
|
|
procedure SetFlags(AFlags:LongWord);
|
|
protected
| |
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
public
| |
property Name:String read GetName write SetName;
|
|
property Hash:LongWord read FHash;
|
|
property Flags:LongWord read FFlags write SetFlags;
|
Shell command help
TShellCommandHelp = class(TShellCommand)
public
| |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
public
| |
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
Shell command information
TShellCommandInfo = class(TShellCommand)
public
| |
constructor Create;
|
|
private
| |
public
| |
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Shell command version
TShellCommandVer = class(TShellCommand)
public
| |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
public
| |
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Shell command time
TShellCommandTime = class(TShellCommand)
public
| |
constructor Create;
|
|
private
| |
public
| |
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Shell command clear
TShellCommandClear = class(TShellCommand)
public
| |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
public
| |
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Shell command restart
TShellCommandRestart = class(TShellCommand)
public
| |
constructor Create;
|
|
private
| |
public
| |
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Shell command shutdown
TShellCommandShutdown = class(TShellCommand)
public
| |
constructor Create;
|
|
private
| |
public
| |
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Shell command uptime
TShellCommandUptime = class(TShellCommand)
public
| |
constructor Create;
|
|
private
| |
public
| |
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Shell command threads
TShellCommandThreads = class(TShellCommand)
public
| |
constructor Create;
|
|
private
| |
public
| |
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Shell command memory
TShellCommandMemory = class(TShellCommand)
public
| |
constructor Create;
|
|
private
| |
public
| |
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Shell command devices
TShellCommandDevices = class(TShellCommand)
public
| |
constructor Create;
|
|
private
| |
public
| |
function DoHelp(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoInfo(AShell:TShell; ASession:TShellSession):Boolean; override;
|
|
function DoCommand(AShell:TShell; ASession:TShellSession; AParameters:TStrings):Boolean; override;
|
Public variables
Shell logging
SHELL_DEFAULT_LOG_LEVEL:LongWord = SHELL_LOG_LEVEL_DEBUG;
|
Minimum level for Shell messages. Only messages with level greater than or equal to this will be printed. |
SHELL_LOG_ENABLED:Boolean;
|
Function declarations
Initialization functions
procedure ShellInit;
Note | None documented |
---|
Shell functions
function ShellGetShell(APrevious:TShell; ALock,AUnlock:Boolean):TShell;
Note | None documented |
---|
function ShellFindShell(const AName:String):TShell;
Note | None documented |
---|
function ShellRegisterShell(AShell:TShell):Boolean;
Note | None documented |
---|
function ShellDeregisterShell(AShell:TShell):Boolean;
Note | None documented |
---|
function ShellGetCommand(APrevious:TShellCommand; ALock,AUnlock:Boolean):TShellCommand;
Note | None documented |
---|
function ShellFindCommand(const AName:String):TShellCommand;
Note | None documented |
---|
function ShellRegisterCommand(ACommand:TShellCommand):Boolean;
Note | None documented |
---|
function ShellDeregisterCommand(ACommand:TShellCommand):Boolean;
Note | None documented |
---|
Shell helper functions
procedure ShellLog(Level:LongWord; const AText:String);
Note | None documented |
---|
procedure ShellLogInfo(const AText:String);
Note | None documented |
---|
procedure ShellLogError(const AText:String);
Note | None documented |
---|
procedure ShellLogDebug(const AText:String);
Note | None documented |
---|
Return to Unit Reference