Ignore:
Timestamp:
Oct 9, 2024, 9:14:47 PM (13 days ago)
Author:
chronos
Message:
  • Added: File system file read.
  • Added: AppCode can process commands with single parameter.
Location:
branches/Independent
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/Independent

    • Property svn:ignore set to
      lib
      Independent
      Independent.lps
      Independent.res
  • branches/Independent/Apps.pas

    r64 r65  
    3232begin
    3333  with Context.Api do begin
    34     PrintHelloWorld;
     34    WriteLine('Hello World!');
    3535    Sleep(OneSecond);
    3636    RunApp('Code');
     
    4949  Name := 'Code';
    5050  Code := TStringList.Create;
    51   Code.Add('PrintHelloWorld');
    5251end;
    5352
     
    6261  I: Integer;
    6362  Line: string;
     63  Command: string;
     64  Index: Integer;
    6465begin
    6566  I := 0;
    6667  while (I >= 0) and (I < Code.Count) do begin
    67     Line := Code[I];
     68    Line := Code[I].Trim;
    6869    Inc(I);
    69     if Line = 'PrintHelloWorld' then Context.Api.PrintHelloWorld;
     70    if Line = '' then Continue;
     71
     72    Index := Pos(' ', Line);
     73    if Index > 0 then begin
     74      Command := Copy(Line, 1, Index - 1);
     75      Delete(Line, 1, Index);
     76    end else begin
     77      Command := Line;
     78      Line := '';
     79    end;
     80    if Command = 'WriteLine' then Context.Api.WriteLine(Line)
     81    else if Command = 'Sleep' then Context.Api.Sleep(StrToInt(Line))
     82    else if Command = 'RunApp' then Context.Api.RunApp(Line)
     83    else raise Exception.Create('Unsupported command ' + Command);
    7084  end;
    7185end;
Note: See TracChangeset for help on using the changeset viewer.