Skip to content

Commit

Permalink
Delphi versions compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
digao-dalpiaz committed Oct 28, 2020
1 parent fca00bd commit d884991
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CompInstall.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[General]
Name=Digao Dalpiaz - DzSocket component
Version=2.1
Version=2.2
DelphiVersions=XE2;XE3;XE4;XE5;XE6;XE7;XE8;10;10.1;10.2;10.3
Packages=DzSocket
AddLibrary=1
Expand Down
1 change: 0 additions & 1 deletion DzSocket.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
Expand Down
12 changes: 9 additions & 3 deletions DzSocket.pas
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,22 @@ TDzTCPServer = class(TComponent)
default DEF_KEEPALIVE_INTERVAL;
end;

{$IF CompilerVersion >= 26}{$DEFINE USE_JSON}{$IFEND} //XE6 or higher
{$IFDEF USE_JSON}
type TMsgArray = TArray<Variant>;
function ArrayToData(const Fields: TMsgArray): String;
function DataToArray(const Data: String): TMsgArray;
{$ENDIF}

procedure Register;

implementation

uses System.SysUtils, Winapi.Winsock2, System.Generics.Collections,
System.Variants, System.JSON;
uses System.SysUtils, System.Variants,
Winapi.Winsock2, System.Generics.Collections
{$IFDEF USE_JSON}, System.JSON{$ENDIF};

const STR_ABOUT = 'Digao Dalpiaz / Version 2.1';
const STR_ABOUT = 'Digao Dalpiaz / Version 2.2';

procedure Register;
begin
Expand All @@ -262,6 +266,7 @@ procedure Register;
//

{$REGION 'Array Conversion'}
{$IFDEF USE_JSON}
function ArrayToData(const Fields: TMsgArray): String;
var
JA: TJSONArray;
Expand Down Expand Up @@ -295,6 +300,7 @@ function DataToArray(const Data: String): TMsgArray;
JA.Free;
end;
end;
{$ENDIF}
{$ENDREGION}

{$REGION 'KeepAlive - uses WinSock 2'}
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@

## What's New

- 10/27/2020 (Version 2.2)

- Fixed previous Delphi versions (at least on XE2, XE3, XE4 and XE5) package tag. It was causing package compilation error.
- Fixed to use JSON unit only when Delphi XE6 or higher.

- 10/26/2020 (Version 2.1)

- Updated CompInstall to version 2.0 (now supports GitHub auto-update)
Expand Down Expand Up @@ -78,7 +83,7 @@ You can do a lot of stuff, like chat app, remote commands app, remote monitoring

- **Commands**: The native socket allows you to send string segment, but if you want to send commands and identify this commands in the other side of the connection, you will need to manually implement this. With DzSocket, you have a Char command always available. Ready, fast and easy.

- **Auto Free Data Objects on Server**: The Client object list available on Server component has a Pointer property, allowing you to store informations about the client connection, usually using a object. With DzSocket, you don't need to worry about this object destruction. You just need to enable a property to take care of these objects.
- **Auto Free Data Objects on Server**: The Client object list available on Server component has a Pointer property, allowing you to store information about the client connection, usually using a object. With DzSocket, you don't need to worry about this object destruction. You just need to enable a property to take care of these objects.

- **Enumerator**: The native Server component does not have a enumerator to iterate Client List connections. Using DzSocket, you can simply do a `for .. in` directly on Server component, iterating client list connections.

Expand Down Expand Up @@ -327,6 +332,8 @@ Sends commands and messages to the server. You should use `Cmd` parameter to spe
## Array data send

**Only available on Delphi XE6 or higher**

When you are using `Send` method from Server or Client socket, there is a `String` parameter allowing you to send data.
There are two global methods you can use to send multiple data at one time:

Expand Down

0 comments on commit d884991

Please sign in to comment.