Pārlūkot izejas kodu

Rewritten config file and bugfix deleting presets

Simon Grossenbacher 7 gadi atpakaļ
vecāks
revīzija
c78502e36a

+ 11 - 10
Example Config.rdproj

@@ -1,9 +1,10 @@
 {
 	"Presets": {
-		"Presets": "GET: Simple GET\r\nGET: GET Extra Headers\r\nGET: Use Basic Auth Example\r\nGET: Example URL Parameters\r\nPOST: Json Post Data\r\nDELETE: Delete Data\r\nPUT: Json Put Data\r\nPATCH: Json Patch Data\r\n",
-		"LastUsed": 4
+		"Presets": "faf2be76254543f9ad9cc8fca91cef5e:R0VUOiBTaW1wbGUgR0VU\r\n7d37b798c22748eebf92ffa281ba982a:R0VUOiBHRVQgRXh0cmEgSGVhZGVycw==\r\n777045dda27d466fab6c051d3e8094e8:R0VUOiBVc2UgQmFzaWMgQXV0aCBFeGFtcGxl\r\na0745bab53eb4c78a6034f1a9d4559de:R0VUOiBFeGFtcGxlIFVSTCBQYXJhbWV0ZXJz\r\n292047e733934bc48429c4d746cae53a:UE9TVDogSnNvbiBQb3N0IERhdGE=\r\nc02b437c22474cf7b44a96c72f430f18:REVMRVRFOiBEZWxldGUgRGF0YQ==\r\n9609fe373b9b4865a2ea83a3dd35be30:UFVUOiBKc29uIFB1dCBEYXRh\r\ncbbcebba6f30425caec540f517cb3524:UEFUQ0g6IEpzb24gUGF0Y2ggRGF0YQ==\r\n",
+		"LastUsed": 0,
+		"ConfigVersion": 2
 	},
-	"Preset_0": {
+	"Preset_faf2be76254543f9ad9cc8fca91cef5e": {
 		"BaseURL": "https://httpbin.org/get",
 		"Method": 0,
 		"URLParams": "",
@@ -14,7 +15,7 @@
 		"AuthUsername": "",
 		"AuthPassword": ""
 	},
-	"Preset_1": {
+	"Preset_7d37b798c22748eebf92ffa281ba982a": {
 		"BaseURL": "https://httpbin.org/headers",
 		"Method": 0,
 		"URLParams": "",
@@ -25,7 +26,7 @@
 		"AuthUsername": "",
 		"AuthPassword": ""
 	},
-	"Preset_2": {
+	"Preset_777045dda27d466fab6c051d3e8094e8": {
 		"BaseURL": "https://httpbin.org/basic-auth/user/pwd",
 		"Method": 0,
 		"URLParams": "",
@@ -36,7 +37,7 @@
 		"AuthUsername": "3f0k+uBHWf2sPtwW4tYMUA==",
 		"AuthPassword": "C35R83xuSqKQ93OJME1BZA=="
 	},
-	"Preset_3": {
+	"Preset_a0745bab53eb4c78a6034f1a9d4559de": {
 		"BaseURL": "https://httpbin.org/get",
 		"Method": 0,
 		"URLParams": "arg1=value1\r\narg2=value2",
@@ -47,7 +48,7 @@
 		"AuthUsername": "",
 		"AuthPassword": ""
 	},
-	"Preset_4": {
+	"Preset_292047e733934bc48429c4d746cae53a": {
 		"BaseURL": "https://httpbin.org/post",
 		"Method": 1,
 		"URLParams": "",
@@ -58,7 +59,7 @@
 		"AuthUsername": "",
 		"AuthPassword": ""
 	},
-	"Preset_5": {
+	"Preset_c02b437c22474cf7b44a96c72f430f18": {
 		"BaseURL": "http://jsonplaceholder.typicode.com/posts/1",
 		"Method": 4,
 		"URLParams": "",
@@ -69,7 +70,7 @@
 		"AuthUsername": "",
 		"AuthPassword": ""
 	},
-	"Preset_6": {
+	"Preset_9609fe373b9b4865a2ea83a3dd35be30": {
 		"BaseURL": "https://httpbin.org/put",
 		"Method": 3,
 		"URLParams": "",
@@ -80,7 +81,7 @@
 		"AuthUsername": "",
 		"AuthPassword": ""
 	},
-	"Preset_7": {
+	"Preset_cbbcebba6f30425caec540f517cb3524": {
 		"BaseURL": "https://httpbin.org/patch",
 		"Method": 2,
 		"URLParams": "",

BIN
RESTDebugger.exe


+ 9 - 9
prj/RESTDebugger.dproj

@@ -86,9 +86,9 @@
     <PropertyGroup Condition="'$(Base_Win64)'!=''">
         <UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
         <UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
-        <VerInfo_Keys>FileVersion=1.1.8.35;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
-        <VerInfo_Release>8</VerInfo_Release>
-        <VerInfo_Build>35</VerInfo_Build>
+        <VerInfo_Keys>FileVersion=1.1.9.40;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
+        <VerInfo_Release>9</VerInfo_Release>
+        <VerInfo_Build>40</VerInfo_Build>
         <Icon_MainIcon>RESTDebugger_Icon.ico</Icon_MainIcon>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
@@ -115,9 +115,9 @@
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
         <BT_BuildType>Debug</BT_BuildType>
-        <VerInfo_Keys>FileVersion=1.1.8.35;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
-        <VerInfo_Build>35</VerInfo_Build>
-        <VerInfo_Release>8</VerInfo_Release>
+        <VerInfo_Keys>FileVersion=1.1.9.40;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
+        <VerInfo_Build>40</VerInfo_Build>
+        <VerInfo_Release>9</VerInfo_Release>
         <VerInfo_Locale>1033</VerInfo_Locale>
         <AppEnableHighDPI>true</AppEnableHighDPI>
         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
@@ -140,9 +140,9 @@
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
         <BT_BuildType>Debug</BT_BuildType>
-        <VerInfo_Keys>FileVersion=1.1.8.35;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
-        <VerInfo_Release>8</VerInfo_Release>
-        <VerInfo_Build>35</VerInfo_Build>
+        <VerInfo_Keys>FileVersion=1.1.9.40;ProductVersion=1.0.0.0;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
+        <VerInfo_Release>9</VerInfo_Release>
+        <VerInfo_Build>40</VerInfo_Build>
         <AppEnableHighDPI>true</AppEnableHighDPI>
         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
         <VerInfo_Locale>1033</VerInfo_Locale>

BIN
prj/RESTDebugger.res


+ 1 - 0
prj/RESTDebugger.skincfg

@@ -53,3 +53,4 @@ dxSkinVisualStudio2013Light=0
 dxSkinVS2010=0
 dxSkinWhiteprint=0
 dxSkinXmas2008Blue=0
+dxSkinTheBezier=0

+ 6 - 6
prj/RESTDebugger.stat

@@ -1,10 +1,10 @@
 [Stats]
-EditorSecs=22911
-DesignerSecs=5716
-InspectorSecs=3066
-CompileSecs=1092704
-OtherSecs=5362
+EditorSecs=25858
+DesignerSecs=6079
+InspectorSecs=3357
+CompileSecs=1167948
+OtherSecs=5662
 StartTime=27.10.2016 18:27:37
 RealKeys=0
 EffectiveKeys=0
-DebugSecs=15554
+DebugSecs=17075

+ 85 - 47
src/_frmMain.dfm

@@ -120,25 +120,28 @@ object frmMain: TfrmMain
   end
   object PageControlResponse: TcxPageControl
     Left = 0
-    Top = 448
+    Top = 454
     Width = 725
-    Height = 462
+    Height = 456
     Align = alClient
     TabOrder = 3
     Properties.ActivePage = tabContent
     Properties.CustomButtons.Buttons = <>
-    ClientRectBottom = 460
+    ExplicitTop = 448
+    ExplicitHeight = 462
+    ClientRectBottom = 454
     ClientRectLeft = 2
     ClientRectRight = 723
     ClientRectTop = 26
     object tabContent: TcxTabSheet
       Caption = 'Response Content'
       ImageIndex = 0
+      ExplicitHeight = 434
       object EditorContent: TSynEdit
         Left = 0
         Top = 0
         Width = 721
-        Height = 434
+        Height = 428
         Align = alClient
         Font.Charset = DEFAULT_CHARSET
         Font.Color = clWindowText
@@ -158,19 +161,22 @@ object frmMain: TfrmMain
         Gutter.Font.Style = []
         Gutter.ShowLineNumbers = True
         Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceHomeKey, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoScrollPastEol, eoShowScrollHint, eoSmartTabDelete, eoTabsToSpaces]
+        RightEdgeColor = clWindow
         TabWidth = 2
         WantTabs = True
         FontSmoothing = fsmNone
+        ExplicitHeight = 434
       end
     end
     object tabHeaders: TcxTabSheet
       Caption = 'Response Headers'
       ImageIndex = 1
+      ExplicitHeight = 434
       object EditorResponseHeaders: TSynEdit
         Left = 0
         Top = 0
         Width = 721
-        Height = 434
+        Height = 428
         Align = alClient
         Font.Charset = DEFAULT_CHARSET
         Font.Color = clWindowText
@@ -190,20 +196,25 @@ object frmMain: TfrmMain
         Gutter.Font.Style = []
         Gutter.ShowLineNumbers = True
         Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceHomeKey, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoScrollPastEol, eoShowScrollHint, eoSmartTabDelete, eoTabsToSpaces]
+        RightEdgeColor = clWindow
         TabWidth = 2
         WantTabs = True
         FontSmoothing = fsmNone
+        ExplicitHeight = 434
       end
     end
   end
-  object Panel2: TPanel
+  object pnlHeader: TPanel
     Left = 0
     Top = 76
     Width = 725
-    Height = 372
+    Height = 370
     Align = alTop
     BevelOuter = bvNone
     TabOrder = 0
+    DesignSize = (
+      725
+      370)
     object Label2: TLabel
       Left = 8
       Top = 16
@@ -220,10 +231,12 @@ object frmMain: TfrmMain
     end
     object Label4: TLabel
       Left = 8
-      Top = 331
+      Top = 329
       Width = 42
       Height = 13
+      Anchors = [akLeft, akBottom]
       Caption = 'Full URL:'
+      ExplicitTop = 331
     end
     object Label6: TLabel
       Left = 8
@@ -234,16 +247,18 @@ object frmMain: TfrmMain
     end
     object edtFullURL: TcxTextEdit
       Left = 8
-      Top = 345
+      Top = 343
+      Anchors = [akLeft, akRight, akBottom]
       Properties.OnChange = edtFullURLPropertiesChange
       TabOrder = 8
-      Width = 525
+      Width = 545
     end
     object btnRun: TcxButton
-      Left = 619
-      Top = 341
+      Left = 637
+      Top = 339
       Width = 75
       Height = 25
+      Anchors = [akRight, akBottom]
       Caption = 'Run'
       OptionsImage.ImageIndex = 14
       OptionsImage.Images = cxImageList
@@ -253,16 +268,18 @@ object frmMain: TfrmMain
     object edtBaseURL: TcxTextEdit
       Left = 97
       Top = 91
+      Anchors = [akLeft, akTop, akRight]
       Properties.OnChange = edtBaseURLPropertiesChange
       TabOrder = 6
-      Width = 498
+      Width = 615
     end
     object btnAdd: TcxButton
-      Left = 478
+      Left = 593
       Top = 30
       Width = 25
       Height = 25
       Hint = 'Add Preset'
+      Anchors = [akTop, akRight]
       OptionsImage.ImageIndex = 0
       OptionsImage.Images = cxImageList
       ParentShowHint = False
@@ -271,11 +288,12 @@ object frmMain: TfrmMain
       OnClick = btnAddClick
     end
     object btnDelete: TcxButton
-      Left = 570
+      Left = 687
       Top = 30
       Width = 25
       Height = 25
       Hint = 'Delete Preset'
+      Anchors = [akTop, akRight]
       OptionsImage.ImageIndex = 3
       OptionsImage.Images = cxImageList
       ParentShowHint = False
@@ -286,17 +304,19 @@ object frmMain: TfrmMain
     object comboPresets: TcxComboBox
       Left = 8
       Top = 32
+      Anchors = [akLeft, akTop, akRight]
       Properties.DropDownListStyle = lsFixedList
       Properties.OnChange = comboPresetsPropertiesChange
       TabOrder = 0
-      Width = 464
+      Width = 579
     end
     object btnEdit: TcxButton
-      Left = 509
+      Left = 624
       Top = 30
       Width = 25
       Height = 25
       Hint = 'Edit Preset'
+      Anchors = [akTop, akRight]
       OptionsImage.ImageIndex = 2
       OptionsImage.Images = cxImageList
       ParentShowHint = False
@@ -305,11 +325,12 @@ object frmMain: TfrmMain
       OnClick = btnEditClick
     end
     object btnCopyPreset: TcxButton
-      Left = 540
+      Left = 656
       Top = 30
       Width = 25
       Height = 25
       Hint = 'Copy Preset'
+      Anchors = [akTop, akRight]
       OptionsImage.ImageIndex = 1
       OptionsImage.Images = cxImageList
       ParentShowHint = False
@@ -334,26 +355,31 @@ object frmMain: TfrmMain
     object PageControlParams: TcxPageControl
       Left = 8
       Top = 132
-      Width = 587
-      Height = 193
+      Width = 706
+      Height = 191
+      Anchors = [akLeft, akTop, akRight, akBottom]
       TabOrder = 7
       Properties.ActivePage = tabURLParams
       Properties.CustomButtons.Buttons = <>
-      ClientRectBottom = 191
+      ExplicitHeight = 193
+      ClientRectBottom = 189
       ClientRectLeft = 2
-      ClientRectRight = 585
+      ClientRectRight = 704
       ClientRectTop = 26
       object tabURLParams: TcxTabSheet
         Caption = 'URL Parameters'
         ImageIndex = 0
+        ExplicitWidth = 583
+        ExplicitHeight = 165
         object Panel3: TPanel
           Left = 0
           Top = 0
-          Width = 583
+          Width = 702
           Height = 31
           Align = alTop
           BevelOuter = bvNone
           TabOrder = 0
+          ExplicitWidth = 583
           object Label5: TLabel
             Left = 8
             Top = 8
@@ -365,9 +391,10 @@ object frmMain: TfrmMain
         object EditorURLParams: TSynEdit
           Left = 0
           Top = 27
-          Width = 583
-          Height = 138
+          Width = 702
+          Height = 136
           Align = alBottom
+          Anchors = [akLeft, akTop, akRight, akBottom]
           Font.Charset = DEFAULT_CHARSET
           Font.Color = clWindowText
           Font.Height = -13
@@ -387,23 +414,23 @@ object frmMain: TfrmMain
           Gutter.ShowLineNumbers = True
           Highlighter = SynIniSyn
           Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceHomeKey, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoScrollPastEol, eoShowScrollHint, eoSmartTabDelete, eoTabsToSpaces]
+          RightEdgeColor = clWindow
           TabWidth = 2
           WantTabs = True
           OnChange = EditorURLParamsChange
           FontSmoothing = fsmNone
+          ExplicitWidth = 583
+          ExplicitHeight = 138
         end
       end
       object cxTabSheet2: TcxTabSheet
         Caption = 'Extra Headers'
         ImageIndex = 1
-        ExplicitLeft = 0
-        ExplicitTop = 0
-        ExplicitWidth = 0
-        ExplicitHeight = 0
+        ExplicitHeight = 165
         object Panel4: TPanel
           Left = 0
           Top = 0
-          Width = 583
+          Width = 702
           Height = 31
           Align = alTop
           BevelOuter = bvNone
@@ -419,9 +446,10 @@ object frmMain: TfrmMain
         object EditorExtraHeaders: TSynEdit
           Left = 0
           Top = 27
-          Width = 583
-          Height = 138
+          Width = 702
+          Height = 136
           Align = alBottom
+          Anchors = [akLeft, akTop, akRight, akBottom]
           Font.Charset = DEFAULT_CHARSET
           Font.Color = clWindowText
           Font.Height = -13
@@ -441,18 +469,17 @@ object frmMain: TfrmMain
           Gutter.ShowLineNumbers = True
           Highlighter = SynIniSyn
           Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceHomeKey, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoScrollPastEol, eoShowScrollHint, eoSmartTabDelete, eoTabsToSpaces]
+          RightEdgeColor = clWindow
           TabWidth = 2
           WantTabs = True
           FontSmoothing = fsmNone
+          ExplicitHeight = 138
         end
       end
       object cxTabSheet3: TcxTabSheet
         Caption = 'Authentication'
         ImageIndex = 3
-        ExplicitLeft = 0
-        ExplicitTop = 0
-        ExplicitWidth = 0
-        ExplicitHeight = 0
+        ExplicitHeight = 165
         object Label9: TLabel
           Left = 15
           Top = 47
@@ -489,14 +516,11 @@ object frmMain: TfrmMain
       object tabPostData: TcxTabSheet
         Caption = 'Post Data'
         ImageIndex = 2
-        ExplicitLeft = 0
-        ExplicitTop = 0
-        ExplicitWidth = 0
-        ExplicitHeight = 0
+        ExplicitHeight = 165
         object Panel5: TPanel
           Left = 0
           Top = 0
-          Width = 583
+          Width = 702
           Height = 46
           Align = alTop
           BevelOuter = bvNone
@@ -525,9 +549,10 @@ object frmMain: TfrmMain
         object EditorPostData: TSynEdit
           Left = 0
           Top = 52
-          Width = 583
-          Height = 113
+          Width = 702
+          Height = 111
           Align = alBottom
+          Anchors = [akLeft, akTop, akRight, akBottom]
           Font.Charset = DEFAULT_CHARSET
           Font.Color = clWindowText
           Font.Height = -13
@@ -547,18 +572,21 @@ object frmMain: TfrmMain
           Gutter.ShowLineNumbers = True
           Highlighter = SynJSONSyn
           Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceHomeKey, eoEnhanceEndKey, eoGroupUndo, eoHideShowScrollbars, eoScrollPastEol, eoShowScrollHint, eoSmartTabDelete, eoTabsToSpaces]
+          RightEdgeColor = clWindow
           TabWidth = 2
           WantTabs = True
           FontSmoothing = fsmNone
+          ExplicitHeight = 113
         end
       end
     end
     object btnCopyFullURL: TcxButton
-      Left = 570
-      Top = 341
+      Left = 590
+      Top = 339
       Width = 25
       Height = 25
       Hint = 'Copy Full URL'
+      Anchors = [akRight, akBottom]
       OptionsImage.ImageIndex = 1
       OptionsImage.Images = cxImageList
       ParentShowHint = False
@@ -567,11 +595,12 @@ object frmMain: TfrmMain
       OnClick = btnCopyFullURLClick
     end
     object btnPasteFullURL: TcxButton
-      Left = 539
-      Top = 341
+      Left = 559
+      Top = 339
       Width = 25
       Height = 25
       Hint = 'Paste Full URL'
+      Anchors = [akRight, akBottom]
       OptionsImage.ImageIndex = 19
       OptionsImage.Images = cxImageList
       ParentShowHint = False
@@ -580,6 +609,15 @@ object frmMain: TfrmMain
       OnClick = btnPasteFullURLClick
     end
   end
+  object cxSplitter1: TcxSplitter
+    Left = 0
+    Top = 446
+    Width = 725
+    Height = 8
+    AlignSplitter = salBottom
+    Control = pnlHeader
+    ExplicitTop = 448
+  end
   object OpenDialog: TOpenDialog
     Filter = 'REST Debugger Project (*.rdproj)|*.rdproj'
     Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing]

+ 96 - 28
src/_frmMain.pas

@@ -15,7 +15,7 @@ uses
   dxBarBuiltInMenu, cxPC, System.ImageList, Vcl.ImgList, cxCheckBox, cxImageList,
   SynEdit, SynHighlighterJSON, SynEditHighlighter, SynHighlighterIni,
   SynHighlighterXML, SynHighlighterHtml, SynEditRegexSearch, SynEditMiscClasses,
-  SynEditSearch, _SearchTextHightlighterSynEditPlugin, SynEditTypes;
+  SynEditSearch, _SearchTextHightlighterSynEditPlugin, SynEditTypes, cxSplitter;
 
 type
   TMethodType = (mtGET, mtPOST, mtPATCH, mtPUT, mtDELETE);
@@ -47,7 +47,7 @@ type
     PageControlResponse: TcxPageControl;
     tabContent: TcxTabSheet;
     tabHeaders: TcxTabSheet;
-    Panel2: TPanel;
+    pnlHeader: TPanel;
     dxBarSubItem4: TdxBarSubItem;
     tbbtnStayOnTop: TdxBarButton;
     edtBaseURL: TcxTextEdit;
@@ -107,6 +107,7 @@ type
     SynHTMLSyn: TSynHTMLSyn;
     SynEditSearch: TSynEditSearch;
     SynEditRegexSearch: TSynEditRegexSearch;
+    cxSplitter1: TcxSplitter;
     procedure FormShow(Sender: TObject);
     procedure FormCreate(Sender: TObject);
     procedure FormDestroy(Sender: TObject);
@@ -178,6 +179,7 @@ type
     FTempProjectFile: string;
     FRoamingSavePath: string;
     FSearchFromCaret: Boolean;
+    FPresetsList: TStringList;
     FHTTP: TIdHTTP;
     function GetTempProjectFile: string;
     function GetAppVersion: string;
@@ -194,7 +196,11 @@ type
     procedure DoGETRequest(const AMethodType: TMethodType);
     procedure DoPOSTRequest(const AMethodType: TMethodType);
     procedure UpdateEditor(const AText: string);
+    procedure UpdatePresetsCombobox;
     procedure CheckForUpdate;
+    function GenerateGuid: string;
+    function Encode(const AText: string): string;
+    function Decode(const AText: string): string;
   public
     MainConfig: TJSONConfig;
     ActiveEditor: TSynEdit;
@@ -214,6 +220,9 @@ type
     procedure ShowSearchReplaceDialog(AReplace: Boolean);
   end;
 
+const
+  iCurrentConfigVersion: Integer = 2;
+
 
 var
   frmMain: TfrmMain;
@@ -276,6 +285,17 @@ begin
   end;
 end;
 
+procedure TfrmMain.UpdatePresetsCombobox;
+var
+  i: Integer;
+begin
+  comboPresets.Properties.Items.Clear;
+  for i := 0 to FPresetsList.Count - 1 do
+  begin
+    comboPresets.Properties.Items.Add(Decode(FPresetsList.ValueFromIndex[i]));
+  end;
+end;
+
 procedure TfrmMain.tbbtnAutoOpenLastUsedClick(Sender: TObject);
 begin
   MainConfig.WriteBool('Project', 'AutoOpenLastUsed', tbbtnAutoOpenLastUsed.Down);
@@ -307,10 +327,11 @@ end;
 
 procedure TfrmMain.AddPreset(const APresetName: string);
 begin
-  comboPresets.Properties.Items.Add(APresetName);
+  FPresetsList.AddPair(GenerateGuid, Encode(APresetName));
+  UpdatePresetsCombobox;
   comboPresets.ItemIndex := comboPresets.Properties.Items.Count - 1;
 
-  FProjectConfig.WriteString('Presets', 'Presets', comboPresets.Properties.Items.Text);
+  FProjectConfig.WriteString('Presets', 'Presets', FPresetsList.Text);
 end;
 
 procedure TfrmMain.btnAddClick(Sender: TObject);
@@ -334,7 +355,7 @@ begin
     if MessageDlg('Really delete preset "' + comboPresets.Text + '"?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
     begin
       DeletePreset(comboPresets.ItemIndex);
-      FProjectConfig.WriteString('Presets', 'Presets', comboPresets.Properties.Items.Text);
+      FProjectConfig.WriteString('Presets', 'Presets', FPresetsList.Text);
     end;
   end;
 end;
@@ -350,9 +371,10 @@ begin
   if InputQuery('Edit Preset', 'Rename preset:', dmy) then
   begin
     comboPresets.Properties.Items[comboPresets.ItemIndex] := dmy;
+    FPresetsList.ValueFromIndex[idx] := Encode(dmy);
     comboPresets.ItemIndex := idx;
 
-    FProjectConfig.WriteString('Presets', 'Presets', comboPresets.Properties.Items.Text);
+    FProjectConfig.WriteString('Presets', 'Presets', FPresetsList.Text);
   end;
 end;
 
@@ -376,7 +398,7 @@ begin
   SavePreset;
   idx := comboPresets.ItemIndex;
   AddPreset('Copy of ' + comboPresets.Text);
-  FProjectConfig.CopySection('Preset_' + idx.ToString, 'Preset_' + comboPresets.ItemIndex.ToString);
+  FProjectConfig.CopySection('Preset_' + FPresetsList.Names[idx], 'Preset_' + FPresetsList.Names[comboPresets.ItemIndex]);
   LoadPreset;
 end;
 
@@ -614,33 +636,23 @@ begin
 end;
 
 procedure TfrmMain.DeletePreset(const AID: Integer);
-var
-  i: Integer;
-  strlist: TStringList;
 begin
   comboPresets.Properties.OnChange := nil;
-  comboPresets.ItemIndex := comboPresets.Properties.Items.Count - 1;
   comboPresets.Properties.Items.Delete(AID);
-  FProjectConfig.DeleteSection('Preset_' + AID.ToString);
-
-  //Rename Section Names - skip first section. This is the global configuration
-  strlist := TStringList.Create;
-  try
-    FProjectConfig.ReadSections(strlist);
-
-    for i := 1 to strlist.Count - 1 do
-    begin
-      FProjectConfig.RenameSection(strlist[i], 'Preset_' + (i - 1).ToString);
-    end;
-  finally
-    strlist.Free;
-  end;
+  FProjectConfig.DeleteSection('Preset_' + FPresetsList.Names[AID]);
+  FPresetsList.Delete(AID);
+  comboPresets.ItemIndex := comboPresets.Properties.Items.Count - 1;
 
   FActivePreset := comboPresets.Text;
   LoadPreset;
   comboPresets.Properties.OnChange := comboPresetsPropertiesChange;
 end;
 
+function TfrmMain.Decode(const AText: string): string;
+begin
+  Result := TNetEncoding.Base64.Decode(AText);
+end;
+
 procedure TfrmMain.DoGETRequest(const AMethodType: TMethodType);
 var
   dmy: string;
@@ -898,6 +910,11 @@ begin
   end;
 end;
 
+function TfrmMain.Encode(const AText: string): string;
+begin
+  Result := TNetEncoding.Base64.Encode(AText);
+end;
+
 procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
 begin
   MainConfig.WriteInteger('MainWindowPos', 'Left', Left);
@@ -905,6 +922,7 @@ begin
   MainConfig.WriteInteger('MainWindowPos', 'Width', Width);
   MainConfig.WriteInteger('MainWindowPos', 'Height', Height);
   MainConfig.WriteBool('MainWindowPos', 'StayOnTop', FormStyle = fsStayOnTop);
+  MainConfig.WriteInteger('MainWindowPos', 'HeaderHeight', pnlHeader.Height);
 
   MainConfig.WriteBool('Search', 'gbSearchBackwards', gbSearchBackwards);
   MainConfig.WriteBool('Search', 'gbSearchCaseSensitive', gbSearchCaseSensitive);
@@ -959,6 +977,9 @@ begin
   FActiveProject := '';
   FActivePreset := '';
 
+  FPresetsList := TStringList.Create;
+  FPresetsList.NameValueSeparator := ':';
+
   ActiveEditor := nil;
 
   if (not MainConfig.ReadBool('Main', 'FirstStartShown')) and (FileExists(IncludeTrailingPathDelimiter(ExtractFilePath(ParamStr(0))) + 'Example Config.rdproj')) then
@@ -1001,6 +1022,7 @@ end;
 
 procedure TfrmMain.FormDestroy(Sender: TObject);
 begin
+  FPresetsList.Free;
   FProjectConfig.Free;
   MainConfig.Free;
 end;
@@ -1042,6 +1064,8 @@ begin
     tbbtnStayOnTop.Down := False;
   end;
 
+  pnlHeader.Height := MainConfig.ReadInteger('MainWindowPos', 'HeaderHeight', 370);
+
   tbbtnAutoOpenLastUsed.Down := MainConfig.ReadBool('Project', 'AutoOpenLastUsed', True);
   tbbtnAutoSaveProject.Down := MainConfig.ReadBool('Project', 'AutoSaveProject', True);
 
@@ -1069,6 +1093,18 @@ begin
   CheckForUpdate;
 end;
 
+function TfrmMain.GenerateGuid: string;
+var
+  guid: TGUID;
+begin
+  CreateGUID(guid);
+  Result := GUIDToString(guid);
+  Result := StringReplace(Result, '{', '', [rfReplaceAll]);
+  Result := StringReplace(Result, '}', '', [rfReplaceAll]);
+  Result := StringReplace(Result, '-', '', [rfReplaceAll]);
+  Result := LowerCase(Result);
+end;
+
 function TfrmMain.GetAppVersion: string;
 var
   VerInfoSize: DWORD;
@@ -1121,7 +1157,7 @@ begin
   idx := comboPresets.Properties.Items.IndexOf(FActivePreset);
   if idx > -1 then
   begin
-    preset := 'Preset_' + idx.ToString;
+    preset := 'Preset_' + FPresetsList.Names[idx];
     edtBaseURL.Text := FProjectConfig.ReadString(preset, 'BaseURL');
     comboMethod.ItemIndex := FProjectConfig.ReadInteger(preset, 'Method', 0);
     EditorURLParams.Lines.Text := FProjectConfig.ReadString(preset, 'URLParams');
@@ -1138,6 +1174,9 @@ begin
 end;
 
 procedure TfrmMain.LoadProject;
+var
+  strlist: TStringList;
+  i: Integer;
 begin
   if FIsTempProjectLoaded then
   begin
@@ -1156,9 +1195,37 @@ begin
     FProjectConfig.Free;
   end;
 
+
   FProjectConfig := TJSONConfig.Create(FActiveProject, False);
   FProjectConfig.AutoSave := False;
-  comboPresets.Properties.Items.Text := FProjectConfig.ReadString('Presets', 'Presets');
+
+  if FProjectConfig.ReadInteger('Presets', 'ConfigVersion') <> iCurrentConfigVersion then
+  begin
+    //Upgrade config to newest version
+    strlist := TStringList.Create;
+    try
+      strlist.Text := FProjectConfig.ReadString('Presets', 'Presets');
+      FPresetsList.Clear;
+      for i := 0 to strlist.Count - 1 do
+      begin
+        FPresetsList.AddPair(GenerateGuid, Encode(strlist[i]));
+        FProjectConfig.RenameSection('Preset_' + i.ToString, 'Preset_' + FPresetsList.Names[i]);
+      end;
+
+      FProjectConfig.WriteString('Presets', 'Presets', FPresetsList.Text);
+      FProjectConfig.WriteInteger('Presets', 'ConfigVersion', iCurrentConfigVersion);
+      FProjectConfig.Save;
+    finally
+      strlist.Free;
+    end;
+  end;
+
+
+  FPresetsList.Clear;
+  FPresetsList.DelimitedText := FProjectConfig.ReadString('Presets', 'Presets');
+
+  UpdatePresetsCombobox;
+
   if comboPresets.Properties.Items.Count = 0 then
   begin
     // Add default
@@ -1402,7 +1469,7 @@ begin
   idx := comboPresets.Properties.Items.IndexOf(FActivePreset);
   if idx > -1 then
   begin
-    preset := 'Preset_' + idx.ToString;
+    preset := 'Preset_' + FPresetsList.Names[idx];
     FProjectConfig.WriteString(preset, 'BaseURL', edtBaseURL.Text);
     FProjectConfig.WriteInteger(preset, 'Method', comboMethod.ItemIndex);
     FProjectConfig.WriteString(preset, 'URLParams', EditorURLParams.Lines.Text);
@@ -1421,6 +1488,7 @@ end;
 procedure TfrmMain.SaveProject;
 begin
   SavePreset;
+  FProjectConfig.WriteInteger('Presets', 'ConfigVersion', iCurrentConfigVersion);
   FProjectConfig.Save;
 end;