|
@@ -116,6 +116,7 @@ type
|
|
|
procedure tbbtnAutoOpenLastUsedClick(Sender: TObject);
|
|
|
procedure dxBarButton2Click(Sender: TObject);
|
|
|
procedure tbbtnAutoSaveProjectClick(Sender: TObject);
|
|
|
+ procedure pbtnFormatCodeClick(Sender: TObject);
|
|
|
private
|
|
|
FMainConfig: TJSONConfig;
|
|
|
FProjectConfig: TJSONConfig;
|
|
@@ -144,7 +145,7 @@ implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
-uses System.NetEncoding, System.UITypes, _EncryptStr;
|
|
|
+uses System.NetEncoding, System.UITypes, _EncryptStr, JsonDataObjects;
|
|
|
|
|
|
procedure TfrmMain.tbbtnRunClick(Sender: TObject);
|
|
|
begin
|
|
@@ -541,6 +542,56 @@ begin
|
|
|
EditorContent.PasteFromClipboard;
|
|
|
end;
|
|
|
|
|
|
+procedure TfrmMain.pbtnFormatCodeClick(Sender: TObject);
|
|
|
+var
|
|
|
+ ja: TJsonArray;
|
|
|
+ jo: TJsonObject;
|
|
|
+begin
|
|
|
+ if EditorContent.Lines.Count > 0 then
|
|
|
+ begin
|
|
|
+ if Length(EditorContent.Lines[0]) > 0 then
|
|
|
+ begin
|
|
|
+ if EditorContent.Lines[0][1] = '{' then
|
|
|
+ begin
|
|
|
+ jo := TJsonObject.Create;
|
|
|
+ try
|
|
|
+ try
|
|
|
+ jo.FromJSON(EditorContent.Lines.Text);
|
|
|
+ except
|
|
|
+ on E: Exception do
|
|
|
+ begin
|
|
|
+ MessageDlg(E.Message, mtError, [mbOK], 0);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ EditorContent.Lines.Clear;
|
|
|
+ jo.SaveToLines(EditorContent.Lines);
|
|
|
+ finally
|
|
|
+ jo.Free;
|
|
|
+ end;
|
|
|
+ end
|
|
|
+ else
|
|
|
+ if EditorContent.Lines[0][1] = '[' then
|
|
|
+ begin
|
|
|
+ ja := TJsonArray.Create;
|
|
|
+ try
|
|
|
+ try
|
|
|
+ ja.FromJSON(EditorContent.Lines.Text);
|
|
|
+ except
|
|
|
+ on E: Exception do
|
|
|
+ begin
|
|
|
+ MessageDlg(E.Message, mtError, [mbOK], 0);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ EditorContent.Lines.Clear;
|
|
|
+ ja.SaveToLines(EditorContent.Lines);
|
|
|
+ finally
|
|
|
+ ja.Free;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
procedure TfrmMain.Run;
|
|
|
var
|
|
|
dmy: string;
|
|
@@ -557,6 +608,7 @@ begin
|
|
|
begin
|
|
|
HTTP.Request.Username := edtAuthUsername.Text;
|
|
|
HTTP.Request.Password := edtAuthPassword.Text;
|
|
|
+ HTTP.Request.BasicAuthentication := True;
|
|
|
end;
|
|
|
|
|
|
if comboMethod.ItemIndex = 0 then
|