diff --git a/Class_ClientNode.pas b/Class_ClientNode.pas index 106013a..7a86c5b 100644 --- a/Class_ClientNode.pas +++ b/Class_ClientNode.pas @@ -1008,7 +1008,7 @@ function TClientNode.CreateJSONConfig(): string; JSONObject:= TJSONObject.Create; try if (FLocalPort.Trim <> '') then - JSONObject.AddPair(TJSONPair.Create('localaddr', FLocalPort.Trim)); + JSONObject.AddPair(TJSONPair.Create('localaddr', ':' + FLocalPort.Trim)); if (FKCPServerIP.Trim <> '') and (FKCPServerPort.Trim <> '') then JSONObject.AddPair(TJSONPair.Create('remoteaddr', (FKCPServerIP.Trim + ':' + FKCPServerPort.Trim))); @@ -1016,7 +1016,12 @@ function TClientNode.CreateJSONConfig(): string; JSONObject.AddPair(TJSONPair.Create('key', FKey.Trim)); if (FisCrypt <> 0) and (FCrypt.Trim <> '') then JSONObject.AddPair(TJSONPair.Create('crypt', FCrypt.Trim)); - JSONObject.AddPair(TJSONPair.Create('nocomp', LowerCase(BoolToStr(Boolean(FisNoComp), True)))); + + if (FisNoComp <> 0) then + JSONObject.AddPair(TJSONPair.Create('nocomp', TJSONTrue.Create)) + else + JSONObject.AddPair(TJSONPair.Create('nocomp', TJSONFalse.Create)); + if (FisDataShard <> 0) and (FDataShard.Trim <> '') then JSONObject.AddPair(TJSONPair.Create('datashard', TJSONNumber.Create(FDataShard.Trim))); if (FisParityShard <> 0) and (FParityShard.Trim <> '') then @@ -1043,7 +1048,11 @@ function TClientNode.CreateJSONConfig(): string; JSONObject.AddPair(TJSONPair.Create('resend', TJSONNumber.Create(FResend.Trim))); JSONObject.AddPair(TJSONPair.Create('nc', TJSONNumber.Create(FisNC))); - JSONObject.AddPair(TJSONPair.Create('acknodelay', LowerCase(BoolToStr(Boolean(FisACKNoDelay), True)))); + if (FisACKNoDelay <> 0) then + JSONObject.AddPair(TJSONPair.Create('acknodelay', TJSONTrue.Create)) + else + JSONObject.AddPair(TJSONPair.Create('acknodelay', TJSONFalse.Create)); + if (FisKeepAlive <> 0) and (FKeepAlive.Trim <> '') then JSONObject.AddPair(TJSONPair.Create('keepalive', TJSONNumber.Create(FKeepAlive.Trim))); if (FisSockBuf <> 0) and (FSockBuf.Trim <> '') then diff --git a/Main.dfm b/Main.dfm index a97a25e..22462f6 100644 --- a/Main.dfm +++ b/Main.dfm @@ -1150,7 +1150,7 @@ object FMain: TFMain Left = 209 Top = 510 Bitmap = { - 494C010104001800C00010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 494C010104001800C80010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 0000000000003600000028000000400000002000000001002000000000000020 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -1458,6 +1458,8 @@ object FMain: TFMain Top = 456 end object SaveDialog_JSON: TSaveDialog + DefaultExt = 'json' + Filter = 'JSON'#37197#32622#25991#20214'|*.json' Options = [ofOverwritePrompt, ofHideReadOnly, ofEnableSizing] Left = 168 Top = 384 diff --git a/Main.pas b/Main.pas index eb64b50..e343133 100644 --- a/Main.pas +++ b/Main.pas @@ -1270,14 +1270,19 @@ procedure TFMain.Menu_ExitClick(Sender: TObject); procedure TFMain.Menu_JSONClick(Sender: TObject); var ClientNode: TClientNode; + DefaultJSONFileName: string; JSONStr: string; JSONFile: TextFile; isExcept: Boolean; ErrorInfoStr, HintStr: string; begin + ClientNode:= ListView_Node.Selected.Data; + DefaultJSONFileName:= ClientNode.KCPServerIP + '.' + ClientNode.KCPServerPort + '--' + ClientNode.LocalPort; + if (ClientNode.Remark.Trim <> '') then + DefaultJSONFileName:= ClientNode.Remark.Trim + '(' + DefaultJSONFileName + ')'; + SaveDialog_JSON.FileName:= DefaultJSONFileName; if not SaveDialog_JSON.Execute then Exit; - ClientNode:= ListView_Node.Selected.Data; JSONStr:= ClientNode.CreateJSONConfig(); isExcept:= False; diff --git a/kcptun_gclient.dpr b/kcptun_gclient.dpr index b7fdbdd..e431921 100644 --- a/kcptun_gclient.dpr +++ b/kcptun_gclient.dpr @@ -2,6 +2,7 @@ program kcptun_gclient; uses Vcl.Forms, + System.SysUtils, Main in 'Main.pas' {FMain}, Class_ClientNode in 'Class_ClientNode.pas', PublicVar in 'PublicVar.pas', @@ -28,7 +29,7 @@ begin Application.Title := 'KCPTun 客户端配置管理工具'; VerInfoRes:= TVerInfoRes.Create(Application.ExeName); try - PublicVar.FileVer:= Copy(VerInfoRes.FileVersion, 1, 5); + PublicVar.FileVer:= Copy(VerInfoRes.FileVersion, 1, (LastDelimiter('.', (VerInfoRes.FileVersion)) - 1)); finally VerInfoRes.Free; end; //取EXE文件的版本信息 diff --git a/kcptun_gclient.dproj b/kcptun_gclient.dproj index c6f4669..af374b7 100644 --- a/kcptun_gclient.dproj +++ b/kcptun_gclient.dproj @@ -92,8 +92,8 @@ 0 - 9 - CompanyName=;FileDescription=;FileVersion=1.0.9.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + 10 + CompanyName=;FileDescription=;FileVersion=1.0.10.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= k.ico true 1033 @@ -104,7 +104,6 @@
FMain
- dfm
@@ -120,7 +119,6 @@
FPhoto
- dfm
Cfg_2 diff --git a/kcptun_gclient.res b/kcptun_gclient.res index 5c2260c..cca864d 100644 Binary files a/kcptun_gclient.res and b/kcptun_gclient.res differ