diff --git a/backup/main.lfm b/backup/main.lfm index 914c98f..97e7aea 100644 --- a/backup/main.lfm +++ b/backup/main.lfm @@ -1,7 +1,7 @@ object GUIForm: TGUIForm - Left = 2260 + Left = 2255 Height = 668 - Top = 311 + Top = 312 Width = 1014 AlphaBlendValue = 128 Caption = 'microM8 GUI' diff --git a/backup/main.pas b/backup/main.pas index 7653d6d..8d1d925 100644 --- a/backup/main.pas +++ b/backup/main.pas @@ -469,6 +469,7 @@ type procedure UpdateColorMode; procedure UpdateTintMode; function SimpleGet(url:String): string; + function SimpleGetInt(url:String): integer; procedure LaunchDisk(disk: string); procedure LaunchCommand(dialect: string; path: string; command: string); procedure SimpleFormPost(url: String; body: string; var resp: TStringStream); @@ -914,7 +915,7 @@ end; procedure TGUIForm.miDisk2WPToggleClick(Sender: TObject); begin - + SimpleGet( baseUrl + '/api/control/hardware/disk/wp/1/toggle' ); end; procedure TGUIForm.miDiskMenuWPClick(Sender: TObject); @@ -2046,6 +2047,10 @@ end; function TGUIForm.SimpleGet(url:string): string; begin result := '0'; + + if not MicroM8Process.Active then + exit; + try result := self.httpc.Get(url) except @@ -2055,6 +2060,22 @@ begin end; end; +function TGUIForm.SimpleGetInt(url:string): integer; +begin + result := 0; + + if not MicroM8Process.Active then + exit; + + try + result := StrToInt(self.httpc.Get(url)) + except + on e: Exception do begin + // nothing much + end; + end; +end; + procedure TGUIForm.SimpleGetStream(url:string; var S: TMemoryStream); begin try diff --git a/lib/x86_64-win64/main.o b/lib/x86_64-win64/main.o index e221d24..5c452e2 100644 Binary files a/lib/x86_64-win64/main.o and b/lib/x86_64-win64/main.o differ diff --git a/lib/x86_64-win64/main.ppu b/lib/x86_64-win64/main.ppu index 6690fd2..a7180dc 100644 Binary files a/lib/x86_64-win64/main.ppu and b/lib/x86_64-win64/main.ppu differ diff --git a/lib/x86_64-win64/poc.obj b/lib/x86_64-win64/poc.obj index aa79ef6..35cc854 100644 Binary files a/lib/x86_64-win64/poc.obj and b/lib/x86_64-win64/poc.obj differ diff --git a/main.pas b/main.pas index a0aefe9..f1dcbcc 100644 --- a/main.pas +++ b/main.pas @@ -469,6 +469,7 @@ type procedure UpdateColorMode; procedure UpdateTintMode; function SimpleGet(url:String): string; + function SimpleGetInt(url:String): integer; procedure LaunchDisk(disk: string); procedure LaunchCommand(dialect: string; path: string; command: string); procedure SimpleFormPost(url: String; body: string; var resp: TStringStream); @@ -2046,6 +2047,10 @@ end; function TGUIForm.SimpleGet(url:string): string; begin result := '0'; + + if not MicroM8Process.Active then + exit; + try result := self.httpc.Get(url) except @@ -2055,8 +2060,28 @@ begin end; end; +function TGUIForm.SimpleGetInt(url:string): integer; +begin + result := 0; + + if not MicroM8Process.Active then + exit; + + try + result := StrToInt(self.httpc.Get(url)) + except + on e: Exception do begin + // nothing much + end; + end; +end; + procedure TGUIForm.SimpleGetStream(url:string; var S: TMemoryStream); begin + + if not MicroM8Process.Active then + exit; + try self.httpc.Get(url, S) except @@ -2069,6 +2094,8 @@ end; procedure TGUIForm.SimpleFormPost( url: string; body: string; var resp: TStringStream ); begin + if not MicroM8Process.Active then + exit; try self.httpc.SimpleFormPost(url,body,resp) except